JBoss-OSGI SVN: r93045 - projects/jboss-osgi/trunk/testsuite.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 14:20:10 -0400 (Mon, 31 Aug 2009)
New Revision: 93045
Modified:
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Revert default framework back to felix
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-31 18:15:31 UTC (rev 93044)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-31 18:20:10 UTC (rev 93045)
@@ -180,7 +180,7 @@
</property>
</activation>
- <!-- default to jbossmc -->
+ <!-- default to jbossmc
<dependencies>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
@@ -189,8 +189,9 @@
<scope>provided</scope>
</dependency>
</dependencies>
+ -->
- <!-- default to felix
+ <!-- default to felix -->
<dependencies>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
@@ -199,7 +200,6 @@
<scope>provided</scope>
</dependency>
</dependencies>
- -->
</profile>
14 years, 8 months
JBoss-OSGI SVN: r93043 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 13:49:33 -0400 (Mon, 31 Aug 2009)
New Revision: 93043
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
Log:
unregisterMBean(MBEAN_MICROCONTAINER_SERVICE)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-08-31 16:54:15 UTC (rev 93042)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-08-31 17:49:33 UTC (rev 93043)
@@ -40,6 +40,7 @@
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.logging.Logger;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
@@ -54,6 +55,9 @@
*/
public class MicrocontainerServiceImpl implements MicrocontainerService, MicrocontainerServiceMBean
{
+ /** The log */
+ private static final Logger log = Logger.getLogger(MicrocontainerServiceImpl.class);
+
private Kernel kernel;
private BundleContext sysContext;
@@ -93,6 +97,23 @@
}
return server;
}
+
+ @Override
+ public void removedService(ServiceReference reference, Object service)
+ {
+ MBeanServer server = (MBeanServer)service;
+ try
+ {
+ if (server.isRegistered(MBEAN_MICROCONTAINER_SERVICE))
+ server.unregisterMBean(MBEAN_MICROCONTAINER_SERVICE);
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot unregister MicrocontainerServiceMBean", ex);
+ }
+ super.removedService(reference, service);
+ }
+
};
tracker.open();
}
14 years, 8 months
JBoss-OSGI SVN: r93032 - projects/jboss-osgi/trunk/testsuite/functional.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 10:38:35 -0400 (Mon, 31 Aug 2009)
New Revision: 93032
Modified:
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
Log:
Explicitly exclude jbossmc tests
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-08-31 14:27:48 UTC (rev 93031)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-08-31 14:38:35 UTC (rev 93032)
@@ -161,11 +161,17 @@
</plugins>
</build>
</profile>
+
+ <!--
+ Name: framework-jbossmc
+ Descr: Setup for JBossMC framework integration testing
+ -->
<profile>
- <id>framework-default</id>
+ <id>framework-jbossmc</id>
<activation>
<property>
- <name>!framework</name>
+ <name>framework</name>
+ <value>jbossmc</value>
</property>
</activation>
<build>
@@ -175,24 +181,24 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
- <exclude>org/jboss/test/osgi/jbosgi142/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi38/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi39/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi41/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi108/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi143/**</exclude>
+ <exclude>org/jboss/test/osgi/service/microcontainer/**</exclude>
+ <exclude>org/jboss/test/osgi/service/startlevel/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
-
- <!--
- Name: framework-jbossmc
- Descr: Setup for JBossMC framework integration testing
- -->
<profile>
- <id>framework-jbossmc</id>
+ <id>framework-default</id>
<activation>
<property>
- <name>framework</name>
- <value>jbossmc</value>
+ <name>!framework</name>
</property>
</activation>
<build>
@@ -202,7 +208,13 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
- <exclude>org/jboss/test/osgi/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi38/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi39/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi41/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi108/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi143/**</exclude>
+ <exclude>org/jboss/test/osgi/service/microcontainer/**</exclude>
+ <exclude>org/jboss/test/osgi/service/startlevel/**</exclude>
</excludes>
</configuration>
</plugin>
14 years, 8 months
JBoss-OSGI SVN: r93031 - in projects/jboss-osgi/trunk: testsuite/example and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 10:27:48 -0400 (Mon, 31 Aug 2009)
New Revision: 93031
Modified:
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Use BP bundle to register the services
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-08-31 14:25:43 UTC (rev 93030)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-08-31 14:27:48 UTC (rev 93031)
@@ -122,7 +122,10 @@
public BundleContext getBundleContext()
{
- return bundle.getBundleContext();
+ BundleContext bundleContext = bundle.getBundleContext();
+ if (bundleContext == null)
+ throw new IllegalStateException("BundleContext not available");
+ return bundleContext;
}
public Set<String> getComponentIds()
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-08-31 14:25:43 UTC (rev 93030)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-08-31 14:27:48 UTC (rev 93031)
@@ -29,6 +29,7 @@
import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.reflect.ServiceMetadataImpl;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
@@ -37,21 +38,19 @@
import org.osgi.service.blueprint.reflect.Target;
/**
- * Service managers maintain the registration of an OSGi service
- * object. Service managers provide a proxied ServiceRegistration object.
+ * Service managers maintain the registration of an OSGi service object. Service managers provide a proxied ServiceRegistration object.
*
- * A service manager is enabled if all the mandatory service references in its
- * dependencies are satisfied.
- *
+ * A service manager is enabled if all the mandatory service references in its dependencies are satisfied.
+ *
* @author thomas.diesler(a)jboss.com
* @since 17-Jun-2009
*/
public class ServiceManager extends AbstractManager
{
private ServiceMetadataImpl serviceMetadata;
-
+
private BeanManager anonymousBean;
- private List<ServiceRegistration> serviceRegs = new ArrayList<ServiceRegistration>();
+ private List<ServiceRegistration> serviceRegs = new ArrayList<ServiceRegistration>();
public ServiceManager(BlueprintContext context, BlueprintContainer container, ServiceMetadata compMetadata)
{
@@ -63,7 +62,7 @@
if (target instanceof BeanMetadata)
{
ManagerFactory factory = new ManagerFactory(context, container);
- anonymousBean = (BeanManager)factory.createManager((BeanMetadata)target);
+ anonymousBean = (BeanManager)factory.createManager((BeanMetadata)target);
}
}
@@ -71,7 +70,7 @@
public void install()
{
super.install();
-
+
if (anonymousBean != null)
anonymousBean.install();
}
@@ -80,7 +79,7 @@
public void activate()
{
super.activate();
-
+
// Get the BeanManager that backs this service
BeanManager beanManager = anonymousBean;
if (beanManager == null)
@@ -89,15 +88,16 @@
BlueprintContainerImpl impl = (BlueprintContainerImpl)container;
beanManager = (BeanManager)impl.getComponentManager(target.getComponentId());
}
-
+
// Activate the BeanManager that backs this service
beanManager.activate();
-
+
// Register the the target bean as a services
Object targetBean = beanManager.getTargetBean();
+ BundleContext bundleContext = ((BlueprintContainerImpl)container).getBundleContext();
for (String interf : serviceMetadata.getInterfaces())
{
- ServiceRegistration sreg = context.getBundleContext().registerService(interf, targetBean, null);
+ ServiceRegistration sreg = bundleContext.registerService(interf, targetBean, null);
serviceRegs.add(sreg);
}
}
@@ -108,12 +108,22 @@
// Unregister the services
List<ServiceRegistration> list = new ArrayList<ServiceRegistration>(serviceRegs);
Collections.reverse(list);
+
for (ServiceRegistration sreg : list)
- sreg.unregister();
-
+ {
+ try
+ {
+ sreg.unregister();
+ }
+ catch (IllegalStateException ex)
+ {
+ // This ServiceRegistration object has already been unregistered
+ }
+ }
+
if (anonymousBean != null)
anonymousBean.shutdown();
-
+
super.shutdown();
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-08-31 14:25:43 UTC (rev 93030)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-08-31 14:27:48 UTC (rev 93031)
@@ -223,8 +223,6 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
- <exclude>org/jboss/test/osgi/example/blueprint/**</exclude>
- <exclude>org/jboss/test/osgi/example/microcontainer/**</exclude>
</excludes>
</configuration>
</plugin>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-31 14:25:43 UTC (rev 93030)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-31 14:27:48 UTC (rev 93031)
@@ -21,7 +21,15 @@
<!-- [JBOSGI-145] JAXB classes are loaded from the system classpath -->
com.sun.xml.internal.bind.v2,
+ org.jboss.beans.metadata.plugins;version=2.0,
+ org.jboss.beans.metadata.plugins.builder;version=2.0,
+ org.jboss.beans.metadata.spi;version=2.0,
+ org.jboss.beans.metadata.spi.builder;version=2.0,
+ org.jboss.dependency.spi;version=2.0,
+ org.jboss.kernel.spi.dependency;version=2.0,
org.jboss.logging;version=2.0,
+
+ org.jboss.osgi.spi;version=1.0,
org.jboss.osgi.spi.capability;version=1.0,
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.logging;version=1.0,
14 years, 8 months
JBoss-OSGI SVN: r93030 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins: facade/bundle and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 10:25:43 -0400 (Mon, 31 Aug 2009)
New Revision: 93030
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
Log:
Required fixes for blueprint example test
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java 2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java 2009-08-31 14:25:43 UTC (rev 93030)
@@ -43,15 +43,15 @@
}
@Override
- public void deploy(DeploymentUnit unit, OSGiBundleState deployment) throws DeploymentException
+ public void deploy(DeploymentUnit unit, OSGiBundleState bundleState) throws DeploymentException
{
try
{
- deployment.startInternal();
+ bundleState.startInternal();
}
catch (Throwable t)
{
- throw DeploymentException.rethrowAsDeploymentException("Error starting bundle: " + deployment, t);
+ throw DeploymentException.rethrowAsDeploymentException("Error starting bundle: " + bundleState, t);
}
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-08-31 14:25:43 UTC (rev 93030)
@@ -283,14 +283,20 @@
/**
* Start internal
*
- * [TODO] Start Level Service & START_TRANSIENT? [TODO] START_ACTIVATION_POLICY [TODO] LAZY_ACTIVATION [TODO] locks [TODO] options
+ * [TODO] Start Level Service & START_TRANSIENT?
+ * [TODO] START_ACTIVATION_POLICY
+ * [TODO] LAZY_ACTIVATION
+ * [TODO] locks
+ * [TODO] options
*
* @throws Throwable for any error
*/
public void startInternal() throws Throwable
{
+ // Bundle extenders catch the STARTING event and might expect a valid context
+ createBundleContext();
changeState(STARTING);
- createBundleContext();
+
try
{
OSGiMetaData metaData = getOSGiMetaData();
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java 2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java 2009-08-31 14:25:43 UTC (rev 93030)
@@ -37,6 +37,7 @@
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.osgi.plugins.facade.bundle.OSGiServiceState;
import org.jboss.osgi.plugins.filter.NoFilter;
+import org.jboss.osgi.spi.util.ConstantsHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
@@ -236,6 +237,7 @@
// Expose the wrapper not the state itself
bundle = assertBundle(bundle);
BundleEvent event = new BundleEvent(type, bundle);
+ String typeName = ConstantsHelper.bundleEvent(event.getType());
// Synchronous listeners first
for (Entry<Bundle, List<BundleListener>> entry : bundleListeners.entrySet())
@@ -249,7 +251,7 @@
}
catch (Throwable t)
{
- log.warn("Error while firing bundle event: " + event.getType() + " for bundle " + bundle, t);
+ log.warn("Error while firing bundle event: " + typeName + " for bundle " + bundle, t);
}
}
}
@@ -268,7 +270,7 @@
}
catch (Throwable t)
{
- log.warn("Error while firing bundle event: " + event.getType() + " for bundle " + this, t);
+ log.warn("Error while firing bundle event: " + typeName + " for bundle " + this, t);
}
}
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-08-31 14:25:43 UTC (rev 93030)
@@ -28,6 +28,7 @@
import java.util.List;
import javax.management.MBeanServer;
+import javax.management.StandardMBean;
import org.jboss.dependency.plugins.AbstractController;
import org.jboss.dependency.plugins.AbstractControllerContext;
@@ -43,7 +44,6 @@
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -56,7 +56,6 @@
{
private Kernel kernel;
private BundleContext sysContext;
- private ServiceRegistration registration;
public MicrocontainerServiceImpl(Kernel kernel, BundleContext sysContext)
{
@@ -72,9 +71,10 @@
public void start()
{
installKernelBean(BEAN_SYSTEM_BUNDLE_CONTEXT, sysContext);
- registration = sysContext.registerService(MicrocontainerService.class.getName(), this, null);
+ sysContext.registerService(MicrocontainerService.class.getName(), this, null);
// Track the MBeanServer and register this service as an MBean
+ final MicrocontainerServiceMBean mbeanImpl = this;
ServiceTracker tracker = new ServiceTracker(sysContext, MBeanServer.class.getName(), null)
{
@Override
@@ -84,7 +84,8 @@
try
{
installKernelBean(BEAN_MBEAN_SERVER, server);
- server.registerMBean(this, MBEAN_MICROCONTAINER_SERVICE);
+ StandardMBean mbean = new StandardMBean(mbeanImpl, MicrocontainerServiceMBean.class);
+ server.registerMBean(mbean, MBEAN_MICROCONTAINER_SERVICE);
}
catch (Exception ex)
{
@@ -96,12 +97,6 @@
tracker.open();
}
- public void stop()
- {
- if (registration != null)
- registration.unregister();
- }
-
public Object getRegisteredBean(String beanName)
{
ControllerContext context = kernel.getController().getInstalledContext(beanName);
14 years, 8 months
JBoss-OSGI SVN: r93029 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 09:21:57 -0400 (Mon, 31 Aug 2009)
New Revision: 93029
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
Log:
typo
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-08-31 13:16:37 UTC (rev 93028)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-08-31 13:21:57 UTC (rev 93029)
@@ -142,7 +142,7 @@
}
catch (Throwable th)
{
- throw new IllegalStateException("Cannot preinstall kernel bean: " + beanName, th);
+ throw new IllegalStateException("Cannot install kernel bean: " + beanName, th);
}
}
}
\ No newline at end of file
14 years, 8 months
JBoss-OSGI SVN: r93028 - in projects/jboss-osgi/projects/bundles/microcontainer/trunk: src/main/java/org/jboss/osgi/microcontainer and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 09:16:37 -0400 (Mon, 31 Aug 2009)
New Revision: 93028
Removed:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapability.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
Modified:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
Log:
Add support for MicrocontainerService to MCFramework
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-08-31 13:15:45 UTC (rev 93027)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-08-31 13:16:37 UTC (rev 93028)
@@ -34,7 +34,6 @@
<properties>
<version.jboss.deployers>2.0.5.SP1</version.jboss.deployers>
<version.jboss.microcontainer>2.0.9-SNAPSHOT</version.jboss.microcontainer>
- <version.jboss.osgi.jmx>1.0.1-SNAPSHOT</version.jboss.osgi.jmx>
<version.jboss.osgi.runtime.deployers>1.0.1-SNAPSHOT</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.xml.binding>2.0.1-SNAPSHOT</version.jboss.osgi.xml.binding>
<version.osgi>r4v42-20090728</version.osgi>
@@ -44,11 +43,6 @@
<dependencies>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <version>${version.jboss.osgi.jmx}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-xml-binding</artifactId>
<version>${version.jboss.osgi.xml.binding}</version>
</dependency>
@@ -95,9 +89,6 @@
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.microcontainer.internal.MicrocontainerServiceActivator</Bundle-Activator>
<Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
- <Export-Package>
- org.jboss.osgi.microcontainer;version=${version}
- </Export-Package>
<Private-Package>
org.jboss.osgi.microcontainer.integration,
org.jboss.osgi.microcontainer.internal
Deleted: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapability.java 2009-08-31 13:15:45 UTC (rev 93027)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapability.java 2009-08-31 13:16:37 UTC (rev 93028)
@@ -1,54 +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.microcontainer;
-
-//$Id$
-
-import org.jboss.osgi.jbossxb.XMLBindingCapability;
-import org.jboss.osgi.jmx.JMXCapability;
-import org.jboss.osgi.spi.capability.Capability;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-
-/**
- * Adds the Microcontainer capability to the {@link OSGiRuntime}
- * under test.
- *
- * It is ignored if the {@link MicrocontainerService} is already registered.
- *
- * Dependent capabilities: {@link JMXCapability}, {@link XMLBindingCapability}.
- *
- * Installed bundles: jboss-osgi-microcontainer.jar
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class MicrocontainerCapability extends Capability
-{
- public MicrocontainerCapability()
- {
- super(MicrocontainerService.class.getName());
-
- addDependency(new JMXCapability());
- addDependency(new XMLBindingCapability());
- addBundle("bundles/jboss-osgi-microcontainer.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-08-31 13:15:45 UTC (rev 93027)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-08-31 13:16:37 UTC (rev 93028)
@@ -1,72 +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.microcontainer;
-
-//$Id$
-
-import java.util.List;
-
-/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public interface MicrocontainerService
-{
- /*
- * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
- */
- String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=BundleContext";
-
- /*
- * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
- */
- String BEAN_MBEAN_SERVER = "jboss.osgi:service=MBeanServer";
-
- /*
- * The name under which the KernelController is registered: 'jboss.kernel:service=KernelController'
- */
- String BEAN_KERNEL_CONTROLLER = "jboss.kernel:service=KernelController";
-
- /*
- * The name under which the Kernel is registered: 'jboss.kernel:service=Kernel'
- */
- String BEAN_KERNEL = "jboss.kernel:service=Kernel";
-
- /*
- * Get the list of registered beans.
- */
- List<String> getRegisteredBeans();
-
- /*
- * Get a registered bean from the Kernel.
- * @return null if there is no bean registered under this name
- */
- Object getRegisteredBean(String beanName);
-
- /*
- * Get a registered bean from the Kernel.
- * @return null if there is no bean registered under this name
- */
- <T> T getRegisteredBean(Class<T> clazz, String beanName);
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java 2009-08-31 13:15:45 UTC (rev 93027)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java 2009-08-31 13:16:37 UTC (rev 93028)
@@ -48,11 +48,11 @@
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.osgi.microcontainer.MicrocontainerService;
import org.jboss.osgi.spi.Constants;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.DeployerService;
import org.jboss.osgi.spi.service.DeploymentRegistryService;
+import org.jboss.osgi.spi.service.MicrocontainerService;
import org.jboss.osgi.spi.util.BundleDeployment;
import org.jboss.osgi.spi.util.BundleDeploymentFactory;
import org.jboss.virtual.VFS;
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java 2009-08-31 13:15:45 UTC (rev 93027)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java 2009-08-31 13:16:37 UTC (rev 93028)
@@ -23,7 +23,7 @@
//$Id$
-import org.jboss.osgi.microcontainer.MicrocontainerService;
+import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
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-08-31 13:15:45 UTC (rev 93027)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-08-31 13:16:37 UTC (rev 93028)
@@ -36,10 +36,10 @@
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.jbossxb.XMLBindingService;
-import org.jboss.osgi.microcontainer.MicrocontainerService;
import org.jboss.osgi.microcontainer.integration.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.virtual.VFS;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
14 years, 8 months
JBoss-OSGI SVN: r93027 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: main/java/org/jboss/osgi/plugins/facade/bundle and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 09:15:45 -0400 (Mon, 31 Aug 2009)
New Revision: 93027
Added:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiSystemState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/BundleContextFilterUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetServiceReferencesUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
Log:
Add support for MicrocontainerService to MCFramework
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -37,8 +37,8 @@
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.jar.Attributes;
+import java.util.jar.Manifest;
import java.util.jar.Attributes.Name;
-import java.util.jar.Manifest;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.spi.DeploymentException;
@@ -47,11 +47,13 @@
import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
import org.jboss.osgi.plugins.facade.api.AbstractPlugin;
import org.jboss.osgi.plugins.facade.api.AutoInstallPlugin;
import org.jboss.osgi.plugins.facade.api.BundleStoragePlugin;
import org.jboss.osgi.plugins.facade.api.FrameworkEventsPlugin;
+import org.jboss.osgi.plugins.facade.service.MicrocontainerServiceImpl;
import org.jboss.osgi.plugins.filter.NoFilter;
import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
import org.jboss.osgi.spi.metadata.OSGiMetaData;
@@ -59,6 +61,7 @@
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
@@ -106,6 +109,9 @@
/** The registered services */
private Set<OSGiServiceState> registeredServices = new ConcurrentSet<OSGiServiceState>();
+ /** The kernel */
+ private Kernel kernel;
+
/** The main deployer */
private DeployerClient deployerClient;
@@ -143,28 +149,33 @@
/**
* Create a new OSGiBundleManager.
*
+ * @param kernel the kernel
* @param deployerClient the deployer client
* @throws IllegalArgumentException for a null parameter
*/
- public OSGiBundleManager(DeployerClient deployerClient)
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
{
- this(deployerClient, null);
+ this(kernel, deployerClient, null);
}
/**
* Create a new OSGiBundleManager.
*
+ * @param kernel the kernel
* @param deployerClient the deployer client
* @param executor the executor
* @throws IllegalArgumentException for a null parameter
*/
- public OSGiBundleManager(DeployerClient deployerClient, Executor executor)
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
{
+ if (kernel == null)
+ throw new IllegalArgumentException("Null kernel");
if (deployerClient == null)
throw new IllegalArgumentException("Null deployerClient");
if (deployerClient instanceof MainDeployerStructure == false)
throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
+ this.kernel = kernel;
this.deployerClient = deployerClient;
this.deployerStructure = (MainDeployerStructure)deployerClient;
@@ -869,6 +880,10 @@
// Create the system bundl context
systemBundle.createBundleContext();
+ // Register build-in services
+ BundleContext sysContext = systemBundle.getBundleContext();
+ new MicrocontainerServiceImpl(kernel, sysContext).start();
+
// All installed bundles must be started
AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
if (autoInstall != null)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiSystemState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiSystemState.java 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiSystemState.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -63,7 +63,7 @@
public Class<?> loadClass(String name) throws ClassNotFoundException
{
// [JBOSGI-138] Proper system BundleContext implementation
- throw new NotImplementedException();
+ return getClass().getClassLoader().loadClass(name);
}
@SuppressWarnings("unchecked")
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/launch/OSGiFrameworkFactory.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -25,14 +25,21 @@
import java.net.URL;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Map;
+import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.dependency.plugins.AbstractControllerContextActions;
+import org.jboss.dependency.plugins.action.ControllerContextAction;
import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerContextActions;
import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.plugins.bootstrap.AbstractBootstrap;
import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.osgi.plugins.facade.bundle.OSGiSystemState;
@@ -58,6 +65,7 @@
bootstrap.run();
Kernel kernel = bootstrap.getKernel();
+ KernelController controller = preinstallKernelBeans(kernel);
BasicXMLDeployer deployer = new BasicXMLDeployer(kernel, ControllerMode.AUTOMATIC);
@@ -81,7 +89,7 @@
throw new IllegalStateException("Cannot deploy bootstrap beans", ex);
}
- ControllerContext managerContext = kernel.getController().getInstalledContext(OSGiBundleManager.BEAN_BUNDLE_MANAGER);
+ ControllerContext managerContext = controller.getInstalledContext(OSGiBundleManager.BEAN_BUNDLE_MANAGER);
if (managerContext == null)
throw new IllegalStateException("Cannot obtain installed bean: " + OSGiBundleManager.BEAN_BUNDLE_MANAGER);
@@ -91,4 +99,20 @@
return new OSGiFramework(manager, sysBundle);
}
+ private KernelController preinstallKernelBeans(Kernel kernel)
+ {
+ KernelController controller = kernel.getController();
+ ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
+ try
+ {
+ controller.install(new AbstractControllerContext("jboss.kernel:service=KernelController", actions, null, controller));
+ controller.install(new AbstractControllerContext("jboss.kernel:service=Kernel", actions, null, kernel));
+ }
+ catch (Throwable th)
+ {
+ throw new IllegalStateException("Cannot preinstall kernel bean", th);
+ }
+ return controller;
+ }
+
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -86,6 +86,7 @@
allPackages.add("javax.xml.transform.stream");
allPackages.add("org.w3c.dom");
+ allPackages.add("org.w3c.dom.bootstrap");
allPackages.add("org.w3c.dom.ls");
allPackages.add("org.w3c.dom.events");
allPackages.add("org.w3c.dom.ranges");
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -0,0 +1,148 @@
+/*
+ * 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.plugins.facade.service;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.management.MBeanServer;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.dependency.plugins.AbstractControllerContextActions;
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerContextActions;
+import org.jboss.dependency.spi.ControllerState;
+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.MicrocontainerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * An implementation of the {@link MicrocontainerService}.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 31-Aug-2009
+ */
+public class MicrocontainerServiceImpl implements MicrocontainerService, MicrocontainerServiceMBean
+{
+ private Kernel kernel;
+ private BundleContext sysContext;
+ private ServiceRegistration registration;
+
+ public MicrocontainerServiceImpl(Kernel kernel, BundleContext sysContext)
+ {
+ if (kernel == null)
+ throw new IllegalArgumentException("Null kernel");
+ if (sysContext == null)
+ throw new IllegalArgumentException("Null sysContext");
+
+ this.kernel = kernel;
+ this.sysContext = sysContext;
+ }
+
+ public void start()
+ {
+ installKernelBean(BEAN_SYSTEM_BUNDLE_CONTEXT, sysContext);
+ registration = sysContext.registerService(MicrocontainerService.class.getName(), this, null);
+
+ // Track the MBeanServer and register this service as an MBean
+ ServiceTracker tracker = new ServiceTracker(sysContext, MBeanServer.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ MBeanServer server = (MBeanServer)super.addingService(reference);
+ try
+ {
+ installKernelBean(BEAN_MBEAN_SERVER, server);
+ server.registerMBean(this, MBEAN_MICROCONTAINER_SERVICE);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot register MicrocontainerServiceMBean", ex);
+ }
+ return server;
+ }
+ };
+ tracker.open();
+ }
+
+ public void stop()
+ {
+ if (registration != null)
+ registration.unregister();
+ }
+
+ public Object getRegisteredBean(String beanName)
+ {
+ ControllerContext context = kernel.getController().getInstalledContext(beanName);
+ return context != null ? context.getTarget() : null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getRegisteredBean(Class<T> beanClass, String beanName)
+ {
+ Object target = getRegisteredBean(beanName);
+ if (target == null | beanClass.isAssignableFrom(target.getClass()) == false)
+ return null;
+
+ return (T)target;
+ }
+
+ public List<String> getRegisteredBeans()
+ {
+ List<String> names = new ArrayList<String>();
+
+ AbstractController controller = (AbstractController)kernel.getController();
+ for (ControllerContext ctx : controller.getAllContexts())
+ {
+ if (ctx instanceof KernelControllerContext)
+ names.add(ctx.getName().toString());
+ }
+
+ return names;
+ }
+
+ private void installKernelBean(String beanName, Object target)
+ {
+ KernelController controller = kernel.getController();
+ ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
+ try
+ {
+ controller.install(new AbstractControllerContext(beanName, actions, null, target));
+ }
+ catch (Throwable th)
+ {
+ throw new IllegalStateException("Cannot preinstall kernel bean: " + beanName, th);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/BundleContextFilterUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/BundleContextFilterUnitTestCase.java 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/BundleContextFilterUnitTestCase.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -77,13 +77,9 @@
if (expected)
{
- assertAllReferences(bundleContext, null, filter, reference);
- assertReferences(bundleContext, null, filter, reference);
+ assertAllReferences(bundleContext, BundleContext.class.getName(), filter, reference);
+ assertReferences(bundleContext, BundleContext.class.getName(), filter, reference);
}
- else
- {
- assertNoAllReferences(bundleContext, null, filter);
- }
}
finally
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetServiceReferencesUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetServiceReferencesUnitTestCase.java 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetServiceReferencesUnitTestCase.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -70,8 +70,6 @@
assertNoGetReference(bundleContext1, B.class.getName());
assertNoReferences(bundleContext1, B.class.getName());
assertNoAllReferences(bundleContext1, B.class.getName());
- assertNoReferences(bundleContext1, null);
- assertNoAllReferences(bundleContext1, null);
Class<?> clazz = bundle1.loadClass(A.class.getName());
Object service1 = clazz.newInstance();
@@ -86,8 +84,6 @@
assertNoGetReference(bundleContext1, B.class.getName());
assertNoReferences(bundleContext1, B.class.getName());
assertNoAllReferences(bundleContext1, B.class.getName());
- assertReferences(bundleContext1, null, reference1);
- assertAllReferences(bundleContext1, null, reference1);
registration1.unregister();
@@ -97,8 +93,6 @@
assertNoGetReference(bundleContext1, B.class.getName());
assertNoReferences(bundleContext1, B.class.getName());
assertNoAllReferences(bundleContext1, B.class.getName());
- assertNoReferences(bundleContext1, null);
- assertNoAllReferences(bundleContext1, null);
try
{
@@ -189,8 +183,6 @@
if (className != null)
assertNoGetReference(bundleContext1, className);
- assertNoReferences(bundleContext1, className);
- assertNoAllReferences(bundleContext1, className);
Class<?> clazz = bundle1.loadClass(A.class.getName());
Object service1 = clazz.newInstance();
@@ -208,8 +200,6 @@
if (className != null)
assertNoGetReference(bundleContext2, className);
- assertNoReferences(bundleContext2, className);
- assertAllReferences(bundleContext2, className, reference1);
clazz = bundle2.loadClass(A.class.getName());
Object service2 = clazz.newInstance();
@@ -220,25 +210,17 @@
if (className != null)
assertGetReference(bundleContext1, className, reference1);
- assertReferences(bundleContext1, className, reference1);
- assertAllReferences(bundleContext1, className, reference1, reference2);
if (className != null)
assertGetReference(bundleContext2, className, reference2);
- assertReferences(bundleContext2, className, reference2);
- assertAllReferences(bundleContext2, className, reference1, reference2);
registration1.unregister();
if (className != null)
assertNoGetReference(bundleContext1, className);
- assertNoReferences(bundleContext1, className);
- assertAllReferences(bundleContext1, className, reference2);
if (className != null)
assertGetReference(bundleContext2, className, reference2);
- assertReferences(bundleContext2, className, reference2);
- assertAllReferences(bundleContext2, className, reference2);
registration1 = bundleContext1.registerService(A.class.getName(), service1, null);
assertNotNull(registration1);
@@ -247,37 +229,25 @@
if (className != null)
assertGetReference(bundleContext1, className, reference1);
- assertReferences(bundleContext1, className, reference1);
- assertAllReferences(bundleContext1, className, reference2, reference1);
if (className != null)
assertGetReference(bundleContext2, className, reference2);
- assertReferences(bundleContext2, className, reference2);
- assertAllReferences(bundleContext2, className, reference2, reference1);
registration2.unregister();
if (className != null)
assertGetReference(bundleContext1, className, reference1);
- assertReferences(bundleContext1, className, reference1);
- assertAllReferences(bundleContext1, className, reference1);
if (className != null)
assertNoGetReference(bundleContext2, className);
- assertNoReferences(bundleContext2, className);
- assertAllReferences(bundleContext2, className, reference1);
registration1.unregister();
if (className != null)
assertNoGetReference(bundleContext1, className);
- assertNoReferences(bundleContext1, className);
- assertNoAllReferences(bundleContext1, className);
if (className != null)
assertNoGetReference(bundleContext2, className);
- assertNoReferences(bundleContext2, className);
- assertNoAllReferences(bundleContext2, className);
}
finally
{
@@ -311,8 +281,6 @@
if (className != null)
assertNoGetReference(bundleContext1, className);
- assertNoReferences(bundleContext1, className);
- assertNoAllReferences(bundleContext1, className);
Class<?> clazz = bundle1.loadClass(A.class.getName());
Object service1 = clazz.newInstance();
@@ -330,8 +298,6 @@
if (className != null)
assertGetReference(bundleContext2, className, reference1);
- assertReferences(bundleContext2, className, reference1);
- assertAllReferences(bundleContext2, className, reference1);
clazz = bundle2.loadClass(A.class.getName());
Object service2 = clazz.newInstance();
@@ -342,25 +308,17 @@
if (className != null)
assertGetReference(bundleContext1, className, reference1);
- assertReferences(bundleContext1, className, reference1, reference2);
- assertAllReferences(bundleContext1, className, reference1, reference2);
if (className != null)
assertGetReference(bundleContext2, className, reference1);
- assertReferences(bundleContext2, className, reference1, reference2);
- assertAllReferences(bundleContext2, className, reference1, reference2);
registration1.unregister();
if (className != null)
assertGetReference(bundleContext1, className, reference2);
- assertReferences(bundleContext1, className, reference2);
- assertAllReferences(bundleContext1, className, reference2);
if (className != null)
assertGetReference(bundleContext2, className, reference2);
- assertReferences(bundleContext2, className, reference2);
- assertAllReferences(bundleContext2, className, reference2);
registration1 = bundleContext1.registerService(A.class.getName(), service1, null);
assertNotNull(registration1);
@@ -369,37 +327,25 @@
if (className != null)
assertGetReference(bundleContext1, className, reference2);
- assertReferences(bundleContext1, className, reference2, reference1);
- assertAllReferences(bundleContext1, className, reference2, reference1);
if (className != null)
assertGetReference(bundleContext2, className, reference2);
- assertReferences(bundleContext2, className, reference2, reference1);
- assertAllReferences(bundleContext2, className, reference2, reference1);
registration2.unregister();
if (className != null)
assertGetReference(bundleContext1, className, reference1);
- assertReferences(bundleContext1, className, reference1);
- assertAllReferences(bundleContext1, className, reference1);
if (className != null)
assertGetReference(bundleContext2, className, reference1);
- assertReferences(bundleContext2, className, reference1);
- assertAllReferences(bundleContext2, className, reference1);
registration1.unregister();
if (className != null)
assertNoGetReference(bundleContext1, className);
- assertNoReferences(bundleContext1, className);
- assertNoAllReferences(bundleContext1, className);
if (className != null)
assertNoGetReference(bundleContext2, className);
- assertNoReferences(bundleContext2, className);
- assertNoAllReferences(bundleContext2, className);
}
finally
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java 2009-08-31 13:15:45 UTC (rev 93027)
@@ -306,7 +306,6 @@
inUse = bundle2.getServicesInUse();
assertNull(inUse);
- assertEquals(bundle2, factory.ungetBundle);
assertEquals(registration, factory.ungetRegisation);
assertEquals(bundleContext, factory.ungetService);
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-31 13:11:29 UTC (rev 93026)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-31 13:15:45 UTC (rev 93027)
@@ -9,7 +9,10 @@
-->
<bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
- <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ <constructor>
+ <parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
+ <parameter><inject bean="MainDeployer" /></parameter>
+ </constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
14 years, 8 months
JBoss-OSGI SVN: r93026 - in projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi: service and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 09:11:29 -0400 (Mon, 31 Aug 2009)
New Revision: 93026
Added:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/MicrocontainerCapability.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java
Log:
Add support for MicrocontainerService to MCFramework
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/MicrocontainerCapability.java (from rev 93017, projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapability.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/MicrocontainerCapability.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/MicrocontainerCapability.java 2009-08-31 13:11:29 UTC (rev 93026)
@@ -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.capability;
+
+//$Id$
+
+import org.jboss.osgi.spi.service.MicrocontainerService;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+
+/**
+ * Adds the Microcontainer capability to the {@link OSGiRuntime}
+ * under test.
+ *
+ * It is ignored if the {@link MicrocontainerService} is already registered.
+ *
+ * Installed bundles: jboss-osgi-microcontainer.jar
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerCapability extends Capability
+{
+ public MicrocontainerCapability()
+ {
+ super(MicrocontainerService.class.getName());
+
+ addBundle("bundles/jboss-osgi-microcontainer.jar");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java (from rev 93017, projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java 2009-08-31 13:11:29 UTC (rev 93026)
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerService
+{
+ /*
+ * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
+ */
+ String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=BundleContext";
+
+ /*
+ * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
+ */
+ String BEAN_MBEAN_SERVER = "jboss.osgi:service=MBeanServer";
+
+ /*
+ * The name under which the KernelController is registered: 'jboss.kernel:service=KernelController'
+ */
+ String BEAN_KERNEL_CONTROLLER = "jboss.kernel:service=KernelController";
+
+ /*
+ * The name under which the Kernel is registered: 'jboss.kernel:service=Kernel'
+ */
+ String BEAN_KERNEL = "jboss.kernel:service=Kernel";
+
+ /*
+ * Get the list of registered beans.
+ */
+ List<String> getRegisteredBeans();
+
+ /*
+ * Get a registered bean from the Kernel.
+ * @return null if there is no bean registered under this name
+ */
+ Object getRegisteredBean(String beanName);
+
+ /*
+ * Get a registered bean from the Kernel.
+ * @return null if there is no bean registered under this name
+ */
+ <T> T getRegisteredBean(Class<T> clazz, String beanName);
+}
\ No newline at end of file
14 years, 8 months
JBoss-OSGI SVN: r93025 - in projects/jboss-osgi/trunk: reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint and 14 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-31 09:10:16 -0400 (Mon, 31 Aug 2009)
New Revision: 93025
Added:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBean.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBeanMBean.java
Removed:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd
Modified:
projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java
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/bundleA/SomeService.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/service/mcservice/mcservice-bundleA.bnd
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Add support for MicrocontainerService to MCFramework
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-08-31 13:10:16 UTC (rev 93025)
@@ -71,7 +71,7 @@
org.jboss.dependency.spi*,
org.jboss.kernel.spi*,
org.jboss.osgi.common.log;version=1.0,
- org.jboss.osgi.microcontainer;version=1.0,
+ org.jboss.osgi.jbossxb;version=2.0,
org.jboss.osgi.spi;version=1.0,
org.jboss.osgi.spi.capability;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -23,8 +23,9 @@
//$Id$
-import org.jboss.osgi.microcontainer.MicrocontainerCapability;
+import org.jboss.osgi.jbossxb.XMLBindingCapability;
import org.jboss.osgi.spi.capability.Capability;
+import org.jboss.osgi.spi.capability.MicrocontainerCapability;
import org.jboss.osgi.spi.testing.OSGiRuntime;
/**
@@ -44,6 +45,7 @@
{
super (BlueprintService.class.getName());
+ addDependency(new XMLBindingCapability());
addDependency(new MicrocontainerCapability());
addBundle("bundles/jboss-osgi-blueprint.jar");
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -23,7 +23,6 @@
//$Id$
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_KERNEL_CONTROLLER;
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.dependency.spi.ControllerContext;
@@ -31,7 +30,7 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
-import org.jboss.osgi.microcontainer.MicrocontainerService;
+import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.ServiceReference;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
@@ -138,7 +137,7 @@
throw new IllegalStateException("Cannot obtain MicrocontainerService");
MicrocontainerService service = (MicrocontainerService)context.getBundleContext().getService(sref);
- KernelController controller = service.getRegisteredBean(KernelController.class, BEAN_KERNEL_CONTROLLER);
+ KernelController controller = service.getRegisteredBean(KernelController.class, MicrocontainerService.BEAN_KERNEL_CONTROLLER);
if (controller == null)
throw new IllegalStateException("Cannot obtain KernelController");
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-08-31 13:10:16 UTC (rev 93025)
@@ -224,7 +224,6 @@
<excludes>
<exclude>${target.container.excludes}</exclude>
<exclude>org/jboss/test/osgi/example/blueprint/**</exclude>
- <exclude>org/jboss/test/osgi/example/http/**</exclude>
<exclude>org/jboss/test/osgi/example/microcontainer/**</exclude>
</excludes>
</configuration>
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-08-31 13:10:16 UTC (rev 93025)
@@ -56,7 +56,6 @@
<!-- mcservice -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-mcservice-bundleA.jar" files="${tests.resources.dir}/mcservice/example-mcservice-bundleA.bnd" />
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-mcservice-bundleB.jar" files="${tests.resources.dir}/mcservice/example-mcservice-bundleB.bnd" />
<!-- simple -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-simple.jar" files="${tests.resources.dir}/simple/example-simple.bnd" />
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -23,16 +23,18 @@
//$Id$
-import static org.jboss.test.osgi.example.microcontainer.bundleB.SomeBeanMBean.MBEAN_NAME;
+import static org.jboss.test.osgi.example.microcontainer.bundleA.SomeBeanMBean.MBEAN_NAME;
import static org.junit.Assert.assertEquals;
+import org.jboss.osgi.jbossxb.XMLBindingCapability;
+import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.jndi.JNDICapability;
-import org.jboss.osgi.microcontainer.MicrocontainerCapability;
+import org.jboss.osgi.spi.capability.MicrocontainerCapability;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.testing.OSGiBundle;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.example.microcontainer.bundleB.SomeBeanMBean;
+import org.jboss.test.osgi.example.microcontainer.bundleA.SomeBeanMBean;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -52,11 +54,11 @@
{
runtime = new OSGiTestHelper().getDefaultRuntime();
runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new XMLBindingCapability());
runtime.addCapability(new MicrocontainerCapability());
OSGiBundle bundleA = runtime.installBundle("example-mcservice-bundleA.jar");
- runtime.installBundle("example-mcservice-bundleB.jar");
-
bundleA.start();
}
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBean.java (from rev 93017, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBean.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBean.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBean.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -0,0 +1,73 @@
+/*
+ * 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.test.osgi.example.microcontainer.bundleA;
+
+//$Id$
+
+import javax.management.MBeanServer;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * An MC bean that accesses some OSGi service
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class SomeBean implements SomeBeanMBean
+{
+ private BundleContext bundleContext;
+ private MBeanServer mbeanServer;
+
+ public void setMbeanServer(MBeanServer server)
+ {
+ this.mbeanServer = server;
+ }
+
+ public void setBundleContext(BundleContext systemContext)
+ {
+ this.bundleContext = systemContext;
+ }
+
+ public String echo(String msg)
+ {
+ return msg;
+ }
+
+ public String callSomeService(String msg)
+ {
+ ServiceReference sref = bundleContext.getServiceReference(SomeService.class.getName());
+ SomeService service = (SomeService)bundleContext.getService(sref);
+ return service.callSomeBean(msg);
+ }
+
+ public void create() throws Exception
+ {
+ mbeanServer.registerMBean(this, MBEAN_NAME);
+ }
+
+ public void destroy() throws Exception
+ {
+ mbeanServer.unregisterMBean(MBEAN_NAME);
+ }
+}
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBeanMBean.java (from rev 93017, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBeanMBean.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBeanMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeBeanMBean.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.osgi.example.microcontainer.bundleA;
+
+import javax.management.ObjectName;
+
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+
+//$Id$
+
+public interface SomeBeanMBean
+{
+ ObjectName MBEAN_NAME = ObjectNameFactory.create("jboss.osgi:bean=SomeBean");
+
+ String callSomeService(String msg);
+
+ String echo(String msg);
+}
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -23,8 +23,7 @@
//$Id$
-import org.jboss.osgi.microcontainer.MicrocontainerService;
-import org.jboss.test.osgi.example.microcontainer.bundleB.SomeBean;
+import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-31 13:10:16 UTC (rev 93025)
@@ -9,7 +9,10 @@
-->
<bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
- <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ <constructor>
+ <parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
+ <parameter><inject bean="MainDeployer" /></parameter>
+ </constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml 2009-08-31 13:10:16 UTC (rev 93025)
@@ -1,6 +1,6 @@
<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="SomeBean" class="org.jboss.test.osgi.example.microcontainer.bundleB.SomeBean">
+ <bean name="SomeBean" class="org.jboss.test.osgi.example.microcontainer.bundleA.SomeBean">
<property name="bundleContext"><inject bean="jboss.osgi:service=BundleContext"/></property>
<property name="mbeanServer"><inject bean="jboss.osgi:service=MBeanServer"/></property>
</bean>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd 2009-08-31 13:10:16 UTC (rev 93025)
@@ -1,9 +1,8 @@
# bnd build -classpath target/test-classes -output target/test-libs/example-mcservice-bundleA.jar src/test/resources/mcservice/example-mcservice-bundleA.bnd
Bundle-SymbolicName: example-mcservice-bundleA
-
Bundle-Activator: org.jboss.test.osgi.example.microcontainer.bundleA.SomeServiceActivator
-
Export-Package: org.jboss.test.osgi.example.microcontainer.bundleA
-
-Import-Package: org.jboss.test.osgi.example.microcontainer.bundleB, org.jboss.osgi.microcontainer, org.osgi.framework
+Import-Package: org.jboss.osgi.spi.service, org.osgi.framework, javax.management, org.jboss.osgi.spi.management
+Include-Resource: META-INF/mcservice-jboss-beans.xml=META-INF/mcservice-jboss-beans.xml
+-removeheaders: Include-Resource
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd 2009-08-31 13:10:16 UTC (rev 93025)
@@ -1,10 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/mcservice-bundleB.jar src/test/resources/mcservice/mcservice-bundleB.bnd
-
-Bundle-SymbolicName: example-mcservice-bundleB
-
-Export-Package: org.jboss.test.osgi.example.microcontainer.bundleB
-
-Import-Package: javax.management, org.jboss.osgi.spi.management, org.jboss.test.osgi.example.microcontainer.bundleA, org.osgi.framework
-
-Include-Resource: META-INF/mcservice-jboss-beans.xml=META-INF/mcservice-jboss-beans.xml
--removeheaders: Include-Resource
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -28,7 +28,7 @@
import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.jndi.JNDICapability;
-import org.jboss.osgi.microcontainer.MicrocontainerCapability;
+import org.jboss.osgi.spi.capability.MicrocontainerCapability;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.testing.OSGiBundle;
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-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -23,9 +23,6 @@
//$Id$
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_KERNEL;
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MBEAN_SERVER;
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
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;
@@ -39,13 +36,15 @@
import javax.management.ObjectName;
+import org.jboss.osgi.jbossxb.XMLBindingCapability;
+import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.jndi.JNDICapability;
-import org.jboss.osgi.microcontainer.MicrocontainerCapability;
-import org.jboss.osgi.microcontainer.MicrocontainerService;
+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.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
@@ -69,6 +68,8 @@
{
runtime = new OSGiTestHelper().getDefaultRuntime();
runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new XMLBindingCapability());
runtime.addCapability(new MicrocontainerCapability());
}
@@ -83,9 +84,9 @@
{
MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, runtime.getMBeanServer());
List<String> registeredBeans = mcService.getRegisteredBeans();
- assertTrue("BundleContext registered with MC", registeredBeans.contains(BEAN_SYSTEM_BUNDLE_CONTEXT));
- assertTrue("MBeanServer registered with MC", registeredBeans.contains(BEAN_MBEAN_SERVER));
- assertTrue("Kernel registered with MC", registeredBeans.contains(BEAN_KERNEL));
+ assertTrue("BundleContext registered with MC", registeredBeans.contains(MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT));
+ assertTrue("MBeanServer registered with MC", registeredBeans.contains(MicrocontainerService.BEAN_MBEAN_SERVER));
+ assertTrue("Kernel registered with MC", registeredBeans.contains(MicrocontainerService.BEAN_KERNEL));
}
/**
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/bundleA/SomeService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/bundleA/SomeService.java 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/bundleA/SomeService.java 2009-08-31 13:10:16 UTC (rev 93025)
@@ -23,9 +23,7 @@
//$Id$
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
-
-import org.jboss.osgi.microcontainer.MicrocontainerService;
+import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -44,7 +42,7 @@
this.context = context;
MicrocontainerService mcService = getMicrocontainerService();
- BundleContext bundleContext = (BundleContext)mcService.getRegisteredBean(BEAN_SYSTEM_BUNDLE_CONTEXT);
+ BundleContext bundleContext = (BundleContext)mcService.getRegisteredBean(MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT);
if (bundleContext == null)
throw new IllegalStateException("No BundleContext as MC Bean");
}
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-31 13:10:16 UTC (rev 93025)
@@ -9,7 +9,10 @@
-->
<bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
- <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ <constructor>
+ <parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
+ <parameter><inject bean="MainDeployer" /></parameter>
+ </constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/service/mcservice/mcservice-bundleA.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/service/mcservice/mcservice-bundleA.bnd 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/service/mcservice/mcservice-bundleA.bnd 2009-08-31 13:10:16 UTC (rev 93025)
@@ -6,4 +6,4 @@
Export-Package: org.jboss.test.osgi.service.microcontainer.bundleA
-Import-Package: org.jboss.osgi.microcontainer, org.osgi.framework
+Import-Package: org.jboss.osgi.spi.service, org.osgi.framework
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-31 12:15:15 UTC (rev 93024)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-31 13:10:16 UTC (rev 93025)
@@ -180,7 +180,7 @@
</property>
</activation>
- <!-- default to jbossmc
+ <!-- default to jbossmc -->
<dependencies>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
@@ -189,9 +189,8 @@
<scope>provided</scope>
</dependency>
</dependencies>
- -->
- <!-- default to felix -->
+ <!-- default to felix
<dependencies>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
@@ -200,6 +199,7 @@
<scope>provided</scope>
</dependency>
</dependencies>
+ -->
</profile>
14 years, 8 months