[jboss-osgi-commits] JBoss-OSGI SVN: r89718 - in projects/jboss-osgi/trunk: docbook/en/images and 12 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Wed Jun 3 05:37:53 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-06-03 05:37:53 -0400 (Wed, 03 Jun 2009)
New Revision: 89718

Added:
   projects/jboss-osgi/trunk/docbook/en/images/jbossosgi-spi.png
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
Removed:
   projects/jboss-osgi/trunk/docbook/en/images/jboss-osgi.png
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/MicrocontainerBootstrapProvider.java
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/MicrocontainerServiceMBean.java
Modified:
   projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
   projects/jboss-osgi/trunk/docbook/en/images/jbossosgi-runtime.png
   projects/jboss-osgi/trunk/docbook/en/modules/ch10-getting-started.xml
   projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml
   projects/jboss-osgi/trunk/docbook/en/modules/ch40-developer-guide.xml
   projects/jboss-osgi/trunk/docbook/src/main/graphics/jbossosgi-runtime.odp
   projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-jdk16/config.xml
   projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/AbstractMicrocontainerService.java
   projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
   projects/jboss-osgi/trunk/runtime/equinox/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/trunk/runtime/felix/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java
Log:
More dev guide - WIP

Modified: projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -36,9 +36,9 @@
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.osgi.common.log.LogServiceTracker;
 import org.jboss.osgi.integration.jbossas.AbstractMicrocontainerService;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.DeployerService;
 import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.jboss.osgi.spi.service.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.XMLBindingService;
 import org.jboss.virtual.VFS;
 import org.osgi.framework.BundleContext;

Deleted: projects/jboss-osgi/trunk/docbook/en/images/jboss-osgi.png
===================================================================
(Binary files differ)

Modified: projects/jboss-osgi/trunk/docbook/en/images/jbossosgi-runtime.png
===================================================================
(Binary files differ)

Copied: projects/jboss-osgi/trunk/docbook/en/images/jbossosgi-spi.png (from rev 89712, projects/jboss-osgi/trunk/docbook/en/images/jboss-osgi.png)
===================================================================
(Binary files differ)

Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch10-getting-started.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch10-getting-started.xml	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch10-getting-started.xml	2009-06-03 09:37:53 UTC (rev 89718)
@@ -51,7 +51,7 @@
 
     <itemizedlist>
       <listitem><emphasis role="bold">JBoss OSGi Distribution</emphasis> - Documentation, Binary Artifacts and Sources</listitem>
-      <listitem><emphasis role="bold">JBoss OSGi Runtime</emphasis> - Standalone JBoss OSGi Runtime based on JBossAS</listitem>
+      <listitem><emphasis role="bold">JBoss OSGi Runtime</emphasis> - Standalone JBoss OSGi Runtime</listitem>
       <listitem><emphasis role="bold">JBoss OSGi Integration</emphasis> - Integration with an existing JBossAS instance</listitem>
     </itemizedlist>
     
@@ -115,7 +115,7 @@
     options are:</para>
     
     <itemizedlist>
-      <listitem><emphasis role="bold">-c (--profile-name)</emphasis> - The runtime profile to start.
+      <listitem><emphasis role="bold">-c (--server-name)</emphasis> - The runtime profile to start.
       The default is the 'default' profile.</listitem>
       <listitem><emphasis role="bold">-b (--bind-address)</emphasis> - The network address various services can bind to.
       The default is 'localhost'</listitem>

Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml	2009-06-03 09:37:53 UTC (rev 89718)
@@ -126,7 +126,7 @@
       <title>TODO: [JBOSGI-98] Support configuration per profile</title>
     </note>
     
-    <para>A runtime profile can be started using the -c comand line option.</para>
+    <para>A runtime profile can be started using the <emphasis role="bold">-c comand line option</emphasis>.</para>
     
     <programlisting>
     [tdiesler at tddell runtime]$ bin/run.sh -c minimal
@@ -138,7 +138,7 @@
     
       JAVA: /usr/java/jdk1.6/bin/java
     
