[jboss-cvs] JBossAS SVN: r89477 - in projects/jboss-osgi/trunk: bundles/hotdeploy and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 27 16:44:18 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-27 16:44:18 -0400 (Wed, 27 May 2009)
New Revision: 89477
Added:
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerActivator.java
Removed:
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerHelper.java
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/HotDeployActivator.java
Modified:
projects/jboss-osgi/trunk/bundles/hotdeploy/pom.xml
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/DeploymentScanner.java
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java
projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/distribution/pom.xml
projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/pom.xml
Log:
Add DeploymentScanner to Runtime
Modified: projects/jboss-osgi/trunk/bundles/hotdeploy/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundles/hotdeploy/pom.xml 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/bundles/hotdeploy/pom.xml 2009-05-27 20:44:18 UTC (rev 89477)
@@ -49,7 +49,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.service.hotdeploy.internal.HotDeployActivator</Bundle-Activator>
+ <Bundle-Activator>org.jboss.osgi.service.hotdeploy.internal.DeploymentScannerActivator</Bundle-Activator>
<Private-Package>org.jboss.osgi.service.hotdeploy.internal</Private-Package>
<Export-Package>
org.jboss.osgi.service.hotdeploy;version=${version}
Modified: projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/DeploymentScanner.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/DeploymentScanner.java 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/DeploymentScanner.java 2009-05-27 20:44:18 UTC (rev 89477)
@@ -34,9 +34,9 @@
public interface DeploymentScanner
{
/**
- * The property that names the scan location: org.jboss.osgi.hotdeploy.scan
+ * The property that names the scan location: org.jboss.osgi.hotdeploy.scandir
*/
- String PROPERTY_SCAN_LOCATION = "org.jboss.osgi.hotdeploy.scan";
+ String PROPERTY_SCAN_LOCATION = "org.jboss.osgi.hotdeploy.scandir";
/**
* The property to defines the scan interval: org.jboss.osgi.hotdeploy.interval
Copied: projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerActivator.java (from rev 89471, projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/HotDeployActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerActivator.java 2009-05-27 20:44:18 UTC (rev 89477)
@@ -0,0 +1,56 @@
+/*
+ * 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.service.hotdeploy.internal;
+
+//$Id$
+
+import org.jboss.osgi.service.hotdeploy.DeploymentScanner;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The {@link DeploymentScanner} service activator
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 27-May-2009
+ */
+public class DeploymentScannerActivator implements BundleActivator
+{
+ private DeploymentScannerImpl service;
+
+ public void start(BundleContext context)
+ {
+ service = new DeploymentScannerImpl(context);
+ context.registerService(DeploymentScanner.class.getName(), service, null);
+
+ service.start();
+ }
+
+ public void stop(BundleContext context)
+ {
+ if (service != null)
+ {
+ service.stop();
+ service = null;
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerHelper.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerHelper.java 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerHelper.java 2009-05-27 20:44:18 UTC (rev 89477)
@@ -1,161 +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.service.hotdeploy.internal;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.service.hotdeploy.BundleInfo;
-import org.jboss.osgi.service.hotdeploy.DeploymentScanner;
-import org.jboss.osgi.service.hotdeploy.BundleInfo.State;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.service.log.LogService;
-
-/**
- * A DeploymentScanner helper
- *
- * @author thomas.diesler at jboss.com
- * @since 27-May-2009
- */
-public class DeploymentScannerHelper
-{
- private LogServiceTracker log;
- private BundleContext context;
- private DeploymentScanner scanner;
- private List<BundleInfo> lastScan;
-
- public DeploymentScannerHelper(BundleContext context, DeploymentScanner scanner)
- {
- this.log = new LogServiceTracker(context);
- this.context = context;
- this.scanner = scanner;
-
- this.lastScan = Arrays.asList(scanner.getBundles());
- }
-
- public void scan()
- {
- List<BundleInfo> currScan = Arrays.asList(scanner.getBundles());
-
- processOldDeployments(currScan);
-
- processNewDeployments(currScan);
-
- lastScan = currScan;
- }
-
- private void processOldDeployments(List<BundleInfo> currScan)
- {
- List<BundleInfo> diff = new ArrayList<BundleInfo>();
-
- // Detect OLD bundles that are not in the current scan
- for (BundleInfo info : lastScan)
- {
- if (currScan.contains(info) == false)
- diff.add(info);
- }
-
- for (BundleInfo info : diff)
- {
- Bundle bundle = getInstalledBundle(context, info.getSymbolicName());
- if (bundle != null)
- {
- if (info.getState() == State.INSTALLED || info.getState() == State.ACTIVE)
- {
- try
- {
- log.log(LogService.LOG_INFO, "Uninstall: " + info.getSymbolicName());
- bundle.uninstall();
- }
- catch (BundleException ex)
- {
- log.log(LogService.LOG_ERROR, "Cannot uninstall bundle", ex);
- }
- }
- }
- }
- }
-
- private void processNewDeployments(List<BundleInfo> currScan)
- {
- List<BundleInfo> diff = new ArrayList<BundleInfo>();
-
- // Detect NEW bundles that are not in the last scan
- for (BundleInfo info : currScan)
- {
- if (lastScan.contains(info) == false)
- diff.add(info);
- }
-
- for (BundleInfo info : diff)
- {
- if (info.getState() == BundleInfo.State.NEW)
- {
- Bundle bundle = null;
- try
- {
- log.log(LogService.LOG_INFO, "Install: " + info.getSymbolicName());
- bundle = context.installBundle(info.getLocation().toExternalForm());
- }
- catch (BundleException ex)
- {
- log.log(LogService.LOG_ERROR, "Cannot install bundle", ex);
- }
-
- if (bundle != null)
- {
- try
- {
- log.log(LogService.LOG_INFO, "Start: " + info.getSymbolicName());
- bundle.start();
- }
- catch (BundleException ex)
- {
- log.log(LogService.LOG_ERROR, "Cannot start bundle", ex);
- }
- }
- }
- }
- }
-
- static Bundle getInstalledBundle(BundleContext context, String symbolicName)
- {
- Bundle bundle = null;
-
- for (Bundle aux : context.getBundles())
- {
- if (aux.getSymbolicName().equals(symbolicName))
- {
- bundle = aux;
- break;
- }
- }
-
- return bundle;
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java 2009-05-27 20:44:18 UTC (rev 89477)
@@ -30,15 +30,20 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
+import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.service.hotdeploy.BundleInfo;
import org.jboss.osgi.service.hotdeploy.DeploymentScanner;
+import org.jboss.osgi.service.hotdeploy.BundleInfo.State;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.service.log.LogService;
/**
* The DeploymentScanner service
@@ -48,6 +53,7 @@
*/
public class DeploymentScannerImpl implements DeploymentScanner
{
+ private LogServiceTracker log;
private BundleContext context;
private long scanInterval;
@@ -55,10 +61,11 @@
private long scanCount;
private ScannerThread scannerThread;
- private DeploymentScannerHelper scanHelper;
+ private List<BundleInfo> lastScan = new ArrayList<BundleInfo>();
public DeploymentScannerImpl(BundleContext context)
{
+ this.log = new LogServiceTracker(context);
this.context = context;
initScanner(context);
@@ -66,7 +73,7 @@
public void start()
{
- scanHelper = new DeploymentScannerHelper(context, this);
+ log.log(LogService.LOG_INFO, "Start DeploymentScanner: [scandir=" + scanLocation + ",interval=" + scanInterval + "ms]");
scannerThread = new ScannerThread(context, this);
scannerThread.start();
}
@@ -75,6 +82,7 @@
{
if (scannerThread != null)
{
+ log.log(LogService.LOG_INFO, "Stop DeploymentScanner");
scannerThread.stopScan();
scannerThread = null;
}
@@ -82,17 +90,116 @@
public void scan()
{
- scanHelper.scan();
+ List<BundleInfo> currScan = Arrays.asList(getBundles());
+
+ processOldDeployments(currScan);
+
+ processNewDeployments(currScan);
+
+ lastScan = currScan;
scanCount++;
}
+ private void processOldDeployments(List<BundleInfo> currScan)
+ {
+ List<BundleInfo> diff = new ArrayList<BundleInfo>();
+
+ // Detect OLD bundles that are not in the current scan
+ for (BundleInfo info : lastScan)
+ {
+ if (currScan.contains(info) == false)
+ diff.add(info);
+ }
+
+ for (BundleInfo info : diff)
+ {
+ Bundle bundle = getInstalledBundle(info.getSymbolicName());
+ if (bundle != null)
+ {
+ if (info.getState() == State.INSTALLED || info.getState() == State.ACTIVE)
+ {
+ try
+ {
+ log.log(LogService.LOG_DEBUG, "Uninstall: " + info.getSymbolicName());
+ bundle.uninstall();
+ }
+ catch (BundleException ex)
+ {
+ log.log(LogService.LOG_ERROR, "Cannot uninstall bundle", ex);
+ }
+ }
+ }
+ }
+ }
+
+ private void processNewDeployments(List<BundleInfo> currScan)
+ {
+ List<BundleInfo> diff = new ArrayList<BundleInfo>();
+
+ // Detect NEW bundles that are not in the last scan
+ for (BundleInfo info : currScan)
+ {
+ if (lastScan.contains(info) == false)
+ diff.add(info);
+ }
+
+ // Install the NEW bundles
+ List<Bundle> bundles = new ArrayList<Bundle>();
+ for (BundleInfo info : diff)
+ {
+ if (info.getState() == BundleInfo.State.NEW)
+ {
+ try
+ {
+ log.log(LogService.LOG_DEBUG, "Install: " + info.getSymbolicName());
+ Bundle bundle = context.installBundle(info.getLocation().toExternalForm());
+ bundles.add(bundle);
+ }
+ catch (BundleException ex)
+ {
+ log.log(LogService.LOG_ERROR, "Cannot install bundle: " + info.getSymbolicName(), ex);
+ }
+ }
+ }
+
+ // Start the installed bundles
+ for (Bundle bundle : bundles)
+ {
+ try
+ {
+ log.log(LogService.LOG_DEBUG, "Start: " + bundle.getSymbolicName());
+ bundle.start();
+ }
+ catch (BundleException ex)
+ {
+ log.log(LogService.LOG_ERROR, "Cannot start bundle: " + bundle.getSymbolicName(), ex);
+ }
+ }
+ }
+
+ private Bundle getInstalledBundle(String symbolicName)
+ {
+ Bundle bundle = null;
+
+ for (Bundle aux : context.getBundles())
+ {
+ if (aux.getSymbolicName().equals(symbolicName))
+ {
+ bundle = aux;
+ break;
+ }
+ }
+
+ return bundle;
+ }
+
public BundleInfo[] getBundles()
{
List<BundleInfo> bundles = new ArrayList<BundleInfo>();
for (File file : scanLocation.listFiles())
{
String symbolicName = getSymbolicName(file);
- Bundle bundle = DeploymentScannerHelper.getInstalledBundle(context, symbolicName);
+ Bundle bundle = getInstalledBundle(symbolicName);
BundleInfo bundleInfo = new BundleInfo(toURL(file), symbolicName, bundle);
bundles.add(bundleInfo);
}
@@ -118,11 +225,11 @@
private void initScanner(BundleContext context)
{
scanInterval = 2000;
-
+
String interval = context.getProperty(PROPERTY_SCAN_INTERVAL);
if (interval != null)
scanInterval = new Long(interval);
-
+
String scanLoc = context.getProperty(PROPERTY_SCAN_LOCATION);
if (scanLoc == null)
throw new IllegalStateException("Cannot obtain value for property: '" + PROPERTY_SCAN_LOCATION + "'");
Deleted: projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/HotDeployActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/HotDeployActivator.java 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/HotDeployActivator.java 2009-05-27 20:44:18 UTC (rev 89477)
@@ -1,56 +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.service.hotdeploy.internal;
-
-//$Id$
-
-import org.jboss.osgi.service.hotdeploy.DeploymentScanner;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * The {@link DeploymentScanner} service activator
- *
- * @author thomas.diesler at jboss.com
- * @since 27-May-2009
- */
-public class HotDeployActivator implements BundleActivator
-{
- private DeploymentScannerImpl service;
-
- public void start(BundleContext context)
- {
- service = new DeploymentScannerImpl(context);
- context.registerService(DeploymentScanner.class.getName(), service, null);
-
- service.start();
- }
-
- public void stop(BundleContext context)
- {
- if (service != null)
- {
- service.stop();
- service = null;
- }
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-27 20:44:18 UTC (rev 89477)
@@ -56,6 +56,7 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.ServiceTracker;
/**
* An OSGi Service the gives access to the Kernel.
@@ -150,22 +151,63 @@
void start()
{
- // Get the required MBeanServer
- MBeanServer mbeanServer = getMBeanServer();
+ final MicrocontainerService mcService = this;
+
+ final Kernel kernel = getKernel();
+ final KernelController controller = kernel.getController();
+
+ // Preregister some beans
+ installBean(controller, BEAN_SYSTEM_BUNDLE_CONTEXT, context);
+ installBean(controller, BEAN_KERNEL, kernel);
+ installBean(controller, BEAN_KERNEL_CONTROLLER, controller);
+
+ // Register the MicrocontainerServiceMBean
+ ServiceTracker tracker = new ServiceTracker(context, MBeanServer.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ // Install the MBeanServer
+ MBeanServer mbeanServer = (MBeanServer)super.addingService(reference);
+ installBean(controller, BEAN_MBEAN_SERVER, mbeanServer);
+
+ // Deploy the deployer beans
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
+ deployer.deploy(deployersURL);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
- // Preregister some beans
+ // Register the MicrocontainerService
+ log.log(LogService.LOG_DEBUG, "Register MicrocontainerService");
+ context.registerService(MicrocontainerService.class.getName(), mcService, null);
+
+ // Register the MicrocontainerServiceMBean
+ registerMicrocontainerServiceMBean(mbeanServer);
+
+ return mbeanServer;
+ }
+ };
+ tracker.open();
+ }
+
+ void stop()
+ {
+ unregisterMicrocontainerServiceMBean();
+ }
+
+ private void installBean(KernelController controller, String beanName, Object beanImpl)
+ {
try
{
- Kernel kernel = getKernel();
- 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_MBEAN_SERVER, actions, mbeanServer));
-
- URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
- deployer.deploy(deployersURL);
+ controller.install(new PreInstalledControllerContext(beanName, actions, beanImpl));
}
catch (RuntimeException rte)
{
@@ -173,39 +215,18 @@
}
catch (Throwable ex)
{
- throw new IllegalStateException("Cannot register MC bean", ex);
+ throw new IllegalStateException("Cannot register bean: " + beanName, ex);
}
-
- log.log(LogService.LOG_DEBUG, "Register MicrocontainerService");
- context.registerService(MicrocontainerService.class.getName(), this, null);
-
- // Register the MicrocontainerServiceMBean
- registerMicrocontainerServiceMBean(mbeanServer);
}
-
- void stop()
+
+ private void registerMicrocontainerServiceMBean(MBeanServer mbeanServer)
{
- unregisterMicrocontainerServiceMBean(getMBeanServer());
- }
-
- private MBeanServer getMBeanServer()
- {
- ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
- if (sref == null)
- throw new IllegalStateException("No MBeanServer registered");
-
- MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
- return mbeanServer;
- }
-
- private void registerMicrocontainerServiceMBean(MBeanServer server)
- {
// Register the MicrocontainerServiceMBean
try
{
log.log(LogService.LOG_DEBUG, "Register MicrocontainerServiceMBean");
StandardMBean mbean = new StandardMBean(this, MicrocontainerServiceMBean.class);
- server.registerMBean(mbean, MBEAN_MICROCONTAINER_SERVICE);
+ mbeanServer.registerMBean(mbean, MBEAN_MICROCONTAINER_SERVICE);
}
catch (Exception ex)
{
@@ -213,19 +234,24 @@
}
}
- private void unregisterMicrocontainerServiceMBean(MBeanServer server)
+ private void unregisterMicrocontainerServiceMBean()
{
- if (server.isRegistered(MBEAN_MICROCONTAINER_SERVICE))
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref != null)
{
- try
+ MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
+ if (mbeanServer.isRegistered(MBEAN_MICROCONTAINER_SERVICE))
{
- log.log(LogService.LOG_DEBUG, "Unregister MicrocontainerServiceMBean");
- server.unregisterMBean(MBEAN_MICROCONTAINER_SERVICE);
+ try
+ {
+ log.log(LogService.LOG_DEBUG, "Unregister MicrocontainerServiceMBean");
+ mbeanServer.unregisterMBean(MBEAN_MICROCONTAINER_SERVICE);
+ }
+ catch (Exception ex)
+ {
+ log.log(LogService.LOG_ERROR, "Cannot unregister MicrocontainerServiceMBean", ex);
+ }
}
- catch (Exception ex)
- {
- log.log(LogService.LOG_ERROR, "Cannot unregister MicrocontainerServiceMBean", ex);
- }
}
}
Modified: projects/jboss-osgi/trunk/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/pom.xml 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/distribution/pom.xml 2009-05-27 20:44:18 UTC (rev 89477)
@@ -76,7 +76,7 @@
<version>${version}</version>
<type>jdocbook</type>
</dependency>
-
+
<!-- Bundles -->
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
@@ -88,6 +88,10 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-hotdeploy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-jaxb</artifactId>
</dependency>
<dependency>
@@ -144,7 +148,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
-
+
<!-- Felix Dependencies -->
<dependency>
<groupId>org.jboss.osgi</groupId>
@@ -186,7 +190,7 @@
<artifactId>org.apache.felix.metatype</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- Knopflerfish Dependencies -->
<dependency>
<groupId>org.jboss.osgi</groupId>
@@ -208,7 +212,7 @@
<groupId>org.knopflerfish</groupId>
<artifactId>org.knopflerfish.framework</artifactId>
</dependency>
-
+
<!-- izpack -->
<dependency>
<groupId>org.codehaus.izpack</groupId>
Modified: projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties 2009-05-27 20:44:18 UTC (rev 89477)
@@ -11,6 +11,9 @@
org.osgi.framework.storage=${osgi.home}/data/osgi-store
org.osgi.framework.storage.clean=onFirstInit
+# Hot Deployement
+org.jboss.osgi.hotdeploy.scandir=${osgi.home}/bundles
+
# HTTP Service Port
org.osgi.service.http.port=8090
@@ -68,16 +71,6 @@
# Bundles that need to be started automatically
org.jboss.osgi.spi.framework.autoStart=\
file://${osgi.home}/bundles/org.apache.felix.log.jar \
- file://${osgi.home}/bundles/jboss-osgi-apache-xerces.jar \
- file://${osgi.home}/bundles/jboss-osgi-common-core.jar \
- file://${osgi.home}/bundles/jboss-osgi-jaxb.jar \
- file://${osgi.home}/bundles/jboss-osgi-xml-binding.jar \
file://${osgi.home}/bundles/jboss-osgi-common.jar \
file://${osgi.home}/bundles/jboss-osgi-logging.jar \
- file://${osgi.home}/bundles/jboss-osgi-jndi.jar \
- file://${osgi.home}/bundles/jboss-osgi-jmx.jar \
- file://${osgi.home}/bundles/jboss-osgi-microcontainer.jar \
- file://${osgi.home}/bundles/org.apache.felix.metatype.jar \
- file://${osgi.home}/bundles/org.apache.felix.configadmin.jar \
- file://${osgi.home}/bundles/org.apache.felix.http.jetty.jar \
- file://${osgi.home}/bundles/jboss-osgi-webconsole.jar
+ file://${osgi.home}/bundles/jboss-osgi-hotdeploy.jar
Modified: projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml 2009-05-27 20:44:18 UTC (rev 89477)
@@ -174,14 +174,15 @@
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="$INSTALL_PATH/runtime/bundles" override="true">
<include name="jboss-osgi-apache-xerces.jar" />
<include name="jboss-osgi-jaxb.jar" />
- <include name="jboss-osgi-xml-binding.jar" />
<include name="jboss-osgi-common-core.jar" />
<include name="jboss-osgi-common.jar" />
<include name="jboss-osgi-logging.jar" />
+ <include name="jboss-osgi-hotdeploy.jar" />
<include name="jboss-osgi-jndi.jar" />
<include name="jboss-osgi-jmx.jar" />
<include name="jboss-osgi-microcontainer.jar" />
<include name="jboss-osgi-webconsole.jar" />
+ <include name="jboss-osgi-xml-binding.jar" />
<include name="org.apache.felix.configadmin.jar" />
<include name="org.apache.felix.http.jetty.jar" />
<include name="org.apache.felix.log.jar" />
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-05-27 17:24:28 UTC (rev 89476)
+++ projects/jboss-osgi/trunk/pom.xml 2009-05-27 20:44:18 UTC (rev 89477)
@@ -52,6 +52,7 @@
<version.jboss.osgi.common>1.0.0.Beta2</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.11</version.jboss.osgi.common.core>
<version.jboss.osgi.deployers>1.0.0.Beta2</version.jboss.osgi.deployers>
+ <version.jboss.osgi.hotdeploy>1.0.0</version.jboss.osgi.hotdeploy>
<version.jboss.osgi.husky>1.0.0</version.jboss.osgi.husky>
<version.jboss.osgi.integration.jbossas>1.0.0.Beta2</version.jboss.osgi.integration.jbossas>
<version.jboss.osgi.jaxb>2.1.10</version.jboss.osgi.jaxb>
@@ -111,6 +112,11 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-hotdeploy</artifactId>
+ <version>${version.jboss.osgi.hotdeploy}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-jmx</artifactId>
<version>${version.jboss.osgi.jmx}</version>
</dependency>
More information about the jboss-cvs-commits
mailing list