[jboss-cvs] JBossAS SVN: r62158 - in projects/microcontainer/trunk: deployers/src/main/org/jboss/deployers/plugins/structure/vfs and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 6 10:58:19 EDT 2007


Author: alesj
Date: 2007-04-06 10:58:19 -0400 (Fri, 06 Apr 2007)
New Revision: 62158

Added:
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/HeaderValue.jj
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ListValueCreator.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ValueCreator.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/AttributeAware.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/PackageAttribute.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/Parameter.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRange.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java
Modified:
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/metadata/AbstractManifestMetaData.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/metadata/ManifestMetaData.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/HolderMetaData.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/OSGiMetaData.java
Log:
Additional OSGi meta data handling.

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/metadata/AbstractManifestMetaData.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/metadata/AbstractManifestMetaData.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/metadata/AbstractManifestMetaData.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -21,9 +21,15 @@
 */
 package org.jboss.deployers.plugins.metadata;
 
-import java.io.Serializable;
-import java.util.Collections;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.OutputStream;
 import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
 
 import org.jboss.deployers.spi.metadata.ManifestMetaData;
 
@@ -32,19 +38,64 @@
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public class AbstractManifestMetaData implements ManifestMetaData, Serializable
+public class AbstractManifestMetaData implements ManifestMetaData, Externalizable
 {
    private static final long serialVersionUID = 1L;
 
-   protected Map<String, String> attributes = Collections.emptyMap();
+   protected Manifest manifest;
 
-   public String getAttribute(String name)
+   public AbstractManifestMetaData()
    {
-      return attributes.get(name);
    }
 
-   protected void putAttribute(String name, String value)
+   public AbstractManifestMetaData(Manifest manifest)
    {
-      attributes.put(name, value);
+      if (manifest == null)
+         throw new IllegalArgumentException("Null manifest!");
+      this.manifest = manifest;
    }
+
+   protected Manifest getManifest()
+   {
+      if (manifest == null)
+         throw new IllegalArgumentException("Null manifest!");
+      return manifest;
+   }
+
+   protected String get(Attributes attributes, String name)
+   {
+      return attributes != null ? attributes.getValue(name) : null;
+   }
+
+   public String getMainAttribute(String name)
+   {
+      return get(getManifest().getMainAttributes(), name);
+   }
+
+   public String getAttribute(String attributesName, String name)
+   {
+      return get(getManifest().getAttributes(attributesName), name);
+   }
+
+   public String getEntry(String entryName, String name)
+   {
+      Map<String,Attributes> entries = getManifest().getEntries();
+      if (entries != null)
+      {
+         return get(entries.get(entryName), name);
+      }
+      return null;
+   }
+
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      OutputStream os = null; // todo
+      getManifest().write(os);
+   }
+
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      InputStream is = null; // todo
+      manifest = new Manifest(is);
+   }
 }

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/AbstractStructureDeployer.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -94,8 +94,8 @@
    /**
     * See if a file corresponds to a top-level deployment.
     * 
-    * @param file
-    * @param metaData
+    * @param file virtual file
+    * @param metaData structure meta data
     * @return true when it is top level
     * @throws IOException for an error accessing the file
     */
@@ -105,8 +105,7 @@
       // See if this is a top-level by checking the parent
       VirtualFile parent = file.getParent();
       String parentPath = parent != null ? parent.getPathName() : null;
