[jboss-cvs] JBossAS SVN: r97108 - in projects/jboss-osgi/projects: bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb and 13 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 27 09:07:54 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-11-27 09:07:53 -0500 (Fri, 27 Nov 2009)
New Revision: 97108

Added:
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/META-INF/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/META-INF/services/
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeanDeployer.java
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/META-INF/
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/META-INF/services/
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
Modified:
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java
   projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/resources/META-INF/base-deployers-beans.xml
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties
   projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
   projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java
Log:
MC bundle delegates to UnmarshallerService

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml	2009-11-27 14:07:53 UTC (rev 97108)
@@ -39,7 +39,7 @@
 
   <!-- Properties -->
   <properties>
-    <version.jboss.osgi.runtime.felix>2.0.0</version.jboss.osgi.runtime.felix>
+    <version.jboss.osgi.runtime.felix>2.0.2-SNAPSHOT</version.jboss.osgi.runtime.felix>
     <version.jboss.xb>2.0.2.Beta3</version.jboss.xb>
     <version.javassist>3.9.0.GA</version.javassist>
     <version.jboss.osgi.common>1.0.4-SNAPSHOT</version.jboss.osgi.common>
@@ -149,7 +149,7 @@
             <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
             <Embed-Transitive>true</Embed-Transitive>
             <Export-Package>
-              org.jboss.osgi.jbossxb;version=2.0.2
+              org.jboss.osgi.jbossxb;version=${version}
             </Export-Package>
             <Import-Package>
               <!-- system -->
@@ -165,9 +165,9 @@
               com.wutka.dtd,
               org.apache.xerces.*,
               org.jboss.logging,
-              org.jboss.osgi.jaxb;version=2.0,
-              org.jboss.osgi.spi.capability;version=1.0,
-              org.jboss.osgi.spi.util;version=1.0,
+              org.jboss.osgi.jaxb;version="[2.1,2.2)",
+              org.jboss.osgi.spi.capability;version="[1.0,1.1)",
+              org.jboss.osgi.spi.util;version="[1.0,1.1)",
               org.jboss.util*,
               org.osgi.framework,
               org.osgi.service.log,
@@ -182,7 +182,15 @@
               jboss-reflect;inline=false,
             </Embed-Dependency>
             <_exportcontents>
-              org.jboss.xb.annotations;version=2.0.2,
+              org.jboss.beans.info*;version=${version.jboss.reflect},
+              org.jboss.classadapter.spi*;version=${version.jboss.reflect},
+              org.jboss.config*;version=${version.jboss.reflect},
+              org.jboss.joinpoint*;version=${version.jboss.reflect},
+              org.jboss.reflect.plugins.introspection;version=${version.jboss.reflect},
+              org.jboss.reflect.spi*;version=${version.jboss.reflect},
+              org.jboss.xb.annotations;version=${version.jboss.xb},
+              org.jboss.xb.binding.sunday.unmarshalling;version=${version.jboss.xb},
+              org.jboss.xb.binding;version=${version.jboss.xb},
             </_exportcontents>
           </instructions>
         </configuration>
@@ -268,7 +276,6 @@
     </plugins>
   </build>
 