-      JAVA_OPTS: -Dprogram.name=run.sh -Dosgi.home=/home/tdiesler/jboss-osgi-1.0.0.Beta2/runtime -server -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true
+      JAVA_OPTS: -Dprogram.name=run.sh ...
     
     =========================================================================
     

Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch40-developer-guide.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch40-developer-guide.xml	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch40-developer-guide.xml	2009-06-03 09:37:53 UTC (rev 89718)
@@ -8,13 +8,19 @@
   <sect1 xml:id="SecSPI">  
     <title>Service Provider Interface</title>
     
-    <para>The JBoss OSGi Service Provider Interface (SPI) is the integration point between the supported OSGi Frameworks and 
-    the <ulink url="http://www.jboss.org/jbossmc">JBoss Microcontainer</ulink>. The configuration defines MC beans for the 
-    framework itself and its associated deployers.</para>
+    <para>The JBoss OSGi Service Provider Interface (SPI) is the integration point for:</para>
     
+    <itemizedlist>
+      <listitem>Supported OSGi Frameworks</listitem>
+      <listitem>Supported Target Containers</listitem>
+      <listitem>Administration, Provisioning and Management</listitem>
+      <listitem>Various Provided Services</listitem>
+      <listitem>Testing Framework</listitem>
+    </itemizedlist>
+    
     <mediaobject>
       <imageobject>
-        <imagedata fileref="images/jboss-osgi.png" contentwidth="450"/> 
+        <imagedata fileref="images/jbossosgi-spi.png" contentwidth="450"/> 
       </imageobject>
     </mediaobject>
     
@@ -23,11 +29,12 @@
 
     <itemizedlist>
       <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/package-summary.html">org.jboss.osgi.spi</ulink> - Common classes and interfaces.</listitem>
+      <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/capability/package-summary.html">org.jboss.osgi.spi.capability</ulink> - Capabilities that can be installed in the OSGi framework.</listitem>
       <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/framework/package-summary.html">org.jboss.osgi.spi.framework</ulink> - Framework integration and bootstrap.</listitem>
-      <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/junit/package-summary.html">org.jboss.osgi.spi.junit</ulink> - JUnit test integration.</listitem>
       <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/logging/package-summary.html">org.jboss.osgi.spi.logging</ulink> - Support for Bundle logging.</listitem>
       <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/management/package-summary.html">org.jboss.osgi.spi.management</ulink> -  Management view on deployed bundles.</listitem>
-      <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/service/microcontainer/package-summary.html">org.jboss.osgi.spi.service.microcontainer</ulink> -  Access to the Kernel and MBeanServer.</listitem>
+      <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/service/package-summary.html">org.jboss.osgi.spi.service</ulink> -  A collection of SPI provided services.</listitem>
+      <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/testing/package-summary.html">org.jboss.osgi.spi.testing</ulink> -  OSGi test support classes and interfaces.</listitem>
     </itemizedlist>
     
     <emphasis role="bold">Bootstrapping JBoss OSGi</emphasis>
@@ -62,9 +69,14 @@
     Bundle bundle = framework.getSystemBundle();
     </programlisting>
     
-    <para>The JBoss OSGi SPI comes with a OSGiBootstrapProvider that uses a <ulink url="http://www.jboss.org/jbossmc">JBoss Microcontainer</ulink> 
-    bean configuration.</para>
+    <para>The JBoss OSGi SPI comes with two bootstrap providers:</para>
     
