[jboss-cvs] JBossAS SVN: r95017 - in projects/jboss-osgi: projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 16 04:57:20 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-16 04:57:19 -0400 (Fri, 16 Oct 2009)
New Revision: 95017
Added:
projects/jboss-osgi/trunk/reactor/deployment/
projects/jboss-osgi/trunk/reactor/deployment/.classpath
projects/jboss-osgi/trunk/reactor/deployment/.project
projects/jboss-osgi/trunk/reactor/deployment/.settings/
projects/jboss-osgi/trunk/reactor/deployment/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/trunk/reactor/deployment/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/trunk/reactor/deployment/pom.xml
projects/jboss-osgi/trunk/reactor/deployment/src/
projects/jboss-osgi/trunk/reactor/deployment/src/main/
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/
Modified:
projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java
projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/reactor/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java
Log:
[JBOSGI-183] Initial implementation of OSGi Deployers
Add reactor project jboss-osgi-deployment
Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml 2009-10-16 08:57:19 UTC (rev 95017)
@@ -39,7 +39,7 @@
<!-- Properties -->
<properties>
- <version.jboss.osgi.common>1.0.2</version.jboss.osgi.common>
+ <version.jboss.osgi.common>1.0.3-SNAPSHOT</version.jboss.osgi.common>
<version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
<version.osgi>r4v42</version.osgi>
</properties>
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java 2009-10-16 08:57:19 UTC (rev 95017)
@@ -23,11 +23,18 @@
//$Id$
+import java.net.URL;
+
import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.DeployerService;
import org.jboss.osgi.spi.framework.BundleContextWrapper;
+import org.jboss.osgi.spi.util.BundleDeployment;
+import org.jboss.osgi.spi.util.BundleDeploymentFactory;
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;
/**
* The FelixBundleContextWrapper wrapps the BundleContext provided by the Felix implemenation.
@@ -50,7 +57,46 @@
@Override
public Bundle installBundle(String location) throws BundleException
{
- Bundle bundle = super.installBundle(location);
+ BundleDeployment dep = BundleDeploymentFactory.createBundleDeployment(location);
+ URL bundleURL = dep.getLocation();
+ String symbolicName = dep.getSymbolicName();
+ Version version = Version.parseVersion(dep.getVersion());
+
+ Bundle bundle;
+
+ ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
+ if (sref != null)
+ {
+ DeployerService service = (DeployerService)context.getService(sref);
+ service.deploy(bundleURL);
+ bundle = getBundle(symbolicName, version, true);
+ }
+ else
+ {
+ bundle = context.installBundle(bundleURL.toExternalForm());
+ }
+
return bundle;
}
+
+ private Bundle getBundle(String symbolicName, Version version, boolean mustExist)
+ {
+ Bundle bundle = null;
+ for (Bundle aux : getBundles())
+ {
+ 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);
+
+ return bundle;
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-10-16 08:57:19 UTC (rev 95017)
@@ -23,7 +23,6 @@
// $Id$
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -35,20 +34,16 @@
import org.jboss.osgi.spi.capability.Capability;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.service.DeployerService;
import org.jboss.osgi.spi.testing.OSGiBundle;
import org.jboss.osgi.spi.testing.OSGiPackageAdmin;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiServiceReference;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
-import org.jboss.osgi.spi.util.BundleDeployment;
-import org.jboss.osgi.spi.util.BundleDeploymentFactory;
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.Version;
import org.osgi.framework.launch.Framework;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -67,27 +62,12 @@
public OSGiBundle installBundle(String location) throws BundleException
{
- URL bundleURL = getTestHelper().getTestArchiveURL(location);
+ location = getTestHelper().getTestArchivePath(location);
- BundleDeployment bundleDep = BundleDeploymentFactory.createBundleDeployment(bundleURL);
- String symbolicName = bundleDep.getSymbolicName();
- Version version = Version.parseVersion(bundleDep.getVersion());
-
- OSGiBundle bundle;
-
BundleContext context = getBundleContext();
- ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
- if (sref != null)
- {
- DeployerService service = (DeployerService)context.getService(sref);
- service.deploy(bundleURL);
- bundle = getBundle(symbolicName, version, true);
- }
- else
- {
- Bundle auxBundle = context.installBundle(bundleURL.toExternalForm());
- bundle = new EmbeddedBundle(this, auxBundle);
- }
+ Bundle auxBundle = context.installBundle(location);
+ OSGiBundle bundle = new EmbeddedBundle(this, auxBundle);
+
return registerBundle(location, bundle);
}
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java 2009-10-16 08:57:19 UTC (rev 95017)
@@ -23,7 +23,9 @@
//$Id: BundleDeployment.java 90925 2009-07-08 10:12:31Z thomas.diesler at jboss.com $
+import java.io.File;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
@@ -38,8 +40,42 @@
* @author thomas.diesler at jboss.com
* @since 08-Jul-2009
*/
-public abstract class BundleDeploymentFactory
+public abstract class BundleDeploymentFactory
{
+ public static BundleDeployment createBundleDeployment(String location) throws BundleException
+ {
+ // Try location as URL
+ URL url = null;
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ // Try location as File
+ if (url == null)
+ {
+ try
+ {
+ File file = new File(location);
+ if (file.exists())
+ url = file.toURI().toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+
+ if (url == null)
+ throw new IllegalArgumentException("Invalid bundle location: " + location);
+
+ return createBundleDeployment(url);
+ }
+
public static BundleDeployment createBundleDeployment(URL url) throws BundleException
{
Manifest manifest;
Modified: projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/trunk/distribution/docbook/en/modules/ch080-provided-examples.xml 2009-10-16 08:57:19 UTC (rev 95017)
@@ -288,7 +288,7 @@
<sect1 xml:id="SecWebAppExample">
<title>WebApp Example</title>
- <para>The <emphasis role="bold">example-webapp.war</emphasis> archive is an OSGi Bundle as well as an Web Application Archive (WAR)
+ <para>The <emphasis role="bold">example-webapp.war</emphasis> archive is an OSGi Bundle and a Web Application Archive (WAR)
at the same time. Similar to <link linkend="SecHTTPServiceExample">HTTP Service Example</link> it registers a servlet and resources with
the WebApp container. This is done through a standard web.xml descriptor.
</para>
@@ -326,7 +326,7 @@
Import-Package: org.osgi.service.http,org.ops4j.pax.web.service,javax.servlet,javax.servlet.http
]]></programlisting>
- <para>The test verifies that we can access the servlet and some resourtces.</para>
+ <para>The test verifies that we can access the servlet and some resources.</para>
<programlisting role="JAVA">
@Test
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/trunk/pom.xml 2009-10-16 08:57:19 UTC (rev 95017)
@@ -60,7 +60,7 @@
<version.jboss.osgi.jaxb>2.1.10.SP2</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.1</version.jboss.osgi.jmx>
<version.jboss.osgi.jndi>1.0.1</version.jboss.osgi.jndi>
- <version.jboss.osgi.microcontainer>1.0.2</version.jboss.osgi.microcontainer>
+ <version.jboss.osgi.microcontainer>1.0.3-SNAPSHOT</version.jboss.osgi.microcontainer>
<version.jboss.osgi.runtime.deployers>1.0.2</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.runtime.equinox>3.5</version.jboss.osgi.runtime.equinox>
<version.jboss.osgi.runtime.felix>2.0.0-SNAPSHOT</version.jboss.osgi.runtime.felix>
Property changes on: projects/jboss-osgi/trunk/reactor/deployment
___________________________________________________________________
Name: svn:ignore
+ target
Added: projects/jboss-osgi/trunk/reactor/deployment/.classpath
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/.classpath (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/.classpath 2009-10-16 08:57:19 UTC (rev 95017)
@@ -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.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/trunk/reactor/deployment/.project
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/.project (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/.project 2009-10-16 08:57:19 UTC (rev 95017)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-runtime-deployer</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/trunk/reactor/deployment/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/.settings/org.eclipse.jdt.core.prefs 2009-10-16 08:57:19 UTC (rev 95017)
@@ -0,0 +1,5 @@
+#Fri Oct 16 10:23:39 CEST 2009
+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.source=1.5
Added: projects/jboss-osgi/trunk/reactor/deployment/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/.settings/org.maven.ide.eclipse.prefs 2009-10-16 08:57:19 UTC (rev 95017)
@@ -0,0 +1,9 @@
+#Fri Oct 16 10:23:37 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/trunk/reactor/deployment/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/pom.xml (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/pom.xml 2009-10-16 08:57:19 UTC (rev 95017)
@@ -0,0 +1,83 @@
+<?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 Deployment</name>
+
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-deployment</artifactId>
+ <packaging>bundle</packaging>
+
+ <version>1.0.0-SNAPSHOT</version>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi</artifactId>
+ <version>1.0.0.Beta5</version>
+ </parent>
+
+ <properties>
+ <version.jboss.deployers>2.0.8.GA</version.jboss.deployers>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </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.deployment.internal.DeployersActivator</Bundle-Activator>
+ <Export-Package>
+ org.jboss.osgi.deployment;version=1.0,
+ </Export-Package>
+ <Private-Package>
+ org.jboss.osgi.deployment.internal
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: projects/jboss-osgi/trunk/reactor/deployment/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/reactor/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/pom.xml 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/trunk/reactor/pom.xml 2009-10-16 08:57:19 UTC (rev 95017)
@@ -14,8 +14,9 @@
<!--
The reactor is used to pull in external subprojects and build them as part of this maven reactor build.
- It is a one-stop entry point to build, test and deploy dependent SNAPSHOTs. To pull in a particular subproject,
- set one or more svn:external definitions. For example
+ It is a one-stop entry point to build, test and deploy dependent SNAPSHOTs.
+
+ To pull in a particular subproject, set one or more svn:external definitions. For example
spi https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/spi/trunk
runtime/deployers https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/deployers/trunk
@@ -42,6 +43,7 @@
</parent>
<modules>
+ <module>deployment</module>
<module>framework</module>
<module>blueprint</module>
</modules>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java 2009-10-16 08:47:46 UTC (rev 95016)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/microcontainer/MicrocontainerServiceTestCase.java 2009-10-16 08:57:19 UTC (rev 95017)
@@ -23,9 +23,9 @@
//$Id$
+import static org.jboss.osgi.deployment.DeployerService.MBEAN_DEPLOYER_SERVICE;
import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
-import static org.jboss.osgi.spi.service.DeployerService.MBEAN_DEPLOYER_SERVICE;
import static org.jboss.test.osgi.service.microcontainer.bundleB.SomeBeanMBean.MBEAN_NAME;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -36,6 +36,7 @@
import javax.management.ObjectName;
+import org.jboss.osgi.deployment.DeployerService;
import org.jboss.osgi.jbossxb.XMLBindingCapability;
import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.jndi.JNDICapability;
@@ -43,7 +44,6 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.service.DeployerService;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
More information about the jboss-cvs-commits
mailing list