[jboss-cvs] JBossAS SVN: r88386 - in projects/jboss-osgi/trunk: build/distribution and 25 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 7 17:23:09 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-07 17:23:09 -0400 (Thu, 07 May 2009)
New Revision: 88386
Added:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/runtime/jbossas/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java
Removed:
projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/deployer/
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
Modified:
projects/jboss-osgi/trunk/build/distribution/pom.xml
projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/jbossas/pom.xml
projects/jboss-osgi/trunk/runtime/pom.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
More work on OSGiRuntime - blueprint tests pass against jbossas
Modified: projects/jboss-osgi/trunk/build/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/build/distribution/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -46,6 +46,17 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-jbossas</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-jbossas</artifactId>
+ <classifier>sources</classifier>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-spi</artifactId>
<version>${version}</version>
</dependency>
Modified: projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -280,6 +280,7 @@
<!-- deployers/osgi.deployer -->
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer" override="true">
<include name="jboss-osgi-runtime-deployer.jar" />
+ <include name="jboss-osgi-runtime-jbossas.jar" />
<include name="jboss-osgi-spi.jar" />
</fileset>
Modified: projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -162,4 +162,9 @@
</plugins>
</build>
+ <!-- Profiles -->
+ <profiles>
+
+ </profiles>
+
</project>
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -26,7 +26,7 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.jboss.osgi.jmx.ObjectNameFactory;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -24,11 +24,10 @@
//$Id$
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_KERNEL;
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MAIN_DEPLOYER;
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.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
-import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import java.util.List;
import java.util.Set;
@@ -37,9 +36,9 @@
import junit.framework.Test;
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
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.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.MicrocontainerCapability;
@@ -86,7 +85,6 @@
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("MainDeployer registered with MC", registeredBeans.contains(BEAN_MAIN_DEPLOYER));
assertTrue("MBeanServer registered with MC", registeredBeans.contains(BEAN_MBEAN_SERVER));
assertTrue("Kernel registered with MC", registeredBeans.contains(BEAN_KERNEL));
}
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,4 @@
+grant {
+ permission java.security.AllPermission;
+};
+
Deleted: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -1,74 +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.jmx;
-
-// $Id$
-
-import java.util.Hashtable;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * A simple factory for creating safe object names.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 08-May-2006
- */
-public class ObjectNameFactory
-{
- public static ObjectName create(String name)
- {
- try
- {
- return new ObjectName(name);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + name + "; " + e);
- }
- }
-
- public static ObjectName create(String domain, String key, String value)
- {
- try
- {
- return new ObjectName(domain, key, value);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + "; " + e);
- }
- }
-
- public static ObjectName create(String domain, Hashtable<String, String> table)
- {
- try
- {
- return new ObjectName(domain, table);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e);
- }
- }
-}
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -112,7 +112,6 @@
org.jboss.joinpoint.*,
org.jboss.logging,
org.jboss.osgi.common.log,
- org.jboss.osgi.jmx,
org.jboss.osgi.spi,
org.jboss.osgi.spi.management,
org.jboss.reflect.*,
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -37,33 +37,28 @@
public interface MicrocontainerService
{
/*
- * * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
+ * 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'
+ * 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 Kernel is registered: 'jboss.osgi:service=Kernel'
+ * The name under which the KernelController is registered: 'jboss.kernel:service=KernelController'
*/
- String BEAN_MAIN_DEPLOYER = "jboss.osgi:service=MainDeployer";
+ String BEAN_KERNEL_CONTROLLER = "jboss.kernel:service=KernelController";
/*
- * * The name under which the KernelController is registered: 'jboss.osgi:service=KernelController'
+ * The name under which the Kernel is registered: 'jboss.kernel:service=Kernel'
*/
- String BEAN_KERNEL_CONTROLLER = "jboss.osgi:service=KernelController";
+ String BEAN_KERNEL = "jboss.kernel:service=Kernel";
/*
- * * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
+ * Get the Microcontainer Kernel
*/
- String BEAN_KERNEL = "jboss.osgi:service=Kernel";
-
- /*
- * * Get the Microcontainer Kernel
- */
Kernel getKernel();
/*
Copied: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java (from rev 88378, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,60 @@
+/*
+ * 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.net.URL;
+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();
+
+ /**
+ * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /**
+ * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -50,7 +50,7 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.microcontainer.MicrocontainerService;
-import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.BundleContext;
@@ -114,7 +114,7 @@
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
VirtualFile file = VFS.createNewRoot(url);
VFSDeployment deployment = deploymentFactory.createVFSDeployment(file);
mainDeployer.addDeployment(deployment);
@@ -138,7 +138,7 @@
String deploymentName = contextMap.remove(url);
if (deploymentName != null)
{
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
mainDeployer.removeDeployment(deploymentName);
mainDeployer.process();
}
@@ -160,8 +160,8 @@
KernelController controller = kernel.getController();
ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
controller.install(new PreInstalledControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, context));
+ controller.install(new PreInstalledControllerContext(BEAN_KERNEL, actions, kernel));
controller.install(new PreInstalledControllerContext(BEAN_KERNEL_CONTROLLER, actions, controller));
- controller.install(new PreInstalledControllerContext(BEAN_KERNEL, actions, kernel));
controller.install(new PreInstalledControllerContext(BEAN_MBEAN_SERVER, actions, mbeanServer));
URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -8,7 +8,7 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- The MainDeployer -->
- <bean name="jboss.osgi:service=MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
<property name="structuralDeployers"><inject bean="StructuralDeployers" /></property>
<property name="deployers"><inject bean="Deployers" /></property>
</bean>
@@ -34,7 +34,7 @@
<!-- The holder for deployers that do real deployment -->
<bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
- <constructor><parameter><inject bean="jboss.osgi:service=KernelController"/></parameter></constructor>
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
<!-- Accept any implementor of deployer -->
<incallback method="addDeployer"/>
<uncallback method="removeDeployer"/>
@@ -72,7 +72,7 @@
<bean name="KernelDeploymentDeployer" class="org.jboss.osgi.deployer.BundleContainedBeansDeployer">
</bean>
<bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
- <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.osgi:service=Kernel"/></parameter></constructor>
+ <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
</bean>
<!-- OSGi Deployment -->
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -35,6 +35,8 @@
<!-- Properties -->
<properties>
+ <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/resources/tst.policy</surefire.security.args>
+
<version.apache.xerces.bundle>2.9.1-SNAPSHOT</version.apache.xerces.bundle>
<version.aqute.bnd>0.0.323</version.aqute.bnd>
<version.equinox>3.4.2</version.equinox>
@@ -454,6 +456,7 @@
</plugins>
</reporting>
+ <!-- Profiles -->
<profiles>
<!--
@@ -494,6 +497,28 @@
</properties>
</profile>
+ <!--
+ Name: jboss501
+ Descr: Setup for jboss501 integration testing
+ -->
+ <profile>
+ <id>jboss501</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>jboss501</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </profile>
+
</profiles>
</project>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -11,23 +11,16 @@
<entry><key>org.osgi.service.http.port</key><value>8090</value></entry>
<entry><key>felix.cm.dir</key><value>${jboss.server.data.dir}/osgi-configadmin</value></entry>
<entry>
- <key>org.osgi.framework.system.packages</key>
+ <key>org.osgi.framework.system.packages.extra</key>
<value>
- javax.management,
- javax.xml.parsers,
org.jboss.logging,
+ org.jboss.osgi.jndi,
+ org.jboss.osgi.jmx,
+ org.jboss.osgi.microcontainer,
org.jboss.osgi.spi.logging,
org.jboss.osgi.spi.management,
- org.jboss.osgi.spi.service.microcontainer,
- org.osgi.framework; version=1.4,
- org.osgi.service.packageadmin; version=1.2,
- org.osgi.service.startlevel; version=1.1,
- org.xml.sax,
<!-- needed by jboss-remoting -->
- javax.naming,
- javax.net,
- javax.net.ssl,
org.apache.log4j,
org.jboss.util,
org.jboss.util.id,
@@ -62,13 +55,40 @@
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
</bean>
- <!-- A Service that gives access to the Microcontainer Kernel -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.spi.service.microcontainer.internal.MicrocontainerServiceImpl">
+ <!--
+ ********************************
+ * *
+ * Services *
+ * *
+ ********************************
+ -->
+
+ <!-- A Service that gives access to the Microcontainer -->
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.internal.MicrocontainerServiceImpl">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
<property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
</bean>
+ <!-- A Service that gives access to JNDI -->
+ <bean name="jboss.osgi:service=Naming" class="org.jboss.osgi.jndi.internal.NamingServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ </bean>
+
+ <!-- A Service that gives access to the MBeanServer -->
+ <bean name="jboss.osgi:service=MBeanServer" class="org.jboss.osgi.jmx.internal.MBeanServerServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * Deployers *
+ * *
+ ********************************
+ -->
+
<!-- The OSGi MetaData Deployer -->
<bean name="jboss.osgi:service=BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
Copied: projects/jboss-osgi/trunk/runtime/jbossas (from rev 88378, projects/jboss-osgi/trunk/runtime/deployer)
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas
___________________________________________________________________
Name: svn:ignore
+ target
Name: svn:mergeinfo
+
Modified: projects/jboss-osgi/trunk/runtime/jbossas/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/pom.xml 2009-05-07 17:38:04 UTC (rev 88378)
+++ projects/jboss-osgi/trunk/runtime/jbossas/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -2,10 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi - Runtime Deployer</name>
+ <name>JBossOSGi - Runtime JBossAS</name>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-runtime-deployer</artifactId>
+ <artifactId>jboss-osgi-runtime-jbossas</artifactId>
<packaging>jar</packaging>
<parent>
@@ -21,6 +21,11 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -30,21 +35,6 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-system-jmx</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
<!-- Build -->
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,55 @@
+/*
+ * 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.jmx.internal;
+
+//$Id$
+
+import javax.management.MBeanServer;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service that gives access to the MBeanServer
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class MBeanServerServiceImpl
+{
+ private MBeanServer mbeanServer;
+ private BundleContext context;
+
+ public void setSystemContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void start()
+ {
+ context.registerService(MBeanServer.class.getName(), mbeanServer, null);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,42 @@
+/*
+ * 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.jndi;
+
+//$Id$
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * A service that gives access to JNDI
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public interface NamingService
+{
+ /**
+ * Get the InitialContext
+ * @throws NamingException if a naming exception is encountered
+ */
+ InitialContext getInitialContext() throws NamingException;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,61 @@
+/*
+ * 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.jndi.internal;
+
+//$Id$
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.jndi.NamingService;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service that gives access to JNDI
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class NamingServiceImpl implements NamingService
+{
+ private BundleContext context;
+
+ public void setSystemContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ /**
+ * Get the InitialContext
+ *
+ * @throws NamingException if a naming exception is encountered
+ */
+ public InitialContext getInitialContext() throws NamingException
+ {
+ return new InitialContext();
+ }
+
+ public void start()
+ {
+ context.registerService(NamingService.class.getName(), this, null);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,84 @@
+/*
+ * 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.net.URL;
+import java.util.List;
+
+import org.jboss.kernel.Kernel;
+
+/**
+ * A service the gives access to the Microcontainer.
+ *
+ * @author thomas.diesler at 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 Microcontainer Kernel
+ */
+ Kernel getKernel();
+
+ /*
+ * * 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);
+
+ /*
+ * * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /*
+ * * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,60 @@
+/*
+ * 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.net.URL;
+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();
+
+ /**
+ * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /**
+ * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,138 @@
+/*
+ * 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.internal;
+
+//$Id$
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.StandardMBean;
+
+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.microcontainer.MicrocontainerService;
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service the gives access to the Microcontainer.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerServiceImpl implements MicrocontainerService, MicrocontainerServiceMBean
+{
+ private BundleContext context;
+ private MBeanServer mbeanServer;
+ private Kernel kernel;
+
+ public void setSystemContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ public void deploy(URL url) throws Exception
+ {
+ throw new NotImplementedException();
+ }
+
+ public void undeploy(URL url) throws Exception
+ {
+ throw new NotImplementedException();
+ }
+
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ public List<String> getRegisteredBeans()
+ {
+ List<String> names = new ArrayList<String>();
+
+ AbstractController controller = (AbstractController)getKernel().getController();
+ for (ControllerContext ctx : controller.getAllContexts())
+ {
+ if (ctx instanceof KernelControllerContext)
+ names.add(ctx.getName().toString());
+ }
+
+ return names;
+ }
+
+ public Object getRegisteredBean(String beanName)
+ {
+ ControllerContext context = getKernel().getController().getInstalledContext(beanName);
+ return context != null ? context.getTarget() : null;
+ }
+
+ public void start()
+ {
+ context.registerService(MicrocontainerService.class.getName(), this, null);
+
+ try
+ {
+ KernelController controller = kernel.getController();
+ ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
+ controller.install(new PreInstalledControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, context));
+ controller.install(new PreInstalledControllerContext(BEAN_MBEAN_SERVER, actions, mbeanServer));
+
+ StandardMBean mbean = new StandardMBean(this, MicrocontainerServiceMBean.class);
+ mbeanServer.registerMBean(mbean, MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE);
+ }
+ catch (Throwable ex)
+ {
+ throw new IllegalStateException("Cannot register MicrocontainerServiceMBean", ex);
+ }
+ }
+
+ static class PreInstalledControllerContext extends AbstractControllerContext
+ {
+ public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
+ {
+ super(name, actions, null, target);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/runtime/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/runtime/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -12,6 +12,7 @@
</parent>
<modules>
+ <module>jbossas</module>
<module>deployer</module>
<module>equinox</module>
<module>felix</module>
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -1,58 +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.management;
-
-//$Id$
-
-import java.net.URL;
-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();
-
- /**
- * Deploy MC beans from URL
- */
- void deploy(URL url) throws Exception;
-
- /**
- * Undeploy MC beans from URL
- */
- void undeploy(URL url) throws Exception;
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -23,8 +23,6 @@
// $Id$
-import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
-
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -41,8 +39,6 @@
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.logging.LogEntryCache;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -72,20 +68,6 @@
return new EmbeddedBundle(bundle);
}
- public void deploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.deploy(archiveURL);
- }
-
- public void undeploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.undeploy(archiveURL);
- }
-
public AbstractBundle[] getBundles()
{
List<AbstractBundle> absBundles = new ArrayList<AbstractBundle>();
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -23,12 +23,9 @@
// $Id$
-import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.net.URL;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set;
@@ -49,7 +46,6 @@
import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
-import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -112,20 +108,6 @@
}
}
- public void deploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.deploy(archiveURL);
- }
-
- public void undeploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.undeploy(archiveURL);
- }
-
@Override
public void addCapability(Capability capability) throws BundleException
{
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -21,12 +21,15 @@
*/
package org.jboss.osgi.spi.testing.internal;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.management.ObjectName;
+
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.Capability;
@@ -101,6 +104,24 @@
}
}
+ public void deploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ invokeMainDeployer("deploy", archiveURL);
+ }
+
+ public void undeploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ invokeMainDeployer("undeploy", archiveURL);
+ }
+
+ private void invokeMainDeployer(String method, URL archiveURL) throws Exception
+ {
+ ObjectName oname = new ObjectName("jboss.system:service=MainDeployer");
+ getMBeanServer().invoke(oname, method, new Object[] { archiveURL }, new String[] { "java.net.URL" });
+ }
+
public String getServerHost()
{
return System.getProperty("jboss.bind.address", "localhost");
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java (from rev 88378, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,111 @@
+/*
+ * 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.http;
+
+//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler at jboss.com $
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.ConfigAdminCapability;
+import org.jboss.osgi.spi.testing.HttpCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+
+import junit.framework.Test;
+
+/**
+ * A test that deployes a bundle that containes a HttpServlet which
+ * is registered through the OSGi HttpService
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class HttpServiceRemoteTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+ private static AbstractBundle testBundle;
+
+ public static Test suite()
+ {
+ OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceRemoteTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new ConfigAdminCapability());
+ runtime.addCapability(new HttpCapability());
+ Thread.sleep(500);
+ testBundle = runtime.installBundle("example/example-http.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ testBundle.uninstall();
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return testSetup;
+ }
+
+ public void testServletAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Servlet", br.readLine());
+ }
+
+ public void testServletInitProps() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("initProp=SomeValue", br.readLine());
+ }
+
+ public void testServletBundleContext() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("example-http", br.readLine());
+ }
+
+ public void testServletStartLevel() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("startLevel=1", br.readLine());
+ }
+
+ public void testResourceAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Resource", br.readLine());
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -1,111 +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.test.osgi.example.http;
-
-//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler at jboss.com $
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.ConfigAdminCapability;
-import org.jboss.osgi.spi.testing.HttpCapability;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-
-import junit.framework.Test;
-
-/**
- * A test that deployes a bundle that containes a HttpServlet which
- * is registered through the OSGi HttpService
- *
- * @author thomas.diesler at jboss.com
- * @since 23-Jan-2009
- */
-public class HttpServiceTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
- private static AbstractBundle testBundle;
-
- public static Test suite()
- {
- OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new ConfigAdminCapability());
- runtime.addCapability(new HttpCapability());
- Thread.sleep(500);
- testBundle = runtime.installBundle("example/example-http.jar");
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- testBundle.uninstall();
- runtime.shutdown();
- super.tearDown();
- }
- };
- return testSetup;
- }
-
- public void testServletAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Servlet", br.readLine());
- }
-
- public void testServletInitProps() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("initProp=SomeValue", br.readLine());
- }
-
- public void testServletBundleContext() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("example-http", br.readLine());
- }
-
- public void testServletStartLevel() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("startLevel=1", br.readLine());
- }
-
- public void testResourceAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Resource", br.readLine());
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -247,14 +247,6 @@
<name>target.container</name>
</property>
</activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-client</artifactId>
- <scope>test</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
<build>
<plugins>
<plugin>
More information about the jboss-cvs-commits
mailing list