+    <itemizedlist>
+      <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.html">PropertiesBootstrapProvider</ulink></listitem>
+      <listitem><ulink url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.html">MicrocontainerBootstrapProvider</ulink></listitem>
+    </itemizedlist>
+    
+    
     <programlisting role="XML"><![CDATA[
     <deployment xmlns="urn:jboss:bean-deployer:2.0" ...>
     

Modified: projects/jboss-osgi/trunk/docbook/src/main/graphics/jbossosgi-runtime.odp
===================================================================
(Binary files differ)

Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-jdk16/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-jdk16/config.xml	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-jdk16/config.xml	2009-06-03 09:37:53 UTC (rev 89718)
@@ -59,6 +59,10 @@
     </hudson.tasks.Shell>
   </builders>
   <publishers class="vector">
+    <hudson.tasks.JavadocArchiver>
+      <javadocDir>jboss-osgi/spi/target/apidocs</javadocDir>
+      <keepAll>false</keepAll>
+    </hudson.tasks.JavadocArchiver>
     <hudson.tasks.junit.JUnitResultArchiver>
       <testResults>jboss-osgi/**/target/surefire-reports/TEST-*.xml</testResults>
     </hudson.tasks.junit.JUnitResultArchiver>

Modified: projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/AbstractMicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/AbstractMicrocontainerService.java	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/AbstractMicrocontainerService.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -23,7 +23,7 @@
 
 //$Id$
 
-import static org.jboss.osgi.spi.service.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
 
 import java.net.URL;
 import java.util.ArrayList;
@@ -49,10 +49,10 @@
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.BundleInfo;
 import org.jboss.osgi.spi.service.DeployerService;
 import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.jboss.osgi.spi.service.MicrocontainerServiceMBean;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
 import org.osgi.framework.BundleException;

Modified: projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
===================================================================
--- projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -32,9 +32,9 @@
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.DeployerService;
 import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.jboss.osgi.spi.service.MicrocontainerServiceMBean;
 import org.osgi.framework.BundleContext;
 
 /**

Modified: projects/jboss-osgi/trunk/runtime/equinox/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-06-03 09:37:53 UTC (rev 89718)
@@ -1 +1 @@
-org.jboss.osgi.spi.internal.MicrocontainerBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.spi.framework.MicrocontainerBootstrapProvider
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/runtime/felix/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/runtime/felix/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-06-03 09:37:53 UTC (rev 89718)
@@ -1 +1 @@
-org.jboss.osgi.spi.internal.MicrocontainerBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.spi.framework.MicrocontainerBootstrapProvider
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-06-03 09:37:53 UTC (rev 89718)
@@ -1 +1 @@
-org.jboss.osgi.spi.internal.MicrocontainerBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.spi.framework.MicrocontainerBootstrapProvider
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java (from rev 89712, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/MicrocontainerBootstrapProvider.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ */
+package org.jboss.osgi.spi.framework;
+
+//$Id$
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.osgi.spi.internal.EmbeddedBeansDeployer;
+
+/**
+ * Bootstrap the OSGiFramework through the MC
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class MicrocontainerBootstrapProvider implements OSGiBootstrapProvider
+{
+   /** The default framework beans property: jboss.osgi.bootstrap.beans */
+   public static final String OSGI_BOOTSTRAP_BEANS = "jboss.osgi.bootstrap.beans";
+   /** The default framework beans: jboss-osgi-bootstrap-beans.xml */
+   public static final String DEFAULT_OSGI_BOOTSTRAP_XML = "jboss-osgi-bootstrap-beans.xml";
+   /** The default framework beans property: jboss.osgi.framework.beans */
+   public static final String OSGI_FRAMEWORK_BEANS = "jboss.osgi.framework.beans";
+   /** The default framework beans: jboss-osgi-beans.xml */
+   public static final String DEFAULT_OSGI_FRAMEWORK_XML = "jboss-osgi-beans.xml";
+   
+   private EmbeddedBeansDeployer deployer = new EmbeddedBeansDeployer();
+   private boolean bootstraped;
+   private boolean configured;
+
+   public OSGiFramework getFramework()
+   {
+      return getFramework(DEFAULT_FRAMEWORK_NAME);
+   }
+
+   public OSGiFramework getFramework(String beanName)
+   {
+      OSGiFramework framework = getInstance(beanName, OSGiFramework.class);
+      if (framework == null && configured == false)
+      {
+         configureWithDefaultBeans();
+         framework = getInstance(beanName, OSGiFramework.class);
+      }
+      return framework;
+   }
+
+   public void configure()
+   {
+      configureWithDefaultBeans();
+   }
+
+   public void configure(InputStream streamConfig)
+   {
+      throw new NotImplementedException("Cannot bootstrap JBossMC from InputStream");
+   }
+
+   public void configure(String resourceConfig)
+   {
+      URL urlConfig = Thread.currentThread().getContextClassLoader().getResource(resourceConfig);
+      if (urlConfig == null)
+         throw new IllegalStateException("Cannot find resource: " + resourceConfig);
+
+      configure(urlConfig);
+   }
+
+   public void configure(URL urlConfig)
+   {
+      deployer.deploy(urlConfig);
+      configured = true;
+   }
+
+   public Object getInstance(String name)
+   {
+      Object retObj = null;
+
+      if (bootstraped == false)
+      {
+         bootstrapKernel();
+         bootstraped = true;
+      }
+
+      if (KernelConstants.KERNEL_NAME.equals(name))
+      {
+         retObj = deployer.getKernel();
+      }
+      else
+      {
+         Controller controller = deployer.getKernel().getController();
+         ControllerContext context = controller.getInstalledContext(name);
+         if (context != null)
+            retObj = context.getTarget();
+      }
+
+      return retObj;
+   }
+
+   public <T> T getInstance(String name, Class<T> expectedType)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+
+      if (expectedType == null)
+         throw new IllegalArgumentException("Null expected type.");
+
+      Object attribute = getInstance(name);
+      if (attribute != null)
+      {
+         if (expectedType.isInstance(attribute) == false)
+            throw new IllegalArgumentException("Not of expected type [" + expectedType + "]: " + attribute);
+
+         return expectedType.cast(attribute);
+      }
+      return null;
+   }
+   
+   private void configureWithDefaultBeans()
+   {
+      String defaultFrameworkBeans = System.getProperty(OSGI_FRAMEWORK_BEANS, DEFAULT_OSGI_FRAMEWORK_XML);
+      configure(defaultFrameworkBeans);
+   }
+
+   private void bootstrapKernel()
+   {
+      // Deploy the bootstrap beans if DEFAULT_BOOTSTRAP_BEANS is on the classpath
+      String defaultBootstrapBeans = System.getProperty(OSGI_BOOTSTRAP_BEANS, DEFAULT_OSGI_BOOTSTRAP_XML);
+      URL urlBootstrap = Thread.currentThread().getContextClassLoader().getResource(defaultBootstrapBeans);
+      if (urlBootstrap != null)
+         deployer.deploy(urlBootstrap);
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/MicrocontainerBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/MicrocontainerBootstrapProvider.java	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/internal/MicrocontainerBootstrapProvider.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-package org.jboss.osgi.spi.internal;
-
-//$Id$
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
-import org.jboss.osgi.spi.NotImplementedException;
-import org.jboss.osgi.spi.framework.AbstractInstanceProvider;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-
-/**
- * Bootstrap the OSGiFrameworj through the MC
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class MicrocontainerBootstrapProvider extends AbstractInstanceProvider implements OSGiBootstrapProvider
-{
-   /** The default framework beans property: jboss.osgi.bootstrap.beans */
-   public static final String OSGI_BOOTSTRAP_BEANS = "jboss.osgi.bootstrap.beans";
-   /** The default framework beans: jboss-osgi-bootstrap-beans.xml */
-   public static final String DEFAULT_OSGI_BOOTSTRAP_XML = "jboss-osgi-bootstrap-beans.xml";
-   /** The default framework beans property: jboss.osgi.framework.beans */
-   public static final String OSGI_FRAMEWORK_BEANS = "jboss.osgi.framework.beans";
-   /** The default framework beans: jboss-osgi-beans.xml */
-   public static final String DEFAULT_OSGI_FRAMEWORK_XML = "jboss-osgi-beans.xml";
-   
-   private EmbeddedBeansDeployer deployer = new EmbeddedBeansDeployer();
-   private boolean bootstraped;
-   private boolean configured;
-
-   public OSGiFramework getFramework()
-   {
-      return getFramework(DEFAULT_FRAMEWORK_NAME);
-   }
-
-   public OSGiFramework getFramework(String beanName)
-   {
-      OSGiFramework framework = getInstance(beanName, OSGiFramework.class);
-      if (framework == null && configured == false)
-      {
-         configureWithDefaultBeans();
-         framework = getInstance(beanName, OSGiFramework.class);
-      }
-      return framework;
-   }
-
-   public void configure()
-   {
-      configureWithDefaultBeans();
-   }
-
-   public void configure(InputStream streamConfig)
-   {
-      throw new NotImplementedException("Cannot bootstrap JBossMC from InputStream");
-   }
-
-   public void configure(String resourceConfig)
-   {
-      URL urlConfig = Thread.currentThread().getContextClassLoader().getResource(resourceConfig);
-      if (urlConfig == null)
-         throw new IllegalStateException("Cannot find resource: " + resourceConfig);
-
-      configure(urlConfig);
-   }
-
-   public void configure(URL urlConfig)
-   {
-      deployer.deploy(urlConfig);
-      configured = true;
-   }
-
-   public Object getInstance(String name)
-   {
-      Object retObj = null;
-
-      if (bootstraped == false)
-      {
-         bootstrapKernel();
-         bootstraped = true;
-      }
-
-      if (KernelConstants.KERNEL_NAME.equals(name))
-      {
-         retObj = deployer.getKernel();
-      }
-      else
-      {
-         Controller controller = deployer.getKernel().getController();
-         ControllerContext context = controller.getInstalledContext(name);
-         if (context != null)
-            retObj = context.getTarget();
-      }
-
-      return retObj;
-   }
-
-   private void configureWithDefaultBeans()
-   {
-      String defaultFrameworkBeans = System.getProperty(OSGI_FRAMEWORK_BEANS, DEFAULT_OSGI_FRAMEWORK_XML);
-      configure(defaultFrameworkBeans);
-   }
-
-   private void bootstrapKernel()
-   {
-      // Deploy the bootstrap beans if DEFAULT_BOOTSTRAP_BEANS is on the classpath
-      String defaultBootstrapBeans = System.getProperty(OSGI_BOOTSTRAP_BEANS, DEFAULT_OSGI_BOOTSTRAP_XML);
-      URL urlBootstrap = Thread.currentThread().getContextClassLoader().getResource(defaultBootstrapBeans);
-      if (urlBootstrap != null)
-         deployer.deploy(urlBootstrap);
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java (from rev 89712, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/MicrocontainerServiceMBean.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.jboss.osgi.spi.management;
+
+//$Id$
+
+import java.util.List;
+
+import javax.management.ObjectName;
+
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerServiceMBean
+{
+   /** 
+    * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService' 
+    */
+   ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
+
+   /**
+    * Get the list of registered beans.
+    */
+   List<String> getRegisteredBeans();
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/MicrocontainerServiceMBean.java	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/MicrocontainerServiceMBean.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.jboss.osgi.spi.service;
-
-//$Id$
-
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.osgi.spi.management.ObjectNameFactory;
-
-/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
- * 
- * @author thomas.diesler at jboss.com
- * @since 23-Jan-2009
- */
-public interface MicrocontainerServiceMBean
-{
-   /** 
-    * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService' 
-    */
-   ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
-
-   /**
-    * Get the list of registered beans.
-    */
-   List<String> getRegisteredBeans();
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java	2009-06-03 09:28:44 UTC (rev 89717)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java	2009-06-03 09:37:53 UTC (rev 89718)
@@ -24,11 +24,11 @@
 //$Id$
 
 import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
 import static org.jboss.osgi.spi.service.DeployerService.MBEAN_DEPLOYER_SERVICE;
 import static org.jboss.osgi.spi.service.MicrocontainerService.BEAN_KERNEL;
 import static org.jboss.osgi.spi.service.MicrocontainerService.BEAN_MBEAN_SERVER;
 import static org.jboss.osgi.spi.service.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
-import static org.jboss.osgi.spi.service.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
 import static org.jboss.test.osgi.service.microcontainer.bundleB.SomeBeanMBean.MBEAN_NAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -43,9 +43,9 @@
 import org.jboss.osgi.spi.capability.MicrocontainerCapability;
 import org.jboss.osgi.spi.management.MBeanProxy;
 import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.DeployerService;
 import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.jboss.osgi.spi.service.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiTest;
 import org.jboss.osgi.spi.testing.OSGiTestHelper;




More information about the jboss-osgi-commits mailing list