JBoss-OSGI SVN: r101161 - in projects/jboss-osgi/projects/bundles/jmx/trunk: jmx-bundle and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 07:57:10 -0500 (Fri, 19 Feb 2010)
New Revision: 101161
Added:
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.project
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.maven.ide.eclipse.prefs
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/
Log:
split jmx build in modules
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath 2010-02-19 12:52:26 UTC (rev 101160)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/.classpath 2010-02-19 12:57:10 UTC (rev 101161)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle
___________________________________________________________________
Name: svn:ignore
+ target
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath 2010-02-19 12:57:10 UTC (rev 101161)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.project
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.project (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.project 2010-02-19 12:57:10 UTC (rev 101161)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-jmx</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.eclipse.jdt.core.prefs 2010-02-19 12:57:10 UTC (rev 101161)
@@ -0,0 +1,13 @@
+#Fri Feb 19 13:54:44 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.settings/org.maven.ide.eclipse.prefs 2010-02-19 12:57:10 UTC (rev 101161)
@@ -0,0 +1,9 @@
+#Fri Feb 19 13:49:47 CET 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
14 years, 4 months
JBoss-OSGI SVN: r101160 - in projects/jboss-osgi/projects/bundles/jmx/trunk: jmx-bundle and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 07:52:26 -0500 (Fri, 19 Feb 2010)
New Revision: 101160
Added:
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/JMXCapability.java
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java
Removed:
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/JMXCapability.java
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
Log:
split jmx build in modules
Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml (from rev 101148, projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml 2010-02-19 12:52:26 UTC (rev 101160)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, the OpenSource J2EE webOS -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBossOSGi - JMX Bundle</name>
+ <description>The JBossOSGi Management</description>
+
+ <groupId>org.jboss.osgi.jmx</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <packaging>bundle</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi.jmx</groupId>
+ <artifactId>jboss-osgi-jmx-parent</artifactId>
+ <version>1.0.4-SNAPSHOT</version>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jndi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.api</artifactId>
+ </dependency>
+
+ <!-- OSGi Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.jmx.internal.JMXServiceActivator</Bundle-Activator>
+ <Export-Package>
+ org.jboss.osgi.jmx;version=${version}
+ </Export-Package>
+ <Import-Package>
+
+ <!-- system -->
+ javax.management*,
+ javax.naming,
+ javax.naming.spi,
+
+ <!-- jboss-osgi -->
+ org.jboss.osgi.spi*;version="[1.0,2.0)",
+
+ <!-- osgi -->
+ org.osgi.framework;version="[1.5,2.0)",
+ org.osgi.service.packageadmin;version="[1.2,2.0)",
+ org.osgi.util.tracker;version="[1.4,2.0)",
+
+ <!-- FIXME: make optional
+ org.jboss.osgi.jndi;resolution:=optional,
+ org.jboss.net.sockets;resolution:=optional,
+ org.jnp.interfaces;resolution:=optional,
+ -->
+ org.jboss.osgi.jndi;version="[1.0,2.0)",
+ org.jboss.net.sockets;version="[2.2,3.0)",
+ org.jnp.interfaces;version="[5.0,6.0)",
+
+ </Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <!-- For some reason the distribution javadoc module needs this -->
+ <file>target/${artifactId}-${version}-sources.jar</file>
+ <classifier>sources</classifier>
+ <type>jar</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src (from rev 101012, projects/jboss-osgi/projects/bundles/jmx/trunk/src)
Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/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 2010-02-16 06:32:28 UTC (rev 101012)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/JMXCapability.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jmx;
-
-//$Id$
-
-import javax.management.MBeanServer;
-
-import org.jboss.osgi.jndi.JNDICapability;
-import org.jboss.osgi.spi.capability.Capability;
-
-/**
- * Adds the JMX capability to the {@link OSGiRuntime}
- * under test.
- *
- * It is ignored if the {@link MBeanServer} is already registered.
- *
- * Installed bundles: jboss-osgi-jmx.jar
- *
- * Default properties set by this capability
- *
- * <table>
- * <tr><th>Property</th><th>Value</th></tr>
- * <tr><td>org.jboss.osgi.jmx.host</td><td>${jboss.bind.address}</td></tr>
- * <tr><td>org.jboss.osgi.jmx.rmi.port</td><td>1198</td></tr>
- * </table>
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class JMXCapability extends Capability
-{
- public JMXCapability()
- {
- super(MBeanServer.class.getName());
-
- 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
Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/JMXCapability.java (from rev 101072, projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/JMXCapability.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/JMXCapability.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/JMXCapability.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jmx;
+
+//$Id$
+
+import javax.management.MBeanServer;
+
+import org.jboss.osgi.jndi.JNDICapability;
+import org.jboss.osgi.spi.capability.Capability;
+
+/**
+ * Adds the JMX capability to the {@link OSGiRuntime}
+ * under test.
+ *
+ * It is ignored if the {@link MBeanServer} is already registered.
+ *
+ * Dependent Capability: {@link JNDICapability}
+ * Installed bundles: jboss-osgi-jmx.jar
+ *
+ * Default properties set by this capability
+ *
+ * <table>
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td>org.jboss.osgi.jmx.host</td><td>${jboss.bind.address}</td></tr>
+ * <tr><td>org.jboss.osgi.jmx.rmi.port</td><td>1198</td></tr>
+ * </table>
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class JMXCapability extends Capability
+{
+ public JMXCapability()
+ {
+ super(MBeanServer.class.getName());
+
+ 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");
+ addBundle("bundles/org.apache.aries.jmx.jar");
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java 2010-02-16 06:32:28 UTC (rev 101012)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -1,89 +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 java.util.ArrayList;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-
-import org.jboss.logging.Logger;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-/**
- * A service that registers an MBeanServer
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public class MBeanServerService
-{
- // Provide logging
- private static final Logger log = Logger.getLogger(MBeanServerService.class);
-
- private BundleContext context;
-
- public MBeanServerService(BundleContext context)
- {
- this.context = context;
- }
-
- @SuppressWarnings("unchecked")
- public MBeanServer registerMBeanServer()
- {
- MBeanServer mbeanServer = null;
-
- // Check if there is an MBeanServer service already
- ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
- if (sref != null)
- {
- mbeanServer = (MBeanServer)context.getService(sref);
- log.debug("Found MBeanServer fom service: " + mbeanServer.getDefaultDomain());
- return mbeanServer;
- }
-
- ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
- if (serverArr.size() > 1)
- log.warn("Multiple MBeanServer instances: " + serverArr);
-
- if (serverArr.size() > 0)
- {
- mbeanServer = serverArr.get(0);
- log.debug("Found MBeanServer: " + mbeanServer.getDefaultDomain());
- }
-
- if (mbeanServer == null)
- {
- log.debug("No MBeanServer, create one ...");
- mbeanServer = MBeanServerFactory.createMBeanServer();
- }
-
- // Register the MBeanServer
- context.registerService(MBeanServer.class.getName(), mbeanServer, null);
- log.debug("MBeanServer registered");
-
- return mbeanServer;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java (from rev 101072, projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerService.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -0,0 +1,88 @@
+/*
+ * 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 java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+import org.jboss.logging.Logger;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A service that registers an MBeanServer
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class MBeanServerService
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(MBeanServerService.class);
+
+ private BundleContext context;
+
+ public MBeanServerService(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public MBeanServer registerMBeanServer()
+ {
+ MBeanServer mbeanServer = null;
+
+ // Check if there is an MBeanServer service already
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref != null)
+ {
+ mbeanServer = (MBeanServer)context.getService(sref);
+ log.debug("Found MBeanServer fom service: " + mbeanServer.getDefaultDomain());
+ return mbeanServer;
+ }
+
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ log.warn("Multiple MBeanServer instances: " + serverArr);
+
+ if (serverArr.size() > 0)
+ {
+ mbeanServer = serverArr.get(0);
+ log.debug("Found MBeanServer: " + mbeanServer.getDefaultDomain());
+ }
+
+ if (mbeanServer == null)
+ {
+ log.debug("No MBeanServer, create one ...");
+ mbeanServer = MBeanServerFactory.createMBeanServer();
+ }
+
+ // Register the MBeanServer
+ context.registerService(MBeanServer.class.getName(), mbeanServer, null);
+ log.debug("MBeanServer registered");
+
+ return mbeanServer;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2010-02-16 06:32:28 UTC (rev 101012)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -1,301 +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 static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
-import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_ID;
-import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_SYMBOLIC_NAME;
-import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_VERSION;
-
-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 javax.management.StandardMBean;
-
-import org.jboss.logging.Logger;
-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;
-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;
-
-/**
- * The managed view of an OSGi Framework
- *
- * @author thomas.diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public class ManagedFrameworkImpl implements ManagedFrameworkMBean
-{
- // Provide logging
- private static final Logger log = Logger.getLogger(ManagedFrameworkImpl.class);
-
- private MBeanServer mbeanServer;
- private BundleContext context;
- private ManagedBundleTracker bundleTracker;
-
- public ManagedFrameworkImpl(BundleContext context, MBeanServer mbeanServer)
- {
- if (context == null)
- throw new IllegalArgumentException("Null 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;
-
- this.bundleTracker = new ManagedBundleTracker(context, mbeanServer);
- }
-
- public BundleContext getBundleContext()
- {
- return context;
- }
-
- @SuppressWarnings("unchecked")
- public ObjectName getBundle(String symbolicName, String version)
- {
- ObjectName oname = null;
-
- String namestr = DOMAIN_NAME + ":" + PROPERTY_SYMBOLIC_NAME + "=" + symbolicName + "," + PROPERTY_VERSION + "=" + version + ",*";
- Set<ObjectName> names = mbeanServer.queryNames(ObjectNameFactory.create(namestr), null);
-
- if (names.size() > 0)
- {
- if (names.size() > 1)
- log.warn("Multiple bundles found: " + names);
-
- // Use the bundle with the highest id
- for (ObjectName aux : names)
- {
- if (oname == null)
- oname = aux;
-
- Integer bestId = new Integer(oname.getKeyProperty(PROPERTY_ID));
- Integer auxId = new Integer(aux.getKeyProperty(PROPERTY_ID));
- if (bestId < auxId)
- oname = aux;
- }
- }
-
- if (log.isTraceEnabled())
- log.trace("getBundle(" + symbolicName + "," + version + ") => " + oname);
-
- 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();
-
- if (log.isTraceEnabled())
- log.trace("getBundle(" + bundleId + ") => " + oname);
-
- return oname;
- }
-
- @SuppressWarnings("unchecked")
- public Set<ObjectName> getBundles()
- {
- // [JBAS-6571] JMX filtering does not work with wildcards
- // ObjectName pattern = ObjectNameFactory.create(Constants.DOMAIN_NAME + ":name=*,*");
- // Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
-
- ObjectName pattern = ObjectNameFactory.create(DOMAIN_NAME + ":*");
- Set<ObjectName> names = mbeanServer.queryNames(pattern, new IsBundleQueryExp());
-
- if (log.isTraceEnabled())
- log.trace("getBundles() => " + names);
-
- 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));
- }
-
- ManagedServiceReference msref = new ManagedServiceReference(props);
- if (log.isTraceEnabled())
- log.trace("getServiceReference(" + clazz + ") => " + msref);
-
- return msref;
- }
-
- 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[] msrefs = null;
- if (foundRefs.size() > 0)
- msrefs = foundRefs.toArray(new ManagedServiceReference[foundRefs.size()]);
-
- if (log.isTraceEnabled())
- log.trace("getServiceReferences(" + clazz + "," + filter +") => " + msrefs);
-
- return msrefs;
- }
-
- public void refreshPackages(ObjectName[] objectNames)
- {
- if (log.isTraceEnabled())
- log.trace("refreshPackages(" + (objectNames != null ? Arrays.asList(objectNames) : null) +")");
-
- Bundle[] bundleArr = getBundles(objectNames);
- ServiceReference sref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
- PackageAdmin service = (PackageAdmin)getBundleContext().getService(sref);
- service.refreshPackages(bundleArr);
- }
-
- public boolean resolveBundles(ObjectName[] objectNames)
- {
- if (log.isTraceEnabled())
- log.trace("resolveBundles(" + (objectNames != null ? Arrays.asList(objectNames) : null) +")");
-
- Bundle[] bundleArr = getBundles(objectNames);
- ServiceReference sref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
- PackageAdmin service = (PackageAdmin)getBundleContext().getService(sref);
- return service.resolveBundles(bundleArr);
- }
-
- private Bundle[] getBundles(ObjectName[] objectNames)
- {
- 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);
- }
- return bundleArr;
- }
-
- public void start()
- {
- // Start tracking the bundles
- bundleTracker.open();
-
- 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(ManagedBundle.PROPERTY_SYMBOLIC_NAME) != null;
- }
-
- public void setMBeanServer(MBeanServer server)
- {
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java (from rev 101072, projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -0,0 +1,183 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.StandardMBean;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.ManagedServiceReference;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * The managed view of an OSGi Framework
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 04-Mar-2009
+ */
+public class ManagedFrameworkImpl implements ManagedFrameworkMBean
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(ManagedFrameworkImpl.class);
+
+ private MBeanServer mbeanServer;
+ private BundleContext context;
+ private ManagedBundleTracker bundleTracker;
+
+ public ManagedFrameworkImpl(BundleContext context, MBeanServer mbeanServer)
+ {
+ if (context == null)
+ throw new IllegalArgumentException("Null 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;
+ this.bundleTracker = new ManagedBundleTracker(context, mbeanServer);
+ }
+
+ @Override
+ public ManagedServiceReference getServiceReference(String clazz)
+ {
+ ServiceReference sref = context.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));
+ }
+
+ ManagedServiceReference msref = new ManagedServiceReference(props);
+ if (log.isTraceEnabled())
+ log.trace("getServiceReference(" + clazz + ") => " + msref);
+
+ return msref;
+ }
+
+ @Override
+ public ManagedServiceReference[] getServiceReferences(String clazz, String filter)
+ {
+ List<ManagedServiceReference> foundRefs = new ArrayList<ManagedServiceReference>();
+
+ ServiceReference[] srefs;
+ try
+ {
+ srefs = context.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[] msrefs = null;
+ if (foundRefs.size() > 0)
+ msrefs = foundRefs.toArray(new ManagedServiceReference[foundRefs.size()]);
+
+ if (log.isTraceEnabled())
+ log.trace("getServiceReferences(" + clazz + "," + filter +") => " + msrefs);
+
+ return msrefs;
+ }
+
+ @Override
+ public void refreshAllPackages()
+ {
+ if (log.isTraceEnabled())
+ log.trace("refreshPackages(null)");
+
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin service = (PackageAdmin)context.getService(sref);
+ service.refreshPackages(null);
+ }
+
+ @Override
+ public boolean resolveAllBundles()
+ {
+ if (log.isTraceEnabled())
+ log.trace("resolveBundles(null)");
+
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin service = (PackageAdmin)context.getService(sref);
+ return service.resolveBundles(null);
+ }
+
+ void start()
+ {
+ // Start tracking the bundles
+ bundleTracker.open();
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java 2010-02-16 06:32:28 UTC (rev 101012)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -1,183 +0,0 @@
-/**
- *
- */
-package org.jboss.osgi.jmx.internal;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Set;
-
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServerConnection;
-import javax.management.NotCompliantMBeanException;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.QueryExp;
-import javax.management.ReflectionException;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-
-public class RMIAdaptor implements MBeanServerConnection, Serializable
-{
- private static final long serialVersionUID = 6066226353118090215L;
-
- private MBeanServerConnection delegate;
-
- public RMIAdaptor(JMXServiceURL url) throws IOException
- {
- JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
- delegate = jmxc.getMBeanServerConnection();
- }
-
- public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
- throws InstanceNotFoundException, IOException
- {
- delegate.addNotificationListener(name, listener, filter, handback);
- }
-
- public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException,
- IOException
- {
- delegate.addNotificationListener(name, listener, filter, handback);
- }
-
- public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws ReflectionException,
- InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException
- {
- return delegate.createMBean(className, name, params, signature);
- }
-
- public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException,
- InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
- {
- return delegate.createMBean(className, name, loaderName, params, signature);
- }
-
- public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException,
- MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
- {
- return delegate.createMBean(className, name, loaderName);
- }
-
- public ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
- MBeanException, NotCompliantMBeanException, IOException
- {
- return delegate.createMBean(className, name);
- }
-
- public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException,
- ReflectionException, IOException
- {
- return delegate.getAttribute(name, attribute);
- }
-
- public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException
- {
- return delegate.getAttributes(name, attributes);
- }
-
- public String getDefaultDomain() throws IOException
- {
- return delegate.getDefaultDomain();
- }
-
- public String[] getDomains() throws IOException
- {
- return delegate.getDomains();
- }
-
- public Integer getMBeanCount() throws IOException
- {
- return delegate.getMBeanCount();
- }
-
- public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException
- {
- return delegate.getMBeanInfo(name);
- }
-
- public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException, IOException
- {
- return delegate.getObjectInstance(name);
- }
-
- public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException,
- ReflectionException, IOException
- {
- return delegate.invoke(name, operationName, params, signature);
- }
-
- public boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException, IOException
- {
- return delegate.isInstanceOf(name, className);
- }
-
- public boolean isRegistered(ObjectName name) throws IOException
- {
- return delegate.isRegistered(name);
- }
-
- @SuppressWarnings({ "rawtypes" })
- public Set queryMBeans(ObjectName name, QueryExp query) throws IOException
- {
- return delegate.queryMBeans(name, query);
- }
-
- @SuppressWarnings({ "rawtypes" })
- public Set queryNames(ObjectName name, QueryExp query) throws IOException
- {
- return delegate.queryNames(name, query);
- }
-
- public void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
- throws InstanceNotFoundException, ListenerNotFoundException, IOException
- {
- delegate.removeNotificationListener(name, listener, filter, handback);
- }
-
- public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException,
- IOException
- {
- delegate.removeNotificationListener(name, listener);
- }
-
- public void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException,
- ListenerNotFoundException, IOException
- {
- delegate.removeNotificationListener(name, listener, filter, handback);
- }
-
- public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException
- {
- delegate.removeNotificationListener(name, listener);
- }
-
- public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException,
- MBeanException, ReflectionException, IOException
- {
- delegate.setAttribute(name, attribute);
- }
-
- public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, IOException
- {
- return delegate.setAttributes(name, attributes);
- }
-
- public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException
- {
- delegate.unregisterMBean(name);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java (from rev 101072, projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/RMIAdaptor.java 2010-02-19 12:52:26 UTC (rev 101160)
@@ -0,0 +1,183 @@
+/**
+ *
+ */
+package org.jboss.osgi.jmx.internal;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServerConnection;
+import javax.management.NotCompliantMBeanException;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.QueryExp;
+import javax.management.ReflectionException;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+public class RMIAdaptor implements MBeanServerConnection, Serializable
+{
+ private static final long serialVersionUID = 6066226353118090215L;
+
+ private MBeanServerConnection delegate;
+
+ public RMIAdaptor(JMXServiceURL url) throws IOException
+ {
+ JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
+ delegate = jmxc.getMBeanServerConnection();
+ }
+
+ public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
+ throws InstanceNotFoundException, IOException
+ {
+ delegate.addNotificationListener(name, listener, filter, handback);
+ }
+
+ public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException,
+ IOException
+ {
+ delegate.addNotificationListener(name, listener, filter, handback);
+ }
+
+ public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws ReflectionException,
+ InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException
+ {
+ return delegate.createMBean(className, name, params, signature);
+ }
+
+ public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException,
+ InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
+ {
+ return delegate.createMBean(className, name, loaderName, params, signature);
+ }
+
+ public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException,
+ MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
+ {
+ return delegate.createMBean(className, name, loaderName);
+ }
+
+ public ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
+ MBeanException, NotCompliantMBeanException, IOException
+ {
+ return delegate.createMBean(className, name);
+ }
+
+ public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException,
+ ReflectionException, IOException
+ {
+ return delegate.getAttribute(name, attribute);
+ }
+
+ public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException
+ {
+ return delegate.getAttributes(name, attributes);
+ }
+
+ public String getDefaultDomain() throws IOException
+ {
+ return delegate.getDefaultDomain();
+ }
+
+ public String[] getDomains() throws IOException
+ {
+ return delegate.getDomains();
+ }
+
+ public Integer getMBeanCount() throws IOException
+ {
+ return delegate.getMBeanCount();
+ }
+
+ public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException
+ {
+ return delegate.getMBeanInfo(name);
+ }
+
+ public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException, IOException
+ {
+ return delegate.getObjectInstance(name);
+ }
+
+ public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException,
+ ReflectionException, IOException
+ {
+ return delegate.invoke(name, operationName, params, signature);
+ }
+
+ public boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException, IOException
+ {
+ return delegate.isInstanceOf(name, className);
+ }
+
+ public boolean isRegistered(ObjectName name) throws IOException
+ {
+ return delegate.isRegistered(name);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public Set queryMBeans(ObjectName name, QueryExp query) throws IOException
+ {
+ return delegate.queryMBeans(name, query);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public Set queryNames(ObjectName name, QueryExp query) throws IOException
+ {
+ return delegate.queryNames(name, query);
+ }
+
+ public void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback)
+ throws InstanceNotFoundException, ListenerNotFoundException, IOException
+ {
+ delegate.removeNotificationListener(name, listener, filter, handback);
+ }
+
+ public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException,
+ IOException
+ {
+ delegate.removeNotificationListener(name, listener);
+ }
+
+ public void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException,
+ ListenerNotFoundException, IOException
+ {
+ delegate.removeNotificationListener(name, listener, filter, handback);
+ }
+
+ public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException
+ {
+ delegate.removeNotificationListener(name, listener);
+ }
+
+ public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException,
+ MBeanException, ReflectionException, IOException
+ {
+ delegate.setAttribute(name, attribute);
+ }
+
+ public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, IOException
+ {
+ return delegate.setAttributes(name, attributes);
+ }
+
+ public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException
+ {
+ delegate.unregisterMBean(name);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-19 12:19:32 UTC (rev 101159)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-19 12:52:26 UTC (rev 101160)
@@ -14,12 +14,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Reactor - JMX</name>
+ <name>JBossOSGi - JMX</name>
<description>The JBossOSGi Management</description>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <packaging>bundle</packaging>
+ <groupId>org.jboss.osgi.jmx</groupId>
+ <artifactId>jboss-osgi-jmx-parent</artifactId>
+ <packaging>pom</packaging>
<version>1.0.4-SNAPSHOT</version>
@@ -45,105 +45,41 @@
<version.osgi>4.2.0</version.osgi>
</properties>
+ <modules>
+ <module>jmx-bundle</module>
+ </modules>
+
<!-- Dependencies -->
- <dependencies>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common-core</artifactId>
- <version>${version.jboss.osgi.common.core}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <version>${version.jboss.osgi.jndi}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.jmx</groupId>
- <artifactId>org.apache.aries.jmx.api</artifactId>
- <version>${version.apache.aries.jmx}</version>
- </dependency>
-
- <!-- OSGi Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.jmx.internal.JMXServiceActivator</Bundle-Activator>
- <Export-Package>
- org.jboss.osgi.jmx;version=${version}
- </Export-Package>
- <Import-Package>
-
- <!-- system -->
- javax.management*,
- javax.naming,
- javax.naming.spi,
-
- <!-- jboss-osgi -->
- org.jboss.osgi.spi*;version="[1.0,2.0)",
-
- <!-- osgi -->
- org.osgi.framework;version="[1.5,2.0)",
- org.osgi.service.packageadmin;version="[1.2,2.0)",
- org.osgi.util.tracker;version="[1.4,2.0)",
-
- <!-- FIXME: make optional
- org.jboss.osgi.jndi;resolution:=optional,
- org.jboss.net.sockets;resolution:=optional,
- org.jnp.interfaces;resolution:=optional,
- -->
- org.jboss.osgi.jndi;version="[1.0,2.0)",
- org.jboss.net.sockets;version="[2.2,3.0)",
- org.jnp.interfaces;version="[5.0,6.0)",
-
- </Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <!-- For some reason the distribution javadoc module needs this -->
- <file>target/${artifactId}-${version}-sources.jar</file>
- <classifier>sources</classifier>
- <type>jar</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common-core</artifactId>
+ <version>${version.jboss.osgi.common.core}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jndi</artifactId>
+ <version>${version.jboss.osgi.jndi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.api</artifactId>
+ <version>${version.apache.aries.jmx}</version>
+ </dependency>
+
+ <!-- OSGi Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
</project>
14 years, 4 months
JBoss-OSGI SVN: r101158 - in projects/jboss-osgi: trunk and 10 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 07:14:57 -0500 (Fri, 19 Feb 2010)
New Revision: 101158
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
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/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/distribution/pom.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
split testing from husky
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -61,6 +61,7 @@
<version.jboss.osgi.reflect>2.2.0</version.jboss.osgi.reflect>
<version.jboss.osgi.runtime.deployers>1.0.4</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
+ <version.jboss.osgi.testing>1.0.0-SNAPSHOT</version.jboss.osgi.testing>
<version.jboss.osgi.xml.binding>2.0.2.Beta4</version.jboss.osgi.xml.binding>
<version.jboss.test>1.1.4.GA</version.jboss.test>
<version.ops4j.pax.web>0.7.2</version.ops4j.pax.web>
@@ -318,7 +319,12 @@
</exclusion>
</exclusions>
</dependency>
-
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <version>${version.jboss.osgi.testing}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
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 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -151,6 +151,7 @@
<include name="jboss-osgi-runtime-felix-sources.jar" />
<include name="jboss-osgi-runtime-jbossas-sources.jar" />
<include name="jboss-osgi-spi-sources.jar" />
+ <include name="jboss-osgi-testing-sources.jar" />
<include name="jboss-osgi-webapp-sources.jar" />
<include name="jboss-osgi-webconsole-sources.jar" />
<include name="jboss-osgi-xml-binding-sources.jar" />
@@ -187,6 +188,7 @@
<include name="jboss-logging-log4j.jar" />
<include name="jboss-osgi-deployment.jar" />
<include name="jboss-osgi-spi.jar" />
+ <include name="jboss-osgi-testing.jar" />
<include name="jboss-vfs.jar" />
<include name="log4j.jar" />
<include name="slf4j-api.jar" />
@@ -400,6 +402,7 @@
<include name="jboss-osgi-deployment.jar" />
<include name="jboss-osgi-runtime-jbossas.jar" />
<include name="jboss-osgi-spi.jar" />
+ <include name="jboss-osgi-testing.jar" />
</fileset>
<!-- deploy/osgi -->
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 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -54,6 +54,7 @@
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0,
<!-- org.osgi -->
org.osgi.framework;version=1.5
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 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -54,6 +54,7 @@
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0,
<!-- org.osgi -->
org.osgi.framework;version=1.5
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 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -42,7 +42,8 @@
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
- org.jboss.osgi.spi.util;version=1.0
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0
</value></entry>
<!-- Husky socket connector properties -->
<entry><key>org.jboss.osgi.husky.runtime.connector.host</key><value>${jboss.bind.address}</value></entry>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-equinox.properties 2010-02-19 12:14:57 UTC (rev 101158)
@@ -29,6 +29,7 @@
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.osgi.testing;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/conf/jboss-osgi-felix.properties 2010-02-19 12:14:57 UTC (rev 101158)
@@ -29,6 +29,7 @@
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.osgi.testing;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
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 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -40,7 +40,8 @@
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
- org.jboss.osgi.spi.util;version=1.0
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0
</value></entry>
<!-- Hot Deployment -->
<entry><key>org.jboss.osgi.hotdeploy.scandir</key><value>${osgi.server.home}/deploy</value></entry>
Modified: projects/jboss-osgi/trunk/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/pom.xml 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/distribution/pom.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -72,6 +72,22 @@
<classifier>javadoc</classifier>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <version>${version.jboss.osgi.testing}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <version>${version.jboss.osgi.testing}</version>
+ <classifier>javadoc</classifier>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi.testsuite</groupId>
<artifactId>jboss-osgi-testsuite-example</artifactId>
<version>${version}</version>
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/pom.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -74,6 +74,7 @@
<version.jboss.osgi.runtime.jbossas>1.0.2</version.jboss.osgi.runtime.jbossas>
<version.jboss.osgi.serviceloader>1.0.0</version.jboss.osgi.serviceloader>
<version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
+ <version.jboss.osgi.testing>1.0.0-SNAPSHOT</version.jboss.osgi.testing>
<version.jboss.osgi.webapp>0.7.2.SP2-SNAPSHOT</version.jboss.osgi.webapp>
<version.jboss.osgi.webconsole>1.0.2</version.jboss.osgi.webconsole>
<version.jboss.osgi.xml.binding>2.0.2.Beta4-SP1-SNAPSHOT</version.jboss.osgi.xml.binding>
@@ -124,6 +125,11 @@
<artifactId>jboss-osgi-spi</artifactId>
<version>${version.jboss.osgi.spi}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <version>${version.jboss.osgi.testing}</version>
+ </dependency>
<!-- jboss.osgi.bundles -->
<dependency>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -37,7 +37,8 @@
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
- org.jboss.osgi.spi.util;version=1.0
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0
</value></entry>
</map>
</property>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties 2010-02-19 12:14:57 UTC (rev 101158)
@@ -28,6 +28,7 @@
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.osgi.testing;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2010-02-19 12:14:57 UTC (rev 101158)
@@ -31,6 +31,7 @@
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.osgi.testing;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -37,7 +37,8 @@
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
- org.jboss.osgi.spi.util;version=1.0
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.osgi.testing;version=1.0
</value></entry>
</map>
</property>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties 2010-02-19 12:14:57 UTC (rev 101158)
@@ -25,6 +25,7 @@
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.osgi.testing;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2010-02-19 12:14:57 UTC (rev 101158)
@@ -28,6 +28,7 @@
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.osgi.testing;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2010-02-19 12:13:22 UTC (rev 101157)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2010-02-19 12:14:57 UTC (rev 101158)
@@ -52,6 +52,10 @@
<artifactId>jboss-osgi-spi</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-deployment</artifactId>
</dependency>
14 years, 4 months
JBoss-OSGI SVN: r101157 - in projects/jboss-osgi/projects/bundles/husky/trunk: .settings and 5 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 07:13:22 -0500 (Fri, 19 Feb 2010)
New Revision: 101157
Removed:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/HuskyActivator.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/context/context-basic.bnd
projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties
Log:
split testing from husky
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-19 12:05:35 UTC (rev 101156)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-19 12:13:22 UTC (rev 101157)
@@ -1,4 +1,4 @@
-#Wed Feb 17 12:15:46 CET 2010
+#Fri Feb 19 13:11:57 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml 2010-02-19 12:05:35 UTC (rev 101156)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/pom.xml 2010-02-19 12:13:22 UTC (rev 101157)
@@ -44,6 +44,7 @@
<version.apache.felix.log>1.0.0</version.apache.felix.log>
<version.jboss.osgi.jmx>1.0.4-SNAPSHOT</version.jboss.osgi.jmx>
<version.jboss.osgi.runtime.felix>2.0.2.SP1-SNAPSHOT</version.jboss.osgi.runtime.felix>
+ <version.jboss.osgi.testing>1.0.0-SNAPSHOT</version.jboss.osgi.testing>
<version.jboss.osgi.deployment>1.0.2-SNAPSHOT</version.jboss.osgi.deployment>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -119,6 +120,12 @@
<version>${version.jboss.osgi.runtime.felix}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <version>${version.jboss.osgi.testing}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -132,7 +139,6 @@
<Bundle-Activator>org.jboss.osgi.husky.runtime.osgi.HuskyActivator</Bundle-Activator>
<Export-Package>
org.jboss.osgi.husky;version=${version},
- org.jboss.osgi.testing;version=${version},
</Export-Package>
<Import-Package>
javax.management*,
@@ -149,17 +155,10 @@
org.osgi.framework;version="[1.5,2.0)",
org.osgi.jmx.framework;version="[1.0,2.0)",
org.osgi.util.tracker;version="[1.4,2.0)",
-
- <!-- ignore client side -->
- !org.jboss.osgi.deployment.deployer,
- !org.jboss.osgi.spi.framework,
- !org.osgi.framework.launch,
- !org.osgi.service.packageadmin,
</Import-Package>
<Private-Package>
org.jboss.osgi.husky.internal,
org.jboss.osgi.husky.runtime*,
- org.jboss.osgi.testing.internal,
</Private-Package>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Dependency>
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java 2010-02-19 12:05:35 UTC (rev 101156)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/HuskyCapability.java 2010-02-19 12:13:22 UTC (rev 101157)
@@ -26,10 +26,9 @@
import org.jboss.osgi.husky.runtime.Connector;
import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.spi.capability.Capability;
-import org.jboss.osgi.testing.OSGiRuntime;
/**
- * Adds the Husky testing capability to the {@link OSGiRuntime}
+ * Adds the Husky testing capability to the OSGiRuntime
* under test.
*
* It is ignored if a Husky connector is already registered.
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/HuskyActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/HuskyActivator.java 2010-02-19 12:05:35 UTC (rev 101156)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/HuskyActivator.java 2010-02-19 12:13:22 UTC (rev 101157)
@@ -38,7 +38,7 @@
* starts the {@link SocketConnector}.
*
* Finally it starts the {@link HuskyExtender}, which is a {@link BundleListener}
- * that looks for manifest headers called {@link HuskyExtender#HEADER_TEST_PACKAGE}.
+ * that looks for manifest headers called {@link ManifestProcessor#HEADER_TEST_PACKAGE}.
*
*
* @author Thomas.Diesler(a)jboss.com
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/context/context-basic.bnd
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/context/context-basic.bnd 2010-02-19 12:05:35 UTC (rev 101156)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/context/context-basic.bnd 2010-02-19 12:13:22 UTC (rev 101157)
@@ -5,10 +5,10 @@
Export-Package: org.jboss.test.osgi.husky.context
Import-Package: \
- org.jboss.osgi.spi.capability, \
- org.jboss.osgi.husky, \
- org.jboss.osgi.testing, \
- org.junit, \
- org.osgi.framework
+ org.jboss.osgi.spi.capability;version="[1.0,2.0)", \
+ org.jboss.osgi.husky;version="[1.0,2.0)", \
+ org.jboss.osgi.testing;version="[1.0,2.0)", \
+ org.junit;version="[4.6,5.0)", \
+ org.osgi.framework;version="[1.5,2.0)"
Test-Package: org.jboss.test.osgi.husky.context
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties 2010-02-19 12:05:35 UTC (rev 101156)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/test/resources/jboss-osgi-framework.properties 2010-02-19 12:13:22 UTC (rev 101157)
@@ -27,6 +27,7 @@
org.jboss.osgi.spi.management;version=1.0, \
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.osgi.testing;version=1.0, \
org.jboss.virtual;version=2.1, \
org.osgi.framework;version=1.5
14 years, 4 months
JBoss-OSGI SVN: r101156 - in projects/jboss-osgi/projects/testing/trunk: .settings and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 07:05:35 -0500 (Fri, 19 Feb 2010)
New Revision: 101156
Modified:
projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/testing/trunk/pom.xml
Log:
Add direct dependency on spi
Modified: projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-19 11:53:11 UTC (rev 101155)
+++ projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-19 12:05:35 UTC (rev 101156)
@@ -1,4 +1,4 @@
-#Fri Feb 19 11:02:56 CET 2010
+#Fri Feb 19 12:59:05 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
Modified: projects/jboss-osgi/projects/testing/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/pom.xml 2010-02-19 11:53:11 UTC (rev 101155)
+++ projects/jboss-osgi/projects/testing/trunk/pom.xml 2010-02-19 12:05:35 UTC (rev 101156)
@@ -43,6 +43,7 @@
<version.apache.aries.jmx>1.0.0-incubating-SNAPSHOT</version.apache.aries.jmx>
<version.apache.felix.log>1.0.0</version.apache.felix.log>
<version.jboss.osgi.jmx>1.0.4-SNAPSHOT</version.jboss.osgi.jmx>
+ <version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.runtime.felix>2.0.2.SP1-SNAPSHOT</version.jboss.osgi.runtime.felix>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -54,6 +55,11 @@
<artifactId>bnd</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <version>${version.jboss.osgi.spi}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-jmx</artifactId>
<version>${version.jboss.osgi.jmx}</version>
14 years, 4 months
JBoss-OSGI SVN: r101150 - in projects/jboss-osgi/projects/testing/trunk/src/test: java/org/jboss/test/osgi/testing and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 05:50:46 -0500 (Fri, 19 Feb 2010)
New Revision: 101150
Added:
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java
projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/
projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd
Log:
split husky and testing
Added: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,65 @@
+/*
+ * 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.testing;
+
+//$Id$
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * A test that deployes a bundle and verifies its state
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 12-Feb-2009
+ */
+public class SimpleTestCase extends OSGiTest
+{
+ @Test
+ public void testSimpleBundle() throws Exception
+ {
+ // Get the default runtime
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ // Install the bundle
+ OSGiBundle bundle = runtime.installBundle("example-simple.jar");
+ assertBundleState(Bundle.INSTALLED, bundle.getState());
+
+ // Start the bundle
+ bundle.start();
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+
+ // Uninstall the bundle
+ bundle.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ }
+ finally
+ {
+ // Shutdown the runtime
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/SimpleTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.testing.bundle;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class SimpleActivator implements BundleActivator
+{
+ private LogService log;
+
+ public void start(BundleContext context)
+ {
+ log = new LogServiceTracker(context);
+ log.log(LogService.LOG_INFO, "Start: " + context.getBundle());
+
+ // Register a service
+ SimpleService service = new SimpleService(context);
+ context.registerService(SimpleService.class.getName(), service, null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ log.log(LogService.LOG_INFO, "Stop: " + context.getBundle());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,50 @@
+/*
+ * 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.testing.bundle;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * A SimpleService
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class SimpleService
+{
+ private LogService log;
+
+ public SimpleService(BundleContext context)
+ {
+ log = new LogServiceTracker(context);
+ }
+
+ public String echo(String msg)
+ {
+ log.log(LogService.LOG_INFO, "echo: " + msg);
+ return msg;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/testing/bundle/SimpleService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/resources/simple/example-simple.bnd 2010-02-19 10:50:46 UTC (rev 101150)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/example-simple.jar src/test/resources/example/simple/example-simple.bnd
+
+Bundle-SymbolicName: example-simple
+
+Bundle-Activator: org.jboss.test.osgi.testing.bundle.SimpleActivator
+Export-Package: org.jboss.test.osgi.testing.bundle
14 years, 4 months
JBoss-OSGI SVN: r101149 - in projects/jboss-osgi/projects: testing and 21 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 05:43:03 -0500 (Fri, 19 Feb 2010)
New Revision: 101149
Added:
projects/jboss-osgi/projects/testing/
projects/jboss-osgi/projects/testing/trunk/
projects/jboss-osgi/projects/testing/trunk/.classpath
projects/jboss-osgi/projects/testing/trunk/.project
projects/jboss-osgi/projects/testing/trunk/.settings/
projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/testing/trunk/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/projects/testing/trunk/pom.xml
projects/jboss-osgi/projects/testing/trunk/scripts/
projects/jboss-osgi/projects/testing/trunk/scripts/antrun-test-jars.xml
projects/jboss-osgi/projects/testing/trunk/scripts/assembly-bundles.xml
projects/jboss-osgi/projects/testing/trunk/src/
projects/jboss-osgi/projects/testing/trunk/src/main/
projects/jboss-osgi/projects/testing/trunk/src/main/java/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/husky/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/husky/internal/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/husky/runtime/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/husky/runtime/junit/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiPackageAdmin.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiServiceReference.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedPackageAdmin.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedServiceReference.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFrameworkException.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteServiceReference.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/package.html
projects/jboss-osgi/projects/testing/trunk/src/test/
projects/jboss-osgi/projects/testing/trunk/src/test/java/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/husky/
projects/jboss-osgi/projects/testing/trunk/src/test/java/org/jboss/test/osgi/husky/context/
projects/jboss-osgi/projects/testing/trunk/src/test/resources/
projects/jboss-osgi/projects/testing/trunk/src/test/resources/context/
projects/jboss-osgi/projects/testing/trunk/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/projects/testing/trunk/src/test/resources/log4j.xml
Log:
split husky and testing
Property changes on: projects/jboss-osgi/projects/testing/trunk
___________________________________________________________________
Name: svn:ignore
+ target
Name: svn:mergeinfo
+
Added: projects/jboss-osgi/projects/testing/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/.classpath (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/.classpath 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/jboss-osgi/projects/testing/trunk/.project
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/.project (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/.project 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-husky</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/.settings/org.eclipse.jdt.core.prefs 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,6 @@
+#Fri Feb 19 11:02:56 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/projects/testing/trunk/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/.settings/org.maven.ide.eclipse.prefs 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,9 @@
+#Fri May 15 00:24:21 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: projects/jboss-osgi/projects/testing/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/pom.xml 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, JUnit testing for OSGi bundles -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBossOSGi - Testing</name>
+ <description>JBoss OSGi Test Support</description>
+
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <packaging>jar</packaging>
+
+ <version>1.0.0-SNAPSHOT</version>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-parent</artifactId>
+ <version>1.0.5-SNAPSHOT</version>
+ </parent>
+
+ <!-- Subversion -->
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
+ <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
+ </scm>
+
+ <!-- Properties -->
+ <properties>
+ <version.apache.aries.jmx>1.0.0-incubating-SNAPSHOT</version.apache.aries.jmx>
+ <version.apache.felix.log>1.0.0</version.apache.felix.log>
+ <version.jboss.osgi.jmx>1.0.4-SNAPSHOT</version.jboss.osgi.jmx>
+ <version.jboss.osgi.runtime.felix>2.0.2.SP1-SNAPSHOT</version.jboss.osgi.runtime.felix>
+ <version.osgi>4.2.0</version.osgi>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version.jboss.osgi.jmx}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx</artifactId>
+ <version>${version.apache.aries.jmx}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>${version.apache.felix.log}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- OSGi Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
+ <version>${version.jboss.osgi.runtime.felix}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <quiet>true</quiet>
+ <excludePackageNames>*.internal</excludePackageNames>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="artifactId" value="${artifactId}" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <property name="build.artifact" value="${project.build.finalName}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${surefire.jpda.args}</argLine>
+ <systemProperties>
+ <property>
+ <name>java.protocol.handler.pkgs</name>
+ <value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
+ </property>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>${project.build.directory}</value>
+ </property>
+ <property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Profiles -->
+ <profiles>
+
+ <!--
+ Name: jpda
+ Descr: Enable JPDA remote debuging
+ -->
+ <profile>
+ <id>jpda</id>
+ <activation>
+ <property>
+ <name>jpda</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jpda.args>-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</surefire.jpda.args>
+ </properties>
+ </profile>
+
+ </profiles>
+
+</project>
Property changes on: projects/jboss-osgi/projects/testing/trunk/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/scripts/antrun-test-jars.xml (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/scripts/antrun-test-jars.xml 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ============================================================ -->
+
+<!-- $Id$ -->
+
+<project default="build-test-jars">
+
+ <description>OSGi test archive builder</description>
+
+ <!-- ================================================================== -->
+ <!-- Init -->
+ <!-- ================================================================== -->
+
+ <target name="init">
+
+ <!-- Property override when not called from maven -->
+ <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
+ <property name="tests.output.dir" value="${basedir}/../target" />
+
+ <mkdir dir="${tests.output.dir}/test-libs" />
+ <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
+ <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
+
+ <taskdef resource="aQute/bnd/ant/taskdef.properties">
+ <classpath>
+ <pathelement path="${maven.runtime.classpath}" />
+ </classpath>
+ </taskdef>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Building -->
+ <!-- ================================================================== -->
+
+ <target name="build-test-jars" depends="init" description="Build the test deployments">
+
+ <!-- Please add alphabetically -->
+
+ <!-- simple -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-simple.jar" files="${tests.resources.dir}/simple/example-simple.bnd" />
+
+ <!-- Please add alphabetically -->
+
+ </target>
+
+</project>
Property changes on: projects/jboss-osgi/projects/testing/trunk/scripts/antrun-test-jars.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/scripts/assembly-bundles.xml (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/scripts/assembly-bundles.xml 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,41 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+ <id>deploy-artifacts</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <!-- Dependency Sets -->
+ <dependencySets>
+
+ <!-- bundle -->
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:jboss-osgi-common-core:jar</include>
+ <include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-jndi:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>compile</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:org.apache.aries.jmx:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>provided</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Property changes on: projects/jboss-osgi/projects/testing/trunk/scripts/assembly-bundles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,159 @@
+/*
+ * 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.testing;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Dictionary;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+/**
+ * An abstraction of an OSGi {@link Bundle}.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiBundle
+{
+ /**
+ * Get the runtime associated with this bundle.
+ */
+ public abstract OSGiRuntime getRuntime();
+
+ /**
+ * Returns this bundle's unique identifier.
+ */
+ public abstract long getBundleId();
+
+ /**
+ * Returns the symbolic name of this bundle as specified by its Bundle-SymbolicName manifest header.
+ */
+ public abstract String getSymbolicName();
+
+ /**
+ * Returns the version of this bundle.
+ */
+ public abstract Version getVersion();
+
+ /**
+ * Returns this bundle's location.
+ */
+ public abstract String getLocation();
+
+ /**
+ * Returns this bundle's Manifest headers and values.
+ */
+ public abstract Dictionary<String, String> getHeaders();
+
+ /**
+ * Returns this bundle's Manifest headers and values localized to the specified locale.
+ */
+ public abstract Dictionary<String, String> getHeaders(String locale);
+
+ /**
+ * Returns this bundle's current state.
+ */
+ public abstract int getState();
+
+ /**
+ * Returns the value of the specified property.
+ */
+ public abstract String getProperty(String key);
+
+ /**
+ * Creates a File object for a file in the persistent storage area provided for the bundle by the Framework.
+ */
+ public abstract File getDataFile(String filename);
+
+ /**
+ * Loads the specified class using this bundle's class loader.
+ *
+ * @param name The name of the class to load
+ * @return The OSGiBundle that is wired to this bundle class loader and contains the class.
+ * @throws ClassNotFoundException If no such class can be found or if this bundle is a fragment bundle
+ */
+ public abstract OSGiBundle loadClass(String name) throws ClassNotFoundException;
+
+ /**
+ * Returns a URL to the entry at the specified path in this bundle.
+ *
+ * @param name The path name of the entry
+ * @return A URL to the entry, or null if no entry could be found
+ */
+ public abstract URL getEntry(String path);
+
+ /**
+ * Find the specified resource from this bundle's class loader.
+ * @param name The name of the resource.
+ * @return A URL to the named resource, or null if the resource could not be found
+ */
+ public abstract URL getResource(String name);
+
+ /**
+ * Starts this bundle.
+ */
+ public abstract void start() throws BundleException;
+
+ /**
+ * Stops this bundle.
+ */
+ public abstract void stop() throws BundleException;
+
+ /**
+ * Uninstalls this bundle.
+ */
+ public abstract void uninstall() throws BundleException;
+
+ /**
+ * Return true if symbolic name and version are equal
+ */
+ public boolean equals(Object obj)
+ {
+ if ((obj instanceof OSGiBundle) == false)
+ return false;
+
+ OSGiBundle other = (OSGiBundle)obj;
+
+ boolean isEqual = getSymbolicName().equals(other.getSymbolicName());
+ isEqual = isEqual && getVersion().equals(other.getVersion());
+ return isEqual;
+ }
+
+ /**
+ * Returns the hash code for this bundle.
+ */
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ /**
+ * Returns the string representation of this bundle
+ */
+ public String toString()
+ {
+ return "[" + getSymbolicName() + "," + getVersion() + "]";
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiPackageAdmin.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiPackageAdmin.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiPackageAdmin.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.testing;
+
+//$Id$
+
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * An abstraction of the OSGi {@link PackageAdmin} service.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public interface OSGiPackageAdmin
+{
+ /**
+ * Forces the update (replacement) or removal of packages exported by the specified bundles.
+ *
+ * @see {@link PackageAdmin#refreshPackages(org.osgi.framework.Bundle[])}
+ *
+ * @param bundles The bundles whose exported packages are to be updated or removed,
+ * or null for all bundles updated or uninstalled since the last call to this method.
+ */
+ void refreshPackages(OSGiBundle[] bundles);
+
+ /**
+ * Resolve the specified bundles.
+ *
+ * @see {@link PackageAdmin#resolveBundles(org.osgi.framework.Bundle[])}
+ *
+ * @param bundles The bundles to resolve or null to resolve all unresolved bundles installed in the Framework.
+ * @return true if all specified bundles are resolved
+ */
+ boolean resolveBundles(OSGiBundle[] bundles);
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiPackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,165 @@
+/*
+ * 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.testing;
+
+import javax.management.MBeanServerConnection;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.spi.capability.Capability;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.jmx.framework.BundleStateMBean;
+import org.osgi.jmx.framework.FrameworkMBean;
+import org.osgi.jmx.framework.PackageStateMBean;
+import org.osgi.jmx.framework.ServiceStateMBean;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * An abstraction of an OSGi Runtime.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public interface OSGiRuntime
+{
+ /**
+ * Add a {@link Capability} to the runtime.
+ *
+ * Adding a capability recursively adds the orderded set of dependent capabilities
+ * before it installs and starts the orderded set bundles.
+ */
+ void addCapability(Capability capability) throws BundleException;
+
+ /**
+ * Remove a {@link Capability} from the runtime.
+ *
+ * Removing a capability does the reverse of {@link #addCapability(Capability)}.
+ */
+ void removeCapability(Capability capability);
+
+ /**
+ * Install an {@link OSGiBundle} from the given location.
+ */
+ OSGiBundle installBundle(String location) throws BundleException;
+
+ /**
+ * Get the FrameworkMBean
+ */
+ FrameworkMBean getFrameworkMBean();
+
+ /**
+ * Get the BundleStateMBean
+ */
+ BundleStateMBean getBundleStateMBean();
+
+ /**
+ * Get the PackageStateMBean
+ */
+ PackageStateMBean getPackageStateMBean();
+
+ /**
+ * Get the ServiceStateMBean
+ */
+ ServiceStateMBean getServiceStateMBean();
+
+ /**
+ * Get the array of installed {@link OSGiBundle}s
+ */
+ OSGiBundle[] getBundles();
+
+ /**
+ * Get the {@link OSGiBundle} for a given symbolic name and version
+ *
+ * In case the version is left unspecified, it returns the first bundle that
+ * matches the symbolic name.
+ *
+ * @param version may be null
+ * @return The bundle or null if there is none
+ */
+ OSGiBundle getBundle(String symbolicName, Version version);
+
+ /**
+ * Get the {@link OSGiBundle} for a given bundle id.
+ *
+ * @return The bundle or null if there is none
+ */
+ OSGiBundle getBundle(long bundleId);
+
+ /**
+ * Get an abstraction of the {@link PackageAdmin}.
+ */
+ OSGiPackageAdmin getPackageAdmin();
+
+ /**
+ * Returns a ServiceReference object for a service that implements and was registered
+ * under the specified class.
+ *
+ * @return A ServiceReference object, or null if no services are registered which implement the named class.
+ */
+ OSGiServiceReference getServiceReference(String clazz);
+
+ /**
+ * Returns a ServiceReference object for a service that implements and was registered
+ * under the specified class.
+ *
+ * @param timeout the timeout to wait for the service to become available
+ * @return A ServiceReference object, or null if no services are registered which implement the named class.
+ */
+ OSGiServiceReference getServiceReference(String clazz, long timeout);
+
+ /**
+ * Returns an array of ServiceReference objects.
+ * The returned array of ServiceReference objects contains services that were registered under the specified
+ * class and match the specified filter criteria.
+ */
+ OSGiServiceReference[] getServiceReferences(String clazz, String filter);
+
+ /**
+ * Get the initial naming context for this {@link OSGiRuntime}
+ */
+ InitialContext getInitialContext() throws NamingException;
+
+ /**
+ * Get the MBeanServerConnection for this {@link OSGiRuntime}
+ */
+ MBeanServerConnection getMBeanServer();
+
+ /**
+ * Get the host name that this {@link OSGiRuntime} is running on.
+ *
+ * This is the value of the 'jboss.bind.address' system property.
+ */
+ String getServerHost();
+
+ /**
+ * Return true if this {@link OSGiRuntime} connects to a remote Framework.
+ */
+ boolean isRemoteRuntime();
+
+ /**
+ * Shutdown the {@link OSGiRuntime}.
+ *
+ * This will remove all installed {@link OSGiBundle}s and added {@link Capability}.
+ */
+ void shutdown();
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiServiceReference.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiServiceReference.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiServiceReference.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,47 @@
+/*
+ * 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.testing;
+
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * An abstraction of the OSGi {@link ServiceReference}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public interface OSGiServiceReference
+{
+ /**
+ * Returns the property value to which the specified property key is mapped
+ * in the properties Dictionary object of the service referenced by this
+ * ServiceReference object.
+ */
+ Object getProperty(String key);
+
+ /**
+ * Returns an array of the keys in the properties Dictionary
+ * object of the service referenced by this ServiceReference object.
+ */
+ String[] getPropertyKeys();
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiServiceReference.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,224 @@
+/*
+ * 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.testing;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.junit.After;
+import org.junit.Before;
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstract OSGi Test.
+ *
+ * {@link OSGiTest} is a convenience wrapper for the functionality provided
+ * by {@link OSGiTestHelper}.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiTest
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(OSGiTest.class);
+
+ private OSGiTestHelper helper;
+
+ protected OSGiTest()
+ {
+ // Prevent unknown protocol: vfsfile
+ VFS.init();
+ }
+
+ /**
+ * Get the test helper used by this test
+ *
+ * Overwrite if you need to supply another helper
+ * i.e. one that you have statically setup
+ */
+ protected OSGiTestHelper getTestHelper()
+ {
+ if (helper == null)
+ helper = new OSGiTestHelper();
+
+ return helper;
+ }
+
+ /**
+ * Writes a a debug start messge
+ */
+ @Before
+ public void setUp() throws Exception
+ {
+ log.debug("### START " + getLongName());
+ }
+
+ /**
+ * Writes a a debug stop messge
+ */
+ @After
+ public void tearDown() throws Exception
+ {
+ log.debug("### END " + getLongName());
+ }
+
+ /**
+ * Get the last token in the FQN of this test class.
+ */
+ protected String getShortName()
+ {
+ String shortName = getClass().getName();
+ shortName = shortName.substring(shortName.lastIndexOf(".") + 1);
+ return shortName;
+ }
+
+ /**
+ * Get the the FQN of this test class.
+ */
+ protected String getLongName()
+ {
+ return getClass().getName();
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getDefaultRuntime()}
+ */
+ protected OSGiRuntime getDefaultRuntime()
+ {
+ return getTestHelper().getDefaultRuntime();
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getEmbeddedRuntime()}
+ */
+ protected OSGiRuntime getEmbeddedRuntime()
+ {
+ return getTestHelper().getEmbeddedRuntime();
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getRemoteRuntime()}
+ */
+ public OSGiRuntime getRemoteRuntime()
+ {
+ return getTestHelper().getRemoteRuntime();
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getResourceURL(String)}
+ */
+ protected URL getResourceURL(String resource)
+ {
+ return getTestHelper().getResourceURL(resource);
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getResourceFile(String)}
+ */
+ protected File getResourceFile(String resource)
+ {
+ return getTestHelper().getResourceFile(resource);
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getTestArchiveURL(String)}
+ */
+ protected URL getTestArchiveURL(String archive)
+ {
+ return getTestHelper().getTestArchiveURL(archive);
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getTestArchivePath(String)}
+ */
+ protected String getTestArchivePath(String archive)
+ {
+ return getTestHelper().getTestArchivePath(archive);
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getTestArchiveFile(String)}
+ */
+ protected File getTestArchiveFile(String archive)
+ {
+ return getTestHelper().getTestArchiveFile(archive);
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getInitialContext()}
+ */
+ public InitialContext getInitialContext() throws NamingException
+ {
+ return getTestHelper().getInitialContext();
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getServerHost()}
+ */
+ public String getServerHost()
+ {
+ return getTestHelper().getServerHost();
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getTargetContainer()}
+ */
+ public String getTargetContainer()
+ {
+ return getTestHelper().getTargetContainer();
+ }
+
+ /**
+ * Delegates to {@link OSGiTestHelper#getFrameworkName()}
+ */
+ public String getFrameworkName()
+ {
+ return getTestHelper().getFrameworkName();
+ }
+
+ public VirtualFile assembleBundle(String name, String resource, Class<?>... packages) throws Exception
+ {
+ return getTestHelper().assembleBundle(name, resource, packages);
+ }
+
+ public VirtualFile assembleBundle(String name, String[] resources, Class<?>... packages) throws Exception
+ {
+ return getTestHelper().assembleBundle(name, resources, packages);
+ }
+
+ public void assertBundleState(int expState, int wasState)
+ {
+ getTestHelper().assertBundleState(expState, wasState);
+ }
+
+ public void assertBundleLoadClass(Bundle bundle, String className, boolean success)
+ {
+ getTestHelper().assertBundleLoadClass(bundle, className, success);
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,288 @@
+/*
+ * 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.testing;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Hashtable;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import junit.framework.AssertionFailedError;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.jboss.osgi.testing.internal.EmbeddedRuntime;
+import org.jboss.osgi.testing.internal.RemoteRuntime;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+
+/**
+ * An OSGi Test Helper
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class OSGiTestHelper
+{
+ private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+ private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
+
+ // The OSGiBootstrapProvider is a lazy property of the helper
+ private OSGiBootstrapProvider bootProvider;
+ private boolean skipCreateBootstrapProvider;
+
+ private static String testResourcesDir;
+ private static String testArchiveDir;
+
+ public OSGiTestHelper()
+ {
+ testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
+ testArchiveDir = System.getProperty(SYSPROP_TEST_ARCHIVE_DIRECTORY, "target/test-libs");
+ }
+
+ public OSGiBootstrapProvider getBootstrapProvider()
+ {
+ if (bootProvider == null && skipCreateBootstrapProvider == false)
+ {
+ try
+ {
+ bootProvider = OSGiBootstrap.getBootstrapProvider();
+ }
+ catch (RuntimeException rte)
+ {
+ skipCreateBootstrapProvider = true;
+ throw rte;
+ }
+ }
+ return bootProvider;
+ }
+
+ public void ungetBootstrapProvider()
+ {
+ bootProvider = null;
+ }
+
+ public OSGiRuntime getDefaultRuntime()
+ {
+ OSGiRuntime runtime;
+
+ String target = System.getProperty("target.container");
+ if (target == null)
+ {
+ runtime = getEmbeddedRuntime();
+ }
+ else
+ {
+ runtime = getRemoteRuntime();
+ }
+ return runtime;
+ }
+
+ public OSGiRuntime getEmbeddedRuntime()
+ {
+ return new EmbeddedRuntime(this);
+ }
+
+ public OSGiRuntime getRemoteRuntime()
+ {
+ return new RemoteRuntime(this);
+ }
+
+ /** Try to discover the URL for the test resource */
+ public URL getResourceURL(String resource)
+ {
+ URL resURL = null;
+ try
+ {
+ File resourceFile = getResourceFile(resource);
+ resURL = resourceFile.toURI().toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ return resURL;
+ }
+
+ /** Try to discover the File for the test resource */
+ public File getResourceFile(String resource)
+ {
+ File file = new File(resource);
+ if (file.exists())
+ return file;
+
+ file = new File(testResourcesDir + "/" + resource);
+ if (file.exists())
+ return file;
+
+ throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
+ }
+
+ /** Try to discover the URL for the deployment archive */
+ public URL getTestArchiveURL(String archive)
+ {
+ try
+ {
+ return getTestArchiveFile(archive).toURI().toURL();
+ }
+ catch (MalformedURLException ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ /** Try to discover the absolute path for the deployment archive */
+ public String getTestArchivePath(String archive)
+ {
+ return getTestArchiveFile(archive).getAbsolutePath();
+ }
+
+ /** Try to discover the File for the deployment archive */
+ public File getTestArchiveFile(String archive)
+ {
+ File file = new File(archive);
+ if (file.exists())
+ return file;
+
+ file = new File(testArchiveDir + "/" + archive);
+ if (file.exists())
+ return file;
+
+ throw new IllegalArgumentException("Cannot obtain '" + testArchiveDir + "/" + archive + "'.");
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public InitialContext getInitialContext() throws NamingException
+ {
+ String port = System.getProperty("jndi.server.port", "1099");
+ Integer jndiPort = new Integer(port);
+
+ Hashtable env = new Hashtable();
+ env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + getServerHost() + ":" + jndiPort);
+ return new InitialContext(env);
+ }
+
+ public String getServerHost()
+ {
+ String bindAddress = System.getProperty("jboss.bind.address", "localhost");
+ return bindAddress;
+ }
+
+ public String getTargetContainer()
+ {
+ String targetContainer = System.getProperty("target.container");
+ return targetContainer;
+ }
+
+ public String getFrameworkName()
+ {
+ String framework = System.getProperty("framework");
+ if (framework == null || framework.length() == 0 || framework.equals("${framework}"))
+ framework = "jbossmc";
+
+ return framework;
+ }
+
+ public VirtualFile assembleBundle(String name, String resource, Class<?>... packages) throws Exception
+ {
+ return assembleBundle(name, new String[] { resource }, packages);
+ }
+
+ public VirtualFile assembleBundle(String name, String[] resources, Class<?>... packages) throws Exception
+ {
+ AssembledDirectory assembledDirectory = AssembledDirectory.createAssembledDirectory(name, "");
+ for (String path : resources)
+ addPath(assembledDirectory, path, "");
+ for (Class<?> reference : packages)
+ addPackage(assembledDirectory, reference);
+ return assembledDirectory;
+ }
+
+ public void assertBundleState(int expState, int wasState)
+ {
+ String expstr = ConstantsHelper.bundleState(expState);
+ String wasstr = ConstantsHelper.bundleState(wasState);
+ assertEquals("Bundle " + expstr, expstr, wasstr);
+ }
+
+ public void assertBundleLoadClass(Bundle bundle, String className, boolean success)
+ {
+ String message = bundle.getSymbolicName() + " loads " + className;
+
+ Class<?> clazz;
+ try
+ {
+ clazz = bundle.loadClass(className);
+ if (success)
+ {
+ assertEquals(message, className, clazz.getName());
+ }
+ else
+ {
+ fail("ClassNotFoundException expected for: " + message + "\nLoaded from " + clazz.getClassLoader());
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ if (success)
+ fail("Unexpected ClassNotFoundException for: " + message);
+ }
+ }
+
+ private void addPath(AssembledDirectory dir, String path, String name) throws Exception
+ {
+ URL url = getClass().getResource(path);
+ if (url == null)
+ throw new AssertionFailedError(path + " not found");
+
+ VirtualFile file = VFS.getVirtualFile(url, name);
+ dir.addPath(file);
+ }
+
+ private void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
+ {
+ String packagePath = packageNameToPath(reference.getName());
+ dir.addResources(reference, new String[] { packagePath + "/*.class" }, new String[0]);
+ }
+
+ // Convert a class's package name into a path
+ private String packageNameToPath(final String className)
+ {
+ int end = className.lastIndexOf('.');
+ if (end == -1)
+ return "";
+
+ String packageName = className.substring(0, end);
+ return packageName.replace('.', '/');
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,169 @@
+/*
+ * 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.testing.internal;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Dictionary;
+
+import org.jboss.osgi.spi.util.ExportedPackageHelper;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * An OSGi Test Case
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedBundle extends OSGiBundleImpl
+{
+ private Bundle bundle;
+
+ public EmbeddedBundle(OSGiRuntimeImpl runtime, Bundle bundle)
+ {
+ super(runtime);
+ this.bundle = bundle;
+ }
+
+ public Bundle getBundle()
+ {
+ return bundle;
+ }
+
+ @Override
+ public int getState()
+ {
+ return bundle.getState();
+ }
+
+ @Override
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
+
+ @Override
+ public Version getVersion()
+ {
+ return bundle.getVersion();
+ }
+
+ @Override
+ public String getLocation()
+ {
+ return bundle.getLocation();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Dictionary<String, String> getHeaders()
+ {
+ return bundle.getHeaders();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Dictionary<String, String> getHeaders(String locale)
+ {
+ return bundle.getHeaders(locale);
+ }
+
+ @Override
+ public long getBundleId()
+ {
+ return bundle.getBundleId();
+ }
+
+ @Override
+ public String getProperty(String key)
+ {
+ return bundle.getBundleContext().getProperty(key);
+ }
+
+ @Override
+ public URL getEntry(String path)
+ {
+ return bundle.getEntry(path);
+ }
+
+ @Override
+ public URL getResource(String name)
+ {
+ return bundle.getResource(name);
+ }
+
+ @Override
+ public File getDataFile(String filename)
+ {
+ return bundle.getBundleContext().getDataFile(filename);
+ }
+
+ @Override
+ public OSGiBundle loadClass(String name) throws ClassNotFoundException
+ {
+ Class<?> clazz = bundle.loadClass(name);
+ Bundle providerBundle = getPackageAdmin().getBundle(clazz);
+ if (providerBundle == null)
+ return null;
+
+ return getRuntime().getBundle(providerBundle.getBundleId());
+ }
+
+ @Override
+ public void start() throws BundleException
+ {
+ bundle.start();
+
+ ExportedPackageHelper helper = new ExportedPackageHelper(bundle.getBundleContext());
+ helper.logExportedPackages(bundle);
+ }
+
+ @Override
+ public void stop() throws BundleException
+ {
+ bundle.stop();
+ }
+
+ @Override
+ public void uninstall() throws BundleException
+ {
+ assertNotUninstalled();
+
+ bundle.uninstall();
+
+ OSGiRuntimeImpl runtimeImpl = (OSGiRuntimeImpl)getRuntime();
+ runtimeImpl.unregisterBundle(this);
+ }
+
+ private PackageAdmin getPackageAdmin()
+ {
+ BundleContext context = ((EmbeddedRuntime)getRuntime()).getSystemContext();
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ return (PackageAdmin)context.getService(sref);
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedPackageAdmin.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedPackageAdmin.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedPackageAdmin.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,69 @@
+/*
+ * 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.testing.internal;
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * An embedded implementation of the {@link OSGiPackageAdmin}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedPackageAdmin implements OSGiPackageAdmin
+{
+ private PackageAdmin delegate;
+
+ public EmbeddedPackageAdmin(PackageAdmin packAdmin)
+ {
+ this.delegate = packAdmin;
+ }
+
+ public boolean resolveBundles(OSGiBundle[] bundles)
+ {
+ Bundle[] bundleArr = getBundles(bundles);
+ return delegate.resolveBundles(bundleArr);
+ }
+
+ public void refreshPackages(OSGiBundle[] bundles)
+ {
+ Bundle[] bundleArr = getBundles(bundles);
+ delegate.refreshPackages(bundleArr);
+ }
+
+ private Bundle[] getBundles(OSGiBundle[] bundles)
+ {
+ Bundle[] bundleArr = null;
+ if (bundles != null)
+ {
+ bundleArr = new Bundle[bundles.length];
+ for (int i=0; i < bundles.length; i++)
+ {
+ bundleArr[i] = ((EmbeddedBundle)bundles[i]).getBundle();
+ }
+ }
+ return bundleArr;
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedPackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,213 @@
+/*
+ * 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.testing.internal;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.capability.Capability;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiServiceReference;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.launch.Framework;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * An embedded implementation of the {@link OSGiRuntime}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedRuntime extends OSGiRuntimeImpl
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(EmbeddedRuntime.class);
+
+ public EmbeddedRuntime(OSGiTestHelper helper)
+ {
+ super(helper);
+ }
+
+ public OSGiBundle installBundle(String location) throws BundleException
+ {
+ BundleInfo info = BundleInfo.createBundleInfo(location);
+
+ BundleContext context = getSystemContext();
+ Bundle auxBundle = context.installBundle(info.getLocation());
+ OSGiBundle bundle = new EmbeddedBundle(this, auxBundle);
+
+ return registerBundle(bundle.getLocation(), bundle);
+ }
+
+ public OSGiBundle[] getBundles()
+ {
+ List<OSGiBundle> absBundles = new ArrayList<OSGiBundle>();
+ for (Bundle bundle : getSystemContext().getBundles())
+ {
+ absBundles.add(new EmbeddedBundle(this, bundle));
+ }
+ OSGiBundle[] bundleArr = new OSGiBundle[absBundles.size()];
+ absBundles.toArray(bundleArr);
+ return bundleArr;
+ }
+
+ public OSGiBundle getBundle(long bundleId)
+ {
+ Bundle bundle = getSystemContext().getBundle(bundleId);
+ return bundle != null ? new EmbeddedBundle(this, bundle) : null;
+ }
+
+ public OSGiServiceReference getServiceReference(String clazz)
+ {
+ ServiceReference sref = getSystemContext().getServiceReference(clazz);
+ return (sref != null ? new EmbeddedServiceReference(sref) : null);
+ }
+
+ public OSGiServiceReference[] getServiceReferences(String clazz, String filter)
+ {
+ OSGiServiceReference[] retRefs = null;
+
+ ServiceReference[] srefs;
+ try
+ {
+ srefs = getSystemContext().getServiceReferences(clazz, filter);
+ }
+ catch (InvalidSyntaxException e)
+ {
+ throw new IllegalArgumentException("Invalid filter syntax: " + filter);
+ }
+
+ if (srefs != null)
+ {
+ retRefs = new OSGiServiceReference[srefs.length];
+ for (int i = 0; i < srefs.length; i++)
+ retRefs[i] = new EmbeddedServiceReference(srefs[i]);
+ }
+ return retRefs;
+ }
+
+ @Override
+ public void addCapability(Capability capability) throws BundleException
+ {
+ // Copy the properties to the System props
+ Map<String, String> props = capability.getSystemProperties();
+ for (Entry<String, String> entry : props.entrySet())
+ {
+ String value = System.getProperty(entry.getKey());
+ if (value == null)
+ System.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ super.addCapability(capability);
+ }
+
+ @Override
+ public void shutdown()
+ {
+ OSGiBootstrapProvider bootProvider = getTestHelper().getBootstrapProvider();
+ if (bootProvider != null)
+ {
+ super.shutdown();
+ try
+ {
+ Framework framework = bootProvider.getFramework();
+ log.debug("Framework stop: " + framework);
+ framework.stop();
+ framework.waitForStop(5000);
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot stop the framework", ex);
+ }
+ finally
+ {
+ getTestHelper().ungetBootstrapProvider();
+ }
+ }
+ }
+
+ public MBeanServerConnection getMBeanServer()
+ {
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+ MBeanServer server = null;
+ if (serverArr.size() == 1)
+ server = serverArr.get(0);
+
+ if (server == null)
+ server = MBeanServerFactory.createMBeanServer();
+
+ return server;
+ }
+
+ public OSGiPackageAdmin getPackageAdmin()
+ {
+ BundleContext context = getSystemContext();
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin packAdmin = (PackageAdmin)context.getService(sref);
+ return new EmbeddedPackageAdmin(packAdmin);
+ }
+
+ public boolean isRemoteRuntime()
+ {
+ return false;
+ }
+
+ BundleContext getSystemContext()
+ {
+ OSGiBootstrapProvider bootProvider = getTestHelper().getBootstrapProvider();
+ Framework framework = bootProvider.getFramework();
+ if (framework.getState() != Bundle.ACTIVE)
+ {
+ try
+ {
+ log.debug("Framework start: " + framework);
+ framework.start();
+ }
+ catch (BundleException ex)
+ {
+ throw new IllegalStateException("Cannot start framework", ex);
+ }
+ }
+ return framework.getBundleContext();
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedServiceReference.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedServiceReference.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedServiceReference.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,54 @@
+/*
+ * 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.testing.internal;
+
+// $Id$
+
+import org.jboss.osgi.testing.OSGiServiceReference;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * An embedded implementation of the {@link OSGiServiceReference}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedServiceReference implements OSGiServiceReference
+{
+ private ServiceReference sref;
+
+ public EmbeddedServiceReference(ServiceReference sref)
+ {
+ this.sref = sref;
+ }
+
+ public Object getProperty(String key)
+ {
+ return sref.getProperty(key);
+ }
+
+ public String[] getPropertyKeys()
+ {
+ return sref.getPropertyKeys();
+ }
+
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedServiceReference.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,83 @@
+/*
+ * 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.testing.internal;
+
+// $Id$
+
+import java.net.URL;
+
+import javax.management.MBeanException;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.osgi.framework.BundleException;
+
+/**
+ * An abstract implementation of the {@link OSGiRuntime}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+class MainDeployerClient
+{
+ private final OSGiRuntime runtime;
+
+ MainDeployerClient(OSGiRuntime runtime)
+ {
+ this.runtime = runtime;
+ }
+
+ public void deploy(URL url) throws BundleException
+ {
+ invokeDeployerMBean("deploy", url);
+ }
+
+ public void undeploy(URL url) throws BundleException
+ {
+ invokeDeployerMBean("undeploy", url);
+ }
+
+ private void invokeDeployerMBean(String method, URL url) throws BundleException
+ {
+ try
+ {
+ ObjectName objectName = ObjectNameFactory.create("jboss.system:service=MainDeployer");
+ runtime.getMBeanServer().invoke(objectName, method, new Object[] { url }, new String[] { URL.class.getName() });
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ if (ex instanceof MBeanException)
+ {
+ ex = ((MBeanException)ex).getTargetException();
+ if (ex instanceof BundleException)
+ throw (BundleException)ex;
+ }
+
+ throw new BundleException("Cannot " + method + ": " + url, ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/MainDeployerClient.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.testing.internal;
+
+// $Id$
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstract implementation of a {@link OSGiBundle}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiBundleImpl extends OSGiBundle
+{
+ private OSGiRuntime runtime;
+
+ OSGiBundleImpl(OSGiRuntime runtime)
+ {
+ this.runtime = runtime;
+ }
+
+ public OSGiRuntime getRuntime()
+ {
+ return runtime;
+ }
+
+ void assertNotUninstalled()
+ {
+ if (getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + getLocation());
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,364 @@
+/*
+ * 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.testing.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.capability.Capability;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiServiceReference;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.jmx.framework.BundleStateMBean;
+import org.osgi.jmx.framework.FrameworkMBean;
+import org.osgi.jmx.framework.PackageStateMBean;
+import org.osgi.jmx.framework.ServiceStateMBean;
+
+/**
+ * An abstract implementation of the {@link OSGiRuntime}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiRuntimeImpl implements OSGiRuntime
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(OSGiRuntimeImpl.class);
+
+ private OSGiTestHelper helper;
+ private Map<String, OSGiBundle> bundles = new LinkedHashMap<String, OSGiBundle>();
+ private List<Capability> capabilities = new ArrayList<Capability>();
+
+ private ServiceStateMBean serviceState;
+ private PackageStateMBean packageState;
+ private BundleStateMBean bundleState;
+ private FrameworkMBean framework;
+
+ public OSGiRuntimeImpl(OSGiTestHelper helper)
+ {
+ this.helper = helper;
+ }
+
+ public OSGiTestHelper getTestHelper()
+ {
+ return helper;
+ }
+
+ public void addCapability(Capability capability) throws BundleException
+ {
+ // Add dependent capabilies
+ for (Capability dependency : capability.getDependencies())
+ addCapability(dependency);
+
+ OSGiServiceReference[] srefs = null;
+
+ // Check if the service provided by the capability exists already
+ String serviceName = capability.getServiceName();
+ if (serviceName != null)
+ srefs = getServiceReferences(serviceName, capability.getFilter());
+
+ if (srefs == null || srefs.length == 0)
+ {
+ log.debug("Add capability: " + capability);
+
+ // Install the capability bundles
+ List<OSGiBundle> installed = new ArrayList<OSGiBundle>();
+ for (BundleInfo info : capability.getBundles())
+ {
+ String location = info.getLocation();
+ String symName = info.getSymbolicName();
+ Version version = info.getVersion();
+ if (bundles.get(location) == null && getBundle(symName, version) == null)
+ {
+ OSGiBundle bundle = installBundle(location);
+ installed.add(bundle);
+ }
+ else
+ {
+ log.debug("Skip bundle: " + location);
+ }
+ }
+
+ // Start the capability bundles
+ for (OSGiBundle bundle : installed)
+ {
+ bundle.start();
+ }
+ capabilities.add(capability);
+ }
+ else
+ {
+ log.debug("Skip capability: " + capability);
+ }
+ }
+
+ public void removeCapability(Capability capability)
+ {
+ if (capabilities.remove(capability))
+ {
+ log.debug("Remove capability : " + capability);
+
+ List<BundleInfo> bundleInfos = new ArrayList<BundleInfo>(capability.getBundles());
+ Collections.reverse(bundleInfos);
+
+ for (BundleInfo info : bundleInfos)
+ failsafeUninstall(bundles.remove(info.getLocation()));
+ }
+
+ List<Capability> dependencies = new ArrayList<Capability>(capability.getDependencies());
+ Collections.reverse(dependencies);
+
+ // Remove dependent capabilities
+ for (Capability dependency : dependencies)
+ removeCapability(dependency);
+ }
+
+ public void shutdown()
+ {
+ log.debug("Start Shutdown");
+
+ // Uninstall the registered bundles
+ ArrayList<String> locations = new ArrayList<String>(bundles.keySet());
+ Collections.reverse(locations);
+
+ while (locations.size() > 0)
+ {
+ String location = locations.remove(0);
+ failsafeUninstall(bundles.remove(location));
+ }
+
+ // Uninstall the capabilities
+ Collections.reverse(capabilities);
+ while (capabilities.size() > 0)
+ {
+ Capability capability = capabilities.get(0);
+ removeCapability(capability);
+ }
+
+ log.debug("End Shutdown");
+ }
+
+ public FrameworkMBean getFrameworkMBean()
+ {
+ if (framework == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(FrameworkMBean.OBJECTNAME);
+ framework = MBeanProxy.get(getMBeanServer(), objectName, FrameworkMBean.class);
+ }
+ return framework;
+ }
+
+ public BundleStateMBean getBundleStateMBean()
+ {
+ if (bundleState == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(BundleStateMBean.OBJECTNAME);
+ bundleState = MBeanProxy.get(getMBeanServer(), objectName, BundleStateMBean.class);
+ }
+ return bundleState;
+ }
+
+ public PackageStateMBean getPackageStateMBean()
+ {
+ if (packageState == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(PackageStateMBean.OBJECTNAME);
+ packageState = MBeanProxy.get(getMBeanServer(), objectName, PackageStateMBean.class);
+ }
+ return packageState;
+ }
+
+ public ServiceStateMBean getServiceStateMBean()
+ {
+ if (serviceState == null)
+ {
+ ObjectName objectName = ObjectNameFactory.create(ServiceStateMBean.OBJECTNAME);
+ serviceState = MBeanProxy.get(getMBeanServer(), objectName, ServiceStateMBean.class);
+ }
+ return serviceState;
+ }
+
+ void deploy(URL archiveURL) throws Exception
+ {
+ //DeployerServiceClient deployer = new DeployerServiceClient(this, DeployerService.MBEAN_DEPLOYER_SERVICE);
+ //deployer.deploy(archiveURL);
+ }
+
+ void undeploy(URL archiveURL) throws Exception
+ {
+ //DeployerServiceClient deployer = new DeployerServiceClient(this, DeployerService.MBEAN_DEPLOYER_SERVICE);
+ //deployer.undeploy(archiveURL);
+ }
+
+ public InitialContext getInitialContext() throws NamingException
+ {
+ return helper.getInitialContext();
+ }
+
+ public String getServerHost()
+ {
+ return helper.getServerHost();
+ }
+
+ public OSGiBundle getBundle(String symbolicName, Version version)
+ {
+ OSGiBundle bundle = getBundle(symbolicName, version, false);
+ return bundle;
+ }
+
+ public OSGiServiceReference getServiceReference(String clazz, long timeout)
+ {
+ int fraktion = 200;
+ timeout = timeout / fraktion;
+ OSGiServiceReference sref = getServiceReference(clazz);
+ while (sref == null && 0 < timeout--)
+ {
+ try
+ {
+ Thread.sleep(fraktion);
+ }
+ catch (InterruptedException e)
+ {
+ // ignore
+ }
+ sref = getServiceReference(clazz);
+ }
+ return sref;
+ }
+
+ OSGiBundle getBundle(String symbolicName, Version version, boolean mustExist)
+ {
+ OSGiBundle bundle = null;
+ List<OSGiBundle> bundles = Arrays.asList(getBundles());
+ for (OSGiBundle aux : bundles)
+ {
+ if (aux.getSymbolicName().equals(symbolicName))
+ {
+ if (version == null || version.equals(aux.getVersion()))
+ {
+ bundle = aux;
+ break;
+ }
+ }
+ }
+
+ if (bundle == null && mustExist == true)
+ throw new IllegalStateException("Cannot obtain bundle: " + symbolicName + "-" + version + ". We have " + bundles);
+
+ return bundle;
+ }
+
+ String getManifestEntry(String location, String key)
+ {
+ Manifest manifest = getManifest(location);
+ Attributes attribs = manifest.getMainAttributes();
+ String value = attribs.getValue(key);
+ return value;
+ }
+
+ private Manifest getManifest(String location)
+ {
+ Manifest manifest;
+ try
+ {
+ File archiveFile = getTestHelper().getTestArchiveFile(location);
+ JarFile jarFile = new JarFile(archiveFile);
+ manifest = jarFile.getManifest();
+ jarFile.close();
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot get manifest from: " + location);
+
+ }
+ return manifest;
+ }
+
+ OSGiBundle registerBundle(String location, OSGiBundle bundle)
+ {
+ if (bundle == null)
+ throw new IllegalArgumentException("Cannot register null bundle for: " + location);
+
+ bundles.put(location, bundle);
+ return bundle;
+ }
+
+ void unregisterBundle(OSGiBundle bundle)
+ {
+ if (bundle == null)
+ throw new IllegalArgumentException("Cannot unregister null bundle");
+
+ if (bundles.containsValue(bundle))
+ {
+ Set<Entry<String, OSGiBundle>> entrySet = bundles.entrySet();
+ for (Entry<String, OSGiBundle> entry : entrySet)
+ {
+ if (bundle.equals(entry.getValue()))
+ {
+ String key = entry.getKey();
+ bundles.remove(key);
+ break;
+ }
+ }
+ }
+ }
+
+ private void failsafeUninstall(OSGiBundle bundle)
+ {
+ if (bundle != null)
+ {
+ try
+ {
+ if (bundle.getState() != Bundle.UNINSTALLED)
+ bundle.uninstall();
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot uninstall bundle: " + bundle, ex);
+ }
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,291 @@
+/*
+ * 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.testing.internal;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.util.Dictionary;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ManagedBundle;
+import org.jboss.osgi.spi.management.ManagedBundleMBean;
+import org.jboss.osgi.spi.util.UnmodifiableDictionary;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.jmx.framework.BundleStateMBean;
+
+/**
+ * An implementation of a remote {@link OSGiBundle}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemoteBundle extends OSGiBundleImpl
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(RemoteBundle.class);
+
+ private long bundleId;
+ private String location;
+ private String symbolicName;
+ private ObjectName objectName;
+ private ManagedBundleMBean bundleMBean;
+ private Dictionary<String, String> defaultHeaders;
+ private Dictionary<String, String> rawHeaders;
+ private Version version;
+ boolean uninstalled;
+
+ public RemoteBundle(OSGiRuntime runtime, long bundleId)
+ {
+ super(runtime);
+ this.bundleId = bundleId;
+
+ BundleStateMBean bundleState = runtime.getBundleStateMBean();
+ try
+ {
+ symbolicName = bundleState.getSymbolicName(bundleId);
+ location = bundleState.getLocation(bundleId);
+
+ String versionStr = bundleState.getVersion(bundleId);
+ version = Version.parseVersion(versionStr);
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot initialize remote bundle", ex);
+ }
+
+ objectName = ManagedBundle.getObjectName(bundleId, symbolicName, version);
+ bundleMBean = MBeanProxy.get(runtime.getMBeanServer(), objectName, ManagedBundleMBean.class);
+
+ // The getHeaders methods must continue to provide the manifest header
+ // information after the bundle enters the UNINSTALLED state.
+ defaultHeaders = bundleMBean.getHeaders(null);
+ rawHeaders = bundleMBean.getHeaders("");
+ }
+
+ @Override
+ public int getState()
+ {
+ if (uninstalled == true)
+ return Bundle.UNINSTALLED;
+
+ try
+ {
+ BundleStateMBean bundleState = getRuntime().getBundleStateMBean();
+ String state = bundleState.getState(bundleId);
+ if ("INSTALLED".equals(state))
+ return Bundle.INSTALLED;
+ if ("RESOLVED".equals(state))
+ return Bundle.RESOLVED;
+ if ("STARTING".equals(state))
+ return Bundle.STARTING;
+ if ("ACTIVE".equals(state))
+ return Bundle.ACTIVE;
+ if ("STOPPING".equals(state))
+ return Bundle.STOPPING;
+ if ("UNINSTALLED".equals(state))
+ return Bundle.UNINSTALLED;
+
+ }
+ catch (Exception rte)
+ {
+ Throwable cause = rte.getCause() != null ? rte.getCause() : rte;
+ if (cause instanceof InstanceNotFoundException == false)
+ log.warn("Cannot get state for bundle: " + bundleId, cause);
+ }
+ return Bundle.UNINSTALLED;
+ }
+
+ @Override
+ public long getBundleId()
+ {
+ return bundleId;
+ }
+
+ @Override
+ public String getSymbolicName()
+ {
+ return symbolicName;
+ }
+
+ @Override
+ public Version getVersion()
+ {
+ return version;
+ }
+
+ @Override
+ public String getLocation()
+ {
+ return location;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Dictionary<String, String> getHeaders()
+ {
+ return new UnmodifiableDictionary(defaultHeaders);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Dictionary<String, String> getHeaders(String locale)
+ {
+ if (locale == null)
+ return new UnmodifiableDictionary(defaultHeaders);
+ else if (locale.length() == 0)
+ return new UnmodifiableDictionary(rawHeaders);
+ else
+ return bundleMBean.getHeaders(locale);
+ }
+
+ @Override
+ public String getProperty(String key)
+ {
+ assertNotUninstalled();
+ return bundleMBean.getProperty(key);
+ }
+
+ @Override
+ public URL getEntry(String path)
+ {
+ assertNotUninstalled();
+ return toURL(bundleMBean.getEntry(path), null);
+ }
+
+ @Override
+ public URL getResource(String name)
+ {
+ assertNotUninstalled();
+ return toURL(bundleMBean.getResource(name), null);
+ }
+
+ @Override
+ public File getDataFile(String filename)
+ {
+ assertNotUninstalled();
+ return bundleMBean.getDataFile(filename);
+ }
+
+ @Override
+ public OSGiBundle loadClass(String name) throws ClassNotFoundException
+ {
+ assertNotUninstalled();
+ ObjectName providerBundle = bundleMBean.loadClass(name);
+ if (providerBundle == null)
+ return null;
+
+ String bundleId = providerBundle.getKeyProperty(ManagedBundle.PROPERTY_ID);
+ return getRuntime().getBundle(new Long(bundleId));
+ }
+
+ @Override
+ public void start() throws BundleException
+ {
+ assertNotUninstalled();
+ try
+ {
+ getRuntime().getFrameworkMBean().startBundle(bundleId);
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot start bundle: " + objectName, ex);
+ }
+ }
+
+ @Override
+ public void stop() throws BundleException
+ {
+ assertNotUninstalled();
+ try
+ {
+ getRuntime().getFrameworkMBean().stopBundle(bundleId);
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot stop bundle: " + objectName, ex);
+ }
+ }
+
+ @Override
+ public void uninstall() throws BundleException
+ {
+ assertNotUninstalled();
+ try
+ {
+ OSGiRuntimeImpl runtimeImpl = (OSGiRuntimeImpl)getRuntime();
+ runtimeImpl.getFrameworkMBean().uninstallBundle(bundleId);
+ runtimeImpl.unregisterBundle(this);
+ uninstalled = true;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot uninstall: " + getLocation(), ex);
+ }
+ }
+
+ private URL toURL(String urlstr, URLStreamHandler sh)
+ {
+ if (urlstr == null)
+ return null;
+
+ try
+ {
+ return sh == null ? new URL(urlstr) : new URL(null, urlstr, sh);
+ }
+ catch (MalformedURLException ex)
+ {
+ // In case of the 'bundle' and 'bundleentry' protocol, use a dummy URLStreamHandler
+ // Access to remote content via the bundle URL is invalid anyway
+ if (sh == null && urlstr.startsWith("bundle"))
+ {
+ sh = new URLStreamHandler()
+ {
+ @Override
+ protected URLConnection openConnection(URL url) throws IOException
+ {
+ return null;
+ }
+ };
+ return toURL(urlstr, sh);
+ }
+ throw new IllegalArgumentException("Invalid URL: " + urlstr);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,49 @@
+/*
+ * 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.testing.internal;
+
+//$Id$
+
+import org.jboss.osgi.spi.management.ManagedServiceReference;
+
+/**
+ * The supported functionality of a remote OSGi Framework
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 04-Mar-2009
+ */
+public interface RemoteFramework
+{
+ /**
+ * 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);
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFrameworkException.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFrameworkException.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFrameworkException.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,49 @@
+/*
+ * 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.testing.internal;
+
+// $Id$
+
+/**
+ * A remote OSGi Framework exception that should be thrown on unrecoverable errors.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jan-2009
+ */
+@SuppressWarnings("serial")
+public class RemoteFrameworkException extends RuntimeException
+{
+ public RemoteFrameworkException(String message)
+ {
+ super(message);
+ }
+
+ public RemoteFrameworkException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public RemoteFrameworkException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteFrameworkException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,101 @@
+/*
+ * 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.testing.internal;
+
+import java.io.IOException;
+
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.osgi.jmx.framework.FrameworkMBean;
+
+/**
+ * A remote implementation of the {@link OSGiPackageAdmin}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemotePackageAdmin implements OSGiPackageAdmin
+{
+ private OSGiRuntime runtime;
+
+ public RemotePackageAdmin(OSGiRuntime runtime)
+ {
+ this.runtime = runtime;
+ }
+
+ public boolean resolveBundles(OSGiBundle[] bundles)
+ {
+ // JMX FrameworkMBean does not allow to resolve/refresh all bundles
+ // https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
+ if (bundles == null)
+ {
+ ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(runtime.getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
+ return mbeanProxy.resolveAllBundles();
+ }
+
+ FrameworkMBean framework = runtime.getFrameworkMBean();
+ try
+ {
+ long[] ids = getBundleIds(bundles);
+ return framework.resolveBundles(ids);
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot resolve bundles", ex);
+ }
+ }
+
+ public void refreshPackages(OSGiBundle[] bundles)
+ {
+ // JMX FrameworkMBean does not allow to resolve/refresh all bundles
+ // https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
+ if (bundles == null)
+ {
+ ManagedFrameworkMBean mbeanProxy = MBeanProxy.get(runtime.getMBeanServer(), ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, ManagedFrameworkMBean.class);
+ mbeanProxy.refreshAllPackages();
+ return;
+ }
+
+ FrameworkMBean framework = runtime.getFrameworkMBean();
+ try
+ {
+ long[] ids = getBundleIds(bundles);
+ framework.refreshPackages(ids);
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot resolve bundles", ex);
+ }
+ }
+
+ private long[] getBundleIds(OSGiBundle[] bundles)
+ {
+ long[] ids = new long[bundles.length];
+ for (int i = 0; i < bundles.length; i++)
+ ids[i] = bundles[i].getBundleId();
+
+ return ids;
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemotePackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,206 @@
+/*
+ * 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.testing.internal;
+
+// $Id$
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.ManagedServiceReference;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiServiceReference;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.osgi.framework.BundleException;
+import org.osgi.jmx.framework.BundleStateMBean;
+
+/**
+ * A remote implementation of the {@link OSGiRuntime}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemoteRuntime extends OSGiRuntimeImpl
+{
+ private MBeanServerConnection mbeanServer;
+
+ public RemoteRuntime(OSGiTestHelper helper)
+ {
+ super(helper);
+ }
+
+ public OSGiBundle installBundle(String location) throws BundleException
+ {
+ try
+ {
+ // Get the bundle info from the location
+ BundleInfo info = BundleInfo.createBundleInfo(location);
+ String rootURL = info.getRootURL().toExternalForm();
+
+ long bundleId = getFrameworkMBean().installBundle(rootURL);
+
+ RemoteBundle bundle = new RemoteBundle(this, bundleId);
+ return registerBundle(bundle.getLocation(), bundle);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (BundleException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot install: " + location, ex);
+ }
+ }
+
+ public void deploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MainDeployerClient deployer = new MainDeployerClient(this);
+ deployer.deploy(archiveURL);
+ }
+
+ public void undeploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MainDeployerClient deployer = new MainDeployerClient(this);
+ deployer.undeploy(archiveURL);
+ }
+
+ public OSGiBundle[] getBundles()
+ {
+ Set<OSGiBundle> bundles = new HashSet<OSGiBundle>();
+ try
+ {
+ TabularData listBundles = getBundleStateMBean().listBundles();
+ Iterator<?> iterator = listBundles.values().iterator();
+ while(iterator.hasNext())
+ {
+ CompositeData next = (CompositeData)iterator.next();
+ Object bundleId = next.get(BundleStateMBean.IDENTIFIER);
+ bundles.add(new RemoteBundle(this, (Long)bundleId));
+ }
+
+ OSGiBundle[] bundleArr = new OSGiBundle[bundles.size()];
+ bundles.toArray(bundleArr);
+ return bundleArr;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot obtain remote bundles", ex);
+ }
+ }
+
+ public OSGiBundle getBundle(long bundleId)
+ {
+ for (OSGiBundle bundle : getBundles())
+ {
+ if (bundleId == bundle.getBundleId())
+ return bundle;
+ }
+ return null;
+ }
+
+ public OSGiServiceReference getServiceReference(String clazz)
+ {
+ ManagedServiceReference manref = getRemoteFramework().getServiceReference(clazz);
+ return manref != null ? new RemoteServiceReference(manref) : null;
+ }
+
+ public OSGiServiceReference[] getServiceReferences(String clazz, String filter)
+ {
+ OSGiServiceReference[] srefs = null;
+
+ ManagedServiceReference[] manrefs = getRemoteFramework().getServiceReferences(clazz, filter);
+ if (manrefs != null)
+ {
+ srefs = new OSGiServiceReference[manrefs.length];
+ for (int i = 0; i < manrefs.length; i++)
+ srefs[i] = new RemoteServiceReference(manrefs[i]);
+ }
+
+ return srefs;
+ }
+
+ public MBeanServerConnection getMBeanServer()
+ {
+ if (mbeanServer == null)
+ {
+ try
+ {
+ InitialContext iniCtx = getInitialContext();
+ mbeanServer = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot obtain MBeanServerConnection", ex);
+ }
+ }
+ return mbeanServer;
+ }
+
+ public OSGiPackageAdmin getPackageAdmin()
+ {
+ return new RemotePackageAdmin(this);
+ }
+
+ private RemoteFramework getRemoteFramework()
+ {
+ ObjectName objectName = ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
+ final ManagedFrameworkMBean managedFramework = MBeanProxy.get(getMBeanServer(), objectName, ManagedFrameworkMBean.class);
+
+ return new RemoteFramework()
+ {
+ public ManagedServiceReference getServiceReference(String clazz)
+ {
+ return managedFramework.getServiceReference(clazz);
+ }
+
+ public ManagedServiceReference[] getServiceReferences(String clazz, String filter)
+ {
+ return managedFramework.getServiceReferences(clazz, filter);
+ }
+ };
+ }
+
+ public boolean isRemoteRuntime()
+ {
+ return true;
+ }
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteServiceReference.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteServiceReference.java (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteServiceReference.java 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,52 @@
+/*
+ * 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.testing.internal;
+
+import org.jboss.osgi.spi.management.ManagedServiceReference;
+import org.jboss.osgi.testing.OSGiServiceReference;
+
+/**
+ * A remote implementation of the {@link OSGiServiceReference}
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemoteServiceReference implements OSGiServiceReference
+{
+ private ManagedServiceReference sref;
+
+ public RemoteServiceReference(ManagedServiceReference sref)
+ {
+ this.sref = sref;
+ }
+
+ public Object getProperty(String key)
+ {
+ return sref.getProperty(key);
+ }
+
+ public String[] getPropertyKeys()
+ {
+ return sref.getPropertyKeys();
+ }
+
+}
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteServiceReference.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/package.html
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/package.html (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/package.html 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,5 @@
+<html>
+<body>
+OSGi test support classes and interfaces.
+</body>
+</html>
Added: projects/jboss-osgi/projects/testing/trunk/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/resources/jboss-osgi-framework.properties 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,40 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${test.archive.directory}/../osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Husky socket connector properties
+org.jboss.osgi.husky.runtime.connector.host=localhost
+org.jboss.osgi.husky.runtime.connector.port=5401
+
+# Framework bootdelegation
+# org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+ org.apache.log4j;version=1.2, \
+ org.jboss.logging;version=2.1, \
+ org.jboss.osgi.deployment.deployer;version=1.0, \
+ org.jboss.osgi.deployment.interceptor;version=1.0, \
+ org.jboss.osgi.spi;version=1.0, \
+ org.jboss.osgi.spi.capability;version=1.0, \
+ org.jboss.osgi.spi.framework;version=1.0, \
+ org.jboss.osgi.spi.management;version=1.0, \
+ org.jboss.osgi.spi.service;version=1.0, \
+ org.jboss.osgi.spi.util;version=1.0, \
+ org.jboss.virtual;version=2.1, \
+ org.osgi.framework;version=1.5
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/resources/jboss-osgi-framework.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/testing/trunk/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/test/resources/log4j.xml (rev 0)
+++ projects/jboss-osgi/projects/testing/trunk/src/test/resources/log4j.xml 2010-02-19 10:43:03 UTC (rev 101149)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${log4j.output.dir}/test.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <param name="Threshold" value="INFO" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Show jboss deployer traces
+ <category name="org.jboss.deployers">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- Show jboss deployer traces
+ <category name="org.jboss.xb">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: projects/jboss-osgi/projects/testing/trunk/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
14 years, 4 months
JBoss-OSGI SVN: r101148 - projects/jboss-osgi/projects/bundles/jmx/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-19 05:40:32 -0500 (Fri, 19 Feb 2010)
New Revision: 101148
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
Log:
Make Aries JMX a dependency
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-19 10:24:51 UTC (rev 101147)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-19 10:40:32 UTC (rev 101148)
@@ -39,6 +39,7 @@
<!-- Properties -->
<properties>
+ <version.apache.aries.jmx>1.0.0-incubating-SNAPSHOT</version.apache.aries.jmx>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.jndi>1.0.3-SNAPSHOT</version.jboss.osgi.jndi>
<version.osgi>4.2.0</version.osgi>
@@ -56,6 +57,11 @@
<artifactId>jboss-osgi-jndi</artifactId>
<version>${version.jboss.osgi.jndi}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.api</artifactId>
+ <version>${version.apache.aries.jmx}</version>
+ </dependency>
<!-- OSGi Dependencies -->
<dependency>
14 years, 4 months
JBoss-OSGI SVN: r101139 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle and 9 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-18 21:24:08 -0500 (Thu, 18 Feb 2010)
New Revision: 101139
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
[JBOSGI-292] PackageAdmin cannot obtain classloading metadata
Cleanup BundleState attachment to the DeploymentUnit
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-02-19 02:24:08 UTC (rev 101139)
@@ -149,12 +149,10 @@
<!-- OSGI Deployment -->
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
- <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+ <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
+ <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -119,7 +119,7 @@
{
synchronized (unit)
{
- OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ OSGiBundleState bundleState = (OSGiBundleState)unit.getAttachment(AbstractBundleState.class);
if (bundleState == null)
{
OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -45,6 +45,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployers.client.spi.DeployerClient;
@@ -787,11 +788,9 @@
}
/**
- * Add a deployment
+ * Add a deployment to the manager, which creates the bundle state.
*
- * @param unit the deployment unit
- * @return the bundle state
- * @throws IllegalArgumentException for a null parameter
+ * Note, the bundle state is not yet added to the manager.
*/
public AbstractBundleState addDeployment(DeploymentUnit unit)
{
@@ -803,7 +802,7 @@
if (absBundle != null)
{
// Add the DeploymentUnit to the OSGiBundleState
- AbstractDeployedBundleState depBundle = (AbstractDeployedBundleState)absBundle;
+ OSGiBundleState depBundle = (OSGiBundleState)absBundle;
depBundle.addDeploymentUnit(unit);
}
else
@@ -825,11 +824,13 @@
}
// Attach the abstract bundle state
+ unit.addAttachment(AbstractBundleState.class, absBundle);
+
if (absBundle.isFragment())
unit.addAttachment(OSGiFragmentState.class, (OSGiFragmentState)absBundle);
else
unit.addAttachment(OSGiBundleState.class, (OSGiBundleState)absBundle);
-
+
return absBundle;
}
@@ -852,6 +853,9 @@
if (bundleState instanceof OSGiBundleState)
{
DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
+ if (unit.getAttachment(ClassLoadingMetaData.class) == null)
+ throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
+
Deployment dep = unit.getAttachment(Deployment.class);
if (dep != null && dep.isBundleUpdate())
return;
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -1,58 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.framework.deployers;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-
-/**
- * AbstractOSGiBundleStateDeployer.<p>
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- */
-public abstract class AbstractOSGiBundleStateDeployer extends AbstractRealDeployer
-{
- /** The bundle manager */
- protected OSGiBundleManager bundleManager;
-
- protected AbstractOSGiBundleStateDeployer(OSGiBundleManager bundleManager)
- {
- if (bundleManager == null)
- throw new IllegalArgumentException("Null bundle manager");
-
- setOutput(AbstractBundleState.class);
- setStage(DeploymentStages.POST_PARSE);
- setTopLevelOnly(true);
-
- this.bundleManager = bundleManager;
- }
-
- protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
- {
- // do nothing
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -142,9 +142,6 @@
unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
- // Add the bundle to the manager when the class loading metadata is available
- bundleManager.addBundle(bundleState);
-
// AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
@@ -152,15 +149,4 @@
if (factory != null)
unit.addAttachment(ClassLoaderFactory.class, factory);
}
-
- @Override
- public void undeploy(DeploymentUnit unit, OSGiMetaData deployment)
- {
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState != null)
- {
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
- bundleManager.removeBundle(bundleState);
- }
- }
}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -1,66 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.framework.deployers;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-
-/**
- * OSGiBundleStateDeployer.<p>
- *
- * This deployer creates a bundle state object for all top level bundle deployments.
- *
- * Note: undeploy/remove part is in a separate deployer.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleStateAddDeployer extends AbstractOSGiBundleStateDeployer
-{
- /**
- * Create a new BundleStateDeployer.
- *
- * @param bundleManager the bundleManager
- * @throws IllegalArgumentException for a null bundle manager
- */
- public OSGiBundleStateAddDeployer(OSGiBundleManager bundleManager)
- {
- super(bundleManager);
- setInput(OSGiMetaData.class);
- }
-
- @Override
- protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
- {
- // [TODO] look at manifest headers and persistent state for this
- unit.setRequiredStage(DeploymentStages.DESCRIBE);
-
- // Attach the abstract bundle state
- AbstractBundleState bundleState = bundleManager.addDeployment(unit);
- unit.addAttachment(AbstractBundleState.class, bundleState);
- }
-}
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java (from rev 101138, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+
+/**
+ * A deployer that creates the bundle state through the bundle manager.
+ *
+ * The bundle is not yet INSTALLED.
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
+ * @author Thomas.Diesler(a)jboss.com
+ */
+public class OSGiBundleStateCreateDeployer extends AbstractRealDeployer
+{
+ /** The bundle manager */
+ protected OSGiBundleManager bundleManager;
+
+ public OSGiBundleStateCreateDeployer(OSGiBundleManager bundleManager)
+ {
+ if (bundleManager == null)
+ throw new IllegalArgumentException("Null bundle manager");
+ this.bundleManager = bundleManager;
+
+ setInput(OSGiMetaData.class);
+ setOutput(AbstractBundleState.class);
+ setStage(DeploymentStages.POST_PARSE);
+ setTopLevelOnly(true);
+ }
+
+ @Override
+ public void internalDeploy(DeploymentUnit unit) throws DeploymentException
+ {
+ unit.setRequiredStage(DeploymentStages.DESCRIBE);
+
+ // Create the bundle state
+ bundleManager.addDeployment(unit);
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+
+/**
+ * A deployer that adds the bundle state to the bundle manager.
+ *
+ * This causes the bundle to get INSTALLED.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 19-Feb-2010
+ */
+public class OSGiBundleStateInstallDeployer extends AbstractSimpleRealDeployer<AbstractBundleState>
+{
+ public OSGiBundleStateInstallDeployer()
+ {
+ super(AbstractBundleState.class);
+ addInput(ClassLoadingMetaData.class);
+ setStage(DeploymentStages.POST_PARSE);
+ setTopLevelOnly(true);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, AbstractBundleState bundleState) throws DeploymentException
+ {
+ // Add the bundle to the manager when it is metadata complete
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ bundleManager.addBundle(bundleState);
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, AbstractBundleState bundleState)
+ {
+ // Remove the bundle from the manager
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ bundleManager.removeBundle(bundleState);
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -1,56 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.framework.deployers;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-
-/**
- * This deployer removes any osgi state bundle from manager.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- */
-public class OSGiBundleStateRemoveDeployer extends AbstractOSGiBundleStateDeployer
-{
- /**
- * Create a new BundleStateDeployer.
- *
- * @param bundleManager the bundleManager
- * @throws IllegalArgumentException for a null bundle manager
- */
- public OSGiBundleStateRemoveDeployer(OSGiBundleManager bundleManager)
- {
- super(bundleManager);
- addInput(OSGiMetaData.class);
- }
-
- @Override
- protected void internalUndeploy(DeploymentUnit unit)
- {
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState != null)
- bundleManager.removeBundle(bundleState);
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -67,8 +67,8 @@
{
long bundleId = bundle.getBundleId();
AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleManager().getBundleById(bundleId);
- if (bundle == null)
- throw new IllegalStateException("Cannot obtain bundle for: " + bundle);
+ if (bundleState == null)
+ throw new IllegalStateException("Cannot obtain bundleState for: " + bundle);
VFSDeploymentUnit unit = (VFSDeploymentUnit)bundleState.getDeploymentUnit();
InvocationContext inv = unit.getAttachment(InvocationContext.class);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -25,10 +25,9 @@
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.virtual.AssembledDirectory;
import org.jboss.virtual.VirtualFile;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.osgi.framework.Bundle;
/**
@@ -140,7 +139,7 @@
protected Bundle getBundle(DeploymentUnit unit) throws Exception
{
- AbstractDeployedBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+ AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
assertNotNull(bundle);
return bundle.getBundleInternal();
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -286,7 +286,7 @@
try
{
DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
- AbstractDeployedBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
if (bundleState == null)
throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java 2010-02-19 02:24:08 UTC (rev 101139)
@@ -26,8 +26,7 @@
import java.lang.reflect.Proxy;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.osgi.framework.Bundle;
/**
@@ -61,7 +60,7 @@
{
if (bundle == null)
{
- AbstractDeployedBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+ AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
if (bundle == null)
throw new IllegalArgumentException("No such OSGiBundleState attachment: " + unit);
this.bundle = bundle.getBundleInternal();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-02-19 02:24:08 UTC (rev 101139)
@@ -160,12 +160,10 @@
<!-- OSGI Deployment -->
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
- <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+ <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
+ <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
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 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-02-19 02:24:08 UTC (rev 101139)
@@ -171,12 +171,10 @@
</bean>
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
- <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+ <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
+ <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
<bean name="OSGiBundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
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 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-02-19 02:24:08 UTC (rev 101139)
@@ -202,12 +202,10 @@
<!-- OSGI Deployment -->
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
- <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+ <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
+ <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-19 02:24:08 UTC (rev 101139)
@@ -185,12 +185,10 @@
<!-- OSGI Deployment -->
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
- <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+ <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
+ <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-02-19 02:24:08 UTC (rev 101139)
@@ -159,12 +159,10 @@
<!-- OSGI Deployment -->
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
- <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+ <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
+ <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
14 years, 4 months
JBoss-OSGI SVN: r101118 - in projects/jboss-osgi: projects/bundles/jndi/trunk and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-18 11:01:49 -0500 (Thu, 18 Feb 2010)
New Revision: 101118
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
projects/jboss-osgi/projects/bundles/jndi/trunk/pom.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/testsuite/example/pom.xml
Log:
[JBOSGI-293] Cannot start example-jndi on Felix
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-18 16:00:28 UTC (rev 101117)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2010-02-18 16:01:49 UTC (rev 101118)
@@ -100,16 +100,15 @@
org.osgi.service.packageadmin;version="[1.2,2.0)",
org.osgi.util.tracker;version="[1.4,2.0)",
- <!-- FIXME: make optional -->
- org.jboss.osgi.jndi,
- org.jboss.net.sockets,
- org.jnp.interfaces,
-
- <!--
+ <!-- FIXME: make optional
org.jboss.osgi.jndi;resolution:=optional,
org.jboss.net.sockets;resolution:=optional,
org.jnp.interfaces;resolution:=optional,
-->
+ org.jboss.osgi.jndi;version="[1.0,2.0)",
+ org.jboss.net.sockets;version="[2.2,3.0)",
+ org.jnp.interfaces;version="[5.0,6.0)",
+
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
Modified: projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml 2010-02-18 16:00:28 UTC (rev 101117)
+++ projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml 2010-02-18 16:01:49 UTC (rev 101118)
@@ -88,23 +88,31 @@
org.jboss.osgi.jndi;version=${version}
</Export-Package>
<Import-Package>
+
+ <!-- system -->
javax.naming*,
- javax.net,
- org.jboss.logging,
- org.jboss.net.sockets,
- org.jboss.util.naming,
- org.jboss.util.threadpool,
- org.jnp.interfaces,
+ javax.net,
+ <!-- jboss -->
+ org.jboss.logging;version="[2.1,3.0)",
+ org.jboss.net.sockets;version="[2.2,3.0)",
+ org.jboss.util.naming;version="[2.2,3.0)",
+ org.jboss.util.threadpool;version="[2.2,3.0)",
+ org.jnp.interfaces;version="[5.0,6.0)",
+
+ <!-- jboss-osgi -->
org.jboss.osgi.common*;version="[1.0,2.0)",
org.jboss.osgi.spi*;version="[1.0,2.0)",
+
+ <!-- osgi -->
org.osgi.framework;version="[1.5,2.0)",
+
</Import-Package>
<Embed-Dependency>
- jnpserver;inline=false,
+ jnpserver;inline=false
</Embed-Dependency>
<_exportcontents>
- org.jnp.interfaces;version=5.0.1,
+ org.jnp.interfaces;version=5.0.1
</_exportcontents>
</instructions>
</configuration>
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 2010-02-18 16:00:28 UTC (rev 101117)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2010-02-18 16:01:49 UTC (rev 101118)
@@ -37,7 +37,7 @@
org.jboss.logging;version=2.1,
<!-- jboss -->
- org.jboss.net.protocol,
+ org.jboss.net.protocol;version=2.2,
org.jboss.virtual;version=2.1,
org.jboss.virtual.plugins.registry;version=2.1,
org.jboss.virtual.plugins.context.jar;version=2.1,
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 2010-02-18 16:00:28 UTC (rev 101117)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2010-02-18 16:01:49 UTC (rev 101118)
@@ -37,7 +37,7 @@
org.jboss.logging;version=2.1,
<!-- jboss -->
- org.jboss.net.protocol,
+ org.jboss.net.protocol;version=2.2,
org.jboss.virtual;version=2.1,
org.jboss.virtual.plugins.registry;version=2.1,
org.jboss.virtual.plugins.context.jar;version=2.1,
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 2010-02-18 16:00:28 UTC (rev 101117)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-02-18 16:01:49 UTC (rev 101118)
@@ -22,8 +22,7 @@
<entry><key>org.osgi.framework.system.packages.extra</key><value>
<!-- jnp naming -->
- org.jnp.interfaces,
- org.jnp.server,
+ org.jnp.interfaces;version=5.0,
<!-- logging -->
org.apache.log4j;version=1.2,
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2010-02-18 16:00:28 UTC (rev 101117)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2010-02-18 16:01:49 UTC (rev 101118)
@@ -232,6 +232,8 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
+ <!-- [JBOSGI-293] Cannot start example-jndi on Felix -->
+ <exclude>org/jboss/test/osgi/example/jndi/**</exclude>
<!-- Functionality not supported in Felix -->
<exclude>org/jboss/test/osgi/example/interceptor/**</exclude>
<exclude>org/jboss/test/osgi/example/microcontainer/**</exclude>
14 years, 4 months