JBoss-OSGI SVN: r95752 - projects/jboss-osgi/trunk/reactor/jta.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-29 08:31:04 -0400 (Thu, 29 Oct 2009)
New Revision: 95752
Modified:
projects/jboss-osgi/trunk/reactor/jta/pom.xml
Log:
Use explicit version import
Modified: projects/jboss-osgi/trunk/reactor/jta/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/pom.xml 2009-10-29 12:17:59 UTC (rev 95751)
+++ projects/jboss-osgi/trunk/reactor/jta/pom.xml 2009-10-29 12:31:04 UTC (rev 95752)
@@ -101,11 +101,11 @@
javax.management,
javax.naming,
javax.naming.spi,
- javax.transaction,
+ javax.transaction;version="[1.0,1.2)",
javax.xml.parsers,
org.apache.commons.logging,
- org.jboss.osgi.spi.capability,
- org.jboss.osgi.spi.util,
+ org.jboss.osgi.spi.capability;version="[1.0,1.1)",
+ org.jboss.osgi.spi.util;version="[1.0,1.1)",
org.osgi.framework,
org.w3c.dom,
16 years, 1 month
JBoss-OSGI SVN: r95751 - projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-matrix-jbossmc.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-29 08:17:59 -0400 (Thu, 29 Oct 2009)
New Revision: 95751
Modified:
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-matrix-jbossmc/config.xml
Log:
Drop jdk1.5 support
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-matrix-jbossmc/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-matrix-jbossmc/config.xml 2009-10-29 12:13:06 UTC (rev 95750)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/jbossosgi-matrix-jbossmc/config.xml 2009-10-29 12:17:59 UTC (rev 95751)
@@ -45,15 +45,8 @@
<string>jboss600</string>
</values>
</axis>
- <axis>
- <name>jdk</name>
- <values>
- <string>jdk1.6</string>
- <string>jdk1.5</string>
- </values>
- </axis>
</axes>
- <combinationFilter>!((container=='jboss600' || container=='jboss520') && jdk=='jdk1.5')</combinationFilter>
+ <jdk>jdk1.6</jdk>
<builders>
<hudson.tasks.Shell>
<command>
16 years, 1 month
JBoss-OSGI SVN: r95750 - projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-29 08:13:06 -0400 (Thu, 29 Oct 2009)
New Revision: 95750
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-felix.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
Log:
Remove ManagedFramework bean
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-10-29 12:08:18 UTC (rev 95749)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-10-29 12:13:06 UTC (rev 95750)
@@ -76,14 +76,6 @@
</property>
</bean>
- <!-- The Framework Management -->
- <bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFrameworkImpl">
- <constructor>
- <parameter><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></parameter>
- <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
- </constructor>
- </bean>
-
<!--
********************************
* *
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-10-29 12:08:18 UTC (rev 95749)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-10-29 12:13:06 UTC (rev 95750)
@@ -99,14 +99,6 @@
</property>
</bean>
- <!-- The Framework Management -->
- <bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFrameworkImpl">
- <constructor>
- <parameter><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></parameter>
- <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
- </constructor>
- </bean>
-
<!--
********************************
* *
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-10-29 12:08:18 UTC (rev 95749)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-10-29 12:13:06 UTC (rev 95750)
@@ -200,11 +200,4 @@
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiManagedFramework" class="org.jboss.osgi.spi.management.ManagedFrameworkImpl">
- <constructor>
- <parameter><inject bean="OSGiBundleManager" property="bundleContext"/></parameter>
- <parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
- </constructor>
- </bean>
-
</deployment>
\ No newline at end of file
16 years, 1 month
JBoss-OSGI SVN: r95744 - in projects/jboss-osgi/trunk: reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-29 06:54:08 -0400 (Thu, 29 Oct 2009)
New Revision: 95744
Added:
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java
Removed:
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-felix-all.properties
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
Log:
Fix jbossmc runtime regression
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2009-10-29 10:36:54 UTC (rev 95743)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2009-10-29 10:54:08 UTC (rev 95744)
@@ -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>${osgi.server.home}/data/ObjectStore</value></entry>
</map>
</property>
<incallback method="addPlugin" />
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-felix-all.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-felix-all.properties 2009-10-29 10:36:54 UTC (rev 95743)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-felix-all.properties 2009-10-29 10:54:08 UTC (rev 95744)
@@ -25,6 +25,9 @@
org.jboss.osgi.husky.runtime.connector.host=${jboss.bind.address}
org.jboss.osgi.husky.runtime.connector.port=5401
+# JTA ObjectStore
+com.arjuna.ats.arjuna.objectstore.objectStoreDir=${osgi.server.home}/data/ObjectStore
+
# Extra System Packages
org.osgi.framework.system.packages.extra=\
org.apache.log4j;version=1.2, \
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-10-29 10:36:54 UTC (rev 95743)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-10-29 10:54:08 UTC (rev 95744)
@@ -37,7 +37,6 @@
import javax.naming.Reference;
import javax.naming.StringRefAddr;
-import org.jboss.osgi.spi.management.ManagedBundleService;
import org.jboss.osgi.spi.management.ManagedFramework;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -78,10 +77,6 @@
context.registerService(ManagedFramework.class.getName(), managedFramework, null);
managedFramework.start();
- // Register the ManagedBundleService
- ManagedBundleService managedBundleService = new ManagedBundleServiceImpl(sysContext, mbeanServer);
- context.registerService(ManagedBundleService.class.getName(), managedBundleService, null);
-
jmxHost = context.getProperty(REMOTE_JMX_HOST);
if (jmxHost == null)
jmxHost = "localhost";
Deleted: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java 2009-10-29 10:36:54 UTC (rev 95743)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java 2009-10-29 10:54:08 UTC (rev 95744)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jmx.internal;
-
-//$Id$
-
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.osgi.spi.management.ManagedBundle;
-import org.jboss.osgi.spi.management.ManagedBundleService;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.util.tracker.BundleTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A service that registers an MBeanServer
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public class ManagedBundleServiceImpl implements ManagedBundleService
-{
- // Provide logging
- private Logger log = LoggerFactory.getLogger(ManagedBundleServiceImpl.class);
-
- private MBeanServer mbeanServer;
-
- public ManagedBundleServiceImpl(BundleContext context, MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
-
- // Start tracking bundles
- ManagedBundleTracker bundleTracker = new ManagedBundleTracker(context);
- bundleTracker.open();
- }
-
- public ManagedBundle register(Bundle bundle)
- {
- try
- {
- ManagedBundle mb = new ManagedBundle(bundle);
- ObjectName oname = mb.getObjectName();
-
- if (mbeanServer.isRegistered(oname) == false)
- {
- log.debug("Register managed bundle: " + oname);
- mbeanServer.registerMBean(mb, oname);
- }
-
- return mb;
- }
- catch (JMException ex)
- {
- log.error("Cannot register managed bundle", ex);
- return null;
- }
- }
-
- public void unregister(Bundle bundle)
- {
- try
- {
- ManagedBundle mb = new ManagedBundle(bundle);
- ObjectName oname = mb.getObjectName();
-
- log.debug("Unregister managed bundle: " + oname);
- if (mbeanServer.isRegistered(oname))
- mbeanServer.unregisterMBean(oname);
-
- }
- catch (JMException ex)
- {
- log.error("Cannot register managed bundle", ex);
- }
- }
-
- class ManagedBundleTracker extends BundleTracker
- {
- ManagedBundleTracker(BundleContext context)
- {
- super(context, Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE | Bundle.UNINSTALLED, null);
- }
-
- @Override
- public Object addingBundle(Bundle bundle, BundleEvent event)
- {
- Object retObject = super.addingBundle(bundle, event);
- register(bundle);
- return retObject;
- }
-
- @Override
- public void removedBundle(Bundle bundle, BundleEvent event, Object object)
- {
- unregister(bundle);
- super.removedBundle(bundle, event, object);
- }
- }
-}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java 2009-10-29 10:54:08 UTC (rev 95744)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jmx.internal;
+
+//$Id$
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.spi.management.ManagedBundle;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.util.tracker.BundleTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Track and register/unregister bundles with the MBeanServer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 29-Oct-2009
+ */
+public class ManagedBundleTracker extends BundleTracker
+{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(ManagedBundleTracker.class);
+
+ private MBeanServer mbeanServer;
+
+ public ManagedBundleTracker(BundleContext context, MBeanServer mbeanServer)
+ {
+ super(context, Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE | Bundle.UNINSTALLED, null);
+ this.mbeanServer = mbeanServer;
+ }
+
+ @Override
+ public Object addingBundle(Bundle bundle, BundleEvent event)
+ {
+ Object retObject = super.addingBundle(bundle, event);
+ register(bundle);
+ return retObject;
+ }
+
+ @Override
+ public void modifiedBundle(Bundle bundle, BundleEvent event, Object object)
+ {
+ if (event != null && event.getType() == BundleEvent.UNINSTALLED)
+ unregister(bundle);
+ }
+
+ private ManagedBundle register(Bundle bundle)
+ {
+ try
+ {
+ ManagedBundle mb = new ManagedBundle(bundle);
+ ObjectName oname = mb.getObjectName();
+
+ if (mbeanServer.isRegistered(oname) == false)
+ {
+ log.debug("Register managed bundle: " + oname);
+ mbeanServer.registerMBean(mb, oname);
+ }
+
+ return mb;
+ }
+ catch (JMException ex)
+ {
+ log.error("Cannot register managed bundle", ex);
+ return null;
+ }
+ }
+
+ private void unregister(Bundle bundle)
+ {
+ try
+ {
+ ManagedBundle mb = new ManagedBundle(bundle);
+ ObjectName oname = mb.getObjectName();
+
+ if (mbeanServer.isRegistered(oname))
+ {
+ log.debug("Unregister managed bundle: " + oname);
+ mbeanServer.unregisterMBean(oname);
+ }
+
+ }
+ catch (JMException ex)
+ {
+ log.error("Cannot register managed bundle", ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleTracker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-29 10:36:54 UTC (rev 95743)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-29 10:54:08 UTC (rev 95744)
@@ -40,6 +40,7 @@
import javax.management.QueryExp;
import javax.management.StandardMBean;
+import org.jboss.osgi.spi.management.ManagedBundle;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.ManagedServiceReference;
import org.jboss.osgi.spi.management.ObjectNameFactory;
@@ -63,25 +64,28 @@
final Logger log = LoggerFactory.getLogger(ManagedFrameworkImpl.class);
private MBeanServer mbeanServer;
- private BundleContext bundleContext;
+ private BundleContext context;
+ private ManagedBundleTracker bundleTracker;
- public ManagedFrameworkImpl(BundleContext bundleContext, MBeanServer mbeanServer)
+ public ManagedFrameworkImpl(BundleContext context, MBeanServer mbeanServer)
{
- if (bundleContext == null)
+ if (context == null)
throw new IllegalArgumentException("Null BundleContext");
- this.bundleContext = bundleContext;
-
if (mbeanServer == null)
throw new IllegalArgumentException("Null MBeanServer");
+
+ if (context.getBundle().getBundleId() != 0)
+ throw new IllegalArgumentException("Not the system bundle context: " + context);
+
+ this.context = context;
this.mbeanServer = mbeanServer;
-
- if (bundleContext.getBundle().getBundleId() != 0)
- throw new IllegalArgumentException("Not the system bundle context: " + bundleContext);
+
+ this.bundleTracker = new ManagedBundleTracker(context, mbeanServer);
}
public BundleContext getBundleContext()
{
- return bundleContext;
+ return context;
}
@SuppressWarnings("unchecked")
@@ -207,6 +211,9 @@
public void start()
{
+ // Start tracking the bundles
+ bundleTracker.open();
+
try
{
if (mbeanServer != null)
@@ -241,7 +248,7 @@
public boolean apply(ObjectName name)
{
- return name.getKeyProperty("bundle") != null;
+ return name.getKeyProperty(ManagedBundle.PROPERTY_SYMBOLIC_NAME) != null;
}
public void setMBeanServer(MBeanServer server)
16 years, 1 month
JBoss-OSGI SVN: r95739 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-29 05:35:47 -0400 (Thu, 29 Oct 2009)
New Revision: 95739
Removed:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleService.java
Log:
Remove ManagedBundleService
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleService.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleService.java 2009-10-29 09:35:24 UTC (rev 95738)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleService.java 2009-10-29 09:35:47 UTC (rev 95739)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi.management;
-
-//$Id$
-
-import org.osgi.framework.Bundle;
-
-
-/**
- * A Service that registers/unregisters the management view
- * of a bundle.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 29-May-2009
- */
-public interface ManagedBundleService
-{
- /**
- * Register a managed bundle
- */
- ManagedBundle register(Bundle bundle);
-
- /**
- * Unregister a managed bundle
- */
- void unregister(Bundle bundle);
-}
\ No newline at end of file
16 years, 1 month
JBoss-OSGI SVN: r95736 - in projects/jboss-osgi: trunk/distribution/installer/src/main/resources/installer and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-29 05:20:49 -0400 (Thu, 29 Oct 2009)
New Revision: 95736
Added:
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedServiceReference.java
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/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/deployers/WebXMLVerifierInterceptor.java
projects/jboss-osgi/trunk/reactor/jmx/pom.xml
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java
projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
Log:
[JBOSGI-125] Add ManagedFramework service
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -23,13 +23,14 @@
//$Id$
+import static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
+
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.management.ObjectName;
-import org.jboss.osgi.spi.OSGiConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
@@ -42,19 +43,33 @@
*/
public class ManagedBundle implements ManagedBundleMBean
{
+ public static final String PROPERTY_ID = "id";
+ public static final String PROPERTY_SYMBOLIC_NAME = "sname";
+ public static final String PROPERTY_VERSION = "version";
+
private Bundle bundle;
private ObjectName oname;
public ManagedBundle(Bundle bundle)
{
this.bundle = bundle;
-
+ this.oname = getObjectName(bundle);
+ }
+
+ public static ObjectName getObjectName(Bundle bundle)
+ {
long id = bundle.getBundleId();
- String name = bundle.getSymbolicName();
+ String symbolicName = bundle.getSymbolicName();
Version version = bundle.getVersion();
- this.oname = ObjectNameFactory.create(OSGiConstants.DOMAIN_NAME + ":id=" + id + ",bundle=" + name + ",version=" + version);
+ return getObjectName(id, symbolicName, version);
}
+ public static ObjectName getObjectName(long id, String sname, Version version)
+ {
+ String oname = DOMAIN_NAME + ":" + PROPERTY_ID + "=" + id + "," + PROPERTY_SYMBOLIC_NAME + "=" + sname + "," + PROPERTY_VERSION + "=" + version;
+ return ObjectNameFactory.create(oname);
+ }
+
public ObjectName getObjectName()
{
return oname;
@@ -86,7 +101,7 @@
Hashtable<String, String> retHeaders = new Hashtable<String, String>();
Dictionary bundleHeaders = bundle.getHeaders();
Enumeration keys = bundleHeaders.keys();
- while(keys.hasMoreElements())
+ while (keys.hasMoreElements())
{
String key = (String)keys.nextElement();
String value = (String)bundleHeaders.get(key);
@@ -94,7 +109,7 @@
}
return retHeaders;
}
-
+
public void start() throws BundleException
{
bundle.start();
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -23,217 +23,49 @@
//$Id$
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
-import javax.management.JMException;
-import javax.management.MBeanServer;
import javax.management.ObjectName;
-import javax.management.QueryExp;
-import org.jboss.osgi.spi.OSGiConstants;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* The managed view of an OSGi Framework
*
* @author thomas.diesler(a)jboss.com
* @since 04-Mar-2009
*/
-public class ManagedFramework implements ManagedFrameworkMBean
+public interface ManagedFramework
{
- // Provide logging
- final Logger log = LoggerFactory.getLogger(ManagedFramework.class);
-
- private MBeanServer mbeanServer;
- private BundleContext bundleContext;
-
- public ManagedFramework(BundleContext bundleContext, MBeanServer mbeanServer)
- {
- if (bundleContext == null)
- throw new IllegalArgumentException("Null BundleContext");
- this.bundleContext = bundleContext;
-
- if (mbeanServer == null)
- throw new IllegalArgumentException("Null MBeanServer");
- this.mbeanServer = mbeanServer;
-
- if (bundleContext.getBundle().getBundleId() != 0)
- throw new IllegalArgumentException ("Not the system bundle context: " + bundleContext);
- }
-
- public BundleContext getBundleContext()
- {
- return bundleContext;
- }
-
- @SuppressWarnings("unchecked")
- public ObjectName getBundle(String symbolicName, String version)
- {
- ObjectName oname = null;
-
- ObjectName pattern = ObjectNameFactory.create(OSGiConstants.DOMAIN_NAME + ":bundle=" + symbolicName + ",*");
- Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
-
- if (names.size() > 0)
- {
- // [TODO] Support bundle version
- if (names.size() > 1)
- throw new IllegalArgumentException("Multiple bundles found: " + names);
-
- oname = names.iterator().next();
- }
-
- return oname;
- }
-
- @SuppressWarnings("unchecked")
- public ObjectName getBundle(long bundleId)
- {
- ObjectName oname = null;
-
- ObjectName pattern = ObjectNameFactory.create(OSGiConstants.DOMAIN_NAME + ":id=" + bundleId + ",*");
- Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
-
- if (names.size() > 0)
- oname = names.iterator().next();
-
- return oname;
- }
-
- @SuppressWarnings("unchecked")
- public Set<ObjectName> getBundles()
- {
- // [JBAS-6571] JMX filtering does not work with wildcards
- // ObjectName pattern = ObjectNameFactory.create(Constants.DOMAIN_NAME + ":bundle=*,*");
- // Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
-
- ObjectName pattern = ObjectNameFactory.create(OSGiConstants.DOMAIN_NAME + ":*");
- Set<ObjectName> names = mbeanServer.queryNames(pattern, new IsBundleQueryExp());
- return names;
- }
-
- public ManagedServiceReference getServiceReference(String clazz)
- {
- ServiceReference sref = getBundleContext().getServiceReference(clazz);
- if (sref == null)
- return null;
-
- Map<String, Object> props = new HashMap<String, Object>();
- for (String key : sref.getPropertyKeys())
- {
- props.put(key, sref.getProperty(key));
- }
-
- return new ManagedServiceReference(props);
- }
-
- public ManagedServiceReference[] getServiceReferences(String clazz, String filter)
- {
- List<ManagedServiceReference> foundRefs = new ArrayList<ManagedServiceReference>();
-
- ServiceReference[] srefs;
- try
- {
- srefs = getBundleContext().getServiceReferences(clazz, filter);
- }
- catch (InvalidSyntaxException e)
- {
- throw new IllegalArgumentException("Invalid filter syntax: " + filter);
- }
-
- if (srefs != null)
- {
- for (ServiceReference sref : srefs)
- {
- Map<String, Object> props = new HashMap<String, Object>();
- for (String key : sref.getPropertyKeys())
- props.put(key, sref.getProperty(key));
-
- foundRefs.add(new ManagedServiceReference(props));
- }
- }
-
- ManagedServiceReference[] manrefs = null;
- if (foundRefs.size() > 0)
- manrefs = foundRefs.toArray(new ManagedServiceReference[foundRefs.size()]);
-
- return manrefs;
- }
-
- public void refreshPackages(String[] symbolicNames)
- {
- ServiceReference sref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
- if (sref != null)
- {
- PackageAdmin service = (PackageAdmin)getBundleContext().getService(sref);
-
- Bundle[] bundles = null;
- if (symbolicNames != null)
- {
- List<String> nameList = Arrays.asList(symbolicNames);
- Set<Bundle> bundleSet = new HashSet<Bundle>();
- for (Bundle bundle : getBundleContext().getBundles())
- {
- if (nameList.contains(bundle.getSymbolicName()))
- bundleSet.add(bundle);
- }
- bundles = new Bundle[bundleSet.size()];
- bundleSet.toArray(bundles);
- }
- service.refreshPackages(bundles);
- }
- }
-
- public void start()
- {
- try
- {
- if (mbeanServer != null)
- mbeanServer.registerMBean(this, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
- }
- catch (JMException ex)
- {
- log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
- }
- }
-
- public void stop()
- {
- try
- {
- if (mbeanServer != null && mbeanServer.isRegistered(MBEAN_MANAGED_FRAMEWORK))
- mbeanServer.unregisterMBean(ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
- }
- catch (JMException ex)
- {
- log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
- }
- }
-
- // Accept names like "jboss.osgi:bundle=*"
- static class IsBundleQueryExp implements QueryExp
- {
- private static final long serialVersionUID = 1L;
-
- public boolean apply(ObjectName name)
- {
- return name.getKeyProperty("bundle") != null;
- }
-
- public void setMBeanServer(MBeanServer server)
- {
- }
- }
+ /**
+ * Get the list of all installed bundles
+ */
+ Set<ObjectName> getBundles();
+
+ /**
+ * Get the installed bundle
+ */
+ ObjectName getBundle(String symbolicName, String version);
+
+ /**
+ * Get the installed bundle
+ */
+ ObjectName getBundle(long bundleId);
+
+ /**
+ * Returns a ServiceReference object for a service that implements and was registered
+ * under the specified class.
+ */
+ ManagedServiceReference getServiceReference(String clazz);
+
+ /**
+ * Returns an array of ManagedServiceReference objects.
+ * The returned array of ManagedServiceReference objects contains services
+ * that were registered under the specified class, match the specified filter criteria,
+ * and the packages for the class names under which the services were registered.
+ */
+ ManagedServiceReference[] getServiceReferences(String clazz, String filter);
+
+ /**
+ * Refresh packages through the PackageAdmin service
+ */
+ void refreshPackages(ObjectName[] bundles);
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -23,8 +23,6 @@
//$Id$
-import java.util.Set;
-
import javax.management.ObjectName;
/**
@@ -33,42 +31,9 @@
* @author thomas.diesler(a)jboss.com
* @since 04-Mar-2009
*/
-public interface ManagedFrameworkMBean
+public interface ManagedFrameworkMBean extends ManagedFramework
{
/** The default object name: jboss.osgi:service=ManagedFramework */
ObjectName MBEAN_MANAGED_FRAMEWORK = ObjectNameFactory.create("jboss.osgi:service=ManagedFramework");
- /**
- * Get the list of all installed bundles
- */
- Set<ObjectName> getBundles();
-
- /**
- * Get the installed bundle
- */
- ObjectName getBundle(String symbolicName, String version);
-
- /**
- * Get the installed bundle
- */
- ObjectName getBundle(long bundleId);
-
- /**
- * Returns a ServiceReference object for a service that implements and was registered
- * under the specified class.
- */
- ManagedServiceReference getServiceReference(String clazz);
-
- /**
- * Returns an array of ManagedServiceReference objects.
- * The returned array of ManagedServiceReference objects contains services
- * that were registered under the specified class, match the specified filter criteria,
- * and the packages for the class names under which the services were registered.
- */
- ManagedServiceReference[] getServiceReferences(String clazz, String filter);
-
- /**
- * Refresh packages through the PackageAdmin service
- */
- void refreshPackages(String[] symbolicNames);
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedServiceReference.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedServiceReference.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedServiceReference.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -39,7 +39,7 @@
private Map<String, Object> props;
- ManagedServiceReference(Map<String, Object> props)
+ public ManagedServiceReference(Map<String, Object> props)
{
this.props = props;
}
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-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2009-10-29 09:20:49 UTC (rev 95736)
@@ -145,6 +145,7 @@
<include name="jboss-osgi-jaxb-sources.jar" />
<include name="jboss-osgi-jmx-sources.jar" />
<include name="jboss-osgi-jndi-sources.jar" />
+ <include name="jboss-osgi-jta-sources.jar" />
<include name="jboss-osgi-microcontainer-sources.jar" />
<include name="jboss-osgi-runtime-equinox-sources.jar" />
<include name="jboss-osgi-runtime-felix-sources.jar" />
@@ -238,6 +239,7 @@
<include name="jboss-osgi-apache-xerces.jar" />
<include name="jboss-osgi-blueprint.jar" />
<include name="jboss-osgi-jaxb.jar" />
+ <include name="jboss-osgi-jta.jar" />
<include name="jboss-osgi-xml-binding.jar" />
</fileset>
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-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-10-29 09:20:49 UTC (rev 95736)
@@ -77,7 +77,7 @@
</bean>
<!-- The Framework Management -->
- <bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
+ <bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFrameworkImpl">
<constructor>
<parameter><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></parameter>
<parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
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-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-10-29 09:20:49 UTC (rev 95736)
@@ -100,7 +100,7 @@
</bean>
<!-- The Framework Management -->
- <bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
+ <bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFrameworkImpl">
<constructor>
<parameter><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></parameter>
<parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
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-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-10-29 09:20:49 UTC (rev 95736)
@@ -200,7 +200,7 @@
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
+ <bean name="OSGiManagedFramework" class="org.jboss.osgi.spi.management.ManagedFrameworkImpl">
<constructor>
<parameter><inject bean="OSGiBundleManager" property="bundleContext"/></parameter>
<parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -34,11 +34,10 @@
import javax.management.MBeanServer;
import javax.management.StandardMBean;
-import org.jboss.osgi.deployment.deployer.DeployerService;
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.management.ManagedBundleService;
import org.jboss.osgi.spi.util.ExportedPackageHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -107,8 +106,6 @@
String location = dep.getLocation().toExternalForm();
Bundle bundle = context.installBundle(location);
- registerManagedBundle(bundle);
-
bundleMap.put(dep, bundle);
if (dep.isAutoStart())
resolvableBundles.add(bundle);
@@ -183,7 +180,6 @@
registry.unregisterDeployment(dep);
- unregisterManagedBundle(bundle);
bundle.uninstall();
}
else
@@ -234,34 +230,6 @@
return bundle;
}
- private void registerManagedBundle(Bundle bundle)
- {
- ServiceReference sref = context.getServiceReference(ManagedBundleService.class.getName());
- if (sref != null)
- {
- ManagedBundleService service = (ManagedBundleService)context.getService(sref);
- service.register(bundle);
- }
- else
- {
- log.debug( "No ManagedBundleService. Cannot register managed bundle: " + bundle);
- }
- }
-
- private void unregisterManagedBundle(Bundle bundle)
- {
- ServiceReference sref = context.getServiceReference(ManagedBundleService.class.getName());
- if (sref != null)
- {
- ManagedBundleService service = (ManagedBundleService)context.getService(sref);
- service.unregister(bundle);
- }
- else
- {
- log.debug( "No ManagedBundleService. Cannot unregister managed bundle: " + bundle);
- }
- }
-
private DeploymentRegistryService getDeploymentRegistry()
{
ServiceReference sref = context.getServiceReference(DeploymentRegistryService.class.getName());
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/deployers/WebXMLVerifierInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/deployers/WebXMLVerifierInterceptor.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/deployers/WebXMLVerifierInterceptor.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -48,13 +48,15 @@
VirtualFile root = context.getRoot();
VirtualFile webXML = root.getChild("/WEB-INF/web.xml");
if (root.getName().endsWith(".war") && webXML == null)
- {
throw new LifecycleInterceptorException("Cannot obtain web.xml from: " + root.toURL());
- }
}
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
catch (Exception ex)
{
- throw new LifecycleInterceptorException("Cannot parse web.xml", ex);
+ throw new LifecycleInterceptorException("Cannot check for web.xml", ex);
}
}
}
Modified: projects/jboss-osgi/trunk/reactor/jmx/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/pom.xml 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/jmx/pom.xml 2009-10-29 09:20:49 UTC (rev 95736)
@@ -86,8 +86,12 @@
<!-- osgi -->
org.osgi.framework;version=1.4,
org.osgi.service.log,
+ org.osgi.service.packageadmin,
org.osgi.util.tracker,
+ <!-- logging -->
+ org.slf4j,
+
<!-- FIXME optional -->
org.jboss.osgi.jndi,
org.jboss.net.sockets,
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -37,9 +37,9 @@
import javax.management.remote.JMXServiceURL;
import org.jboss.net.sockets.DefaultSocketFactory;
-import org.jboss.osgi.common.log.LogServiceTracker;
import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A Service Activator that registers an MBeanServer
@@ -49,7 +49,9 @@
*/
public class JMXConnectorService
{
- private LogService log;
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(JMXConnectorService.class);
+
private JMXServiceURL serviceURL;
private JMXConnectorServer jmxConnectorServer;
private boolean shutdownRegistry;
@@ -57,18 +59,16 @@
public JMXConnectorService(BundleContext context, MBeanServer mbeanServer, String host, int rmiPort) throws IOException
{
- log = new LogServiceTracker(context);
-
// check to see if registry already created
rmiRegistry = LocateRegistry.getRegistry(host, rmiPort);
try
{
rmiRegistry.list();
- log.log(LogService.LOG_DEBUG, "RMI registry running at host=" + host + ",port=" + rmiPort);
+ log.debug("RMI registry running at host=" + host + ",port=" + rmiPort);
}
catch (RemoteException e)
{
- log.log(LogService.LOG_DEBUG, "No RMI registry running at host=" + host + ",port=" + rmiPort + ". Will create one.");
+ log.debug("No RMI registry running at host=" + host + ",port=" + rmiPort + ". Will create one.");
rmiRegistry = LocateRegistry.createRegistry(rmiPort, null, new DefaultSocketFactory(InetAddress.getByName(host)));
shutdownRegistry = true;
}
@@ -77,7 +77,7 @@
serviceURL = getServiceURL(host, rmiPort);
jmxConnectorServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, null, mbeanServer);
- log.log(LogService.LOG_DEBUG, "JMXConnectorServer created: " + serviceURL);
+ log.debug("JMXConnectorServer created: " + serviceURL);
}
static JMXServiceURL getServiceURL(String host, int rmiPort)
@@ -102,11 +102,11 @@
jmxConnectorServer.start();
- log.log(LogService.LOG_DEBUG, "JMXConnectorServer started: " + serviceURL);
+ log.debug("JMXConnectorServer started: " + serviceURL);
}
catch (IOException ex)
{
- log.log(LogService.LOG_ERROR, "Cannot start JMXConnectorServer", ex);
+ log.error("Cannot start JMXConnectorServer", ex);
}
finally
{
@@ -126,15 +126,15 @@
// Shutdown the registry if this service created it
if (shutdownRegistry == true)
{
- log.log(LogService.LOG_DEBUG, "Shutdown RMI registry");
+ log.debug("Shutdown RMI registry");
UnicastRemoteObject.unexportObject(rmiRegistry, true);
}
- log.log(LogService.LOG_DEBUG, "JMXConnectorServer stopped");
+ log.debug("JMXConnectorServer stopped");
}
catch (IOException ex)
{
- log.log(LogService.LOG_WARNING, "Cannot stop JMXConnectorServer", ex);
+ log.warn("Cannot stop JMXConnectorServer", ex);
}
finally
{
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -37,15 +37,14 @@
import javax.naming.Reference;
import javax.naming.StringRefAddr;
-import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.spi.management.ManagedBundleService;
import org.jboss.osgi.spi.management.ManagedFramework;
-import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A BundleActivator for the MBeanServer related services
@@ -55,20 +54,18 @@
*/
public class JMXServiceActivator implements BundleActivator
{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(JMXServiceActivator.class);
+
private JMXConnectorService jmxConnector;
private String jmxHost;
private String jmxRmiPort;
private String rmiAdaptorPath;
private MBeanServer mbeanServer;
- private ManagedFramework managedFramework;
- private ManagedBundleService managedBundleService;
+ private ManagedFrameworkImpl managedFramework;
- private LogService log;
-
public void start(BundleContext context)
{
- log = new LogServiceTracker(context);
-
// Register the MBeanServer
MBeanServerService service = new MBeanServerService(context);
mbeanServer = service.registerMBeanServer();
@@ -76,18 +73,14 @@
// Get the system BundleContext
BundleContext sysContext = context.getBundle(0).getBundleContext();
- // Register the ManagedBundleService
- managedBundleService = new ManagedBundleServiceImpl(sysContext, mbeanServer);
- context.registerService(ManagedBundleService.class.getName(), managedBundleService, null);
- log.log(LogService.LOG_DEBUG, "ManagedBundleService registered");
-
// Register the ManagedFramework
- managedFramework = new ManagedFramework(sysContext, mbeanServer);
+ managedFramework = new ManagedFrameworkImpl(sysContext, mbeanServer);
+ context.registerService(ManagedFramework.class.getName(), managedFramework, null);
managedFramework.start();
- // Register all ManagedBundles
- for (Bundle bundle : context.getBundles())
- managedBundleService.register(bundle);
+ // Register the ManagedBundleService
+ ManagedBundleService managedBundleService = new ManagedBundleServiceImpl(sysContext, mbeanServer);
+ context.registerService(ManagedBundleService.class.getName(), managedBundleService, null);
jmxHost = context.getProperty(REMOTE_JMX_HOST);
if (jmxHost == null)
@@ -108,10 +101,6 @@
public void stop(BundleContext context)
{
- // Unregister all ManagedBundles
- for (Bundle bundle : context.getBundles())
- managedBundleService.unregister(bundle);
-
// Unregister the managed framework
managedFramework.stop();
@@ -149,7 +138,7 @@
catch (IOException ex)
{
// Assume that the JMXConnector is already running if we cannot start it
- log.log(LogService.LOG_DEBUG, "Assume JMXConnectorServer already running on: " + serviceURL);
+ log.debug("Assume JMXConnectorServer already running on: " + serviceURL);
}
try
@@ -168,11 +157,11 @@
iniCtx.bind(rmiAdaptorPath, ref);
rmiAdaptorBound = true;
- log.log(LogService.LOG_INFO, "MBeanServerConnection bound to: " + rmiAdaptorPath);
+ log.info("MBeanServerConnection bound to: " + rmiAdaptorPath);
}
catch (NamingException ex)
{
- log.log(LogService.LOG_ERROR, "Cannot bind RMIAdaptor", ex);
+ log.error("Cannot bind RMIAdaptor", ex);
}
}
return iniCtx;
@@ -196,11 +185,11 @@
try
{
iniCtx.unbind(rmiAdaptorPath);
- log.log(LogService.LOG_INFO, "MBeanServerConnection unbound from: " + rmiAdaptorPath);
+ log.info("MBeanServerConnection unbound from: " + rmiAdaptorPath);
}
catch (NamingException ex)
{
- log.log(LogService.LOG_ERROR, "Cannot unbind RMIAdaptor", ex);
+ log.error("Cannot unbind RMIAdaptor", ex);
}
}
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -28,10 +28,10 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
-import org.jboss.osgi.common.log.LogServiceTracker;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A service that registers an MBeanServer
@@ -41,12 +41,13 @@
*/
public class MBeanServerService
{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(MBeanServerService.class);
+
private BundleContext context;
- private LogService log;
public MBeanServerService(BundleContext context)
{
- log = new LogServiceTracker(context);
this.context = context;
}
@@ -60,30 +61,30 @@
if (sref != null)
{
mbeanServer = (MBeanServer)context.getService(sref);
- log.log(LogService.LOG_DEBUG, "Found MBeanServer fom service: " + mbeanServer.getDefaultDomain());
+ log.debug("Found MBeanServer fom service: " + mbeanServer.getDefaultDomain());
return mbeanServer;
}
ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
if (serverArr.size() > 1)
- log.log(LogService.LOG_WARNING, "Multiple MBeanServer instances: " + serverArr);
+ log.warn("Multiple MBeanServer instances: " + serverArr);
if (serverArr.size() > 0)
{
mbeanServer = serverArr.get(0);
- log.log(LogService.LOG_DEBUG, "Found MBeanServer: " + mbeanServer.getDefaultDomain());
+ log.debug("Found MBeanServer: " + mbeanServer.getDefaultDomain());
}
if (mbeanServer == null)
{
- log.log(LogService.LOG_DEBUG, "No MBeanServer, create one ...");
+ log.debug("No MBeanServer, create one ...");
mbeanServer = MBeanServerFactory.createMBeanServer();
}
// Register the MBeanServer
context.registerService(MBeanServer.class.getName(), mbeanServer, null);
- log.log(LogService.LOG_DEBUG, "MBeanServer registered");
-
+ log.debug("MBeanServer registered");
+
return mbeanServer;
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedBundleServiceImpl.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -27,12 +27,14 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.spi.management.ManagedBundle;
import org.jboss.osgi.spi.management.ManagedBundleService;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
+import org.osgi.framework.BundleEvent;
+import org.osgi.util.tracker.BundleTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A service that registers an MBeanServer
@@ -42,13 +44,18 @@
*/
public class ManagedBundleServiceImpl implements ManagedBundleService
{
- private LogService log;
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(ManagedBundleServiceImpl.class);
+
private MBeanServer mbeanServer;
-
+
public ManagedBundleServiceImpl(BundleContext context, MBeanServer mbeanServer)
{
- this.log = new LogServiceTracker(context);
this.mbeanServer = mbeanServer;
+
+ // Start tracking bundles
+ ManagedBundleTracker bundleTracker = new ManagedBundleTracker(context);
+ bundleTracker.open();
}
public ManagedBundle register(Bundle bundle)
@@ -57,18 +64,18 @@
{
ManagedBundle mb = new ManagedBundle(bundle);
ObjectName oname = mb.getObjectName();
-
+
if (mbeanServer.isRegistered(oname) == false)
{
- log.log(LogService.LOG_DEBUG, "Register managed bundle: " + oname);
+ log.debug("Register managed bundle: " + oname);
mbeanServer.registerMBean(mb, oname);
}
-
+
return mb;
}
catch (JMException ex)
{
- log.log(LogService.LOG_ERROR, "Cannot register managed bundle", ex);
+ log.error("Cannot register managed bundle", ex);
return null;
}
}
@@ -79,15 +86,38 @@
{
ManagedBundle mb = new ManagedBundle(bundle);
ObjectName oname = mb.getObjectName();
-
- log.log(LogService.LOG_DEBUG, "Unregister managed bundle: " + oname);
+
+ log.debug("Unregister managed bundle: " + oname);
if (mbeanServer.isRegistered(oname))
mbeanServer.unregisterMBean(oname);
-
+
}
catch (JMException ex)
{
- log.log(LogService.LOG_ERROR, "Cannot register managed bundle", ex);
+ log.error("Cannot register managed bundle", ex);
}
}
+
+ class ManagedBundleTracker extends BundleTracker
+ {
+ ManagedBundleTracker(BundleContext context)
+ {
+ super(context, Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE | Bundle.UNINSTALLED, null);
+ }
+
+ @Override
+ public Object addingBundle(Bundle bundle, BundleEvent event)
+ {
+ Object retObject = super.addingBundle(bundle, event);
+ register(bundle);
+ return retObject;
+ }
+
+ @Override
+ public void removedBundle(Bundle bundle, BundleEvent event, Object object)
+ {
+ unregister(bundle);
+ super.removedBundle(bundle, event, object);
+ }
+ }
}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java (from rev 95390, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jmx.internal;
+
+//$Id$
+
+import static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
+import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_SYMBOLIC_NAME;
+import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_ID;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.QueryExp;
+import javax.management.StandardMBean;
+
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.ManagedServiceReference;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The managed view of an OSGi Framework
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 04-Mar-2009
+ */
+public class ManagedFrameworkImpl implements ManagedFrameworkMBean
+{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(ManagedFrameworkImpl.class);
+
+ private MBeanServer mbeanServer;
+ private BundleContext bundleContext;
+
+ public ManagedFrameworkImpl(BundleContext bundleContext, MBeanServer mbeanServer)
+ {
+ if (bundleContext == null)
+ throw new IllegalArgumentException("Null BundleContext");
+ this.bundleContext = bundleContext;
+
+ if (mbeanServer == null)
+ throw new IllegalArgumentException("Null MBeanServer");
+ this.mbeanServer = mbeanServer;
+
+ if (bundleContext.getBundle().getBundleId() != 0)
+ throw new IllegalArgumentException("Not the system bundle context: " + bundleContext);
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return bundleContext;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ObjectName getBundle(String symbolicName, String version)
+ {
+ ObjectName oname = null;
+
+ ObjectName pattern = ObjectNameFactory.create(DOMAIN_NAME + ":" + PROPERTY_SYMBOLIC_NAME + "=" + symbolicName + ",*");
+ Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
+
+ if (names.size() > 0)
+ {
+ // [TODO] Support bundle version
+ if (names.size() > 1)
+ throw new IllegalArgumentException("Multiple bundles found: " + names);
+
+ oname = names.iterator().next();
+ }
+
+ return oname;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ObjectName getBundle(long bundleId)
+ {
+ ObjectName oname = null;
+
+ ObjectName pattern = ObjectNameFactory.create(DOMAIN_NAME + ":" + PROPERTY_ID + "=" + bundleId + ",*");
+ Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
+
+ if (names.size() > 0)
+ oname = names.iterator().next();
+
+ return oname;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set<ObjectName> getBundles()
+ {
+ // [JBAS-6571] JMX filtering does not work with wildcards
+ // ObjectName pattern = ObjectNameFactory.create(Constants.DOMAIN_NAME + ":sname=*,*");
+ // Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
+
+ ObjectName pattern = ObjectNameFactory.create(DOMAIN_NAME + ":*");
+ Set<ObjectName> names = mbeanServer.queryNames(pattern, new IsBundleQueryExp());
+ return names;
+ }
+
+ public ManagedServiceReference getServiceReference(String clazz)
+ {
+ ServiceReference sref = getBundleContext().getServiceReference(clazz);
+ if (sref == null)
+ return null;
+
+ Map<String, Object> props = new HashMap<String, Object>();
+ for (String key : sref.getPropertyKeys())
+ {
+ props.put(key, sref.getProperty(key));
+ }
+
+ return new ManagedServiceReference(props);
+ }
+
+ public ManagedServiceReference[] getServiceReferences(String clazz, String filter)
+ {
+ List<ManagedServiceReference> foundRefs = new ArrayList<ManagedServiceReference>();
+
+ ServiceReference[] srefs;
+ try
+ {
+ srefs = getBundleContext().getServiceReferences(clazz, filter);
+ }
+ catch (InvalidSyntaxException e)
+ {
+ throw new IllegalArgumentException("Invalid filter syntax: " + filter);
+ }
+
+ if (srefs != null)
+ {
+ for (ServiceReference sref : srefs)
+ {
+ Map<String, Object> props = new HashMap<String, Object>();
+ for (String key : sref.getPropertyKeys())
+ props.put(key, sref.getProperty(key));
+
+ foundRefs.add(new ManagedServiceReference(props));
+ }
+ }
+
+ ManagedServiceReference[] manrefs = null;
+ if (foundRefs.size() > 0)
+ manrefs = foundRefs.toArray(new ManagedServiceReference[foundRefs.size()]);
+
+ return manrefs;
+ }
+
+ public void refreshPackages(ObjectName[] objectNames)
+ {
+ ServiceReference sref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
+ if (sref != null)
+ {
+ PackageAdmin service = (PackageAdmin)getBundleContext().getService(sref);
+
+ Bundle[] bundleArr = null;
+ if (objectNames != null)
+ {
+ List<String> symbolicNames = new ArrayList<String>();
+ for (ObjectName oname : objectNames)
+ symbolicNames.add(oname.getKeyProperty(PROPERTY_SYMBOLIC_NAME));
+
+ Set<Bundle> bundleSet = new HashSet<Bundle>();
+ for (Bundle bundle : getBundleContext().getBundles())
+ {
+ if (symbolicNames.contains(bundle.getSymbolicName()))
+ bundleSet.add(bundle);
+ }
+ bundleArr = new Bundle[bundleSet.size()];
+ bundleSet.toArray(bundleArr);
+ }
+ service.refreshPackages(bundleArr);
+ }
+ }
+
+ public void start()
+ {
+ try
+ {
+ if (mbeanServer != null)
+ {
+ StandardMBean mbean = new StandardMBean(this, ManagedFrameworkMBean.class);
+ mbeanServer.registerMBean(mbean, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
+ }
+ }
+ catch (JMException ex)
+ {
+ log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
+ }
+ }
+
+ public void stop()
+ {
+ try
+ {
+ if (mbeanServer != null && mbeanServer.isRegistered(MBEAN_MANAGED_FRAMEWORK))
+ mbeanServer.unregisterMBean(ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
+ }
+ catch (JMException ex)
+ {
+ log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
+ }
+ }
+
+ // Accept names like "jboss.osgi:id=*"
+ static class IsBundleQueryExp implements QueryExp
+ {
+ private static final long serialVersionUID = 1L;
+
+ public boolean apply(ObjectName name)
+ {
+ return name.getKeyProperty("bundle") != null;
+ }
+
+ public void setMBeanServer(MBeanServer server)
+ {
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java 2009-10-29 09:14:39 UTC (rev 95735)
+++ projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java 2009-10-29 09:20:49 UTC (rev 95736)
@@ -21,11 +21,15 @@
*/
package org.jboss.osgi.testing.internal;
+import javax.management.ObjectName;
+
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.spi.management.ManagedBundle;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.osgi.framework.Version;
/**
* A remote implementation of the {@link OSGiPackageAdmin}
@@ -44,13 +48,17 @@
public void refreshPackages(OSGiBundle[] bundles)
{
- String[] bundleArr = null;
+ ObjectName[] bundleArr = null;
if (bundles != null)
{
- bundleArr = new String[bundles.length];
+ bundleArr = new ObjectName[bundles.length];
for (int i=0; i < bundles.length; i++)
{
- bundleArr[i] = bundles[i].getSymbolicName();
+ OSGiBundle bundle = bundles[i];
+ long id = bundle.getBundleId();
+ String symbolicName = bundle.getSymbolicName();
+ Version version = bundle.getVersion();
+ bundleArr[i] = ManagedBundle.getObjectName(id, symbolicName, version);
}
}
try
16 years, 1 month
JBoss-OSGI SVN: r95711 - projects/jboss-osgi/trunk/testsuite/example.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-28 17:32:23 -0400 (Wed, 28 Oct 2009)
New Revision: 95711
Modified:
projects/jboss-osgi/trunk/testsuite/example/pom.xml
Log:
Exclude JTA for equinox
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-28 21:28:02 UTC (rev 95710)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-28 21:32:23 UTC (rev 95711)
@@ -188,6 +188,7 @@
<exclude>org/jboss/test/osgi/example/interceptor/**</exclude>
<exclude>org/jboss/test/osgi/example/jmx/**</exclude>
<exclude>org/jboss/test/osgi/example/jndi/**</exclude>
+ <exclude>org/jboss/test/osgi/example/jta/**</exclude>
<exclude>org/jboss/test/osgi/example/microcontainer/**</exclude>
<exclude>org/jboss/test/osgi/example/simple/**</exclude>
<exclude>org/jboss/test/osgi/example/webapp/**</exclude>
16 years, 1 month
JBoss-OSGI SVN: r95710 - projects/jboss-osgi/trunk/reactor/jta/src/test/java/org/jboss/test/osgi/jta.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-28 17:28:02 -0400 (Wed, 28 Oct 2009)
New Revision: 95710
Modified:
projects/jboss-osgi/trunk/reactor/jta/src/test/java/org/jboss/test/osgi/jta/UserTransactionTestCase.java
Log:
cleanup
Modified: projects/jboss-osgi/trunk/reactor/jta/src/test/java/org/jboss/test/osgi/jta/UserTransactionTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/test/java/org/jboss/test/osgi/jta/UserTransactionTestCase.java 2009-10-28 21:26:47 UTC (rev 95709)
+++ projects/jboss-osgi/trunk/reactor/jta/src/test/java/org/jboss/test/osgi/jta/UserTransactionTestCase.java 2009-10-28 21:28:02 UTC (rev 95710)
@@ -29,8 +29,6 @@
import org.junit.Test;
-import com.arjuna.common.util.propertyservice.plugins.PropertyManagerIOPlugin;
-
/**
* Test basic JBossTM operations
*
@@ -44,14 +42,5 @@
{
UserTransaction ut = com.arjuna.ats.jta.UserTransaction.userTransaction();
assertNotNull("UserTransaction not null", ut);
-
- /*
- System.out.println("");
- new RuntimeException().printStackTrace(System.out);
- System.out.println("Thread: " + Thread.currentThread() + " - " + Thread.currentThread().getContextClassLoader());
- System.out.println("PropertyManager: " + this);
- System.out.println("PropertyManager: " + getClass().getClassLoader());
- System.out.println("PropertyManagerIOPlugin: " + PropertyManagerIOPlugin.class.getClassLoader());
- */
}
}
16 years, 1 month
JBoss-OSGI SVN: r95709 - projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-28 17:26:47 -0400 (Wed, 28 Oct 2009)
New Revision: 95709
Modified:
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java
Log:
Use target/ObjectStore if it exists
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-10-28 21:23:55 UTC (rev 95708)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java 2009-10-28 21:26:47 UTC (rev 95709)
@@ -23,6 +23,8 @@
//$Id$
+import java.io.File;
+
import javax.transaction.TransactionManager;
import org.jboss.osgi.spi.capability.Capability;
@@ -46,7 +48,8 @@
{
super(TransactionManager.class.getName());
- addSystemProperty(Environment.OBJECTSTORE_DIR, "target/ObjectStore");
+ if (new File("target").exists())
+ addSystemProperty(Environment.OBJECTSTORE_DIR, "target/ObjectStore");
addBundle("bundles/jboss-osgi-jta.jar");
}
16 years, 1 month