-
   <!-- Profiles -->
   <profiles>
 

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/UnmarshallerService.java	2009-11-27 14:07:53 UTC (rev 97108)
@@ -38,6 +38,8 @@
  */
 public interface UnmarshallerService
 {
+   void setFeature(String featureName, Boolean flag);
+   
    void setValidation(boolean validation);
 
    void setNamespaceAware(boolean namespaces);

Modified: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/UnmarshallerServiceImpl.java	2009-11-27 14:07:53 UTC (rev 97108)
@@ -52,6 +52,7 @@
    // Provide logging
    private static Logger log = LoggerFactory.getLogger(UnmarshallerServiceImpl.class);
 
+   private UnmarshallerFactory factory;
    private Unmarshaller unmarshaller;
    private JBossEntityResolver entityResolver;
    private DefaultSchemaResolver schemaBindingResolver;
@@ -59,16 +60,22 @@
 
    public UnmarshallerServiceImpl(BundleContext context)
    {
-      unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      factory = UnmarshallerFactory.newInstance();
       schemaBindingResolver = new DefaultSchemaResolver();
       bundleLoader = BundleClassLoader.createClassLoader(context.getBundle());
+      log.debug("UnmarshallerService using: " + bundleLoader);
    }
 
+   public void setFeature(String featureName, Boolean flag)
+   {
+      factory.setFeature(featureName, flag);
+   }
+
    public void setNamespaceAware(boolean namespaces)
    {
       try
       {
-         unmarshaller.setNamespaceAware(namespaces);
+         getUnmarshaller().setNamespaceAware(namespaces);
       }
       catch (JBossXBException ex)
       {
@@ -80,7 +87,7 @@
    {
       try
       {
-         unmarshaller.setSchemaValidation(validation);
+         getUnmarshaller().setSchemaValidation(validation);
       }
       catch (JBossXBException ex)
       {
@@ -92,7 +99,7 @@
    {
       try
       {
-         unmarshaller.setValidation(validation);
+         getUnmarshaller().setValidation(validation);
       }
       catch (JBossXBException ex)
       {
@@ -102,7 +109,7 @@
 
    public void setErrorHandler(ErrorHandler errorHandler)
    {
-      unmarshaller.setErrorHandler(errorHandler);
+      getUnmarshaller().setErrorHandler(errorHandler);
    }
 
    public void registerSchemaLocation(String id, String dtdOrSchema)
@@ -112,7 +119,7 @@
          try
          {
             entityResolver = new JBossEntityResolver();
-            unmarshaller.setEntityResolver(entityResolver);
+            getUnmarshaller().setEntityResolver(entityResolver);
          }
          catch (JBossXBException ex)
          {
@@ -153,7 +160,7 @@
       try
       {
          Thread.currentThread().setContextClassLoader(bundleLoader);
-         return unmarshaller.unmarshal(xmlReader, schemaBindingResolver);
+         return getUnmarshaller().unmarshal(xmlReader, schemaBindingResolver);
       }
       catch (JBossXBException ex)
       {
@@ -173,7 +180,7 @@
       try
       {
          Thread.currentThread().setContextClassLoader(bundleLoader);
-         return unmarshaller.unmarshal(xmlStream, schemaBindingResolver);
+         return getUnmarshaller().unmarshal(xmlStream, schemaBindingResolver);
       }
       catch (JBossXBException ex)
       {
@@ -193,7 +200,7 @@
       try
       {
          Thread.currentThread().setContextClassLoader(bundleLoader);
-         return unmarshaller.unmarshal(source, schemaBindingResolver);
+         return getUnmarshaller().unmarshal(source, schemaBindingResolver);
       }
       catch (JBossXBException ex)
       {
@@ -213,7 +220,7 @@
       try
       {
          Thread.currentThread().setContextClassLoader(bundleLoader);
-         return unmarshaller.unmarshal(xml, schemaBindingResolver);
+         return getUnmarshaller().unmarshal(xml, schemaBindingResolver);
       }
       catch (JBossXBException ex)
       {
@@ -226,4 +233,11 @@
          Thread.currentThread().setContextClassLoader(ctxLoader);
       }
    }
+
+   private Unmarshaller getUnmarshaller()
+   {
+      if (unmarshaller == null)
+         unmarshaller = factory.newUnmarshaller();
+      return unmarshaller;
+   }
 }
\ No newline at end of file

Added: projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-11-27 14:07:53 UTC (rev 97108)
@@ -0,0 +1 @@
+org.jboss.osgi.felix.FelixBootstrapProvider                     # The Felix bootstrap provider
\ No newline at end of file

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml	2009-11-27 14:07:53 UTC (rev 97108)
@@ -39,7 +39,7 @@
   
   <!-- Properties -->
   <properties>
-    <version.jboss.osgi.runtime.felix>2.0.0</version.jboss.osgi.runtime.felix>
+    <version.jboss.osgi.runtime.felix>2.0.2-SNAPSHOT</version.jboss.osgi.runtime.felix>
     <version.jboss.deployers>2.0.5.SP1</version.jboss.deployers>
     <version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
     <version.jboss.osgi.common>1.0.4-SNAPSHOT</version.jboss.osgi.common>
@@ -51,7 +51,6 @@
     <version.jboss.osgi.runtime.deployers>1.0.3</version.jboss.osgi.runtime.deployers>
     <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
     <version.jboss.osgi.xml.binding>2.0.2-SNAPSHOT</version.jboss.osgi.xml.binding>
-    <version.jboss.reflect>2.0.2.GA</version.jboss.reflect>
     <version.osgi>4.2.0</version.osgi>
   </properties>
 
@@ -77,6 +76,10 @@
           <groupId>org.jboss</groupId>
           <artifactId>jboss-common-core</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jbossxb</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>
@@ -226,14 +229,12 @@
               jboss-metatype;inline=false,
               jboss-mdr;inline=false,
               jboss-osgi-deployers;inline=false,
-              jboss-reflect;inline=false,
               jboss-kernel;inline=false,
             </Embed-Dependency>
             <_exportcontents>
               org.jboss.beans.metadata*;version=2.0.9,
               org.jboss.dependency.spi*;version=2.0.9,
               org.jboss.kernel.spi*;version=2.0.9,
-              org.jboss.reflect.spi;version=2.0.2,
             </_exportcontents>
           </instructions>
         </configuration>
@@ -270,9 +271,9 @@
             <configuration>
               <tasks>
                 <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
-                <property name="artifactId" value="${artifactId}" />
                 <property name="tests.output.dir" value="${project.build.directory}" />
                 <property name="build.artifact" value="${project.build.finalName}" />
+                <property name="artifactId" value="${artifactId}" />
                 <ant antfile="scripts/antrun-test-jars.xml" />
               </tasks>
             </configuration>
@@ -319,4 +320,25 @@
     </plugins>
   </build>
 
+  <!-- Profiles -->
+  <profiles>
+
+    <!--
+      Name: jpda
+      Descr: Enable JPDA remote debuging
+    -->
+    <profile>
+      <id>jpda</id>
+      <activation>
+        <property>
+          <name>jpda</name>
+        </property>
+      </activation>
+      <properties>
+        <surefire.jpda.args>-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</surefire.jpda.args>
+      </properties>
+    </profile>
+    
+  </profiles>
+  
 </project>

Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeanDeployer.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeanDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeanDeployer.java	2009-11-27 14:07:53 UTC (rev 97108)
@@ -0,0 +1,161 @@
+/*
+ * 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.microcontainer.internal;
+
+// $Id$
+
+import org.jboss.deployers.vfs.deployer.kernel.BeanDeployer;
+import org.jboss.deployers.vfs.spi.deployer.JBossXBDeployerHelper;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.osgi.jbossxb.UnmarshallerService;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A {@link BeanDeployer} that that delegates to the {@link UnmarshallerService}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 30-Jun-2009
+ */
+public class EmbeddedBeanDeployer extends BeanDeployer
+{
+   private BundleContext systemContext;
+   
+   public void setSystemContext(BundleContext systemContext)
+   {
+      this.systemContext = systemContext;
+   }
+
+   static UnmarshallerService getUnmarshallerService(BundleContext context)
+   {
+      ServiceReference sref = context.getServiceReference(UnmarshallerService.class.getName());
+      if (sref == null)
+         throw new IllegalStateException("Cannot obtain: " + UnmarshallerService.class.getName());
+      
+      UnmarshallerService unmarshaller = (UnmarshallerService)context.getService(sref);
+      unmarshaller.addClassBinding("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.metadata.AOPDeployment");
+      unmarshaller.addClassBinding("urn:jboss:bean-deployer", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment10");
+      unmarshaller.addClassBinding("urn:jboss:bean-deployer:2.0", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment");
+      unmarshaller.addClassBinding("urn:jboss:javabean:1.0", "org.jboss.javabean.plugins.jaxb.JavaBean10");
+      unmarshaller.addClassBinding("urn:jboss:javabean:2.0", "org.jboss.javabean.plugins.jaxb.JavaBean20");
+      unmarshaller.addClassBinding("urn:jboss:policy:1.0", "org.jboss.beans.metadata.plugins.policy.AbstractPolicyMetaData");
+      unmarshaller.addClassBinding("urn:jboss:classloading:1.0", "org.jboss.classloading.spi.metadata.ClassLoadingMetaData10");
+      unmarshaller.addClassBinding("urn:jboss:classloader:1.0", "org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10");
+      unmarshaller.addClassBinding("urn:jboss:deployers:2.0", "org.jboss.deployers.vfs.plugins.xb.SchemaResolverDeployerMetaData");
+      
+      return unmarshaller;
+   }
+   
+   @Override
+   protected JBossXBDeployerHelper<KernelDeployment> getHelper()
+   {
+      return new EmbeddedDeployerHelper<KernelDeployment>(getOutput());
+   }
+   
+   class EmbeddedDeployerHelper<T> extends JBossXBDeployerHelper<T>
+   {
+      protected EmbeddedDeployerHelper(Class<T> output)
+      {
+         super(output);
+      }
+
+      @Override
+      public void setFeature(String featureName, Boolean flag) throws Exception
+      {
+         UnmarshallerService unmarshaller = getUnmarshallerService(systemContext);
+         unmarshaller.setFeature(featureName, flag);
+      }
+
+      @Override
+      @SuppressWarnings("unchecked")
+      public T parse(VirtualFile file) throws Exception
+      {
+         UnmarshallerService unmarshaller = getUnmarshallerService(systemContext);
+         return (T)unmarshaller.unmarshal(file.openStream());
+      }
+
+      // Below are the methods that are not (yet) implemented
+      @Override
+      public <U> U parse(Class<U> expectedType, VirtualFile file, U root, ObjectModelFactory omf) throws Exception
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public <U> U parse(Class<U> expectedType, VirtualFile file) throws Exception
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public T parse(VirtualFile file, T root, ObjectModelFactory omf) throws Exception
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public void addTypeBinding(String namespace, Class<?> metadata)
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public DefaultSchemaResolver getResolver()
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public boolean isUseSchemaValidation()
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public boolean isUseValidation()
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public void removeTypeBinding(String namespace)
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public void setUseSchemaValidation(boolean useSchemaValidation)
+      {
+         throw new NotImplementedException();
+      }
+
+      @Override
+      public void setUseValidation(boolean useValidation)
+      {
+         throw new NotImplementedException();
+      }
+   }
+}


Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeanDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java	2009-11-27 14:07:53 UTC (rev 97108)
@@ -35,7 +35,6 @@
 import org.jboss.logging.Logger;
 import org.jboss.osgi.jbossxb.UnmarshallerService;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 
 /**
  * An XML deployer that unlike the {@link BasicXMLDeployer} does not cache
@@ -134,21 +133,7 @@
 
       long start = System.currentTimeMillis();
 
-      ServiceReference sref = context.getServiceReference(UnmarshallerService.class.getName());
-      if (sref == null)
-         throw new IllegalStateException("Cannot obtain: " + UnmarshallerService.class.getName());
-      
-      UnmarshallerService unmarshaller = (UnmarshallerService)context.getService(sref);
-      unmarshaller.addClassBinding("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.metadata.AOPDeployment");
-      unmarshaller.addClassBinding("urn:jboss:bean-deployer", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment10");
-      unmarshaller.addClassBinding("urn:jboss:bean-deployer:2.0", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment");
-      unmarshaller.addClassBinding("urn:jboss:javabean:1.0", "org.jboss.javabean.plugins.jaxb.JavaBean10");
-      unmarshaller.addClassBinding("urn:jboss:javabean:2.0", "org.jboss.javabean.plugins.jaxb.JavaBean20");
-      unmarshaller.addClassBinding("urn:jboss:policy:1.0", "org.jboss.beans.metadata.plugins.policy.AbstractPolicyMetaData");
-      unmarshaller.addClassBinding("urn:jboss:classloading:1.0", "org.jboss.classloading.spi.metadata.ClassLoadingMetaData10");
-      unmarshaller.addClassBinding("urn:jboss:classloader:1.0", "org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10");
-      unmarshaller.addClassBinding("urn:jboss:deployers:2.0", "org.jboss.deployers.vfs.plugins.xb.SchemaResolverDeployerMetaData");
-      
+      UnmarshallerService unmarshaller = EmbeddedBeanDeployer.getUnmarshallerService(context);
       KernelDeployment deployment = (KernelDeployment)unmarshaller.unmarshal(url.toString());
       if (deployment == null)
          throw new RuntimeException("The xml " + url + " is not well formed!");

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-11-27 14:07:53 UTC (rev 97108)
@@ -23,17 +23,24 @@
 
 //$Id$
 
+import static org.osgi.framework.Constants.OBJECTCLASS;
+
 import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
 
 import javax.management.MBeanServer;
 
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.osgi.jbossxb.UnmarshallerService;
 import org.jboss.osgi.microcontainer.AbstractMicrocontainerService;
 import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.MicrocontainerService;
 import org.jboss.virtual.VFS;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.util.tracker.ServiceTracker;
 
@@ -75,28 +82,54 @@
       installBean(controller, BEAN_KERNEL, kernel);
       installBean(controller, BEAN_KERNEL_CONTROLLER, controller);
 
+      // Setup a filter to track both services
+      Filter filter;
+      try
+      {
+         String jmxService = "(" + OBJECTCLASS + "=" + MBeanServer.class.getName() + ")";
+         String xmlService = "(" + OBJECTCLASS + "=" + UnmarshallerService.class.getName() + ")";
+         filter = context.createFilter("(|" + jmxService + xmlService + ")");
+      }
+      catch (InvalidSyntaxException ex)
+      {
+         throw new IllegalArgumentException("Invalid filter syntax");
+      }
+
       // Register the MicrocontainerServiceMBean
-      ServiceTracker tracker = new ServiceTracker(context, MBeanServer.class.getName(), null)
+      ServiceTracker tracker = new ServiceTracker(context, filter, null)
       {
+         UnmarshallerService xmlService;
+         MBeanServer mbeanServer;
+         
          @Override
          public Object addingService(ServiceReference sref)
          {
-            MBeanServer mbeanServer = (MBeanServer)super.addingService(sref);
+            Object service = super.addingService(sref);
+            
+            List<String> classList = Arrays.asList((String[])sref.getProperty(OBJECTCLASS));
+            if (classList.contains(MBeanServer.class.getName()))
+               mbeanServer = (MBeanServer)service;
 
-            // Install the MBeanServer
-            installBean(controller, BEAN_MBEAN_SERVER, mbeanServer);
+            if (classList.contains(UnmarshallerService.class.getName()))
+               xmlService = (UnmarshallerService)service;
 
-            // Deploy the deployer beans
-            URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
-            deployer.deploy(deployersURL);
+            if (mbeanServer != null && xmlService != null)
+            {
+               // Install the MBeanServer
+               installBean(controller, BEAN_MBEAN_SERVER, mbeanServer);
 
-            // Register the MicrocontainerService
-            context.registerService(MicrocontainerService.class.getName(), mcServiceImpl, null);
+               // Deploy the deployer beans
+               URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
+               deployer.deploy(deployersURL);
 
-            // Register the MicrocontainerServiceMBean
-            registerMicrocontainerServiceMBean(mbeanServer);
+               // Register the MicrocontainerService
+               context.registerService(MicrocontainerService.class.getName(), mcServiceImpl, null);
 
-            return mbeanServer;
+               // Register the MicrocontainerServiceMBean
+               registerMicrocontainerServiceMBean(mbeanServer);
+            }
+            
+            return service;
          }
       };
       tracker.open();

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/resources/META-INF/base-deployers-beans.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/resources/META-INF/base-deployers-beans.xml	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/resources/META-INF/base-deployers-beans.xml	2009-11-27 14:07:53 UTC (rev 97108)
@@ -52,6 +52,7 @@
   <!-- POJO Deployment -->
   
   <bean name="BeanDeployer" class="org.jboss.osgi.microcontainer.internal.EmbeddedBeanDeployer">
+    <property name="systemContext"><inject bean="jboss.osgi:service=BundleContext" /></property>
     <property name="suffix">jboss-beans.xml</property>
   </bean>
   <bean name="KernelDeploymentDeployer" class="org.jboss.osgi.deployer.BundleContainedBeansDeployer">

Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-11-27 14:07:53 UTC (rev 97108)
@@ -0,0 +1 @@
+org.jboss.osgi.felix.FelixBootstrapProvider                     # The Felix bootstrap provider
\ No newline at end of file

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/test/resources/jboss-osgi-framework.properties	2009-11-27 14:07:53 UTC (rev 97108)
@@ -4,12 +4,15 @@
 # $Id: jboss-osgi-framework.properties 97021 2009-11-26 12:40:11Z thomas.diesler at jboss.com $
 #
 
+# Felix config properties  
+felix.bootdelegation.implicit=false
+
 # Properties to configure the Framework
 org.osgi.framework.storage=${test.archive.directory}/../osgi-store
 org.osgi.framework.storage.clean=onFirstInit
 
 # Framework bootdelegation
-# org.osgi.framework.bootdelegation=
+org.osgi.framework.bootdelegation=sun.reflect
 
 # Extra System Packages
 org.osgi.framework.system.packages.extra=\
@@ -36,5 +39,5 @@
 	file://${test.archive.directory}/bundles/org.osgi.compendium.jar
 
 # Bundles that need to be started automatically 
-#org.jboss.osgi.spi.framework.autoStart=\
-#	file://${test.archive.directory}/bundles/jboss-osgi-common.jar 
+org.jboss.osgi.spi.framework.autoStart=\
+	file://${test.archive.directory}/bundles/jboss-osgi-common.jar 

Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml	2009-11-27 14:07:53 UTC (rev 97108)
@@ -40,8 +40,8 @@
   <properties>
     <version.eclipse.equinox>3.5.1</version.eclipse.equinox>
     <version.jboss.osgi.deployment>1.0.0</version.jboss.osgi.deployment>
-    <version.jboss.osgi.husky>1.0.2</version.jboss.osgi.husky>
-    <version.jboss.osgi.spi>1.0.3</version.jboss.osgi.spi>
+    <version.jboss.osgi.husky>1.0.2-SNAPSHOT</version.jboss.osgi.husky>
+    <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
   </properties>
   
   <!-- Dependencies -->

Modified: projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml	2009-11-27 14:07:53 UTC (rev 97108)
@@ -39,8 +39,8 @@
   <properties>
     <version.felix.framework>2.0.2</version.felix.framework>
     <version.jboss.osgi.deployment>1.0.0</version.jboss.osgi.deployment>
-    <version.jboss.osgi.husky>1.0.2</version.jboss.osgi.husky>
-    <version.jboss.osgi.spi>1.0.3</version.jboss.osgi.spi>
+    <version.jboss.osgi.husky>1.0.2-SNAPSHOT</version.jboss.osgi.husky>
+    <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
     <version.osgi>4.2.0</version.osgi>
   </properties>
 

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java	2009-11-27 13:47:59 UTC (rev 97107)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java	2009-11-27 14:07:53 UTC (rev 97108)
@@ -27,11 +27,9 @@
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.Dictionary;
 import java.util.Enumeration;
 
 import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
 
 /**
  * A BundleClassLoader delegates all classloading concerns to the underlying Bundle.
@@ -108,8 +106,7 @@
 
    public String toString()
    {
-      Dictionary<?, ?> headers = bundle.getHeaders();
-      String bundleId = bundle.getSymbolicName() + ":" + headers.get(Constants.BUNDLE_VERSION);
-      return "BundleClassLoader for [" + bundleId + "]";
+      String shortName = bundle.getSymbolicName() + "-" + bundle.getVersion();
+      return "BundleClassLoader[id=" + bundle.getBundleId() + "," + shortName + "]";
    }
 }




More information about the jboss-cvs-commits mailing list