-      boolean isTopLevel = parentPath == null || metaData.getContext(parentPath) == null;
-      return isTopLevel;
+      return (parentPath == null || metaData.getContext(parentPath) == null);
    }
 
    /**
@@ -119,7 +118,7 @@
     * @param includeRootManifestCP - a flag indicating if the entry metainf
     *    manifest classpath should be included.
     * @param context - the context to populate
-    * @throws IOException
+    * @throws IOException on any IO error
     */
    protected void addClassPath(VirtualFile root, VirtualFile entry,
          boolean includeEntry, boolean includeRootManifestCP,

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/vfs/CandidateStructureVisitorFactory.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -41,7 +41,6 @@
     * @param parent the parent virtual file
     * @param metaData the structure metaData
     * @param deployers the structure deployers
-    * @param context the deployment context
     * @param attributes the visitor attributes uses {@link VisitorAttributes#DEFAULT} when null
     * @return the visitor
     * @throws Exception for any error

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/metadata/ManifestMetaData.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/metadata/ManifestMetaData.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/metadata/ManifestMetaData.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -34,5 +34,23 @@
     * @param name the name
     * @return attribute value or null if attribute doesn't exist
     */
-   String getAttribute(String name);
+   String getMainAttribute(String name);
+
+   /**
+    * Get attribute value from specific attrbiutes.
+    * 
+    * @param attributesName attribute group name
+    * @param name string key for accessing specific attribute
+    * @return attribute value or null if attribute doesn't exist
+    */
+   String getAttribute(String attributesName, String name);
+
+   /**
+    * Get attribute value from specific attrbiutes.
+    *
+    * @param entryName entry name
+    * @param name string key for accessing specific attribute
+    * @return attribute value or null if attribute doesn't exist
+    */
+   String getEntry(String entryName, String name);
 }

Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/OSGiMetaDataDeployer.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -24,6 +24,7 @@
 import java.util.jar.Manifest;
 
 import org.jboss.deployers.plugins.deployers.helpers.ManifestDeployer;
+import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
 import org.jboss.osgi.spi.metadata.OSGiMetaData;
 
 /**
@@ -40,7 +41,7 @@
 
    protected OSGiMetaData createMetaData(Manifest manifest) throws Exception
    {
-      return null;  //todo
+      return new AbstractOSGiMetaData(manifest);
    }
 
 }

Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -21,8 +21,21 @@
 */
 package org.jboss.osgi.plugins.metadata;
 
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Manifest;
+
 import org.jboss.deployers.plugins.metadata.AbstractManifestMetaData;
+import org.jboss.logging.Logger;
 import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import static org.osgi.framework.Constants.*;
+import org.osgi.framework.Version;
 
 /**
  * Abstract OSGi meta data.
@@ -32,14 +45,181 @@
 public class AbstractOSGiMetaData extends AbstractManifestMetaData implements OSGiMetaData
 {
    private static final long serialVersionUID = 1L;
+   private static Logger log = Logger.getLogger(AbstractOSGiMetaData.class);
 
-   public String getBundleSymbolicName()
+   protected static StringValueCreator STRING_VC = new StringValueCreator();
+   protected static IntegerValueCreator INTEGER_VC = new IntegerValueCreator();
+   protected static VersionValueCreator VERSION_VC = new VersionValueCreator();
+   protected static URLValueCreator URL_VC = new URLValueCreator();
+   protected static ParameterizedAttributeValueCreator PARAM_ATTRIB_VC = new ParameterizedAttributeValueCreator();
+   protected static StringListValueCreator STRING_LIST_VC = new StringListValueCreator();
+   protected static ParameterizedAttributeListValueCreator PARAM_ATTRIB_LIST_VC = new ParameterizedAttributeListValueCreator();
+   protected static PackageAttributeListValueCreator PACKAGE_LIST_VC = new PackageAttributeListValueCreator();
+
+   protected Map<String, Object> cachedAttributes = new HashMap<String, Object>();
+
+   public AbstractOSGiMetaData()
    {
-      return null;
    }
 
+   public AbstractOSGiMetaData(Manifest manifest)
+   {
+      super(manifest);
+   }
+
    public String getBundleActivator()
    {
-      return null;
+      return get(BUNDLE_ACTIVATOR, STRING_VC);
    }
+
+   public List<String> getBundleClassPath()
+   {
+      return get(BUNDLE_CLASSPATH, STRING_LIST_VC, Arrays.asList("."));
+   }
+
+   public String getBundleDescription()
+   {
+      return get(BUNDLE_DESCRIPTION, STRING_VC);
+   }
+
+   public String getBundleLocalization()
+   {
+      return get(BUNDLE_LOCALIZATION, STRING_VC, BUNDLE_LOCALIZATION_DEFAULT_BASENAME);
+   }
+
+   public int getBundleManifestVersion()
+   {
+      return get(BUNDLE_VERSION, INTEGER_VC, 1);
+   }
+
+   public String getBundleName()
+   {
+      return get(BUNDLE_NAME, STRING_VC);
+   }
+
+   public List<ParameterizedAttribute> getBundleNativeCode()
+   {
+      return get(BUNDLE_NATIVECODE, PARAM_ATTRIB_LIST_VC);
+   }
+
+   public List<String> getRequiredExecutionEnvironment()
+   {
+      return get(BUNDLE_REQUIREDEXECUTIONENVIRONMENT, STRING_LIST_VC);
+   }
+
+   public String getBundleSymbolicName()
+   {
+      return get(BUNDLE_SYMBOLICNAME, STRING_VC);
+   }
+
+   public URL getBundleUpdateLocation()
+   {
+      return get(BUNDLE_UPDATELOCATION, URL_VC);
+   }
+
+   public Version getBundleVersion()
+   {
+      return get(BUNDLE_VERSION, VERSION_VC , new Version("0.0.0"));
+   }
+
+   public List<PackageAttribute> getDynamicImports()
+   {
+      return get(DYNAMICIMPORT_PACKAGE, PACKAGE_LIST_VC);
+   }
+
+   public List<PackageAttribute> getExportPackages()
+   {
+      return get(EXPORT_PACKAGE, PACKAGE_LIST_VC);
+   }
+
+   public ParameterizedAttribute getFragmentHost()
+   {
+      return get(FRAGMENT_HOST, PARAM_ATTRIB_VC);
+   }
+
+   public List<PackageAttribute> getImportPackages()
+   {
+      return get(IMPORT_PACKAGE, PACKAGE_LIST_VC);
+   }
+
+   public List<ParameterizedAttribute> getRequireBundles()
+   {
+      return get(REQUIRE_BUNDLE, PARAM_ATTRIB_LIST_VC);
+   }
+
+   @SuppressWarnings("unchecked")
+   protected <T> T get(String key, ValueCreator<T> creator)
+   {
+      return get(key, creator, null);
+   }
+
+   @SuppressWarnings("unchecked")
+   protected <T> T get(String key, ValueCreator<T> creator, T defaultValue)
+   {
+      T value = (T)cachedAttributes.get(key);
+      if (value == null)
+      {
+         String attribute = getMainAttribute(key);
+         if (attribute != null)
+         {
+            value = creator.createValue(attribute);
+            cachedAttributes.put(key, value);
+         }
+         else if (defaultValue != null)
+         {
+            value = defaultValue;
+            cachedAttributes.put(key, value);
+         }
+      }
+      return value;
+   }
+
+   private static class StringValueCreator implements ValueCreator<String>
+   {
+      public String createValue(String attribute)
+      {
+         return attribute;
+      }
+   }
+
+   private static class IntegerValueCreator implements ValueCreator<Integer>
+   {
+      public Integer createValue(String attribute)
+      {
+         return Integer.valueOf(attribute);
+      }
+   }
+
+   private static class VersionValueCreator implements ValueCreator<Version>
+   {
+      public Version createValue(String attribute)
+      {
+         return new Version(attribute);
+      }
+   }
+
+   private static class URLValueCreator implements ValueCreator<URL>
+   {
+      public URL createValue(String attribute)
+      {
+         try
+         {
+            return new URL(attribute);
+         }
+         catch (MalformedURLException e)
+         {
+            log.warn("Exception while creating URL.", e);
+            return null;
+         }
+      }
+   }
+
+   private static class StringListValueCreator extends ListValueCreator<String>
+   {
+      public List<String> createValue(String attribute)
+      {
+         return Arrays.asList(attribute.split(","));
+      }
+   }
+
 }

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,166 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.util.StringTokenizer;
+
+import org.jboss.osgi.spi.metadata.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+/**
+ * Represents an OSGi version range:
+ * version-range ::= interval | atleast
+ * interval ::= ( '[' | '(' ) floor ',' ceiling ( ']' | ')' )
+ * atleast ::= version
+ * floor ::= version
+ * ceiling ::= version
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
+ */
+public class AbstractVersionRange implements VersionRange, Serializable
+{
+   private static final long serialVersionUID = 1l;
+
+   /** The lower bound of the range */
+   private transient Version floor;
+   /** The upper bound of the range */
+   private transient Version ceiling;
+   /** is the floor version a >(true) or >= constraint(false) */
+   private transient boolean floorIsGreaterThan;
+   /** is the ceiling version a <(true) or <= constraint(false) */
+   private transient boolean ceilingIsLessThan;
+   /** create object from this after serialization */
+   private String rangeSpec;
+
+   public static VersionRange parseRangeSpec(String rangeSpec)
+   {
+      Version floor = null;
+      Version ceiling = null;
+      StringTokenizer st = new StringTokenizer(rangeSpec, ",[]()", true);
+      boolean floorIsGreaterThan = false;
+      boolean ceilingIsLessThan = false;
+      while( st.hasMoreTokens() )
+      {
+         String token = st.nextToken();
+         if( token.equals("[") )
+            floorIsGreaterThan = false;
+         else if( token.equals("(") )
+            floorIsGreaterThan = true;
+         else if( token.equals("]") )
+            ceilingIsLessThan = false;
+         else if( token.equals(")") )
+            ceilingIsLessThan = true;
+         else if( token.equals(",") )
+         {
+         }
+         else
+         {
+            // A version token
+            if( floor == null )
+               floor = new Version(token);
+            else
+               ceiling = new Version(token);
+         }
+
+      }
+      return new AbstractVersionRange(rangeSpec, floor, ceiling, floorIsGreaterThan, ceilingIsLessThan);
+   }
+
+   public AbstractVersionRange(String rangeSpec, Version floor, Version ceiling, boolean floorIsLessThan, boolean ceilingIsLessThan)
+   {
+      this.rangeSpec = rangeSpec;
+      this.floor = floor;
+      this.ceiling = ceiling;
+      this.floorIsGreaterThan = floorIsLessThan;
+      this.ceilingIsLessThan = ceilingIsLessThan;
+   }
+
+   public Version getFloor()
+   {
+      return floor;
+   }
+
+   public Version getCeiling()
+   {
+      return ceiling;
+   }
+
+   public boolean isInRange(Version v)
+   {
+      // Test a null floor version which implies 0.0.0 <= v <= inf
+      boolean isInRange = floor == null;
+      if( isInRange == false )
+      {
+         // Test the floor version
+         int floorCompare = v.compareTo(floor);
+         if( (floorIsGreaterThan && floorCompare > 0) || (floorIsGreaterThan == false && floorCompare >= 0) )
+         {
+            isInRange = ceiling == null;
+            if( isInRange == false )
+            {
+               // Test the ceiling version
+               int ceilingCompare = v.compareTo(ceiling);
+               if( (ceilingIsLessThan && ceilingCompare < 0) || (ceilingIsLessThan == false && ceilingCompare <= 0) )
+               {
+                  isInRange = true;
+               }
+            }
+         }
+      }
+      return isInRange;
+   }
+
+   public String toString()
+   {
+      StringBuilder tmp = new StringBuilder();
+      if( floor == null )
+         tmp.append("0.0.0");
+      else
+         tmp.append(floor.toString());
+      tmp.append(" <");
+      if( floorIsGreaterThan == false )
+         tmp.append('=');
+      tmp.append(" v ");
+      // Ceiling
+      tmp.append('<');
+      if( ceilingIsLessThan == false )
+         tmp.append('=');
+      tmp.append(' ');
+      if( ceiling == null )
+         tmp.append("inf");
+      else
+         tmp.append(ceiling.toString());
+      return tmp.toString();
+   }
+
+   protected Object readResolve() throws ObjectStreamException
+   {
+      return parseRangeSpec(rangeSpec);
+   }
+
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/HeaderValue.jj
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/HeaderValue.jj	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/HeaderValue.jj	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,254 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+ options {
+   LOOKAHEAD=1;
+   DEBUG_PARSER=true;
+   DEBUG_LOOKAHEAD=true;
+   DEBUG_TOKEN_MANAGER=false;
+   STATIC=false;
+}
+
+PARSER_BEGIN(HeaderValue)
+package org.jboss.osgi.plugins.metadata;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A JavaCC 3.2 grammar for the OSGi R4 bundle headers
+
+ * @see https://javacc.dev.java.net/
+ * eclipse plugin: http://sourceforge.net/projects/eclipse-javacc
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
+ */
+public class HeaderValue
+{
+   /**
+   * Package name and param holder.
+   */
+   public static class PkgInfo
+   {
+      List<String> pkgNames = new ArrayList<String>();
+      Map<String, String> paramMap = new HashMap<String, String>();
+   }
+
+   public HeaderValue()
+   {
+      this(new StringReader(""));
+   }
+
+   public HeaderValue(String value)
+   {
+      this(new StringReader(value));
+   }
+
+   public PkgInfo parseImportPackage(StringReader header, boolean trace)
+      throws ParseException
+   {
+      ReInit(header);
+
+      // This will have no effect unless the debugging options are true
+      if (trace)
+      {
+         this.enable_tracing();
+      }
+      else
+      {
+         this.disable_tracing();
+      }
+
+      return this.ImportPackage();
+   }
+   
+   public static PkgInfo parseImportPackage(String header, boolean trace)
+      throws ParseException
+   {
+      HeaderValue parser = new HeaderValue();
+      return parser.parseImportPackage(new StringReader(header), trace);
+   }
+}
+PARSER_END(HeaderValue)
+
+/* IGNORE WHITESPACE */
+
+SKIP :
+{
+    " "
+  | "\r"
+  | "\t"
+  | "\n"
+}
+
+/* Common tokens */
+TOKEN:
+{
+  <#ALPHA: [ "a"-"z", "A"-"Z" ] >
+|
+  <#DIGIT: ["0" - "9"] >
+|
+  <#ALPHANUM: <ALPHA>|<DIGIT> >
+|
+  <#TOKN: (<ALPHANUM>|"_"|"-")+ >
+|
+  <NUMBER: (<DIGIT>)+ >
+|
+  <QNAME: <JLETTER> (<JLETTER>|<DIGIT>)* ("." <JLETTER> (<JLETTER>|<DIGIT>)*)* >
+|
+  <#JLETTER: [ "_", "a"-"z", "A"-"Z" ] >
+|
+  <#JLETTER_OR_DIGIT: <JLETTER> | <DIGIT> >
+|
+  <IDENTIFIER: <JLETTER> (<JLETTER> | <JLETTER_OR_DIGIT>)* >
+|
+  <QUOTED_STRING: "\"" ( ~["\"", "\\", "\r", "\n", "\u0000"] | "\\\"")* "\"" >
+|
+  <ARGUMENT: <TOKN>|<QUOTED_STRING> >
+|
+  <DIRECTIVE: <TOKN> ":=" <ARGUMENT> >
+|
+  <ATTRIBUTE: <TOKN> "=" <ARGUMENT> >
+|
+  <PARAMETER: <DIRECTIVE>|<ATTRIBUTE> >
+|
+  <UNIQUE_NAME: <IDENTIFIER> ("." <IDENTIFIER>)* >
+|
+  <SYMBOLIC_NAME: <TOKN> ("." <TOKN>)* >
+|
+  <PACKAGE_NAME: <UNIQUE_NAME> >
+|
+  <PATH: <PATH_UNQUOTED> | "\"" <PATH_UNQUOTED> "\"" >
+|
+  <PATH_UNQUOTED: <PATH_SEP> | (<PATH_SEP>)? <PATH_ELEMENT> (<PATH_SEP> <PATH_ELEMENT>)* >
+|
+  <PATH_ELEMENT: (~["/", "\"", "\n", "\r", "\u0000"])+ >
+|
+  <PATH_SEP: "/" >
+}
+
+/* Directives */
+TOKEN [IGNORE_CASE]:
+{
+  <EXCLUDE_DIRECTIVE: "exclude">
+|
+  <EXTENSION_DIRECTIVE: "extension">
+|
+  <FRAGMENT_ATTACHMENT_DIRECTIVE: "fragment-attachment">
+|
+  <INCLUDE_DIRECTIVE: "include">
+|
+  <MANDATORY_DIRECTIVE: "mandatory">
+|
+  <RESOLUTION_DIRECTIVE: "resolution">
+|
+  <RESOLUTION_DIRECTIVE_VALUE: "mandatory"|"optional">
+|
+  <SINGLETON_DIRECTIVE: "singleton">
+|
+  <USES_DIRECTIVE: "uses">
+|
+  <VISIBILITY_DIRECTIVE: "visibility">
+}
+
+/* Attributes */
+TOKEN [IGNORE_CASE]:
+{
+  <BUNDLE_SYMBOLICNAME_ATTRIBUTE: "bundle-symbolic-name">
+|
+  <BUNDLE_VERSION_ATTRIBUTE: "bundle-version">
+|
+  <SELECTION_FILTER_ATTRIBUTE: "selection-filter">
+|
+  <VERSION_ATTRIBUTE: "version">
+|
+  <VERSION_VALUE: (<NUMBER> ("." <NUMBER> ("." <NUMBER> ("." <ALPHANUM>)? )?  )?) >
+}
+
+/** Start of the grammar */
+
+void headers() :
+{
+}
+{
+   header() <EOF>
+}
+void header() :
+{
+}
+{
+	(BundleManifestVersion())?
+	| (ImportPackage())?
+}
+
+void BundleManifestVersion() :
+{
+}
+{
+  <NUMBER>
+}
+
+/**
+Entry point for the Import-Package header value parsing.
+*/
+PkgInfo ImportPackage() :
+{
+   PkgInfo info = new PkgInfo();
+}
+{
+  Import(info) ( "," Import(info) )*
+  {
+  	return info;
+  }
+}
+
+void Import(PkgInfo info) :
+{
+}
+{
+   PackageNames(info) ( ";" <PARAMETER> )*
+}
+
+void PackageNames(PkgInfo info) :
+{
+	Token t = null;
+}
+{
+  t=<PACKAGE_NAME> {info.pkgNames.add(t.image);} ( ";" t=<PACKAGE_NAME> {info.pkgNames.add(t.image);})*
+}
+void ImportParameters(PkgInfo info) :
+{
+	Token t = null;
+}
+{
+  <RESOLUTION_DIRECTIVE> <DIRECTIVE> t=<RESOLUTION_DIRECTIVE_VALUE>
+  {
+  	info.paramMap.put("resolution", t.image);
+  }
+  | <VERSION_ATTRIBUTE> <ATTRIBUTE>  t=<VERSION_VALUE>
+  {
+  	info.paramMap.put("version", t.image);
+  }
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ListValueCreator.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ListValueCreator.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ListValueCreator.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+/**
+ * Create value list from string attribute.
+ *
+ * @param <T> expected component type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class ListValueCreator<T> implements ValueCreator<List<T>>
+{
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/PackageAttributeListValueCreator.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+
+/**
+ * Create package attribute list from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PackageAttributeListValueCreator extends ListValueCreator<PackageAttribute>
+{
+   public List<PackageAttribute> createValue(String attibute)
+   {
+      return null; // todo
+   }
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeListValueCreator.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import java.util.List;
+
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+
+/**
+ * Create paramertized attribute list from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ParameterizedAttributeListValueCreator extends ListValueCreator<ParameterizedAttribute>
+{
+   public List<ParameterizedAttribute> createValue(String attribute)
+   {
+      return null;  //Todo
+   }
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ParameterizedAttributeValueCreator.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+
+/**
+ * Create paramertized attribute from string attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ParameterizedAttributeValueCreator implements ValueCreator<ParameterizedAttribute>
+{
+   public ParameterizedAttribute createValue(String attribute)
+   {
+      return null;  //todo
+   }
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ValueCreator.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ValueCreator.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/metadata/ValueCreator.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.plugins.metadata;
+
+/**
+ * Create value from attribute.
+ *
+ * @param <T> expected type
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ValueCreator<T>
+{
+   /**
+    * Create value from string attribute.
+    *
+    * @param attribute string to get value from
+    * @return value
+    */
+   T createValue(String attribute);
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/AttributeAware.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/AttributeAware.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/AttributeAware.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Attribute string value holder.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface AttributeAware
+{
+   /**
+    * Get the attribute.
+    *
+    * @return string attribute value
+    */
+   String getAttribute();
+}

Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/HolderMetaData.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/HolderMetaData.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/HolderMetaData.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -26,17 +26,37 @@
 import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
 
 /**
- * Common OSGi meta data attributes.
+ * Common OSGi meta data mainAttributes.
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
 public interface HolderMetaData
 {
+   /**
+    * Get the element id.
+    *
+    * @return unique string id
+    */
    String getId();
 
+   /**
+    * Get the exposed interface.
+    *
+    * @return qualified interface name.
+    */
    String getInterface();
 
+   /**
+    * Get the dependencies.
+    *
+    * @return set of dependencies.
+    */
    Set<DependencyMetaData> getDepends();
 
+   /**
+    * Get the classloader metadata.
+    *
+    * @return classloader metadata
+    */
    ClassLoaderMetaData getContextClassLoader();
 }

Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/OSGiMetaData.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/OSGiMetaData.java	2007-04-06 14:49:31 UTC (rev 62157)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/OSGiMetaData.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -21,14 +21,75 @@
 */
 package org.jboss.osgi.spi.metadata;
 
+import java.net.URL;
+import java.util.List;
+
 import org.jboss.deployers.spi.metadata.ManifestMetaData;
+import org.osgi.framework.Version;
 
 /**
+ * OSGi specific manifest meta data.
+ *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
 public interface OSGiMetaData extends ManifestMetaData
 {
    /**
+    * Get bundle activator class name.
+    *
+    * @return bundle activator classname or null if no such attribute
+    */
+   String getBundleActivator();
+
+   /**
+    * Get the bundle classpath
+    *
+    * @return list of JAR file path names or directories inside bundle
+    */
+   List<String> getBundleClassPath();
+
+   /**
+    * Get the description
+    *
+    * @return a description
+    */
+   String getBundleDescription();
+
+   /**
+    * Get the localization's location
+    *
+    * @return location in the bundle for localization files
+    */
+   String getBundleLocalization();
+
+   /**
+    * Get the bundle manifest version
+    *
+    * @return bundle's specification number
+    */
+   int getBundleManifestVersion();
+
+   /**
+    * Get the name
+    *
+    * @return readable name
+    */
+   String getBundleName();
+
+   /**
+    * Get native code libs
+    * @return native libs contained in the bundle
+    */
+   List<ParameterizedAttribute> getBundleNativeCode();
+
+   /**
+    * Get required exectuion envs
+    *
+    * @return list of execution envs that must be present on the Service Platform
+    */
+   List<String> getRequiredExecutionEnvironment();
+
+   /**
     * Get bundle symbolic name.
     *
     * @return bundle's symbolic name
@@ -36,9 +97,51 @@
    String getBundleSymbolicName();
 
    /**
-    * Get bundle activator class name.
+    * Get the update url.
     *
-    * @return bundle activator classname or null if no such attribute
+    * @return URL of an update bundle location
     */
-   String getBundleActivator();
+   URL getBundleUpdateLocation();
+
+   /**
+    * Get bundle's version.
+    *
+    * @return version of this bundle
+    */
+   Version getBundleVersion();
+
+   /**
+    * Get dynamic imports.
+    *
+    * @return package names that should be dynamically imported when needed
+    */
+   List<PackageAttribute> getDynamicImports();
+
+   /**
+    * Get the export packages.
+    *
+    * @return exported packages
+    */
+   List<PackageAttribute> getExportPackages();
+
+   /**
+    * Get the fragment host.
+    *
+    * @return host bundle for this fragment
+    */
+   ParameterizedAttribute getFragmentHost();
+
+   /**
+    * Get the import packages.
+    *
+    * @return imported packages.
+    */
+   List<PackageAttribute> getImportPackages();
+
+   /**
+    * Get the required exports
+    *
+    * @return required exports from anoter bundle
+    */
+   List<ParameterizedAttribute> getRequireBundles();
 }

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/PackageAttribute.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/PackageAttribute.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/PackageAttribute.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import org.jboss.reflect.spi.PackageInfo;
+
+/**
+ * A package info.
+ * Includes version and properties.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface PackageAttribute extends VersionRangeAttribute, ParameterizedAttribute
+{
+   /**
+    * Get the package info.
+    * Must 'match' getAttribute method
+    * from AttributeAware interface. 
+    *
+    * @return package info
+    */
+   PackageInfo getPackageInfo();
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/Parameter.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/Parameter.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/Parameter.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Parameter interface - single value or set of values.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface Parameter
+{
+   /**
+    * Get value.
+    * Simple value or collection.
+    *
+    * @return value
+    */
+   Object getValue();
+
+   /**
+    * Has multiple values.
+    * Used when same name is used for multiple parameter values.
+    * Value _can_ be casted into Collection.
+    *
+    * @return true is returned type is Collection, otherwise false
+    */
+   boolean isCollection();
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ParameterizedAttribute extends AttributeAware
+{
+   /**
+    * Get the parameters.
+    *
+    * @return properties for this attribute
+    */
+   Map<String, Parameter> getParameters();
+
+   /**
+    * Get the parameter by name.
+    * Helper method to getParameters method.
+    *
+    * @param name parameter's name
+    * @return parameter value
+    */
+   Parameter getParameter(String name);
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRange.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRange.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRange.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+import org.osgi.framework.Version;
+
+/**
+ * Version range.
+ * [floor, ceiling]
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface VersionRange
+{
+   /**
+    * Get the floor version.
+    *
+    * @return floor version
+    */
+   Version getFloor();
+
+   /**
+    * Get the ceiling version.
+    *
+    * @return ceiling version
+    */
+   Version getCeiling();
+
+   /**
+    * Is param verision between (including) floor and ceiling.
+    *
+    * @param version version parameter to compare
+    * @return true if version param in version range interval
+    */
+   boolean isInRange(Version version);
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/VersionRangeAttribute.java	2007-04-06 14:58:19 UTC (rev 62158)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.spi.metadata;
+
+/**
+ * Attribute with VersionRange attribute.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface VersionRangeAttribute extends AttributeAware
+{
+   /**
+    * Get the version range.
+    *
+    * @return version range for this attribute
+    */
+   VersionRange getVersion();
+}




More information about the jboss-cvs-commits mailing list