JBoss-OSGI SVN: r93479 - projects/jboss-osgi/projects/runtime/microcontainer/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-09-14 10:34:45 -0400 (Mon, 14 Sep 2009)
New Revision: 93479
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
Log:
Add more exact pom info.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-09-14 14:32:07 UTC (rev 93478)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-09-14 14:34:45 UTC (rev 93479)
@@ -108,6 +108,16 @@
</dependency>
<dependency>
<groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ <version>${version.jboss.classloading}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ <version>${version.jboss.classloading}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloading-vfs</artifactId>
<version>${version.jboss.classloading}</version>
</dependency>
16 years, 10 months
JBoss-OSGI SVN: r93476 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2009-09-14 10:00:27 -0400 (Mon, 14 Sep 2009)
New Revision: 93476
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java
Log:
Fix separator.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java 2009-09-14 13:46:48 UTC (rev 93475)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleContextUnitTestCase.java 2009-09-14 14:00:27 UTC (rev 93476)
@@ -29,8 +29,6 @@
import java.util.Locale;
import java.util.Set;
-import junit.framework.Test;
-
import org.jboss.test.osgi.OSGiTestCase;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -488,7 +486,7 @@
File dataFile = bundleContext.getDataFile("blah");
assertNotNull(dataFile);
- assertTrue(dataFile.toString().endsWith("/blah"));
+ assertTrue(dataFile.toString().endsWith(File.separator + "blah"));
}
finally
{
16 years, 10 months
JBoss-OSGI SVN: r93473 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 09:36:52 -0400 (Mon, 14 Sep 2009)
New Revision: 93473
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
Log:
Fix dependency on compendium symbolic name
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-09-14 12:59:02 UTC (rev 93472)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-09-14 13:36:52 UTC (rev 93473)
@@ -98,9 +98,21 @@
{
try
{
+ RemoteBundle bundle = null;
+
// Asume that the compendium is already installed in the remote runtime
- ManagedBundleMBean bundleMBean = getRemoteFramework().getBundle("osgi.cmpn", null);
- RemoteBundle bundle = new RemoteBundle(this, bundleMBean, null);
+ for (ManagedBundleMBean bundleMBean : getRemoteFramework().getBundles())
+ {
+ String symbolicName = bundleMBean.getSymbolicName();
+ if (symbolicName.equals("org.osgi.compendium") || symbolicName.equals("osgi.cmpn"))
+ {
+ bundle = new RemoteBundle(this, bundleMBean, null);
+ }
+ }
+
+ if (bundle == null)
+ throw new BundleException("Cannot obtain compendium");
+
return bundle;
}
catch (RuntimeException rte)
@@ -109,7 +121,7 @@
}
catch (Exception ex)
{
- throw new BundleException("Cannot install compendium", ex);
+ throw new BundleException("Cannot obtain compendium", ex);
}
}
16 years, 10 months
JBoss-OSGI SVN: r93472 - in projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi: testing and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 08:59:02 -0400 (Mon, 14 Sep 2009)
New Revision: 93472
Added:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
Log:
Add LogServiceCapability and Runtime.installCompendium()
Added: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.capability;
+
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.osgi.service.log.LogService;
+
+/**
+ * Adds the OSGi compedium LogService capability to the {@link OSGiRuntime}
+ * under test.
+ *
+ * It is ignored if the {@link LogService} is already registered.
+ *
+ * Installed bundles: org.apache.felix.log.jar, jboss-osgi-common.jar
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 14-Sep-2009
+ */
+public class LogServiceCapability extends Capability
+{
+ public LogServiceCapability()
+ {
+ super(LogService.class.getName());
+ addBundle("bundles/org.apache.felix.log.jar");
+ addBundle("bundles/jboss-osgi-common.jar");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-09-14 12:57:00 UTC (rev 93471)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -59,6 +59,11 @@
OSGiBundle installBundle(String location) throws BundleException;
/**
+ * Install the compedium bundle for this runtime
+ */
+ OSGiBundle installCompendium() throws BundleException;
+
+ /**
* Get the array of installed {@link OSGiBundle}s
*/
OSGiBundle[] getBundles();
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-09-14 12:57:00 UTC (rev 93471)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -87,6 +87,12 @@
return registerBundle(location, bundle);
}
+ public OSGiBundle installCompendium() throws BundleException
+ {
+ String compendiumLocation = System.getProperty("org.osgi.compendium.jar", "bundles/org.osgi.compendium.jar");
+ return installBundle(compendiumLocation);
+ }
+
public OSGiBundle[] getBundles()
{
List<OSGiBundle> absBundles = new ArrayList<OSGiBundle>();
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-09-14 12:57:00 UTC (rev 93471)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -94,6 +94,25 @@
}
}
+ public OSGiBundle installCompendium() throws BundleException
+ {
+ try
+ {
+ // Asume that the compendium is already installed in the remote runtime
+ ManagedBundleMBean bundleMBean = getRemoteFramework().getBundle("osgi.cmpn", null);
+ RemoteBundle bundle = new RemoteBundle(this, bundleMBean, null);
+ return bundle;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot install compendium", ex);
+ }
+ }
+
@Override
public void deploy(String location) throws Exception
{
16 years, 10 months
JBoss-OSGI SVN: r93471 - projects/jboss-osgi/projects/bundles/jndi/trunk/src/main/java/org/jboss/osgi/jndi.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 08:57:00 -0400 (Mon, 14 Sep 2009)
New Revision: 93471
Modified:
projects/jboss-osgi/projects/bundles/jndi/trunk/src/main/java/org/jboss/osgi/jndi/JNDICapability.java
Log:
Add dependency on LogServiceCapability
Modified: projects/jboss-osgi/projects/bundles/jndi/trunk/src/main/java/org/jboss/osgi/jndi/JNDICapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jndi/trunk/src/main/java/org/jboss/osgi/jndi/JNDICapability.java 2009-09-14 12:56:20 UTC (rev 93470)
+++ projects/jboss-osgi/projects/bundles/jndi/trunk/src/main/java/org/jboss/osgi/jndi/JNDICapability.java 2009-09-14 12:57:00 UTC (rev 93471)
@@ -26,6 +26,7 @@
import javax.naming.InitialContext;
import org.jboss.osgi.spi.capability.Capability;
+import org.jboss.osgi.spi.capability.LogServiceCapability;
import org.jboss.osgi.spi.testing.OSGiRuntime;
/**
@@ -58,6 +59,8 @@
addSystemProperty("org.jboss.osgi.jndi.rmi.port", "1198");
addSystemProperty("org.jboss.osgi.jndi.port", "1199");
+ addDependency(new LogServiceCapability());
+
addBundle("bundles/jboss-osgi-common-core.jar");
addBundle("bundles/jboss-osgi-jndi.jar");
}
16 years, 10 months
JBoss-OSGI SVN: r93470 - in projects/jboss-osgi/trunk: reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container and 9 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 08:56:20 -0400 (Mon, 14 Sep 2009)
New Revision: 93470
Removed:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/FrameworkLaunchTestCase.java
Modified:
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Fix embedded rof Felix
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/scripts/assembly-bundles.xml 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/scripts/assembly-bundles.xml 2009-09-14 12:56:20 UTC (rev 93470)
@@ -22,6 +22,7 @@
<include>*:jboss-osgi-husky:jar</include>
<include>*:jboss-osgi-jaxb:jar</include>
<include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-jndi:jar</include>
<include>*:jboss-osgi-microcontainer:jar</include>
<include>*:jboss-osgi-xml-binding:jar</include>
<include>*:org.apache.felix.log:jar</include>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -78,7 +78,7 @@
{
if (context == null)
{
- runtime = new OSGiTestHelper().getDefaultRuntime();
+ runtime = new OSGiTestHelper().getEmbeddedRuntime();
runtime.addCapability(new HuskyCapability());
runtime.addCapability(new BlueprintCapability());
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/FrameworkLaunchTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/FrameworkLaunchTestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/FrameworkLaunchTestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.example.simple;
-
-//$Id: $
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.test.osgi.example.simple.bundle.SimpleService;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A test that deployes a bundle and verifies its state
- *
- * @author thomas.diesler(a)jboss.com
- * @since 28-Aug-2009
- */
-public class FrameworkLaunchTestCase extends OSGiTest
-{
- @Test
- public void testSimpleBundle() throws Exception
- {
- OSGiBootstrapProvider bootstrapProvider = OSGiBootstrap.getBootstrapProvider();
- Framework framework = bootstrapProvider.getFramework();
- framework.start();
-
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundle = sysContext.installBundle(getBundleLocation("example-simple.jar"));
- assertEquals("example-simple", bundle.getSymbolicName());
-
- bundle.start();
- assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
-
- BundleContext bndContext = bundle.getBundleContext();
- assertNotNull("BundleContext not null", bndContext);
-
- // getServiceReference from bundle context
- ServiceReference sref = bndContext.getServiceReference(SimpleService.class.getName());
- assertNotNull("ServiceReference not null", sref);
-
- // getServiceReference from system context
- sref = sysContext.getServiceReference(SimpleService.class.getName());
- assertNotNull("ServiceReference not null", sref);
-
- bundle.uninstall();
- assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
-
- framework.stop();
- framework.waitForStop(5000);
- }
-
- private String getBundleLocation(String jarname)
- {
- return getTestArchiveURL(jarname).toExternalForm();
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-09-14 12:56:20 UTC (rev 93470)
@@ -165,6 +165,7 @@
<excludes>
<exclude>${target.container.excludes}</exclude>
<exclude>org/jboss/test/osgi/jbosgi142/**</exclude>
+ <exclude>org/jboss/test/osgi/jbosgi151/**</exclude>
</excludes>
</configuration>
</plugin>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/capabilities/CapabilityTestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -39,6 +39,7 @@
import org.jboss.osgi.jbossxb.XMLBindingService;
import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.jndi.JNDICapability;
+import org.jboss.osgi.spi.capability.LogServiceCapability;
import org.jboss.osgi.spi.testing.OSGiBundle;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiServiceReference;
@@ -60,9 +61,8 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
- runtime.installBundle("bundles/org.apache.felix.log.jar").start();
- runtime.installBundle("bundles/jboss-osgi-common.jar").start();
+ runtime.installCompendium();
+ runtime.addCapability(new LogServiceCapability());
OSGiBundle bundle = runtime.getBundle("jboss-osgi-apache-xerces", null);
assertNull("Test bundle null", bundle);
@@ -93,9 +93,8 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
- runtime.installBundle("bundles/org.apache.felix.log.jar").start();
- runtime.installBundle("bundles/jboss-osgi-common.jar").start();
+ runtime.installCompendium();
+ runtime.addCapability(new LogServiceCapability());
OSGiBundle bundle = runtime.getBundle("jboss-osgi-jaxb", null);
assertNull("Test bundle null", bundle);
@@ -117,9 +116,8 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
- runtime.installBundle("bundles/org.apache.felix.log.jar").start();
- runtime.installBundle("bundles/jboss-osgi-common.jar").start();
+ runtime.installCompendium();
+ runtime.addCapability(new LogServiceCapability());
OSGiBundle bundle = runtime.getBundle("jboss-osgi-xml-binding", null);
assertNull("Test bundle null", bundle);
@@ -141,9 +139,8 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
- runtime.installBundle("bundles/org.apache.felix.log.jar").start();
- runtime.installBundle("bundles/jboss-osgi-common.jar").start();
+ runtime.installCompendium();
+ runtime.addCapability(new LogServiceCapability());
OSGiBundle bundle = runtime.getBundle("jboss-osgi-jndi", null);
assertNull("Test bundle null", bundle);
@@ -165,9 +162,8 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
- runtime.installBundle("bundles/org.apache.felix.log.jar").start();
- runtime.installBundle("bundles/jboss-osgi-common.jar").start();
+ runtime.installCompendium();
+ runtime.addCapability(new LogServiceCapability());
OSGiBundle bundle = runtime.getBundle("jboss-osgi-jmx", null);
assertNull("Test bundle null", bundle);
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -50,7 +50,7 @@
OSGiRuntime runtime = getDefaultRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
+ runtime.installCompendium();
OSGiBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
bundleA.start();
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -58,7 +58,7 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
+ runtime.installCompendium();
OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertTrue("Bundle installed", bundleX.getState() <= Bundle.RESOLVED);
@@ -83,7 +83,7 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
+ runtime.installCompendium();
OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertTrue("Bundle installed", bundleX.getState() <= Bundle.RESOLVED);
@@ -112,7 +112,7 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
+ runtime.installCompendium();
OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertTrue("Bundle installed", bundleX.getState() <= Bundle.RESOLVED);
@@ -145,7 +145,7 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
+ runtime.installCompendium();
OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
@@ -184,7 +184,7 @@
OSGiRuntime runtime = getEmbeddedRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
+ runtime.installCompendium();
OSGiBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -54,6 +54,7 @@
OSGiRuntime runtime = getDefaultRuntime();
try
{
+ runtime.installCompendium();
runtime.addCapability(new ConfigAdminCapability());
OSGiBundle bundleA = runtime.installBundle("jbosgi41-bundleA.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -67,10 +67,13 @@
public static void setUpClass() throws Exception
{
runtime = new OSGiTestHelper().getDefaultRuntime();
+
+ runtime.installCompendium();
runtime.addCapability(new JNDICapability());
runtime.addCapability(new JMXCapability());
runtime.addCapability(new XMLBindingCapability());
runtime.addCapability(new MicrocontainerCapability());
+
}
@AfterClass
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java 2009-09-14 12:56:20 UTC (rev 93470)
@@ -45,7 +45,7 @@
OSGiRuntime runtime = getDefaultRuntime();
try
{
- runtime.installBundle("bundles/org.osgi.compendium.jar");
+ runtime.installCompendium();
OSGiBundle bundle = runtime.installBundle("service/startlevel.jar");
bundle.start();
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-14 12:41:39 UTC (rev 93469)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-14 12:56:20 UTC (rev 93470)
@@ -35,7 +35,7 @@
<!-- Properties -->
<properties>
<version.jboss.naming>5.0.1.GA</version.jboss.naming>
- <version.jbossas.client>5.0.1.GA</version.jbossas.client>
+ <version.jbossas.client>5.1.0.GA</version.jbossas.client>
</properties>
<!-- Dependencies -->
@@ -48,7 +48,7 @@
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-spi</artifactId>
</dependency>
-
+
<!-- Bundle Dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
@@ -135,7 +135,7 @@
<artifactId>jboss-osgi-jaxb</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- Test Dependencies -->
<dependency>
<groupId>org.jboss.naming</groupId>
@@ -155,7 +155,7 @@
<scope>test</scope>
</dependency>
</dependencies>
-
+
<!-- Build -->
<build>
<testResources>
@@ -180,7 +180,7 @@
<name>!framework</name>
</property>
</activation>
-
+
<!-- default to jbossmc -->
<dependencies>
<dependency>
@@ -190,21 +190,13 @@
<scope>provided</scope>
</dependency>
</dependencies>
-
- <!-- default to felix
- <properties>
- <jboss.osgi.framework.properties>jboss-osgi-felix.properties</jboss.osgi.framework.properties>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-runtime-felix</artifactId>
- <version>${version.jboss.osgi.runtime.felix}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
+
+ <!--
+ default to felix <properties> <jboss.osgi.framework.properties>jboss-osgi-felix.properties</jboss.osgi.framework.properties> </properties> <dependencies>
+ <dependency> <groupId>org.jboss.osgi.runtime</groupId> <artifactId>jboss-osgi-runtime-felix</artifactId> <version>${version.jboss.osgi.runtime.felix}</version>
+ <scope>provided</scope> </dependency> </dependencies>
-->
-
+
</profile>
<!--
@@ -401,25 +393,10 @@
<target.container.excludes>org/jboss/test/osgi/nothing-to-exclude</target.container.excludes>
</properties>
<dependencies>
- <!--
<dependency>
<groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-server</artifactId>
- <classifier>jmx-invoker-adaptor-client</classifier>
- <version>${version.jbossas.client}</version>
- <scope>test</scope>
- </dependency>
- -->
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>${version.jbossas.client}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
<scope>test</scope>
<type>pom</type>
</dependency>
16 years, 10 months
JBoss-OSGI SVN: r93469 - projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 08:41:39 -0400 (Mon, 14 Sep 2009)
New Revision: 93469
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java
Log:
Add dependency on JNDICapability
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java 2009-09-14 12:35:09 UTC (rev 93468)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java 2009-09-14 12:41:39 UTC (rev 93469)
@@ -25,6 +25,7 @@
import javax.management.MBeanServer;
+import org.jboss.osgi.jndi.JNDICapability;
import org.jboss.osgi.spi.capability.Capability;
import org.jboss.osgi.spi.testing.OSGiRuntime;
@@ -56,6 +57,8 @@
addSystemProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
addSystemProperty("org.jboss.osgi.jmx.rmi.port", "1198");
+ addDependency(new JNDICapability());
+
addBundle("bundles/jboss-osgi-jmx.jar");
}
}
\ No newline at end of file
16 years, 10 months
JBoss-OSGI SVN: r93466 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins: resolver and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 08:07:40 -0400 (Mon, 14 Sep 2009)
New Revision: 93466
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
Log:
Restore signature on Capability.resolve()
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java 2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java 2009-09-14 12:07:40 UTC (rev 93466)
@@ -93,9 +93,9 @@
}
@Override
- public boolean resolves(Module capModule, Module reqModule, Requirement requirement)
+ public boolean resolves(Module reqModule, Requirement requirement)
{
- if (super.resolves(capModule, reqModule, requirement) == false)
+ if (super.resolves(reqModule, requirement) == false)
return false;
if (requirement instanceof OSGiBundleRequirement == false)
return true;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java 2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java 2009-09-14 12:07:40 UTC (rev 93466)
@@ -132,7 +132,7 @@
boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
if (isSystemPackage == false)
{
- OSGiPackageRequirement requirement = OSGiPackageRequirement.create(packageAttribute);
+ OSGiPackageRequirement requirement = OSGiPackageRequirement.create(bundleState, packageAttribute);
requirements.addRequirement(requirement);
}
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java 2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java 2009-09-14 12:07:40 UTC (rev 93466)
@@ -29,6 +29,7 @@
import org.jboss.classloading.spi.dependency.Module;
import org.jboss.classloading.spi.metadata.Requirement;
import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
@@ -130,9 +131,9 @@
}
@Override
- public boolean resolves(Module capModule, Module reqModule, Requirement requirement)
+ public boolean resolves(Module reqModule, Requirement requirement)
{
- if (super.resolves(capModule, reqModule, requirement) == false)
+ if (super.resolves(reqModule, requirement) == false)
return false;
if (requirement instanceof OSGiPackageRequirement == false)
return true;
@@ -147,12 +148,25 @@
if (bundleCapability == null)
return false;
+ Module capModule = getModule();
Module otherCapModule = bundleCapability.getExportingModule();
PackageCapability otherCapability = bundleCapability.getPackageCapability();
boolean isMatch = (otherCapModule == capModule && otherCapability == this);
return isMatch;
}
+ /**
+ * Get the Module associated with this capability
+ */
+ public Module getModule()
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ Module module = unit.getAttachment(Module.class);
+ if (module == null)
+ throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+ return module;
+ }
+
@SuppressWarnings("deprecation")
public boolean match(OSGiPackageRequirement packageRequirement)
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java 2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java 2009-09-14 12:07:40 UTC (rev 93466)
@@ -25,7 +25,10 @@
import java.util.Map;
import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.dependency.Module;
import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
import org.jboss.osgi.spi.metadata.PackageAttribute;
import org.jboss.osgi.spi.metadata.Parameter;
@@ -44,6 +47,9 @@
/** The serialVersionUID */
private static final long serialVersionUID = 5109907232396093061L;
+ /** The bundle state */
+ private OSGiBundleState bundleState;
+
/** The attributes */
private PackageAttribute requirePackage;
@@ -55,8 +61,10 @@
* @throws IllegalArgumentException for a null requirePackage
*/
@SuppressWarnings("deprecation")
- public static OSGiPackageRequirement create(PackageAttribute requirePackage)
+ public static OSGiPackageRequirement create(OSGiBundleState bundleState, PackageAttribute requirePackage)
{
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle");
if (requirePackage == null)
throw new IllegalArgumentException("Null require package");
@@ -79,7 +87,7 @@
range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
}
- return new OSGiPackageRequirement(name, range, requirePackage);
+ return new OSGiPackageRequirement(bundleState, name, range, requirePackage);
}
/**
@@ -90,9 +98,11 @@
* @param requirePackage the require package metadata
* @throws IllegalArgumentException for a null name or requirePackage
*/
- public OSGiPackageRequirement(String name, VersionRange versionRange, PackageAttribute requirePackage)
+ public OSGiPackageRequirement(OSGiBundleState bundleState, String name, VersionRange versionRange, PackageAttribute requirePackage)
{
super(name, versionRange);
+ this.bundleState = bundleState;
+
if (requirePackage != null)
{
this.requirePackage = requirePackage;
@@ -112,6 +122,18 @@
return requirePackage;
}
+ /**
+ * Get the Module associated with this requirement
+ */
+ public Module getModule()
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ Module module = unit.getAttachment(Module.class);
+ if (module == null)
+ throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+ return module;
+ }
+
@Override
public boolean equals(Object obj)
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-14 12:07:40 UTC (rev 93466)
@@ -407,7 +407,7 @@
Object version = otherPackage.getVersion();
VersionRange versionRange = new VersionRange(version, true, version, true);
- OSGiPackageRequirement newPackageRequirement = new OSGiPackageRequirement(packageName, versionRange, null);
+ OSGiPackageRequirement newPackageRequirement = new OSGiPackageRequirement(bundle, packageName, versionRange, null);
BundleRequirement newBundleRequirement = new BundleRequirement(bundle, newPackageRequirement);
newBundleRequirement.setWire(otherCapability);
bundleRequirements.add(newBundleRequirement);
16 years, 10 months
JBoss-OSGI SVN: r93463 - projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 05:50:13 -0400 (Mon, 14 Sep 2009)
New Revision: 93463
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
Log:
Always start JMXConnectorServer, assume that failure indicates already running server
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-09-14 09:32:01 UTC (rev 93462)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-09-14 09:50:13 UTC (rev 93463)
@@ -55,40 +55,29 @@
private boolean shutdownRegistry;
private Registry rmiRegistry;
- public JMXConnectorService(BundleContext context, MBeanServer mbeanServer, String host, int rmiPort)
+ 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
{
- // 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);
- }
- catch (RemoteException e)
- {
- log.log(LogService.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;
- }
-
- // create new connector server and start it
- serviceURL = getServiceURL(host, rmiPort);
- jmxConnectorServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, null, mbeanServer);
-
- log.log(LogService.LOG_DEBUG, "JMXConnectorServer created: " + serviceURL);
+ rmiRegistry.list();
+ log.log(LogService.LOG_DEBUG, "RMI registry running at host=" + host + ",port=" + rmiPort);
}
- catch (RuntimeException rte)
+ catch (RemoteException e)
{
- throw rte;
+ log.log(LogService.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;
}
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot create JMXConnectorServer", ex);
- }
+
+ // create new connector server and start it
+ serviceURL = getServiceURL(host, rmiPort);
+ jmxConnectorServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, null, mbeanServer);
+
+ log.log(LogService.LOG_DEBUG, "JMXConnectorServer created: " + serviceURL);
}
static JMXServiceURL getServiceURL(String host, int rmiPort)
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-09-14 09:32:01 UTC (rev 93462)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-09-14 09:50:13 UTC (rev 93463)
@@ -31,8 +31,6 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerConnection;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -146,16 +144,15 @@
JMXServiceURL serviceURL = JMXConnectorService.getServiceURL(jmxHost, Integer.parseInt(jmxRmiPort));
try
{
- // Assume that the JMXConnector is already running if we can connect to it
- JMXConnector connector = JMXConnectorFactory.connect(serviceURL);
- connector.connect();
- connector.close();
+ // Try to start the JMXConnector, this should fail if it is already running
+ // [TODO] is there a better way to check whether the connector is already running?
+ jmxConnector = new JMXConnectorService(context, mbeanServer, jmxHost, Integer.parseInt(jmxRmiPort));
+ jmxConnector.start();
}
catch (IOException ex)
{
- // Start JMXConnectorService
- jmxConnector = new JMXConnectorService(context, mbeanServer, jmxHost, Integer.parseInt(jmxRmiPort));
- jmxConnector.start();
+ // Assume that the JMXConnector is already running if we cannot start it
+ log.log(LogService.LOG_DEBUG, "Assume JMXConnectorServer already running on: " + serviceURL);
}
try
16 years, 10 months
JBoss-OSGI SVN: r93461 - projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-14 05:30:39 -0400 (Mon, 14 Sep 2009)
New Revision: 93461
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
Log:
Fix JMXConnector check
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-09-14 08:56:27 UTC (rev 93460)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-09-14 09:30:39 UTC (rev 93461)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.net.InetAddress;
+import java.net.MalformedURLException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
@@ -58,8 +59,6 @@
{
log = new LogServiceTracker(context);
- String jmxConnectorServerPath = "/jmxconnector";
-
try
{
// check to see if registry already created
@@ -77,7 +76,7 @@
}
// create new connector server and start it
- serviceURL = new JMXServiceURL("service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + rmiPort + jmxConnectorServerPath);
+ serviceURL = getServiceURL(host, rmiPort);
jmxConnectorServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, null, mbeanServer);
log.log(LogService.LOG_DEBUG, "JMXConnectorServer created: " + serviceURL);
@@ -92,9 +91,17 @@
}
}
- public JMXServiceURL getServiceURL()
+ static JMXServiceURL getServiceURL(String host, int rmiPort)
{
- return serviceURL;
+ String jmxConnectorURL = "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + rmiPort + "/jmxconnector";
+ try
+ {
+ return new JMXServiceURL(jmxConnectorURL);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Invalid connector URL: " + jmxConnectorURL);
+ }
}
public void start()
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-09-14 08:56:27 UTC (rev 93460)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java 2009-09-14 09:30:39 UTC (rev 93461)
@@ -28,10 +28,11 @@
import static org.jboss.osgi.jmx.Constants.REMOTE_JMX_RMI_PORT;
import java.io.IOException;
-import java.net.Socket;
import javax.management.MBeanServer;
import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -142,11 +143,13 @@
{
InitialContext iniCtx = (InitialContext)super.addingService(reference);
+ JMXServiceURL serviceURL = JMXConnectorService.getServiceURL(jmxHost, Integer.parseInt(jmxRmiPort));
try
{
// Assume that the JMXConnector is already running if we can connect to it
- Socket socket = new Socket(jmxHost, new Integer(jmxRmiPort));
- socket.close();
+ JMXConnector connector = JMXConnectorFactory.connect(serviceURL);
+ connector.connect();
+ connector.close();
}
catch (IOException ex)
{
@@ -166,7 +169,7 @@
try
{
iniCtx.createSubcontext("jmx").createSubcontext("invoker");
- StringRefAddr addr = new StringRefAddr(JMXServiceURL.class.getName(), jmxConnector.getServiceURL().toString());
+ StringRefAddr addr = new StringRefAddr(JMXServiceURL.class.getName(), serviceURL.toString());
Reference ref = new Reference(MBeanServerConnection.class.getName(), addr, RMIAdaptorFactory.class.getName(), null);
iniCtx.bind(rmiAdaptorPath, ref);
rmiAdaptorBound = true;
16 years, 10 months