JBoss-OSGI SVN: r95916 - in projects/jboss-osgi: trunk/distribution/installer/src/main/resources/jbossas and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-11-02 08:49:24 -0500 (Mon, 02 Nov 2009)
New Revision: 95916
Modified:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
Log:
Fix MC service init classloader
Add javax.transaction to syscp
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-11-02 13:25:53 UTC (rev 95915)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java 2009-11-02 13:49:24 UTC (rev 95916)
@@ -56,38 +56,24 @@
if ("org.jboss.osgi.framework".equals(systemBundleName))
return;
+ // Get the classloader that is used to initialize the MC service
+ ClassLoader classLoader = getClass().getClassLoader();
+
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
{
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ Thread.currentThread().setContextClassLoader(classLoader);
mcService = new MicrocontainerServiceImpl(context);
mcService.start();
-
- // Track the MicrocontainerService
- ServiceTracker tracker = new ServiceTracker(context, MicrocontainerService.class.getName(), null)
- {
- @Override
- public Object addingService(ServiceReference reference)
- {
- MicrocontainerService mcService = (MicrocontainerService)super.addingService(reference);
-
- // Register the DeployerService that uses the MC deployers
- Properties props = new Properties();
- props.setProperty("provider", "microcontainer");
- props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
- MainDeployer mainDeployer = (MainDeployer)mcService.getRegisteredBean("MainDeployer");
- MicrocontainerDeployerServiceImpl deployerService = new MicrocontainerDeployerServiceImpl(context, mainDeployer);
- context.registerService(DeployerService.class.getName(), deployerService, props);
-
- return mcService;
- }
- };
- tracker.open();
}
finally
{
Thread.currentThread().setContextClassLoader(ctxLoader);
}
+
+ // Track the MicrocontainerService and register the DeployerService
+ MicrocontainerServiceTracker tracker = new MicrocontainerServiceTracker(context, classLoader);
+ tracker.open();
}
public void stop(BundleContext context)
@@ -95,4 +81,41 @@
if (mcService != null)
mcService.stop();
}
+
+ /**
+ * Register the DeployerService that uses the MC deployers
+ */
+ class MicrocontainerServiceTracker extends ServiceTracker
+ {
+ private ClassLoader classLoader;
+
+ public MicrocontainerServiceTracker(BundleContext context, ClassLoader classLoader)
+ {
+ super(context, MicrocontainerService.class.getName(), null);
+ this.classLoader = classLoader;
+ }
+
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ MicrocontainerService mcService = (MicrocontainerService)super.addingService(reference);
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ Properties props = new Properties();
+ props.setProperty("provider", "microcontainer");
+ props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+ MainDeployer mainDeployer = (MainDeployer)mcService.getRegisteredBean("MainDeployer");
+ MicrocontainerDeployerServiceImpl deployerService = new MicrocontainerDeployerServiceImpl(context, mainDeployer);
+ context.registerService(DeployerService.class.getName(), deployerService, props);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ return mcService;
+ }
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-11-02 13:25:53 UTC (rev 95915)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-11-02 13:49:24 UTC (rev 95916)
@@ -26,6 +26,7 @@
<key>org.osgi.framework.system.packages.extra</key>
<value>
<!-- system -->
+ javax.transaction;version=1.0,
javax.xml.bind.annotation;version=2.1,
org.apache.xerces.dom;version=2.9,
org.jnp.interfaces;version=5.0,
14 years, 6 months
JBoss-OSGI SVN: r95913 - in projects/jboss-osgi: projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-11-02 07:18:46 -0500 (Mon, 02 Nov 2009)
New Revision: 95913
Added:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java
Modified:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/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
projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml
Log:
Separate mc service from deployer service integration
Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java 2009-11-02 12:18:46 UTC (rev 95913)
@@ -0,0 +1,175 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
+import org.jboss.osgi.spi.OSGiConstants;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An abstract base implementation of the {@link DeployerService} that delegates to the MC
+ * provided deployer architecture.
+ *
+ * The jboss-osgi-microcontainer bundle and the jbossas integration both provide
+ * concrete implementations.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 02-Nov-2009
+ */
+public abstract class AbstractMicrocontainerDeployerService extends AbstractDeployerService
+{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(AbstractMicrocontainerDeployerService.class);
+
+ private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+ private ServiceTracker registryTracker;
+
+ public abstract MainDeployer getMainDeployer();
+
+ public abstract BundleContext getBundleContext();
+
+ public void deploy(URL url) throws BundleException
+ {
+ Deployment dep = createDeployment(url);
+ deploy(new Deployment[] { dep });
+ }
+
+ public void undeploy(URL url) throws BundleException
+ {
+ DeploymentRegistryService registry = getDeploymentRegistry();
+ Deployment dep = registry.getDeployment(url);
+ if (dep != null)
+ {
+ try
+ {
+ VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
+ getMainDeployer().removeDeployment(vfsdep.getName());
+ getMainDeployer().process();
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot undeploy bundle", ex);
+ }
+ }
+ }
+
+ public void deploy(Deployment[] depArr) throws BundleException
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ List<VFSDeployment> depList = new ArrayList<VFSDeployment>();
+ DeploymentRegistryService registry = getDeploymentRegistry();
+
+ for (Deployment dep : depArr)
+ {
+ VirtualFile root = dep.getRoot();
+ VFSDeployment vfsdep = deploymentFactory.createVFSDeployment(root);
+ dep.addAttachment(VFSDeployment.class, vfsdep);
+ registry.registerDeployment(dep);
+ depList.add(vfsdep);
+
+ MutableAttachments att = (MutableAttachments)vfsdep.getPredeterminedManagedObjects();
+ att.addAttachment(OSGiConstants.PROPERTY_START_LEVEL, new Integer(dep.getStartLevel()));
+ att.addAttachment(OSGiConstants.PROPERTY_AUTO_START, new Boolean(dep.isAutoStart()));
+
+ getMainDeployer().addDeployment(vfsdep);
+ }
+
+ // Process the deployments
+ getMainDeployer().process();
+
+ // Check for completeness
+ VFSDeployment[] deploymentArr = depList.toArray(new VFSDeployment[depList.size()]);
+ getMainDeployer().checkComplete(deploymentArr);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot deploy bundles", ex);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void undeploy(Deployment[] depArr) throws BundleException
+ {
+ try
+ {
+ DeploymentRegistryService registry = getDeploymentRegistry();
+
+ for (Deployment dep : depArr)
+ {
+ registry.unregisterDeployment(dep);
+ VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
+ getMainDeployer().removeDeployment(vfsdep.getName());
+ }
+ getMainDeployer().process();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot undeploy bundles", ex);
+ }
+ }
+
+ private DeploymentRegistryService getDeploymentRegistry()
+ {
+ if (registryTracker == null)
+ {
+ registryTracker = new ServiceTracker(getBundleContext(), DeploymentRegistryService.class.getName(), null);
+ registryTracker.open();
+ }
+ DeploymentRegistryService service = (DeploymentRegistryService)registryTracker.getService();
+ if (service == null)
+ throw new IllegalStateException("Cannot obtain DeploymentRegistryService");
+ return service;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java 2009-11-02 12:18:46 UTC (rev 95913)
@@ -25,7 +25,6 @@
import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
-import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -40,46 +39,30 @@
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerContextActions;
import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
-import org.jboss.osgi.spi.OSGiConstants;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
- * An OSGi Service the gives access to the Kernel.
+ * An abstract base implementation of the {@link MicrocontainerService}.
*
+ * The jboss-osgi-microcontainer bundle and the jbossas integration both provide
+ * concrete implementations.
+ *
* @author thomas.diesler(a)jboss.com
* @since 23-Jan-2009
*/
-public abstract class AbstractMicrocontainerService extends AbstractDeployerService implements MicrocontainerService
+public abstract class AbstractMicrocontainerService implements MicrocontainerService
{
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
- private ServiceTracker registryTracker;
-
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(AbstractMicrocontainerService.class);
+
public abstract Kernel getKernel();
- public abstract void logDebug(String message);
-
- public abstract void logWarning(String message, Exception ex);
-
- public void logWarning(String message)
- {
- logWarning(message, null);
- }
-
public List<String> getRegisteredBeans()
{
List<String> names = new ArrayList<String>();
@@ -106,104 +89,6 @@
return (T)getRegisteredBean(beanName);
}
- public void deploy(URL url) throws BundleException
- {
- Deployment dep = createDeployment(url);
- deploy(new Deployment[] { dep });
- }
-
- public void undeploy(URL url) throws BundleException
- {
- DeploymentRegistryService registry = getDeploymentRegistry();
- Deployment dep = registry.getDeployment(url);
- if (dep != null)
- {
- try
- {
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
- VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
- mainDeployer.removeDeployment(vfsdep.getName());
- mainDeployer.process();
- }
- catch (Exception ex)
- {
- logWarning("Cannot undeploy bundle", ex);
- }
- }
- }
-
- public void deploy(Deployment[] depArr) throws BundleException
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- List<VFSDeployment> depList = new ArrayList<VFSDeployment>();
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
- DeploymentRegistryService registry = getDeploymentRegistry();
-
- for (Deployment dep : depArr)
- {
- VirtualFile root = dep.getRoot();
- VFSDeployment vfsdep = deploymentFactory.createVFSDeployment(root);
- dep.addAttachment(VFSDeployment.class, vfsdep);
- registry.registerDeployment(dep);
- depList.add(vfsdep);
-
- MutableAttachments att = (MutableAttachments)vfsdep.getPredeterminedManagedObjects();
- att.addAttachment(OSGiConstants.PROPERTY_START_LEVEL, new Integer(dep.getStartLevel()));
- att.addAttachment(OSGiConstants.PROPERTY_AUTO_START, new Boolean(dep.isAutoStart()));
-
- mainDeployer.addDeployment(vfsdep);
- }
-
- // Process the deployments
- mainDeployer.process();
-
- // Check for completeness
- VFSDeployment[] deploymentArr = depList.toArray(new VFSDeployment[depList.size()]);
- mainDeployer.checkComplete(deploymentArr);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new BundleException("Cannot deploy bundles", ex);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-
- public void undeploy(Deployment[] depArr) throws BundleException
- {
- try
- {
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
- DeploymentRegistryService registry = getDeploymentRegistry();
-
- for (Deployment dep : depArr)
- {
- registry.unregisterDeployment(dep);
- VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
- mainDeployer.removeDeployment(vfsdep.getName());
- }
- mainDeployer.process();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- logWarning("Cannot undeploy bundles", ex);
- }
- }
-
protected void installBean(KernelController controller, String beanName, Object beanImpl)
{
try
@@ -240,30 +125,16 @@
{
try
{
- logDebug("Unregister MicrocontainerServiceMBean");
+ log.debug("Unregister MicrocontainerServiceMBean");
mbeanServer.unregisterMBean(MBEAN_MICROCONTAINER_SERVICE);
}
catch (Exception ex)
{
- logWarning("Cannot unregister MicrocontainerServiceMBean", ex);
+ log.warn("Cannot unregister MicrocontainerServiceMBean", ex);
}
}
}
- private DeploymentRegistryService getDeploymentRegistry()
- {
- if (registryTracker == null)
- {
- BundleContext context = getRegisteredBean(BundleContext.class, BEAN_SYSTEM_BUNDLE_CONTEXT);
- registryTracker = new ServiceTracker(context, DeploymentRegistryService.class.getName(), null);
- registryTracker.open();
- }
- DeploymentRegistryService service = (DeploymentRegistryService)registryTracker.getService();
- if (service == null)
- throw new IllegalStateException("Cannot obtain DeploymentRegistryService");
- return service;
- }
-
static class PreInstalledControllerContext extends AbstractControllerContext
{
public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java 2009-11-02 12:18:46 UTC (rev 95913)
@@ -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.internal;
+
+//$Id$
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.microcontainer.AbstractMicrocontainerDeployerService;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of the {@link DeployerService} which is installed as a bundle.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public class MicrocontainerDeployerServiceImpl extends AbstractMicrocontainerDeployerService
+{
+ private BundleContext context;
+ private MainDeployer mainDeployer;
+
+ public MicrocontainerDeployerServiceImpl(BundleContext context, MainDeployer mainDeployer)
+ {
+ this.context = context;
+ this.mainDeployer = mainDeployer;
+ }
+
+ @Override
+ public BundleContext getBundleContext()
+ {
+ return context;
+ }
+
+ @Override
+ public MainDeployer getMainDeployer()
+ {
+ return mainDeployer;
+ }
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java 2009-11-02 12:18:46 UTC (rev 95913)
@@ -23,10 +23,17 @@
//$Id$
+import java.util.Properties;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.osgi.deployment.deployer.DeployerService;
import org.jboss.osgi.microcontainer.MicrocontainerCapabilityMarker;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
/**
* A BundleActivator that registers the {@link MicrocontainerService}
@@ -55,6 +62,27 @@
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
mcService = new MicrocontainerServiceImpl(context);
mcService.start();
+
+ // Track the MicrocontainerService
+ ServiceTracker tracker = new ServiceTracker(context, MicrocontainerService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ MicrocontainerService mcService = (MicrocontainerService)super.addingService(reference);
+
+ // Register the DeployerService that uses the MC deployers
+ Properties props = new Properties();
+ props.setProperty("provider", "microcontainer");
+ props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+ MainDeployer mainDeployer = (MainDeployer)mcService.getRegisteredBean("MainDeployer");
+ MicrocontainerDeployerServiceImpl deployerService = new MicrocontainerDeployerServiceImpl(context, mainDeployer);
+ context.registerService(DeployerService.class.getName(), deployerService, props);
+
+ return mcService;
+ }
+ };
+ tracker.open();
}
finally
{
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-11-02 12:18:46 UTC (rev 95913)
@@ -28,30 +28,25 @@
import java.net.URL;
import java.util.Arrays;
import java.util.List;
-import java.util.Properties;
import javax.management.MBeanServer;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.deployment.deployer.DeployerService;
import org.jboss.osgi.jbossxb.XMLBindingService;
import org.jboss.osgi.microcontainer.AbstractMicrocontainerService;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.jboss.virtual.VFS;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
/**
- * An implementation of the {@link DeployerService} and {@link MicrocontainerService}
- * which is installed as a bundle
+ * An implementation of the {@link MicrocontainerService}
+ * which is installed as a bundle.
*
* @author thomas.diesler(a)jboss.com
* @since 23-Jan-2009
@@ -60,12 +55,10 @@
{
private BundleContext context;
private EmbeddedKernelBootstrap deployer;
- private LogService log;
public MicrocontainerServiceImpl(BundleContext context)
{
this.context = context;
- this.log = new LogServiceTracker(context);
VFS.init();
@@ -77,18 +70,6 @@
return deployer.getKernel();
}
- @Override
- public void logDebug(String message)
- {
- log.log(LogService.LOG_DEBUG, message);
- }
-
- @Override
- public void logWarning(String message, Exception ex)
- {
- log.log(LogService.LOG_WARNING, message, ex);
- }
-
void start()
{
final MicrocontainerService mcServiceImpl = this;
@@ -142,16 +123,8 @@
deployer.deploy(deployersURL);
// Register the MicrocontainerService
- log.log(LogService.LOG_DEBUG, "Register MicrocontainerService");
context.registerService(MicrocontainerService.class.getName(), mcServiceImpl, null);
- // Register the DeployerService
- Properties props = new Properties();
- props.setProperty("provider", "microcontainer");
- props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
- log.log(LogService.LOG_DEBUG, "Register DeployerService");
- context.registerService(DeployerService.class.getName(), mcServiceImpl, props);
-
// Register the MicrocontainerServiceMBean
registerMicrocontainerServiceMBean(mbeanServer);
}
Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-11-02 12:18:46 UTC (rev 95913)
@@ -93,7 +93,7 @@
jboss-osgi-microcontainer
</includeArtifactIds>
<includes>
- org/jboss/osgi/microcontainer/integration/*.class
+ org/jboss/osgi/microcontainer/*.class
</includes>
</configuration>
</plugin>
Added: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java 2009-11-02 12:18:46 UTC (rev 95913)
@@ -0,0 +1,89 @@
+/*
+ * 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.integration.jbossas;
+
+//$Id$
+
+import java.util.Properties;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.microcontainer.AbstractMicrocontainerDeployerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * An implementation of the {@link DeployerService} which is installed as MC bean in jbossas.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerDeployerServiceBean extends AbstractMicrocontainerDeployerService
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(MicrocontainerDeployerServiceBean.class);
+
+ private MainDeployer mainDeployer;
+ private BundleContext context;
+ private ServiceRegistration serviceReg;
+
+ public MainDeployer getMainDeployer()
+ {
+ return mainDeployer;
+ }
+
+ public void setMainDeployer(MainDeployer mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return context;
+ }
+
+ public void setBundleContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public void start()
+ {
+ // Register the DeployerService
+ Properties props = new Properties();
+ props.setProperty("provider", "microcontainer");
+ props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+ serviceReg = context.registerService(DeployerService.class.getName(), this, props);
+ log.debug("DeployerService registered");
+ }
+
+ void stop()
+ {
+ if (serviceReg != null)
+ {
+ serviceReg.unregister();
+ serviceReg = null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java 2009-11-02 12:18:46 UTC (rev 95913)
@@ -24,22 +24,18 @@
//$Id$
-import java.util.Properties;
-
import javax.management.MBeanServer;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.DeployerService;
import org.jboss.osgi.microcontainer.AbstractMicrocontainerService;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
/**
- * An implementation of the {@link DeployerService} and {@link MicrocontainerService}
+ * An implementation of the {@link MicrocontainerService}
* which is installed as MC bean in jbossas.
*
* @author thomas.diesler(a)jboss.com
@@ -47,6 +43,7 @@
*/
public class MicrocontainerServiceBean extends AbstractMicrocontainerService implements MicrocontainerServiceMBean
{
+ // Provide logging
private static Logger log = Logger.getLogger(MicrocontainerServiceBean.class);
private BundleContext bundleContext;
@@ -73,18 +70,6 @@
return kernel;
}
- @Override
- public void logDebug(String message)
- {
- log.debug(message);
- }
-
- @Override
- public void logWarning(String message, Exception ex)
- {
- log.warn(message, ex);
- }
-
public void start() throws Exception
{
Kernel kernel = getKernel();
@@ -101,13 +86,6 @@
bundleContext.registerService(MicrocontainerService.class.getName(), this, null);
log.debug("MicrocontainerService registered");
- // Register the DeployerService
- Properties props = new Properties();
- props.setProperty("provider", "microcontainer");
- props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
- bundleContext.registerService(DeployerService.class.getName(), this, props);
- log.debug("DeployerService registered");
-
// Register the MicrocontainerServiceMBean
registerMicrocontainerServiceMBean(mbeanServer);
log.debug("MicrocontainerServiceMBean registered");
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-11-02 12:18:46 UTC (rev 95913)
@@ -60,6 +60,8 @@
<entry><key>org.jboss.osgi.jndi.host</key><value>${jboss.bind.address}</value></entry>
<entry><key>org.jboss.osgi.jndi.rmi.port</key><value>1098</value></entry>
<entry><key>org.jboss.osgi.jndi.port</key><value>1099</value></entry>
+ <!-- JTA Object Store -->
+ <entry><key>com.arjuna.ats.arjuna.objectstore.objectStoreDir</key><value>${jboss.server.data.dir}/tx-object-store</value></entry>
</map>
</property>
<property name="autoInstall">
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-11-02 12:18:46 UTC (rev 95913)
@@ -83,6 +83,8 @@
<entry><key>org.jboss.osgi.jndi.host</key><value>${jboss.bind.address}</value></entry>
<entry><key>org.jboss.osgi.jndi.rmi.port</key><value>1098</value></entry>
<entry><key>org.jboss.osgi.jndi.port</key><value>1099</value></entry>
+ <!-- JTA Object Store -->
+ <entry><key>com.arjuna.ats.arjuna.objectstore.objectStoreDir</key><value>${jboss.server.data.dir}/tx-object-store</value></entry>
</map>
</property>
<property name="autoInstall">
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-11-02 12:18:46 UTC (rev 95913)
@@ -64,6 +64,8 @@
<entry><key>org.jboss.osgi.jndi.host</key><value>${jboss.bind.address}</value></entry>
<entry><key>org.jboss.osgi.jndi.rmi.port</key><value>1098</value></entry>
<entry><key>org.jboss.osgi.jndi.port</key><value>1099</value></entry>
+ <!-- JTA Object Store -->
+ <entry><key>com.arjuna.ats.arjuna.objectstore.objectStoreDir</key><value>${jboss.server.data.dir}/tx-object-store</value></entry>
</map>
</property>
<incallback method="addPlugin" />
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml 2009-11-02 12:18:46 UTC (rev 95913)
@@ -6,21 +6,6 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <!--
- ********************************
- * *
- * Services *
- * *
- ********************************
- -->
-
- <!-- Microcontainer Service -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
- <property name="bundleContext"><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>
-
<!-- Transaction Service -->
<bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
<property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml 2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml 2009-11-02 12:18:46 UTC (rev 95913)
@@ -6,14 +6,6 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <!--
- ********************************
- * *
- * Services *
- * *
- ********************************
- -->
-
<!-- Microcontainer Service -->
<bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
<property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
@@ -21,11 +13,10 @@
<property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
</bean>
- <!-- Transaction Service -->
- <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+ <!-- Microcontainer Deployer Service -->
+ <bean name="jboss.osgi:service=MicrocontainerDeployer" class="org.jboss.osgi.integration.jbossas.MicrocontainerDeployerServiceBean">
<property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
- <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
- <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+ <property name="mainDeployer"><inject bean="MainDeployer"/></property>
</bean>
</deployment>
14 years, 6 months
JBoss-OSGI SVN: r95911 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-11-02 06:00:59 -0500 (Mon, 02 Nov 2009)
New Revision: 95911
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java
Log:
javadoc
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java 2009-11-02 10:58:24 UTC (rev 95910)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/MicrocontainerService.java 2009-11-02 11:00:59 UTC (rev 95911)
@@ -26,45 +26,45 @@
import java.util.List;
/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
+ * An OSGi Service that gives access to Kernel bean registrations.
*
* @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
*/
14 years, 6 months
JBoss-OSGI SVN: r95892 - in projects/jboss-osgi: projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer and 5 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-11-01 07:22:13 -0500 (Sun, 01 Nov 2009)
New Revision: 95892
Added:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapabilityMarker.java
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapabilityMarker.java
Removed:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/microcontainer/
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.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/internal/MicrocontainerServiceActivator.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java
Log:
Use marker services for jta and mc
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-11-01 11:50:12 UTC (rev 95891)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-11-01 12:22:13 UTC (rev 95892)
@@ -112,7 +112,6 @@
org.jboss.osgi.microcontainer;version=${version}
</Export-Package>
<Private-Package>
- org.jboss.osgi.microcontainer.integration,
org.jboss.osgi.microcontainer.internal
</Private-Package>
<Import-Package>
Copied: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java (from rev 95850, 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/AbstractMicrocontainerService.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -0,0 +1,274 @@
+/*
+ * 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 static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+
+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.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
+import org.jboss.osgi.spi.OSGiConstants;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.service.MicrocontainerService;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * An OSGi Service the gives access to the Kernel.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public abstract class AbstractMicrocontainerService extends AbstractDeployerService implements MicrocontainerService
+{
+ private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+ private ServiceTracker registryTracker;
+
+ public abstract Kernel getKernel();
+
+ public abstract void logDebug(String message);
+
+ public abstract void logWarning(String message, Exception ex);
+
+ public void logWarning(String message)
+ {
+ logWarning(message, null);
+ }
+
+ public List<String> getRegisteredBeans()
+ {
+ List<String> names = new ArrayList<String>();
+
+ AbstractController controller = (AbstractController)getKernel().getController();
+ for (ControllerContext ctx : controller.getAllContexts())
+ {
+ if (ctx instanceof KernelControllerContext || ctx instanceof PreInstalledControllerContext)
+ names.add(ctx.getName().toString());
+ }
+
+ return names;
+ }
+
+ public Object getRegisteredBean(String beanName)
+ {
+ ControllerContext context = getKernel().getController().getInstalledContext(beanName);
+ return context != null ? context.getTarget() : null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getRegisteredBean(Class<T> clazz, String beanName)
+ {
+ return (T)getRegisteredBean(beanName);
+ }
+
+ public void deploy(URL url) throws BundleException
+ {
+ Deployment dep = createDeployment(url);
+ deploy(new Deployment[] { dep });
+ }
+
+ public void undeploy(URL url) throws BundleException
+ {
+ DeploymentRegistryService registry = getDeploymentRegistry();
+ Deployment dep = registry.getDeployment(url);
+ if (dep != null)
+ {
+ try
+ {
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
+ VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
+ mainDeployer.removeDeployment(vfsdep.getName());
+ mainDeployer.process();
+ }
+ catch (Exception ex)
+ {
+ logWarning("Cannot undeploy bundle", ex);
+ }
+ }
+ }
+
+ public void deploy(Deployment[] depArr) throws BundleException
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ List<VFSDeployment> depList = new ArrayList<VFSDeployment>();
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
+ DeploymentRegistryService registry = getDeploymentRegistry();
+
+ for (Deployment dep : depArr)
+ {
+ VirtualFile root = dep.getRoot();
+ VFSDeployment vfsdep = deploymentFactory.createVFSDeployment(root);
+ dep.addAttachment(VFSDeployment.class, vfsdep);
+ registry.registerDeployment(dep);
+ depList.add(vfsdep);
+
+ MutableAttachments att = (MutableAttachments)vfsdep.getPredeterminedManagedObjects();
+ att.addAttachment(OSGiConstants.PROPERTY_START_LEVEL, new Integer(dep.getStartLevel()));
+ att.addAttachment(OSGiConstants.PROPERTY_AUTO_START, new Boolean(dep.isAutoStart()));
+
+ mainDeployer.addDeployment(vfsdep);
+ }
+
+ // Process the deployments
+ mainDeployer.process();
+
+ // Check for completeness
+ VFSDeployment[] deploymentArr = depList.toArray(new VFSDeployment[depList.size()]);
+ mainDeployer.checkComplete(deploymentArr);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot deploy bundles", ex);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void undeploy(Deployment[] depArr) throws BundleException
+ {
+ try
+ {
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
+ DeploymentRegistryService registry = getDeploymentRegistry();
+
+ for (Deployment dep : depArr)
+ {
+ registry.unregisterDeployment(dep);
+ VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
+ mainDeployer.removeDeployment(vfsdep.getName());
+ }
+ mainDeployer.process();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ logWarning("Cannot undeploy bundles", ex);
+ }
+ }
+
+ protected void installBean(KernelController controller, String beanName, Object beanImpl)
+ {
+ try
+ {
+ ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
+ controller.install(new PreInstalledControllerContext(beanName, actions, beanImpl));
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable ex)
+ {
+ throw new IllegalStateException("Cannot register bean: " + beanName, ex);
+ }
+ }
+
+ protected void registerMicrocontainerServiceMBean(MBeanServer mbeanServer)
+ {
+ try
+ {
+ StandardMBean mbean = new StandardMBean((MicrocontainerServiceMBean)this, MicrocontainerServiceMBean.class);
+ mbeanServer.registerMBean(mbean, MBEAN_MICROCONTAINER_SERVICE);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot register MicrocontainerServiceMBean", ex);
+ }
+ }
+
+ protected void unregisterMicrocontainerServiceMBean(MBeanServer mbeanServer)
+ {
+ if (mbeanServer.isRegistered(MBEAN_MICROCONTAINER_SERVICE))
+ {
+ try
+ {
+ logDebug("Unregister MicrocontainerServiceMBean");
+ mbeanServer.unregisterMBean(MBEAN_MICROCONTAINER_SERVICE);
+ }
+ catch (Exception ex)
+ {
+ logWarning("Cannot unregister MicrocontainerServiceMBean", ex);
+ }
+ }
+ }
+
+ private DeploymentRegistryService getDeploymentRegistry()
+ {
+ if (registryTracker == null)
+ {
+ BundleContext context = getRegisteredBean(BundleContext.class, BEAN_SYSTEM_BUNDLE_CONTEXT);
+ registryTracker = new ServiceTracker(context, DeploymentRegistryService.class.getName(), null);
+ registryTracker.open();
+ }
+ DeploymentRegistryService service = (DeploymentRegistryService)registryTracker.getService();
+ if (service == null)
+ throw new IllegalStateException("Cannot obtain DeploymentRegistryService");
+ return service;
+ }
+
+ static class PreInstalledControllerContext extends AbstractControllerContext
+ {
+ public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
+ {
+ super(name, actions, null, target);
+ }
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapabilityMarker.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapabilityMarker.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapabilityMarker.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -0,0 +1,35 @@
+/*
+ * 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$
+
+
+/**
+ * A marker service for the jboss-osgi-microcontainer.jar
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 01-Nov-2009
+ */
+public interface MicrocontainerCapabilityMarker
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerCapabilityMarker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java 2009-11-01 11:50:12 UTC (rev 95891)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -23,6 +23,7 @@
//$Id$
+import org.jboss.osgi.microcontainer.MicrocontainerCapabilityMarker;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -39,6 +40,15 @@
public void start(BundleContext context)
{
+ // Always register the marker service
+ MicrocontainerCapabilityMarker markerService = new MicrocontainerCapabilityMarker(){};
+ context.registerService(MicrocontainerCapabilityMarker.class.getName(), markerService, null);
+
+ // Do nothing if this bundle gets installed on the jbossmc framework
+ String systemBundleName = context.getBundle(0).getSymbolicName();
+ if ("org.jboss.osgi.framework".equals(systemBundleName))
+ return;
+
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
{
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-11-01 11:50:12 UTC (rev 95891)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -37,7 +37,7 @@
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.deployment.deployer.DeployerService;
import org.jboss.osgi.jbossxb.XMLBindingService;
-import org.jboss.osgi.microcontainer.integration.AbstractMicrocontainerService;
+import org.jboss.osgi.microcontainer.AbstractMicrocontainerService;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.jboss.virtual.VFS;
Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java 2009-11-01 11:50:12 UTC (rev 95891)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -32,7 +32,7 @@
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.microcontainer.integration.AbstractMicrocontainerService;
+import org.jboss.osgi.microcontainer.AbstractMicrocontainerService;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java 2009-11-01 11:50:12 UTC (rev 95891)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -46,7 +46,7 @@
{
public TransactionCapability()
{
- super(TransactionService.class.getName());
+ super(TransactionCapabilityMarker.class.getName());
if (new File("target").exists())
addSystemProperty(Environment.OBJECTSTORE_DIR, "target/ObjectStore");
Copied: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapabilityMarker.java (from rev 95882, projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapabilityMarker.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapabilityMarker.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -0,0 +1,35 @@
+/*
+ * 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.jta;
+
+//$Id$
+
+
+/**
+ * A marker service for the jboss-osgi-jta bundle.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 27-Oct-2009
+ */
+public interface TransactionCapabilityMarker
+{
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java 2009-11-01 11:50:12 UTC (rev 95891)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -1,35 +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.jta;
-
-//$Id$
-
-
-/**
- * A marker service for the jboss-osgi-jta bundle.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 27-Oct-2009
- */
-public interface TransactionService
-{
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java 2009-11-01 11:50:12 UTC (rev 95891)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java 2009-11-01 12:22:13 UTC (rev 95892)
@@ -26,7 +26,7 @@
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
-import org.jboss.osgi.jta.TransactionService;
+import org.jboss.osgi.jta.TransactionCapabilityMarker;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceFactory;
@@ -46,8 +46,8 @@
public void start(BundleContext context)
{
// Always register the marker service
- TransactionService markerService = new TransactionService(){};
- context.registerService(TransactionService.class.getName(), markerService, null);
+ TransactionCapabilityMarker markerService = new TransactionCapabilityMarker(){};
+ context.registerService(TransactionCapabilityMarker.class.getName(), markerService, null);
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
14 years, 6 months
JBoss-OSGI SVN: r95891 - in projects/jboss-osgi/trunk: distribution/installer/src/main/resources/jbossas and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-11-01 06:50:12 -0500 (Sun, 01 Nov 2009)
New Revision: 95891
Added:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml
Removed:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManagerLifecycle.java
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkFactory.java
Log:
User separate beans xml descriptors for jta, microcontainer services
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2009-11-01 10:29:15 UTC (rev 95890)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2009-11-01 11:50:12 UTC (rev 95891)
@@ -108,9 +108,9 @@
<!--
********************************
- *
- * JBossOSGi Distribution
- *
+ * *
+ * JBossOSGi Distribution *
+ * *
********************************
-->
@@ -160,9 +160,9 @@
<!--
********************************
- *
- * JBossOSGi Runtime
- *
+ * *
+ * JBossOSGi Runtime *
+ * *
********************************
-->
@@ -337,9 +337,9 @@
<!--
*********************************
- *
- * JBossAS Integration
- *
+ * *
+ * JBossAS Integration *
+ * *
*********************************
-->
@@ -386,6 +386,9 @@
<include name="pax-web-jetty-bundle.jar" />
<include name="org.apache.felix.log.jar" />
</fileset>
+ <fileset dir="@{deploy.artifacts.dir}/resources/jbossas" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/osgi" override="true">
+ <include name="jta-service-jboss-beans.xml" />
+ </fileset>
<!-- Felix Integration -->
@@ -404,6 +407,9 @@
override="true">
<include name="org.osgi.compendium.jar" />
</fileset>
+ <fileset condition="isFelix" dir="@{deploy.artifacts.dir}/resources/jbossas" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/osgi" override="true">
+ <include name="microcontainer-service-jboss-beans.xml" />
+ </fileset>
<!-- Equinox Integration -->
@@ -420,6 +426,9 @@
<include name="org.apache.felix.metatype.jar" />
<include name="org.eclipse.osgi.services.jar" />
</fileset>
+ <fileset condition="isEquinox" dir="@{deploy.artifacts.dir}/resources/jbossas" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/osgi" override="true">
+ <include name="microcontainer-service-jboss-beans.xml" />
+ </fileset>
<!-- JBossMC Integration -->
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-11-01 10:29:15 UTC (rev 95890)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-11-01 11:50:12 UTC (rev 95891)
@@ -78,28 +78,6 @@
<!--
********************************
* *
- * Services *
- * *
- ********************************
- -->
-
- <!-- Microcontainer Service -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
- <property name="bundleContext"><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>
-
- <!-- Transaction Service -->
- <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
- <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
- <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
- <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
- </bean>
-
- <!--
- ********************************
- * *
* Deployers *
* *
********************************
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-11-01 10:29:15 UTC (rev 95890)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-11-01 11:50:12 UTC (rev 95891)
@@ -101,28 +101,6 @@
<!--
********************************
* *
- * Services *
- * *
- ********************************
- -->
-
- <!-- Microcontainer Service -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
- <property name="bundleContext"><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>
-
- <!-- Transaction Service -->
- <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
- <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
- <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
- <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
- </bean>
-
- <!--
- ********************************
- * *
* Deployers *
* *
********************************
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-11-01 10:29:15 UTC (rev 95890)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-11-01 11:50:12 UTC (rev 95891)
@@ -5,7 +5,7 @@
<!--
********************************
* *
- * OSGi Framework *
+ * OSGi Bundle Manager *
* *
********************************
-->
@@ -73,7 +73,7 @@
<!--
********************************
* *
- * OSGi Framework Plugins *
+ * OSGi Manager Plugins *
* *
********************************
-->
@@ -104,7 +104,7 @@
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
-
+
<!--
********************************
* *
@@ -131,6 +131,18 @@
<uncallback method="removeInterceptor" />
</bean>
+ <!--
+ ********************************
+ * *
+ * Framework *
+ * *
+ ********************************
+ -->
+
+ <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.framework.launch.OSGiFramework">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
+
<!--
********************************
* *
@@ -184,33 +196,4 @@
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
- <!--
- ********************************
- * *
- * OSGi Lifecycle *
- * *
- ********************************
- -->
-
- <!-- [TODO] use dependencies instead of bean order -->
-
- <bean name="OSGiBundleManagerLifecycle" class="org.jboss.osgi.framework.bundle.OSGiBundleManagerLifecycle">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
-
-
- <!--
- ********************************
- * *
- * Generic OSGi Services *
- * *
- ********************************
- -->
-
- <bean name="OSGiTransactionService" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
- <property name="bundleContext"><inject bean="OSGiBundleManager" property="systemContext"/></property>
- <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
- <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
- </bean>
-
</deployment>
\ No newline at end of file
Added: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml (rev 0)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml 2009-11-01 11:50:12 UTC (rev 95891)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ $Id$
+-->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ ********************************
+ * *
+ * Services *
+ * *
+ ********************************
+ -->
+
+ <!-- Microcontainer Service -->
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
+ <property name="bundleContext"><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>
+
+ <!-- Transaction Service -->
+ <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+ <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+ <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+ </bean>
+
+</deployment>
Property changes on: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml (rev 0)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml 2009-11-01 11:50:12 UTC (rev 95891)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ $Id$
+-->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ ********************************
+ * *
+ * Services *
+ * *
+ ********************************
+ -->
+
+ <!-- Microcontainer Service -->
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
+ <property name="bundleContext"><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>
+
+ <!-- Transaction Service -->
+ <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+ <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+ <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+ </bean>
+
+</deployment>
Property changes on: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManagerLifecycle.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManagerLifecycle.java 2009-11-01 10:29:15 UTC (rev 95890)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManagerLifecycle.java 2009-11-01 11:50:12 UTC (rev 95891)
@@ -1,53 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.framework.bundle;
-
-// $Id: $
-
-import org.osgi.framework.BundleException;
-
-/**
- * A bean that starts/stops the bundle manager.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleManagerLifecycle
-{
- private OSGiBundleManager bundleManager;
-
- public OSGiBundleManagerLifecycle(OSGiBundleManager bundleManager)
- {
- this.bundleManager = bundleManager;
- }
-
- public void start() throws BundleException
- {
- bundleManager.startFramework();
- }
-
- public void stop() throws BundleException
- {
- bundleManager.stopFramework();
- }
-
-}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java 2009-11-01 10:29:15 UTC (rev 95890)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java 2009-11-01 11:50:12 UTC (rev 95891)
@@ -29,7 +29,6 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleWrapper;
-import org.jboss.osgi.framework.bundle.OSGiSystemState;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.launch.Framework;
@@ -47,9 +46,9 @@
private OSGiBundleManager bundleManager;
- public OSGiFramework(OSGiBundleManager bundleManager, OSGiSystemState bundleState)
+ public OSGiFramework(OSGiBundleManager bundleManager)
{
- super(bundleState);
+ super(bundleManager.getBundleById(0));
this.bundleManager = bundleManager;
}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkFactory.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkFactory.java 2009-11-01 10:29:15 UTC (rev 95890)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/launch/OSGiFrameworkFactory.java 2009-11-01 11:50:12 UTC (rev 95891)
@@ -42,7 +42,6 @@
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiSystemState;
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
@@ -100,9 +99,7 @@
throw new IllegalStateException("Cannot obtain installed bean: " + OSGiBundleManager.BEAN_BUNDLE_MANAGER);
OSGiBundleManager manager = (OSGiBundleManager)managerContext.getTarget();
- OSGiSystemState sysBundle = (OSGiSystemState)manager.getBundleById(0);
-
- return new OSGiFramework(manager, sysBundle);
+ return new OSGiFramework(manager);
}
private KernelController preinstallKernelBeans(Kernel kernel)
14 years, 6 months
JBoss-OSGI SVN: r95890 - projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-11-01 05:29:15 -0500 (Sun, 01 Nov 2009)
New Revision: 95890
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd
Log:
Import javax.transaction with version range
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd 2009-11-01 07:08:09 UTC (rev 95889)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd 2009-11-01 10:29:15 UTC (rev 95890)
@@ -3,7 +3,7 @@
Bundle-SymbolicName: example-jta
Export-Package: org.jboss.test.osgi.example.jta
Import-Package: \
- javax.transaction, \
+ javax.transaction;version="[1.0,1.1)", \
org.jboss.osgi.jmx, org.jboss.osgi.husky, org.jboss.osgi.testing, org.jboss.osgi.jta, org.jboss.osgi.spi.capability, \
org.junit, org.osgi.framework
14 years, 6 months