JBoss-OSGI SVN: r92700 - in projects/jboss-osgi: projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 17:00:52 -0400 (Sat, 22 Aug 2009)
New Revision: 92700
Removed:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/
Modified:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
projects/jboss-osgi/trunk/reactor/pom.xml
projects/jboss-osgi/trunk/reactor/runtime/
Log:
[JBOSGI-130] Bundle is still in state INSTALLED after bundle.start()
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2009-08-22 19:14:14 UTC (rev 92699)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2009-08-22 21:00:52 UTC (rev 92700)
@@ -80,6 +80,11 @@
// Create a context for this jar file with META-INF as the location for metadata
context = createContext(structureContext, "META-INF");
+ // The classpath is the root
+ addClassPath(structureContext, file, true, true, context);
+
+ // We don't process children as potential subdeployments
+
return true;
}
catch (Exception e)
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-08-22 19:14:14 UTC (rev 92699)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
@@ -16,10 +16,10 @@
<version.jboss.aop>2.1.0.CR3</version.jboss.aop>
<version.jboss.deployers>2.0.8.GA</version.jboss.deployers>
<version.jboss.logging.log4j>2.1.0.GA</version.jboss.logging.log4j>
+ <version.jboss.osgi.runtime.deployers>1.0.1-SNAPSHOT</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.spi>1.0.1-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.microcontainer>2.0.6.GA</version.jboss.microcontainer>
<version.jboss.test>1.1.4.GA</version.jboss.test>
- <version.junit>4.6</version.junit>
<version.osgi>r4v42-20090728</version.osgi>
</properties>
@@ -96,6 +96,11 @@
<artifactId>jboss-osgi-spi</artifactId>
<version>${version.jboss.osgi.spi}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-deployers</artifactId>
+ <version>${version.jboss.osgi.runtime.deployers}</version>
+ </dependency>
<!-- OSGi Dependencies -->
<dependency>
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-22 19:14:14 UTC (rev 92699)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleClassLoadingDeployer.java 2009-08-22 21:00:52 UTC (rev 92700)
@@ -21,6 +21,7 @@
*/
package org.jboss.osgi.plugins.deployers.bundle;
+import java.util.ArrayList;
import java.util.List;
import org.jboss.classloading.plugins.metadata.ModuleCapability;
@@ -36,12 +37,13 @@
import org.jboss.osgi.spi.metadata.PackageAttribute;
/**
- * OSGiBundleClassLoadingDeployer.<p>
+ * OSGiBundleClassLoadingDeployer.
+ * <p>
*
* This deployer maps osgi metadata into our classloading metadata.
- *
- * todo versions and attributes
- * todo require-bundle, dynamic-imports, etc.
+ *
+ * todo versions and attributes todo require-bundle, dynamic-imports, etc.
+ *
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
@@ -59,40 +61,51 @@
}
@Override
- public void deploy(DeploymentUnit unit, OSGiMetaData deployment) throws DeploymentException
+ public void deploy(DeploymentUnit unit, OSGiMetaData metadata) throws DeploymentException
{
if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
return;
-
+
ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
- classLoadingMetaData.setName(deployment.getBundleSymbolicName());
- classLoadingMetaData.setVersion(deployment.getBundleVersion());
+ classLoadingMetaData.setName(metadata.getBundleSymbolicName());
+ classLoadingMetaData.setVersion(metadata.getBundleVersion());
- Capability capability = new ModuleCapability(deployment.getBundleSymbolicName(), deployment.getBundleVersion());
+ Capability capability = new ModuleCapability(metadata.getBundleSymbolicName(), metadata.getBundleVersion());
classLoadingMetaData.getCapabilities().addCapability(capability);
+
+ // [TODO] externalise system packages
+ ArrayList<String> systemNames = new ArrayList<String>();
+ systemNames.add("org.osgi.framework");
- List<PackageAttribute> exported = deployment.getExportPackages();
- if (exported != null && exported.isEmpty() == false)
+ ArrayList<String> exportedNames = new ArrayList<String>();
+
+ List<PackageAttribute> exported = metadata.getExportPackages();
+ if (exported != null)
{
for (PackageAttribute packageAttribute : exported)
{
String packageName = packageAttribute.getPackageInfo().getName();
- capability = new PackageCapability(packageName);
+ capability = new PackageCapability(packageName);
classLoadingMetaData.getCapabilities().addCapability(capability);
+ exportedNames.add(packageName);
}
}
-
- List<PackageAttribute> imported = deployment.getImportPackages();
- if (imported != null && imported.isEmpty() == false)
+
+ List<PackageAttribute> imported = metadata.getImportPackages();
+ if (imported != null)
{
for (PackageAttribute packageAttribute : imported)
{
String packageName = packageAttribute.getPackageInfo().getName();
- PackageRequirement requirement = new PackageRequirement(packageName);
- classLoadingMetaData.getRequirements().addRequirement(requirement);
+ if (systemNames.contains(packageName) == false && exportedNames.contains(packageName) == false)
+ {
+ // [TODO] add version ranges
+ PackageRequirement requirement = new PackageRequirement(packageName);
+ classLoadingMetaData.getRequirements().addRequirement(requirement);
+ }
}
}
-
+
unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
}
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-22 19:14:14 UTC (rev 92699)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-22 21:00:52 UTC (rev 92700)
@@ -24,6 +24,7 @@
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Dictionary;
@@ -38,6 +39,12 @@
import java.util.jar.Manifest;
import java.util.jar.Attributes.Name;
+import org.jboss.classloading.spi.dependency.RequirementDependencyItem;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.DependencyItem;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
@@ -461,8 +468,36 @@
{
try
{
- // todo check actually changed state
- deployerClient.change(bundleState.getDeploymentUnit().getName(), DeploymentStages.INSTALLED);
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
+
+ ControllerContext context = unit.getAttachment(ControllerContext.class);
+ if (context == null)
+ throw new IllegalStateException("Cannot obtain controller context");
+
+ // check actually changed state
+ ControllerState actualState = context.getState();
+ if (actualState != ControllerState.INSTALLED)
+ {
+ ArrayList<Requirement> unresolved = new ArrayList<Requirement>();
+ DependencyInfo depInfo = context.getDependencyInfo();
+ for (DependencyItem iDependOn : depInfo.getIDependOn(RequirementDependencyItem.class))
+ {
+ if (iDependOn.isResolved() == false)
+ {
+ RequirementDependencyItem rdi = (RequirementDependencyItem)iDependOn;
+ unresolved.add(rdi.getRequirement());
+ }
+ }
+ if (unresolved.size() > 0)
+ {
+ throw new BundleException("Cannot start bundle " + bundleState + ", because of unresolved dependencies\n " + unresolved);
+ }
+ else
+ {
+ throw new BundleException("Cannot start bundle: " + bundleState);
+ }
+ }
}
catch (DeploymentException e)
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-22 19:14:14 UTC (rev 92699)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-22 21:00:52 UTC (rev 92700)
@@ -60,8 +60,7 @@
assertEquals("simple-bundle", bundle.getSymbolicName());
bundle.start();
- System.out.println("FIXME [JBOSGI-130] Bundle in state INSTALLED after bundle.start()");
- //assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
+ assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
bundle.uninstall();
assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
@@ -78,9 +77,8 @@
assertEquals("simple-bundle", bundle.getSymbolicName());
- System.out.println("FIXME [JBOSGI-131] BundleContext not available after bundle install");
- //bundle.start();
- //assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
+ bundle.start();
+ assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
bundle.uninstall();
assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-22 19:14:14 UTC (rev 92699)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml 2009-08-22 21:00:52 UTC (rev 92700)
@@ -1,127 +1,108 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <!-- The MainDeployer -->
- <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
- <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
- <property name="deployers"><inject bean="Deployers"/></property>
- </bean>
+ <!--
+ ********************************
+ * *
+ * OSGi Framework *
+ * *
+ ********************************
+ -->
+
+ <bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
+ <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * OSGi Deployment *
+ * *
+ ********************************
+ -->
+
+ <!-- The MainDeployer -->
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <property name="structuralDeployers"><inject bean="StructuralDeployers" /></property>
+ <property name="deployers"><inject bean="Deployers" /></property>
+ </bean>
- <!-- The holder for deployers that determine structure -->
- <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
- <property name="structureBuilder">
- <!-- The consolidator of the structure information -->
- <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
- </property>
- <!-- Accept any implementor of structure deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
+ <!-- The holder for deployers that determine structure -->
+ <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+ <property name="structureBuilder">
+ <!-- The consolidator of the structure information -->
+ <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder" />
+ </property>
+ <!-- Accept any implementor of structure deployer -->
+ <incallback method="addDeployer" />
+ <uncallback method="removeDeployer" />
+ </bean>
- <!-- The holder for deployers that do real deployment -->
- <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
- <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
- <!-- Accept any implementor of deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
+ <!-- The holder for deployers that do real deployment -->
+ <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController" /></parameter></constructor>
+ <!-- Accept any implementor of deployer -->
+ <incallback method="addDeployer" />
+ <uncallback method="removeDeployer" />
+ </bean>
- <!-- A declared structure descriptor deployer -->
- <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
+ <!-- Bundle Structure -->
+ <bean name="BundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
+
+ <!-- JAR & File Structure (needed for negative testing) -->
+ <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure" />
+ <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure" />
- <!-- JAR Structure -->
- <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
- <!-- Unless specified the default list of suffixes is .zip, .ear, .jar, ,.rar, .war, .sar, .har, .aop -->
- <constructor>
- <parameter>
- <set elementClass="java.lang.String">
- <value>.zip</value>
- <value>.ear</value>
- <value>.jar</value>
- <value>.rar</value>
- <value>.war</value>
- <value>.sar</value>
- <value>.har</value>
- <value>.aop</value>
- <value>.deployer</value>
- <value>.beans</value>
- </set>
- </parameter>
- </constructor>
- <property name="candidateStructureVisitorFactory">
- <!-- Any file that is not an ordinary directory is a candidate -->
- <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
- <!-- A filter to exclude some obvious non-subdeployments -->
- <property name="filter">
- <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
- <constructor><parameter>
- <list elementClass="java.lang.String">
- <!-- Exclude class files as subdeployments -->
- <value>.class</value>
- </list>
- </parameter></constructor>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
+ <!-- POJO Deployment -->
+ <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer" />
+ <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer" />
+ <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+ <constructor>
+ <parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
+ </constructor>
+ </bean>
- <!-- File Structure -->
- <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
- <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
- <constructor>
- <parameter>
- <set elementClass="java.lang.String">
- <value>-service.xml</value>
- <value>-beans.xml</value>
- <value>-ds.xml</value>
- <value>-aop.xml</value>
- </set>
- </parameter>
- </constructor>
- </bean>
+ <!-- OSGI Deployment -->
+ <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer" />
+ <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
+ <constructor>
+ <parameter><inject bean="OSGiBundleManager" /></parameter>
+ </constructor>
+ </bean>
+ <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer" />
+ <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
- <!-- POJO Deployment -->
- <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
- <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
- <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
- <constructor><parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
- </bean>
-
- <!-- OSGI Deployment -->
- <bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
- <constructor><parameter><inject bean="MainDeployer"/></parameter></constructor>
- </bean>
- <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer"/>
- <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager"/></parameter></constructor>
- </bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer"/>
- <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer"/>
+ <!--
+ ********************************
+ * *
+ * OSGi Classloading *
+ * *
+ ********************************
+ -->
+
+ <!-- ClassLoading -->
+ <bean name="ClassLoaderSystem" class="org.jboss.test.osgi.OSGiClassLoaderSystem" />
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <incallback method="addModule" state="Configured" />
+ <uncallback method="removeModule" state="Configured" />
+ </bean>
+ <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+ </constructor>
+ <property name="name">jboss-classloading.xml</property>
+ </bean>
+ <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+ <property name="defaultMetaData">
+ <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true" />
+ </property>
+ </bean>
+ <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
+ <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
+ <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ <property name="system"><inject bean="ClassLoaderSystem" /></property>
+ </bean>
- <!-- ClassLoading -->
- <bean name="ClassLoaderSystem" class="org.jboss.test.osgi.OSGiClassLoaderSystem"/>
- <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
- <incallback method="addModule" state="Configured"/>
- <uncallback method="removeModule" state="Configured"/>
- </bean>
- <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
- <constructor>
- <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
- </constructor>
- <property name="name">jboss-classloading.xml</property>
- </bean>
- <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
- <property name="defaultMetaData">
- <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
- </property>
- </bean>
- <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- </bean>
- <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- <property name="system"><inject bean="ClassLoaderSystem"/></property>
- </bean>
-
</deployment>
Modified: projects/jboss-osgi/trunk/reactor/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/pom.xml 2009-08-22 19:14:14 UTC (rev 92699)
+++ projects/jboss-osgi/trunk/reactor/pom.xml 2009-08-22 21:00:52 UTC (rev 92700)
@@ -13,46 +13,15 @@
<!--
- 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 of these svn:external definitions
+ 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
- spi https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/spi/trunk
- bundles/apache-xerces https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/common https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/hotdeploy https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/husky https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/jaxb https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/jmx https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/jndi https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/jboss-common-core https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/jboss-xml-binding https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/microcontainer https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/remotelog https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- bundles/webconsole https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/bundles/...
- runtime/deployers https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
- runtime/equinox https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
- runtime/felix https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
- runtime/jbossas https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
- runtime/knopflerfish https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/... and enable the associated maven module
+ 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/...
- <module>spi</module>
- <module>runtime/equinox</module>
- <module>runtime/felix</module>
- <module>runtime/knopflerfish</module>
- <module>runtime/deployers</module>
- <module>bundles/common</module>
- <module>bundles/jboss-common-core</module>
- <module>bundles/apache-xerces</module>
- <module>bundles/jaxb</module>
- <module>bundles/jboss-xml-binding</module>
- <module>bundles/jndi</module>
- <module>bundles/jmx</module>
- <module>bundles/remotelog</module>
- <module>bundles/webconsole</module>
- <module>bundles/hotdeploy</module>
- <module>bundles/microcontainer</module>
- <module>bundles/husky</module>
- <module>runtime/jbossas</module>
+ <module>spi</module>
+ <module>runtime/deployers</module>
A release MUST NOT contain any svn:external definitions.
-->
@@ -74,6 +43,7 @@
<modules>
<module>spi</module>
+ <module>runtime/deployers</module>
<module>runtime/equinox</module>
<module>runtime/felix</module>
<module>runtime/jbossas</module>
Property changes on: projects/jboss-osgi/trunk/reactor/runtime
___________________________________________________________________
Name: svn:externals
- equinox https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
felix https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
jbossas https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
microcontainer https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
+ deployers https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
equinox https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
felix https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
jbossas https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
microcontainer https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/...
16 years, 4 months
JBoss-OSGI SVN: r92699 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 15:14:14 -0400 (Sat, 22 Aug 2009)
New Revision: 92699
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
Log:
[JBOSGI-131] BundleContext not available after bundle install
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-22 18:17:24 UTC (rev 92698)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-22 19:14:14 UTC (rev 92699)
@@ -78,7 +78,7 @@
assertEquals("simple-bundle", bundle.getSymbolicName());
- System.out.println("FIXME [JBOSGI-131] BundleContext not available after bundle.start()");
+ System.out.println("FIXME [JBOSGI-131] BundleContext not available after bundle install");
//bundle.start();
//assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
16 years, 4 months
JBoss-OSGI SVN: r92698 - in projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi: deployer and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 14:17:24 -0400 (Sat, 22 Aug 2009)
New Revision: 92698
Added:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/
Removed:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/
Modified:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/BundleDeploymentUnitFilter.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java
Log:
Restore package to org.jboss.osgi.deployer
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+// $Id$
+
+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.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
+import org.jboss.osgi.deployer.helpers.BundleDeploymentUnitFilter;
+import org.jboss.osgi.deployer.helpers.PackageAdminDependencyItem;
+import org.jboss.osgi.spi.Constants;
+import org.jboss.osgi.spi.util.BundleClassLoader;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A deployer that attaches a {@link ClassLoaderFactory} that creates a
+ * {@link BundleClassLoader} for the deployed Bundle.
+ *
+ * @author Ales.Justin(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleClassLoaderDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private DeploymentUnitFilter filter = new BundleDeploymentUnitFilter();
+ private BundleContext systemContext;
+
+ public BundleClassLoaderDeployer()
+ {
+ super(Bundle.class);
+ addOutput(ClassLoaderFactory.class);
+ setStage(DeploymentStages.POST_PARSE);
+ }
+
+ public void setSystemContext(BundleContext systemContext)
+ {
+ this.systemContext = systemContext;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ // create bundle delegate classloader
+ ClassLoaderFactory factory = createClassLoaderFactory(bundle);
+ unit.addAttachment(ClassLoaderFactory.class, factory);
+
+ // create dependency items
+ String propStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
+ if (Boolean.parseBoolean(propStart != null ? propStart : "true") == false)
+ unit.addIDependOn(new PackageAdminDependencyItem(systemContext, bundle));
+
+ // skip annotations scanning, if filter is set
+ if (filter != null)
+ unit.addAttachment(DeploymentUnitFilter.class, filter);
+ }
+
+ /**
+ * Create classloader factory.
+ *
+ * @param bundle the bundle
+ * @return new classloader factory
+ */
+ protected ClassLoaderFactory createClassLoaderFactory(final Bundle bundle)
+ {
+ return new ClassLoaderFactory()
+ {
+ public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
+ {
+ return BundleClassLoader.createClassLoader(bundle);
+ }
+
+ public void removeClassLoader(DeploymentUnit unit) throws Exception
+ {
+ }
+ };
+ }
+
+ /**
+ * Set deployment filter.
+ *
+ * @param filter the deployment filter
+ */
+ public void setFilter(DeploymentUnitFilter filter)
+ {
+ this.filter = filter;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.deployer;
+
+// $Id$
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.osgi.framework.Bundle;
+
+/**
+ * Deploy the bundle contained MC beans onto the Kernel.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 06-May-2009
+ */
+public class BundleContainedBeansDeployer extends AbstractComponentDeployer<KernelDeployment, BeanMetaData>
+{
+ /*
+ * Create a new KernelDeploymentDeployer.
+ */
+ public BundleContainedBeansDeployer()
+ {
+ addInput(Bundle.class);
+ addInput(ClassLoaderFactory.class);
+ setDeploymentVisitor(new KernelDeploymentVisitor());
+ setComponentVisitor(new BeanMetaDataVisitor());
+ }
+
+ /*
+ * KernelDeploymentVisitor.
+ */
+ public static class KernelDeploymentVisitor extends BeanMetaDataFactoryVisitor<KernelDeployment>
+ {
+ @Override
+ public void deploy(DeploymentUnit unit, KernelDeployment deployment) throws DeploymentException
+ {
+ ClassLoaderFactory factory = unit.getAttachment(ClassLoaderFactory.class);
+ unit.createClassLoader(factory);
+
+ super.deploy(unit, deployment);
+ }
+
+ public Class<KernelDeployment> getVisitorType()
+ {
+ return KernelDeployment.class;
+ }
+
+ protected List<BeanMetaData> getBeans(KernelDeployment deployment)
+ {
+ return deployment.getBeans();
+ }
+ }
+
+ /*
+ * BeanMetaDataVisitor.
+ */
+ public static class BeanMetaDataVisitor extends BeanMetaDataFactoryVisitor<BeanMetaData>
+ {
+ public Class<BeanMetaData> getVisitorType()
+ {
+ return BeanMetaData.class;
+ }
+
+ protected List<BeanMetaData> getBeans(BeanMetaData deployment)
+ {
+ return Collections.singletonList(deployment);
+ }
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+// $Id: $
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.spi.management.ManagedBundle;
+import org.osgi.framework.Bundle;
+
+/**
+ * Register the Bundle as MBean with JMX.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Mar-2009
+ */
+public class BundleManagementDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private MBeanServer mbeanServer;
+
+ public BundleManagementDeployer()
+ {
+ super(Bundle.class);
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ if (mbeanServer != null)
+ {
+ ManagedBundle mb = new ManagedBundle(bundle);
+ ObjectName oname = mb.getObjectName();
+ try
+ {
+ mbeanServer.registerMBean(mb, oname);
+ unit.addAttachment(ManagedBundle.class, mb);
+ }
+ catch (Exception ex)
+ {
+ DeploymentException.rethrowAsDeploymentException(ex.getMessage(), ex);
+ }
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, Bundle bundle)
+ {
+ if (mbeanServer != null)
+ {
+ try
+ {
+ ManagedBundle mb = unit.getAttachment(ManagedBundle.class);
+ if (mb != null && mbeanServer.isRegistered(mb.getObjectName()))
+ mbeanServer.unregisterMBean(mb.getObjectName());
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot unregister: " + bundle, ex);
+ }
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
+
+
+/**
+ * The Bundle metadata.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleMetaData extends AbstractManifestMetaData
+{
+ private String symbolicName;
+ private URL bundleLocation;
+
+ // exteralizable usage
+ public BundleMetaData()
+ {
+ }
+
+ public BundleMetaData(String symbolicName)
+ {
+ this.symbolicName = symbolicName;
+ }
+
+ public String getSymbolicName()
+ {
+ return symbolicName;
+ }
+
+ public URL getBundleLocation()
+ {
+ return bundleLocation;
+ }
+
+ public void setBundleLocation(URL bundleLocation)
+ {
+ this.bundleLocation = bundleLocation;
+ }
+
+ public String toString()
+ {
+ return "Bundle[name=" + symbolicName + "]";
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+//$Id$
+
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Constants;
+
+/**
+ * Create {@link BundleMetaData} from Manifest Headers.
+ *
+ * If the manifest does not contain a header (named "Bundle-SymbolicName") this deployer does nothing.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleMetaDataDeployer extends ManifestDeployer<BundleMetaData>
+{
+ public BundleMetaDataDeployer()
+ {
+ super(BundleMetaData.class);
+ }
+
+ @Override
+ protected BundleMetaData parse(VFSDeploymentUnit unit, VirtualFile file, BundleMetaData root) throws Exception
+ {
+ BundleMetaData metaData = super.parse(unit, file, root);
+ if (metaData != null)
+ {
+ metaData.setBundleLocation(unit.getRoot().toURL());
+ log.debug("Bundle-SymbolicName: " + metaData.getSymbolicName() + " in " + file);
+ }
+ return metaData;
+ }
+
+ @Override
+ protected BundleMetaData createMetaData(Manifest manifest) throws Exception
+ {
+ Attributes attribs = manifest.getMainAttributes();
+ String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ if (symbolicName != null)
+ return new BundleMetaData(symbolicName);
+
+ return null;
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+//$Id$
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+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.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * Installs the Bundle into the Framework's SystemContext.
+ *
+ * This deployer does not start the bundle. It leaves it in state INSTALLED.
+ * On undeploy the Bundle gets uninstalled from the Framework's SystemContext.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Ales.Justin(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
+{
+ private BundleContext systemContext;
+ private List<URL> skipBundles = new ArrayList<URL>();
+
+ public BundleRealDeployer()
+ {
+ super(BundleMetaData.class);
+ addOutput(Bundle.class);
+ setStage(DeploymentStages.POST_PARSE);
+ }
+
+ public void setSystemContext(BundleContext bundleContext)
+ {
+ this.systemContext = bundleContext;
+ }
+
+ public void setSkipBundles(List<URL> skipBundles)
+ {
+ this.skipBundles = skipBundles;
+ }
+
+ public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws DeploymentException
+ {
+ URL bundleURL = metadata.getBundleLocation();
+ if (bundleURL == null)
+ throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
+
+ String bundlePath = bundleURL.getPath();
+ if (bundlePath.endsWith("/"))
+ bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
+
+ try
+ {
+ boolean skipBundle = false;
+ for (URL skip : skipBundles)
+ {
+ String skipPath = skip.getPath();
+ if (skipPath.equals(bundlePath))
+ {
+ skipBundle = true;
+ break;
+ }
+ }
+ if (skipBundle == false)
+ {
+ Bundle bundle = systemContext.installBundle(bundleURL.toString());
+ unit.addAttachment(Bundle.class, bundle);
+
+ log.info("Installed: " + bundle);
+ }
+ }
+ catch (BundleException ex)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Cannot install bundle: " + metadata, ex);
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, BundleMetaData osGiMetaData)
+ {
+ Bundle bundle = unit.getAttachment(Bundle.class);
+ if (bundle != null)
+ {
+ try
+ {
+ bundle.uninstall();
+ log.info("Uninstalled: " + bundle);
+ }
+ catch (BundleException ex)
+ {
+ log.warn(ex);
+ }
+ }
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+// $Id: $
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.spi.Constants;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.startlevel.StartLevel;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * Sets the bundle's start level on the StartLevel service.
+ *
+ * A start level can be given when the bundle is deployed through the
+ * WebConsole. Currently, neither hot deployment nor SPI test framework
+ * deployments support start levels.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 08-Jul-2009
+ */
+public class BundleStartLevelDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private BundleContext systemContext;
+ private ServiceTracker startLevelTracker;
+
+ public BundleStartLevelDeployer()
+ {
+ super(Bundle.class);
+ addOutput(Constants.PROPERTY_START_LEVEL);
+ }
+
+ public void setSystemContext(BundleContext systemContext)
+ {
+ this.systemContext = systemContext;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ Integer propStart = unit.getAttachment(Constants.PROPERTY_START_LEVEL, Integer.class);
+ StartLevel startLevel = getStartLevel();
+ if (propStart != null && startLevel != null)
+ {
+ startLevel.setBundleStartLevel(bundle, propStart);
+ }
+ }
+
+ private StartLevel getStartLevel()
+ {
+ if (startLevelTracker == null)
+ {
+ startLevelTracker = new ServiceTracker(systemContext, StartLevel.class.getName(), null);
+ startLevelTracker.open();
+ }
+ return (StartLevel)startLevelTracker.getService();
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+// $Id: $
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.spi.Constants;
+import org.jboss.osgi.spi.logging.ExportedPackageHelper;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * This is the Bundle start/stop Deployer
+ *
+ * @author Ales.Justin(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 27-Feb-2009
+ */
+public class BundleStartStopDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private BundleContext systemContext;
+ private PackageAdmin packageAdmin;
+
+ // The list of unresolved bundles
+ private List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
+
+ public BundleStartStopDeployer()
+ {
+ super(Bundle.class);
+ addInput(Constants.PROPERTY_START_LEVEL);
+ }
+
+ public void setSystemContext(BundleContext systemContext)
+ {
+ this.systemContext = systemContext;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ Boolean propAutoStart = unit.getAttachment(Constants.PROPERTY_AUTO_START, Boolean.class);
+ if (propAutoStart == null || Boolean.TRUE.equals(propAutoStart))
+ {
+ String propDeferredStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
+ if (Boolean.parseBoolean(propDeferredStart != null ? propDeferredStart : "true") == true)
+ {
+ deferredStart(unit, bundle);
+ }
+ else
+ {
+ simpleStart(unit, bundle);
+ }
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, Bundle bundle)
+ {
+ try
+ {
+ bundle.stop();
+
+ unresolvedBundles.remove(bundle);
+
+ log.info("Stoped: " + bundle);
+ }
+ catch (BundleException e)
+ {
+ log.warn("Cannot stop bundle: " + e);
+ }
+ }
+
+ private void simpleStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
+ try
+ {
+ // Added support for Bundle.START_ACTIVATION_POLICY on start
+ // http://issues.apache.org/jira/browse/FELIX-1317
+ // bundle.start(Bundle.START_ACTIVATION_POLICY);
+
+ bundle.start();
+
+ log.info("Started: " + bundle);
+ packageHelper.logExportedPackages(bundle);
+ }
+ catch (BundleException e)
+ {
+ log.warn("Cannot start bundle", e);
+ }
+ }
+
+ private void deferredStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
+
+ // Get the required dependency on the PackageAdmin service
+ if (packageAdmin == null)
+ {
+ ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
+ packageAdmin = (PackageAdmin)systemContext.getService(sref);
+ if (packageAdmin == null)
+ throw new IllegalStateException("Cannot obtain PackageAdmin service");
+ }
+
+ // Always add the bundle as unresolved
+ unresolvedBundles.add(bundle);
+
+ Bundle[] bundleArr = new Bundle[unresolvedBundles.size()];
+ unresolvedBundles.toArray(bundleArr);
+
+ // Try to resolve the bundles
+ packageAdmin.resolveBundles(bundleArr);
+
+ // Find resolved bundles and start them
+ Iterator<Bundle> it = unresolvedBundles.iterator();
+ while (it.hasNext())
+ {
+ Bundle auxBundle = it.next();
+ if ((Bundle.RESOLVED & auxBundle.getState()) == Bundle.RESOLVED)
+ {
+ it.remove();
+ try
+ {
+ // Added support for Bundle.START_ACTIVATION_POLICY on start
+ // http://issues.apache.org/jira/browse/FELIX-1317
+ // auxBundle.start(Bundle.START_ACTIVATION_POLICY);
+
+ auxBundle.start();
+
+ packageHelper.logExportedPackages(bundle);
+ log.info("Started: " + bundle);
+ }
+ catch (BundleException e)
+ {
+ log.warn("Cannot start bundle", e);
+ }
+ }
+ }
+
+ // Report unresolved bundles
+ if (unresolvedBundles.size() > 0)
+ log.info("Unresolved: " + unresolvedBundles);
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+// $Id$
+
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Constants;
+
+/**
+ * Determine the structure of a Bundle deployment.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-Apr-2009
+ */
+public class BundleStructureDeployer extends AbstractVFSStructureDeployer
+{
+ /**
+ * Sets the default relative order 9000.
+ */
+ public BundleStructureDeployer()
+ {
+ setRelativeOrder(9000);
+ }
+
+ /**
+ * Determine the structure of a bundle deployment
+ *
+ * @param context the structure context
+ * @return true when it recognised the context
+ * @throws DeploymentException for an error
+ */
+ public boolean determineStructure(StructureContext structureContext) throws DeploymentException
+ {
+ ContextInfo context = null;
+ VirtualFile file = structureContext.getFile();
+ VirtualFile root = structureContext.getRoot();
+
+ try
+ {
+ // This file is not for me, because I'm only interested
+ // in root deployments that contain a MANIFEST.MF
+ Manifest manifest = VFSUtils.getManifest(file);
+ if (file != root || manifest == null)
+ return false;
+
+ // This file is also not for me, because I need to see Bundle-SymbolicName
+ Attributes attribs = manifest.getMainAttributes();
+ String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ if (symbolicName == null)
+ return false;
+
+ // Create a context for this jar file with META-INF as the location for metadata
+ context = createContext(structureContext, "META-INF");
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ // Remove the invalid context
+ if (context != null)
+ structureContext.removeChild(context);
+
+ throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers (from rev 92696, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers)
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/BundleDeploymentUnitFilter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/BundleDeploymentUnitFilter.java 2009-08-22 18:13:15 UTC (rev 92696)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/BundleDeploymentUnitFilter.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -19,7 +19,7 @@
* 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.runtime.deployer.helpers;
+package org.jboss.osgi.deployer.helpers;
// $Id$
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java 2009-08-22 18:13:15 UTC (rev 92696)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -19,7 +19,7 @@
* 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.runtime.deployer.helpers;
+package org.jboss.osgi.deployer.helpers;
// $Id$
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/PackageAdminDependencyItem.java 2009-08-22 18:13:15 UTC (rev 92696)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -19,7 +19,7 @@
* 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.runtime.deployer.helpers;
+package org.jboss.osgi.deployer.helpers;
import org.jboss.dependency.plugins.AbstractDependencyItem;
import org.jboss.dependency.spi.ControllerState;
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-// $Id$
-
-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.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
-import org.jboss.osgi.runtime.deployer.helpers.BundleDeploymentUnitFilter;
-import org.jboss.osgi.runtime.deployer.helpers.PackageAdminDependencyItem;
-import org.jboss.osgi.spi.Constants;
-import org.jboss.osgi.spi.util.BundleClassLoader;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * A deployer that attaches a {@link ClassLoaderFactory} that creates a
- * {@link BundleClassLoader} for the deployed Bundle.
- *
- * @author Ales.Justin(a)jboss.org
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleClassLoaderDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private DeploymentUnitFilter filter = new BundleDeploymentUnitFilter();
- private BundleContext systemContext;
-
- public BundleClassLoaderDeployer()
- {
- super(Bundle.class);
- addOutput(ClassLoaderFactory.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- // create bundle delegate classloader
- ClassLoaderFactory factory = createClassLoaderFactory(bundle);
- unit.addAttachment(ClassLoaderFactory.class, factory);
-
- // create dependency items
- String propStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
- if (Boolean.parseBoolean(propStart != null ? propStart : "true") == false)
- unit.addIDependOn(new PackageAdminDependencyItem(systemContext, bundle));
-
- // skip annotations scanning, if filter is set
- if (filter != null)
- unit.addAttachment(DeploymentUnitFilter.class, filter);
- }
-
- /**
- * Create classloader factory.
- *
- * @param bundle the bundle
- * @return new classloader factory
- */
- protected ClassLoaderFactory createClassLoaderFactory(final Bundle bundle)
- {
- return new ClassLoaderFactory()
- {
- public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
- {
- return BundleClassLoader.createClassLoader(bundle);
- }
-
- public void removeClassLoader(DeploymentUnit unit) throws Exception
- {
- }
- };
- }
-
- /**
- * Set deployment filter.
- *
- * @param filter the deployment filter
- */
- public void setFilter(DeploymentUnitFilter filter)
- {
- this.filter = filter;
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.runtime.deployer;
-
-// $Id$
-
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.osgi.framework.Bundle;
-
-/**
- * Deploy the bundle contained MC beans onto the Kernel.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 06-May-2009
- */
-public class BundleContainedBeansDeployer extends AbstractComponentDeployer<KernelDeployment, BeanMetaData>
-{
- /*
- * Create a new KernelDeploymentDeployer.
- */
- public BundleContainedBeansDeployer()
- {
- addInput(Bundle.class);
- addInput(ClassLoaderFactory.class);
- setDeploymentVisitor(new KernelDeploymentVisitor());
- setComponentVisitor(new BeanMetaDataVisitor());
- }
-
- /*
- * KernelDeploymentVisitor.
- */
- public static class KernelDeploymentVisitor extends BeanMetaDataFactoryVisitor<KernelDeployment>
- {
- @Override
- public void deploy(DeploymentUnit unit, KernelDeployment deployment) throws DeploymentException
- {
- ClassLoaderFactory factory = unit.getAttachment(ClassLoaderFactory.class);
- unit.createClassLoader(factory);
-
- super.deploy(unit, deployment);
- }
-
- public Class<KernelDeployment> getVisitorType()
- {
- return KernelDeployment.class;
- }
-
- protected List<BeanMetaData> getBeans(KernelDeployment deployment)
- {
- return deployment.getBeans();
- }
- }
-
- /*
- * BeanMetaDataVisitor.
- */
- public static class BeanMetaDataVisitor extends BeanMetaDataFactoryVisitor<BeanMetaData>
- {
- public Class<BeanMetaData> getVisitorType()
- {
- return BeanMetaData.class;
- }
-
- protected List<BeanMetaData> getBeans(BeanMetaData deployment)
- {
- return Collections.singletonList(deployment);
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-// $Id: $
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.management.ManagedBundle;
-import org.osgi.framework.Bundle;
-
-/**
- * Register the Bundle as MBean with JMX.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public class BundleManagementDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private MBeanServer mbeanServer;
-
- public BundleManagementDeployer()
- {
- super(Bundle.class);
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- if (mbeanServer != null)
- {
- ManagedBundle mb = new ManagedBundle(bundle);
- ObjectName oname = mb.getObjectName();
- try
- {
- mbeanServer.registerMBean(mb, oname);
- unit.addAttachment(ManagedBundle.class, mb);
- }
- catch (Exception ex)
- {
- DeploymentException.rethrowAsDeploymentException(ex.getMessage(), ex);
- }
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, Bundle bundle)
- {
- if (mbeanServer != null)
- {
- try
- {
- ManagedBundle mb = unit.getAttachment(ManagedBundle.class);
- if (mb != null && mbeanServer.isRegistered(mb.getObjectName()))
- mbeanServer.unregisterMBean(mb.getObjectName());
- }
- catch (Exception ex)
- {
- log.warn("Cannot unregister: " + bundle, ex);
- }
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-//$Id$
-
-import java.net.URL;
-
-import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
-
-
-/**
- * The Bundle metadata.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaData extends AbstractManifestMetaData
-{
- private String symbolicName;
- private URL bundleLocation;
-
- // exteralizable usage
- public BundleMetaData()
- {
- }
-
- public BundleMetaData(String symbolicName)
- {
- this.symbolicName = symbolicName;
- }
-
- public String getSymbolicName()
- {
- return symbolicName;
- }
-
- public URL getBundleLocation()
- {
- return bundleLocation;
- }
-
- public void setBundleLocation(URL bundleLocation)
- {
- this.bundleLocation = bundleLocation;
- }
-
- public String toString()
- {
- return "Bundle[name=" + symbolicName + "]";
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-//$Id$
-
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
-
-/**
- * Create {@link BundleMetaData} from Manifest Headers.
- *
- * If the manifest does not contain a header (named "Bundle-SymbolicName") this deployer does nothing.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaDataDeployer extends ManifestDeployer<BundleMetaData>
-{
- public BundleMetaDataDeployer()
- {
- super(BundleMetaData.class);
- }
-
- @Override
- protected BundleMetaData parse(VFSDeploymentUnit unit, VirtualFile file, BundleMetaData root) throws Exception
- {
- BundleMetaData metaData = super.parse(unit, file, root);
- if (metaData != null)
- {
- metaData.setBundleLocation(unit.getRoot().toURL());
- log.debug("Bundle-SymbolicName: " + metaData.getSymbolicName() + " in " + file);
- }
- return metaData;
- }
-
- @Override
- protected BundleMetaData createMetaData(Manifest manifest) throws Exception
- {
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName != null)
- return new BundleMetaData(symbolicName);
-
- return null;
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-//$Id$
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-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.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * Installs the Bundle into the Framework's SystemContext.
- *
- * This deployer does not start the bundle. It leaves it in state INSTALLED.
- * On undeploy the Bundle gets uninstalled from the Framework's SystemContext.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Ales.Justin(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
-{
- private BundleContext systemContext;
- private List<URL> skipBundles = new ArrayList<URL>();
-
- public BundleRealDeployer()
- {
- super(BundleMetaData.class);
- addOutput(Bundle.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void setSystemContext(BundleContext bundleContext)
- {
- this.systemContext = bundleContext;
- }
-
- public void setSkipBundles(List<URL> skipBundles)
- {
- this.skipBundles = skipBundles;
- }
-
- public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws DeploymentException
- {
- URL bundleURL = metadata.getBundleLocation();
- if (bundleURL == null)
- throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
-
- String bundlePath = bundleURL.getPath();
- if (bundlePath.endsWith("/"))
- bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
-
- try
- {
- boolean skipBundle = false;
- for (URL skip : skipBundles)
- {
- String skipPath = skip.getPath();
- if (skipPath.equals(bundlePath))
- {
- skipBundle = true;
- break;
- }
- }
- if (skipBundle == false)
- {
- Bundle bundle = systemContext.installBundle(bundleURL.toString());
- unit.addAttachment(Bundle.class, bundle);
-
- log.info("Installed: " + bundle);
- }
- }
- catch (BundleException ex)
- {
- throw DeploymentException.rethrowAsDeploymentException("Cannot install bundle: " + metadata, ex);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, BundleMetaData osGiMetaData)
- {
- Bundle bundle = unit.getAttachment(Bundle.class);
- if (bundle != null)
- {
- try
- {
- bundle.uninstall();
- log.info("Uninstalled: " + bundle);
- }
- catch (BundleException ex)
- {
- log.warn(ex);
- }
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-// $Id: $
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.Constants;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.startlevel.StartLevel;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Sets the bundle's start level on the StartLevel service.
- *
- * A start level can be given when the bundle is deployed through the
- * WebConsole. Currently, neither hot deployment nor SPI test framework
- * deployments support start levels.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 08-Jul-2009
- */
-public class BundleStartLevelDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private BundleContext systemContext;
- private ServiceTracker startLevelTracker;
-
- public BundleStartLevelDeployer()
- {
- super(Bundle.class);
- addOutput(Constants.PROPERTY_START_LEVEL);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- Integer propStart = unit.getAttachment(Constants.PROPERTY_START_LEVEL, Integer.class);
- StartLevel startLevel = getStartLevel();
- if (propStart != null && startLevel != null)
- {
- startLevel.setBundleStartLevel(bundle, propStart);
- }
- }
-
- private StartLevel getStartLevel()
- {
- if (startLevelTracker == null)
- {
- startLevelTracker = new ServiceTracker(systemContext, StartLevel.class.getName(), null);
- startLevelTracker.open();
- }
- return (StartLevel)startLevelTracker.getService();
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,173 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-// $Id: $
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.Constants;
-import org.jboss.osgi.spi.logging.ExportedPackageHelper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * This is the Bundle start/stop Deployer
- *
- * @author Ales.Justin(a)jboss.org
- * @author Thomas.Diesler(a)jboss.com
- * @since 27-Feb-2009
- */
-public class BundleStartStopDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private BundleContext systemContext;
- private PackageAdmin packageAdmin;
-
- // The list of unresolved bundles
- private List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
-
- public BundleStartStopDeployer()
- {
- super(Bundle.class);
- addInput(Constants.PROPERTY_START_LEVEL);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- Boolean propAutoStart = unit.getAttachment(Constants.PROPERTY_AUTO_START, Boolean.class);
- if (propAutoStart == null || Boolean.TRUE.equals(propAutoStart))
- {
- String propDeferredStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
- if (Boolean.parseBoolean(propDeferredStart != null ? propDeferredStart : "true") == true)
- {
- deferredStart(unit, bundle);
- }
- else
- {
- simpleStart(unit, bundle);
- }
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, Bundle bundle)
- {
- try
- {
- bundle.stop();
-
- unresolvedBundles.remove(bundle);
-
- log.info("Stoped: " + bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot stop bundle: " + e);
- }
- }
-
- private void simpleStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
- try
- {
- // Added support for Bundle.START_ACTIVATION_POLICY on start
- // http://issues.apache.org/jira/browse/FELIX-1317
- // bundle.start(Bundle.START_ACTIVATION_POLICY);
-
- bundle.start();
-
- log.info("Started: " + bundle);
- packageHelper.logExportedPackages(bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot start bundle", e);
- }
- }
-
- private void deferredStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
-
- // Get the required dependency on the PackageAdmin service
- if (packageAdmin == null)
- {
- ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
- packageAdmin = (PackageAdmin)systemContext.getService(sref);
- if (packageAdmin == null)
- throw new IllegalStateException("Cannot obtain PackageAdmin service");
- }
-
- // Always add the bundle as unresolved
- unresolvedBundles.add(bundle);
-
- Bundle[] bundleArr = new Bundle[unresolvedBundles.size()];
- unresolvedBundles.toArray(bundleArr);
-
- // Try to resolve the bundles
- packageAdmin.resolveBundles(bundleArr);
-
- // Find resolved bundles and start them
- Iterator<Bundle> it = unresolvedBundles.iterator();
- while (it.hasNext())
- {
- Bundle auxBundle = it.next();
- if ((Bundle.RESOLVED & auxBundle.getState()) == Bundle.RESOLVED)
- {
- it.remove();
- try
- {
- // Added support for Bundle.START_ACTIVATION_POLICY on start
- // http://issues.apache.org/jira/browse/FELIX-1317
- // auxBundle.start(Bundle.START_ACTIVATION_POLICY);
-
- auxBundle.start();
-
- packageHelper.logExportedPackages(bundle);
- log.info("Started: " + bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot start bundle", e);
- }
- }
- }
-
- // Report unresolved bundles
- if (unresolvedBundles.size() > 0)
- log.info("Unresolved: " + unresolvedBundles);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java 2009-08-22 18:15:34 UTC (rev 92697)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java 2009-08-22 18:17:24 UTC (rev 92698)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.runtime.deployer;
-
-// $Id$
-
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
-import org.jboss.deployers.vfs.spi.structure.StructureContext;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
-
-/**
- * Determine the structure of a Bundle deployment.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-Apr-2009
- */
-public class BundleStructureDeployer extends AbstractVFSStructureDeployer
-{
- /**
- * Sets the default relative order 9000.
- */
- public BundleStructureDeployer()
- {
- setRelativeOrder(9000);
- }
-
- /**
- * Determine the structure of a bundle deployment
- *
- * @param context the structure context
- * @return true when it recognised the context
- * @throws DeploymentException for an error
- */
- public boolean determineStructure(StructureContext structureContext) throws DeploymentException
- {
- ContextInfo context = null;
- VirtualFile file = structureContext.getFile();
- VirtualFile root = structureContext.getRoot();
-
- try
- {
- // This file is not for me, because I'm only interested
- // in root deployments that contain a MANIFEST.MF
- Manifest manifest = VFSUtils.getManifest(file);
- if (file != root || manifest == null)
- return false;
-
- // This file is also not for me, because I need to see Bundle-SymbolicName
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName == null)
- return false;
-
- // Create a context for this jar file with META-INF as the location for metadata
- context = createContext(structureContext, "META-INF");
-
- return true;
- }
- catch (Exception e)
- {
- // Remove the invalid context
- if (context != null)
- structureContext.removeChild(context);
-
- throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
- }
- }
-}
\ No newline at end of file
16 years, 4 months
JBoss-OSGI SVN: r92696 - in projects/jboss-osgi/projects/runtime/deployers/trunk: src/main/java/org/jboss/osgi and 4 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 14:13:15 -0400 (Sat, 22 Aug 2009)
New Revision: 92696
Added:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/
Removed:
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/
Modified:
projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/BundleDeploymentUnitFilter.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java
projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/PackageAdminDependencyItem.java
Log:
Move trunk to version 1.0.1-SNAPSHOT
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/pom.xml 2009-08-22 18:13:15 UTC (rev 92696)
@@ -16,23 +16,23 @@
<name>JBossOSGi Runtime - Deployers</name>
- <groupId>org.jboss.osgi</groupId>
+ <groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-deployers</artifactId>
<packaging>jar</packaging>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
<!-- Parent -->
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.1</version>
+ <version>1.0.2-SNAPSHOT</version>
</parent>
<properties>
- <version.jboss.deployers>2.0.5.SP1</version.jboss.deployers>
- <version.jboss.osgi.spi>1.0.0</version.jboss.osgi.spi>
- <version.osgi>r4v41</version.osgi>
+ <version.jboss.deployers>2.0.8.GA</version.jboss.deployers>
+ <version.jboss.osgi.spi>1.0.1-SNAPSHOT</version.jboss.osgi.spi>
+ <version.osgi>r4v42-20090728</version.osgi>
</properties>
<!-- Dependencies -->
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-// $Id$
-
-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.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
-import org.jboss.osgi.deployer.helpers.BundleDeploymentUnitFilter;
-import org.jboss.osgi.deployer.helpers.PackageAdminDependencyItem;
-import org.jboss.osgi.spi.Constants;
-import org.jboss.osgi.spi.util.BundleClassLoader;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * A deployer that attaches a {@link ClassLoaderFactory} that creates a
- * {@link BundleClassLoader} for the deployed Bundle.
- *
- * @author Ales.Justin(a)jboss.org
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleClassLoaderDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private DeploymentUnitFilter filter = new BundleDeploymentUnitFilter();
- private BundleContext systemContext;
-
- public BundleClassLoaderDeployer()
- {
- super(Bundle.class);
- addOutput(ClassLoaderFactory.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- // create bundle delegate classloader
- ClassLoaderFactory factory = createClassLoaderFactory(bundle);
- unit.addAttachment(ClassLoaderFactory.class, factory);
-
- // create dependency items
- String propStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
- if (Boolean.parseBoolean(propStart != null ? propStart : "true") == false)
- unit.addIDependOn(new PackageAdminDependencyItem(systemContext, bundle));
-
- // skip annotations scanning, if filter is set
- if (filter != null)
- unit.addAttachment(DeploymentUnitFilter.class, filter);
- }
-
- /**
- * Create classloader factory.
- *
- * @param bundle the bundle
- * @return new classloader factory
- */
- protected ClassLoaderFactory createClassLoaderFactory(final Bundle bundle)
- {
- return new ClassLoaderFactory()
- {
- public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
- {
- return BundleClassLoader.createClassLoader(bundle);
- }
-
- public void removeClassLoader(DeploymentUnit unit) throws Exception
- {
- }
- };
- }
-
- /**
- * Set deployment filter.
- *
- * @param filter the deployment filter
- */
- public void setFilter(DeploymentUnitFilter filter)
- {
- this.filter = filter;
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.deployer;
-
-// $Id$
-
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.osgi.framework.Bundle;
-
-/**
- * Deploy the bundle contained MC beans onto the Kernel.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 06-May-2009
- */
-public class BundleContainedBeansDeployer extends AbstractComponentDeployer<KernelDeployment, BeanMetaData>
-{
- /*
- * Create a new KernelDeploymentDeployer.
- */
- public BundleContainedBeansDeployer()
- {
- addInput(Bundle.class);
- addInput(ClassLoaderFactory.class);
- setDeploymentVisitor(new KernelDeploymentVisitor());
- setComponentVisitor(new BeanMetaDataVisitor());
- }
-
- /*
- * KernelDeploymentVisitor.
- */
- public static class KernelDeploymentVisitor extends BeanMetaDataFactoryVisitor<KernelDeployment>
- {
- @Override
- public void deploy(DeploymentUnit unit, KernelDeployment deployment) throws DeploymentException
- {
- ClassLoaderFactory factory = unit.getAttachment(ClassLoaderFactory.class);
- unit.createClassLoader(factory);
-
- super.deploy(unit, deployment);
- }
-
- public Class<KernelDeployment> getVisitorType()
- {
- return KernelDeployment.class;
- }
-
- protected List<BeanMetaData> getBeans(KernelDeployment deployment)
- {
- return deployment.getBeans();
- }
- }
-
- /*
- * BeanMetaDataVisitor.
- */
- public static class BeanMetaDataVisitor extends BeanMetaDataFactoryVisitor<BeanMetaData>
- {
- public Class<BeanMetaData> getVisitorType()
- {
- return BeanMetaData.class;
- }
-
- protected List<BeanMetaData> getBeans(BeanMetaData deployment)
- {
- return Collections.singletonList(deployment);
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-// $Id: $
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.management.ManagedBundle;
-import org.osgi.framework.Bundle;
-
-/**
- * Register the Bundle as MBean with JMX.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public class BundleManagementDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private MBeanServer mbeanServer;
-
- public BundleManagementDeployer()
- {
- super(Bundle.class);
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- if (mbeanServer != null)
- {
- ManagedBundle mb = new ManagedBundle(bundle);
- ObjectName oname = mb.getObjectName();
- try
- {
- mbeanServer.registerMBean(mb, oname);
- unit.addAttachment(ManagedBundle.class, mb);
- }
- catch (Exception ex)
- {
- DeploymentException.rethrowAsDeploymentException(ex.getMessage(), ex);
- }
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, Bundle bundle)
- {
- if (mbeanServer != null)
- {
- try
- {
- ManagedBundle mb = unit.getAttachment(ManagedBundle.class);
- if (mb != null && mbeanServer.isRegistered(mb.getObjectName()))
- mbeanServer.unregisterMBean(mb.getObjectName());
- }
- catch (Exception ex)
- {
- log.warn("Cannot unregister: " + bundle, ex);
- }
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-//$Id$
-
-import java.net.URL;
-
-import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
-
-
-/**
- * The Bundle metadata.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaData extends AbstractManifestMetaData
-{
- private String symbolicName;
- private URL bundleLocation;
-
- // exteralizable usage
- public BundleMetaData()
- {
- }
-
- public BundleMetaData(String symbolicName)
- {
- this.symbolicName = symbolicName;
- }
-
- public String getSymbolicName()
- {
- return symbolicName;
- }
-
- public URL getBundleLocation()
- {
- return bundleLocation;
- }
-
- public void setBundleLocation(URL bundleLocation)
- {
- this.bundleLocation = bundleLocation;
- }
-
- public String toString()
- {
- return "Bundle[name=" + symbolicName + "]";
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-//$Id$
-
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
-
-/**
- * Create {@link BundleMetaData} from Manifest Headers.
- *
- * If the manifest does not contain a header (named "Bundle-SymbolicName") this deployer does nothing.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaDataDeployer extends ManifestDeployer<BundleMetaData>
-{
- public BundleMetaDataDeployer()
- {
- super(BundleMetaData.class);
- }
-
- @Override
- protected BundleMetaData parse(VFSDeploymentUnit unit, VirtualFile file, BundleMetaData root) throws Exception
- {
- BundleMetaData metaData = super.parse(unit, file, root);
- if (metaData != null)
- {
- metaData.setBundleLocation(unit.getRoot().toURL());
- log.debug("Bundle-SymbolicName: " + metaData.getSymbolicName() + " in " + file);
- }
- return metaData;
- }
-
- @Override
- protected BundleMetaData createMetaData(Manifest manifest) throws Exception
- {
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName != null)
- return new BundleMetaData(symbolicName);
-
- return null;
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-//$Id$
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-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.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * Installs the Bundle into the Framework's SystemContext.
- *
- * This deployer does not start the bundle. It leaves it in state INSTALLED.
- * On undeploy the Bundle gets uninstalled from the Framework's SystemContext.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Ales.Justin(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
-{
- private BundleContext systemContext;
- private List<URL> skipBundles = new ArrayList<URL>();
-
- public BundleRealDeployer()
- {
- super(BundleMetaData.class);
- addOutput(Bundle.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void setSystemContext(BundleContext bundleContext)
- {
- this.systemContext = bundleContext;
- }
-
- public void setSkipBundles(List<URL> skipBundles)
- {
- this.skipBundles = skipBundles;
- }
-
- public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws DeploymentException
- {
- URL bundleURL = metadata.getBundleLocation();
- if (bundleURL == null)
- throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
-
- String bundlePath = bundleURL.getPath();
- if (bundlePath.endsWith("/"))
- bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
-
- try
- {
- boolean skipBundle = false;
- for (URL skip : skipBundles)
- {
- String skipPath = skip.getPath();
- if (skipPath.equals(bundlePath))
- {
- skipBundle = true;
- break;
- }
- }
- if (skipBundle == false)
- {
- Bundle bundle = systemContext.installBundle(bundleURL.toString());
- unit.addAttachment(Bundle.class, bundle);
-
- log.info("Installed: " + bundle);
- }
- }
- catch (BundleException ex)
- {
- throw DeploymentException.rethrowAsDeploymentException("Cannot install bundle: " + metadata, ex);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, BundleMetaData osGiMetaData)
- {
- Bundle bundle = unit.getAttachment(Bundle.class);
- if (bundle != null)
- {
- try
- {
- bundle.uninstall();
- log.info("Uninstalled: " + bundle);
- }
- catch (BundleException ex)
- {
- log.warn(ex);
- }
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-// $Id: $
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.Constants;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.startlevel.StartLevel;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Sets the bundle's start level on the StartLevel service.
- *
- * A start level can be given when the bundle is deployed through the
- * WebConsole. Currently, neither hot deployment nor SPI test framework
- * deployments support start levels.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 08-Jul-2009
- */
-public class BundleStartLevelDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private BundleContext systemContext;
- private ServiceTracker startLevelTracker;
-
- public BundleStartLevelDeployer()
- {
- super(Bundle.class);
- addOutput(Constants.PROPERTY_START_LEVEL);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- Integer propStart = unit.getAttachment(Constants.PROPERTY_START_LEVEL, Integer.class);
- StartLevel startLevel = getStartLevel();
- if (propStart != null && startLevel != null)
- {
- startLevel.setBundleStartLevel(bundle, propStart);
- }
- }
-
- private StartLevel getStartLevel()
- {
- if (startLevelTracker == null)
- {
- startLevelTracker = new ServiceTracker(systemContext, StartLevel.class.getName(), null);
- startLevelTracker.open();
- }
- return (StartLevel)startLevelTracker.getService();
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,173 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-// $Id: $
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.spi.Constants;
-import org.jboss.osgi.spi.logging.ExportedPackageHelper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * This is the Bundle start/stop Deployer
- *
- * @author Ales.Justin(a)jboss.org
- * @author Thomas.Diesler(a)jboss.com
- * @since 27-Feb-2009
- */
-public class BundleStartStopDeployer extends AbstractSimpleRealDeployer<Bundle>
-{
- private BundleContext systemContext;
- private PackageAdmin packageAdmin;
-
- // The list of unresolved bundles
- private List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
-
- public BundleStartStopDeployer()
- {
- super(Bundle.class);
- addInput(Constants.PROPERTY_START_LEVEL);
- }
-
- public void setSystemContext(BundleContext systemContext)
- {
- this.systemContext = systemContext;
- }
-
- public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- Boolean propAutoStart = unit.getAttachment(Constants.PROPERTY_AUTO_START, Boolean.class);
- if (propAutoStart == null || Boolean.TRUE.equals(propAutoStart))
- {
- String propDeferredStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
- if (Boolean.parseBoolean(propDeferredStart != null ? propDeferredStart : "true") == true)
- {
- deferredStart(unit, bundle);
- }
- else
- {
- simpleStart(unit, bundle);
- }
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, Bundle bundle)
- {
- try
- {
- bundle.stop();
-
- unresolvedBundles.remove(bundle);
-
- log.info("Stoped: " + bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot stop bundle: " + e);
- }
- }
-
- private void simpleStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
- try
- {
- // Added support for Bundle.START_ACTIVATION_POLICY on start
- // http://issues.apache.org/jira/browse/FELIX-1317
- // bundle.start(Bundle.START_ACTIVATION_POLICY);
-
- bundle.start();
-
- log.info("Started: " + bundle);
- packageHelper.logExportedPackages(bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot start bundle", e);
- }
- }
-
- private void deferredStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
- {
- ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
-
- // Get the required dependency on the PackageAdmin service
- if (packageAdmin == null)
- {
- ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
- packageAdmin = (PackageAdmin)systemContext.getService(sref);
- if (packageAdmin == null)
- throw new IllegalStateException("Cannot obtain PackageAdmin service");
- }
-
- // Always add the bundle as unresolved
- unresolvedBundles.add(bundle);
-
- Bundle[] bundleArr = new Bundle[unresolvedBundles.size()];
- unresolvedBundles.toArray(bundleArr);
-
- // Try to resolve the bundles
- packageAdmin.resolveBundles(bundleArr);
-
- // Find resolved bundles and start them
- Iterator<Bundle> it = unresolvedBundles.iterator();
- while (it.hasNext())
- {
- Bundle auxBundle = it.next();
- if ((Bundle.RESOLVED & auxBundle.getState()) == Bundle.RESOLVED)
- {
- it.remove();
- try
- {
- // Added support for Bundle.START_ACTIVATION_POLICY on start
- // http://issues.apache.org/jira/browse/FELIX-1317
- // auxBundle.start(Bundle.START_ACTIVATION_POLICY);
-
- auxBundle.start();
-
- packageHelper.logExportedPackages(bundle);
- log.info("Started: " + bundle);
- }
- catch (BundleException e)
- {
- log.warn("Cannot start bundle", e);
- }
- }
- }
-
- // Report unresolved bundles
- if (unresolvedBundles.size() > 0)
- log.info("Unresolved: " + unresolvedBundles);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2009-08-22 18:02:53 UTC (rev 92695)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-// $Id$
-
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
-import org.jboss.deployers.vfs.spi.structure.StructureContext;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
-
-/**
- * Determine the structure of a Bundle deployment.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-Apr-2009
- */
-public class BundleStructureDeployer extends AbstractVFSStructureDeployer
-{
- /**
- * Sets the default relative order 9000.
- */
- public BundleStructureDeployer()
- {
- setRelativeOrder(9000);
- }
-
- /**
- * Determine the structure of a bundle deployment
- *
- * @param context the structure context
- * @return true when it recognised the context
- * @throws DeploymentException for an error
- */
- public boolean determineStructure(StructureContext structureContext) throws DeploymentException
- {
- ContextInfo context = null;
- VirtualFile file = structureContext.getFile();
- VirtualFile root = structureContext.getRoot();
-
- try
- {
- // This file is not for me, because I'm only interested
- // in root deployments that contain a MANIFEST.MF
- Manifest manifest = VFSUtils.getManifest(file);
- if (file != root || manifest == null)
- return false;
-
- // This file is also not for me, because I need to see Bundle-SymbolicName
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName == null)
- return false;
-
- // Create a context for this jar file with META-INF as the location for metadata
- context = createContext(structureContext, "META-INF");
-
- return true;
- }
- catch (Exception e)
- {
- // Remove the invalid context
- if (context != null)
- structureContext.removeChild(context);
-
- throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleClassLoaderDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+// $Id$
+
+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.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
+import org.jboss.osgi.runtime.deployer.helpers.BundleDeploymentUnitFilter;
+import org.jboss.osgi.runtime.deployer.helpers.PackageAdminDependencyItem;
+import org.jboss.osgi.spi.Constants;
+import org.jboss.osgi.spi.util.BundleClassLoader;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A deployer that attaches a {@link ClassLoaderFactory} that creates a
+ * {@link BundleClassLoader} for the deployed Bundle.
+ *
+ * @author Ales.Justin(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleClassLoaderDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private DeploymentUnitFilter filter = new BundleDeploymentUnitFilter();
+ private BundleContext systemContext;
+
+ public BundleClassLoaderDeployer()
+ {
+ super(Bundle.class);
+ addOutput(ClassLoaderFactory.class);
+ setStage(DeploymentStages.POST_PARSE);
+ }
+
+ public void setSystemContext(BundleContext systemContext)
+ {
+ this.systemContext = systemContext;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ // create bundle delegate classloader
+ ClassLoaderFactory factory = createClassLoaderFactory(bundle);
+ unit.addAttachment(ClassLoaderFactory.class, factory);
+
+ // create dependency items
+ String propStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
+ if (Boolean.parseBoolean(propStart != null ? propStart : "true") == false)
+ unit.addIDependOn(new PackageAdminDependencyItem(systemContext, bundle));
+
+ // skip annotations scanning, if filter is set
+ if (filter != null)
+ unit.addAttachment(DeploymentUnitFilter.class, filter);
+ }
+
+ /**
+ * Create classloader factory.
+ *
+ * @param bundle the bundle
+ * @return new classloader factory
+ */
+ protected ClassLoaderFactory createClassLoaderFactory(final Bundle bundle)
+ {
+ return new ClassLoaderFactory()
+ {
+ public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
+ {
+ return BundleClassLoader.createClassLoader(bundle);
+ }
+
+ public void removeClassLoader(DeploymentUnit unit) throws Exception
+ {
+ }
+ };
+ }
+
+ /**
+ * Set deployment filter.
+ *
+ * @param filter the deployment filter
+ */
+ public void setFilter(DeploymentUnitFilter filter)
+ {
+ this.filter = filter;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleContainedBeansDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.runtime.deployer;
+
+// $Id$
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.osgi.framework.Bundle;
+
+/**
+ * Deploy the bundle contained MC beans onto the Kernel.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 06-May-2009
+ */
+public class BundleContainedBeansDeployer extends AbstractComponentDeployer<KernelDeployment, BeanMetaData>
+{
+ /*
+ * Create a new KernelDeploymentDeployer.
+ */
+ public BundleContainedBeansDeployer()
+ {
+ addInput(Bundle.class);
+ addInput(ClassLoaderFactory.class);
+ setDeploymentVisitor(new KernelDeploymentVisitor());
+ setComponentVisitor(new BeanMetaDataVisitor());
+ }
+
+ /*
+ * KernelDeploymentVisitor.
+ */
+ public static class KernelDeploymentVisitor extends BeanMetaDataFactoryVisitor<KernelDeployment>
+ {
+ @Override
+ public void deploy(DeploymentUnit unit, KernelDeployment deployment) throws DeploymentException
+ {
+ ClassLoaderFactory factory = unit.getAttachment(ClassLoaderFactory.class);
+ unit.createClassLoader(factory);
+
+ super.deploy(unit, deployment);
+ }
+
+ public Class<KernelDeployment> getVisitorType()
+ {
+ return KernelDeployment.class;
+ }
+
+ protected List<BeanMetaData> getBeans(KernelDeployment deployment)
+ {
+ return deployment.getBeans();
+ }
+ }
+
+ /*
+ * BeanMetaDataVisitor.
+ */
+ public static class BeanMetaDataVisitor extends BeanMetaDataFactoryVisitor<BeanMetaData>
+ {
+ public Class<BeanMetaData> getVisitorType()
+ {
+ return BeanMetaData.class;
+ }
+
+ protected List<BeanMetaData> getBeans(BeanMetaData deployment)
+ {
+ return Collections.singletonList(deployment);
+ }
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleManagementDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleManagementDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+// $Id: $
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.spi.management.ManagedBundle;
+import org.osgi.framework.Bundle;
+
+/**
+ * Register the Bundle as MBean with JMX.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Mar-2009
+ */
+public class BundleManagementDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private MBeanServer mbeanServer;
+
+ public BundleManagementDeployer()
+ {
+ super(Bundle.class);
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ if (mbeanServer != null)
+ {
+ ManagedBundle mb = new ManagedBundle(bundle);
+ ObjectName oname = mb.getObjectName();
+ try
+ {
+ mbeanServer.registerMBean(mb, oname);
+ unit.addAttachment(ManagedBundle.class, mb);
+ }
+ catch (Exception ex)
+ {
+ DeploymentException.rethrowAsDeploymentException(ex.getMessage(), ex);
+ }
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, Bundle bundle)
+ {
+ if (mbeanServer != null)
+ {
+ try
+ {
+ ManagedBundle mb = unit.getAttachment(ManagedBundle.class);
+ if (mb != null && mbeanServer.isRegistered(mb.getObjectName()))
+ mbeanServer.unregisterMBean(mb.getObjectName());
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot unregister: " + bundle, ex);
+ }
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaData.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
+
+
+/**
+ * The Bundle metadata.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleMetaData extends AbstractManifestMetaData
+{
+ private String symbolicName;
+ private URL bundleLocation;
+
+ // exteralizable usage
+ public BundleMetaData()
+ {
+ }
+
+ public BundleMetaData(String symbolicName)
+ {
+ this.symbolicName = symbolicName;
+ }
+
+ public String getSymbolicName()
+ {
+ return symbolicName;
+ }
+
+ public URL getBundleLocation()
+ {
+ return bundleLocation;
+ }
+
+ public void setBundleLocation(URL bundleLocation)
+ {
+ this.bundleLocation = bundleLocation;
+ }
+
+ public String toString()
+ {
+ return "Bundle[name=" + symbolicName + "]";
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleMetaDataDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+//$Id$
+
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Constants;
+
+/**
+ * Create {@link BundleMetaData} from Manifest Headers.
+ *
+ * If the manifest does not contain a header (named "Bundle-SymbolicName") this deployer does nothing.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleMetaDataDeployer extends ManifestDeployer<BundleMetaData>
+{
+ public BundleMetaDataDeployer()
+ {
+ super(BundleMetaData.class);
+ }
+
+ @Override
+ protected BundleMetaData parse(VFSDeploymentUnit unit, VirtualFile file, BundleMetaData root) throws Exception
+ {
+ BundleMetaData metaData = super.parse(unit, file, root);
+ if (metaData != null)
+ {
+ metaData.setBundleLocation(unit.getRoot().toURL());
+ log.debug("Bundle-SymbolicName: " + metaData.getSymbolicName() + " in " + file);
+ }
+ return metaData;
+ }
+
+ @Override
+ protected BundleMetaData createMetaData(Manifest manifest) throws Exception
+ {
+ Attributes attribs = manifest.getMainAttributes();
+ String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ if (symbolicName != null)
+ return new BundleMetaData(symbolicName);
+
+ return null;
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleRealDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+//$Id$
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+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.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * Installs the Bundle into the Framework's SystemContext.
+ *
+ * This deployer does not start the bundle. It leaves it in state INSTALLED.
+ * On undeploy the Bundle gets uninstalled from the Framework's SystemContext.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Ales.Justin(a)jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
+{
+ private BundleContext systemContext;
+ private List<URL> skipBundles = new ArrayList<URL>();
+
+ public BundleRealDeployer()
+ {
+ super(BundleMetaData.class);
+ addOutput(Bundle.class);
+ setStage(DeploymentStages.POST_PARSE);
+ }
+
+ public void setSystemContext(BundleContext bundleContext)
+ {
+ this.systemContext = bundleContext;
+ }
+
+ public void setSkipBundles(List<URL> skipBundles)
+ {
+ this.skipBundles = skipBundles;
+ }
+
+ public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws DeploymentException
+ {
+ URL bundleURL = metadata.getBundleLocation();
+ if (bundleURL == null)
+ throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
+
+ String bundlePath = bundleURL.getPath();
+ if (bundlePath.endsWith("/"))
+ bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
+
+ try
+ {
+ boolean skipBundle = false;
+ for (URL skip : skipBundles)
+ {
+ String skipPath = skip.getPath();
+ if (skipPath.equals(bundlePath))
+ {
+ skipBundle = true;
+ break;
+ }
+ }
+ if (skipBundle == false)
+ {
+ Bundle bundle = systemContext.installBundle(bundleURL.toString());
+ unit.addAttachment(Bundle.class, bundle);
+
+ log.info("Installed: " + bundle);
+ }
+ }
+ catch (BundleException ex)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Cannot install bundle: " + metadata, ex);
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, BundleMetaData osGiMetaData)
+ {
+ Bundle bundle = unit.getAttachment(Bundle.class);
+ if (bundle != null)
+ {
+ try
+ {
+ bundle.uninstall();
+ log.info("Uninstalled: " + bundle);
+ }
+ catch (BundleException ex)
+ {
+ log.warn(ex);
+ }
+ }
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartLevelDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartLevelDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+// $Id: $
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.spi.Constants;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.startlevel.StartLevel;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * Sets the bundle's start level on the StartLevel service.
+ *
+ * A start level can be given when the bundle is deployed through the
+ * WebConsole. Currently, neither hot deployment nor SPI test framework
+ * deployments support start levels.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 08-Jul-2009
+ */
+public class BundleStartLevelDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private BundleContext systemContext;
+ private ServiceTracker startLevelTracker;
+
+ public BundleStartLevelDeployer()
+ {
+ super(Bundle.class);
+ addOutput(Constants.PROPERTY_START_LEVEL);
+ }
+
+ public void setSystemContext(BundleContext systemContext)
+ {
+ this.systemContext = systemContext;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ Integer propStart = unit.getAttachment(Constants.PROPERTY_START_LEVEL, Integer.class);
+ StartLevel startLevel = getStartLevel();
+ if (propStart != null && startLevel != null)
+ {
+ startLevel.setBundleStartLevel(bundle, propStart);
+ }
+ }
+
+ private StartLevel getStartLevel()
+ {
+ if (startLevelTracker == null)
+ {
+ startLevelTracker = new ServiceTracker(systemContext, StartLevel.class.getName(), null);
+ startLevelTracker.open();
+ }
+ return (StartLevel)startLevelTracker.getService();
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStartStopDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+// $Id: $
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.spi.Constants;
+import org.jboss.osgi.spi.logging.ExportedPackageHelper;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * This is the Bundle start/stop Deployer
+ *
+ * @author Ales.Justin(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 27-Feb-2009
+ */
+public class BundleStartStopDeployer extends AbstractSimpleRealDeployer<Bundle>
+{
+ private BundleContext systemContext;
+ private PackageAdmin packageAdmin;
+
+ // The list of unresolved bundles
+ private List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
+
+ public BundleStartStopDeployer()
+ {
+ super(Bundle.class);
+ addInput(Constants.PROPERTY_START_LEVEL);
+ }
+
+ public void setSystemContext(BundleContext systemContext)
+ {
+ this.systemContext = systemContext;
+ }
+
+ public void deploy(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ Boolean propAutoStart = unit.getAttachment(Constants.PROPERTY_AUTO_START, Boolean.class);
+ if (propAutoStart == null || Boolean.TRUE.equals(propAutoStart))
+ {
+ String propDeferredStart = systemContext.getProperty(Constants.PROPERTY_DEFERRED_START);
+ if (Boolean.parseBoolean(propDeferredStart != null ? propDeferredStart : "true") == true)
+ {
+ deferredStart(unit, bundle);
+ }
+ else
+ {
+ simpleStart(unit, bundle);
+ }
+ }
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, Bundle bundle)
+ {
+ try
+ {
+ bundle.stop();
+
+ unresolvedBundles.remove(bundle);
+
+ log.info("Stoped: " + bundle);
+ }
+ catch (BundleException e)
+ {
+ log.warn("Cannot stop bundle: " + e);
+ }
+ }
+
+ private void simpleStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
+ try
+ {
+ // Added support for Bundle.START_ACTIVATION_POLICY on start
+ // http://issues.apache.org/jira/browse/FELIX-1317
+ // bundle.start(Bundle.START_ACTIVATION_POLICY);
+
+ bundle.start();
+
+ log.info("Started: " + bundle);
+ packageHelper.logExportedPackages(bundle);
+ }
+ catch (BundleException e)
+ {
+ log.warn("Cannot start bundle", e);
+ }
+ }
+
+ private void deferredStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
+ {
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
+
+ // Get the required dependency on the PackageAdmin service
+ if (packageAdmin == null)
+ {
+ ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
+ packageAdmin = (PackageAdmin)systemContext.getService(sref);
+ if (packageAdmin == null)
+ throw new IllegalStateException("Cannot obtain PackageAdmin service");
+ }
+
+ // Always add the bundle as unresolved
+ unresolvedBundles.add(bundle);
+
+ Bundle[] bundleArr = new Bundle[unresolvedBundles.size()];
+ unresolvedBundles.toArray(bundleArr);
+
+ // Try to resolve the bundles
+ packageAdmin.resolveBundles(bundleArr);
+
+ // Find resolved bundles and start them
+ Iterator<Bundle> it = unresolvedBundles.iterator();
+ while (it.hasNext())
+ {
+ Bundle auxBundle = it.next();
+ if ((Bundle.RESOLVED & auxBundle.getState()) == Bundle.RESOLVED)
+ {
+ it.remove();
+ try
+ {
+ // Added support for Bundle.START_ACTIVATION_POLICY on start
+ // http://issues.apache.org/jira/browse/FELIX-1317
+ // auxBundle.start(Bundle.START_ACTIVATION_POLICY);
+
+ auxBundle.start();
+
+ packageHelper.logExportedPackages(bundle);
+ log.info("Started: " + bundle);
+ }
+ catch (BundleException e)
+ {
+ log.warn("Cannot start bundle", e);
+ }
+ }
+ }
+
+ // Report unresolved bundles
+ if (unresolvedBundles.size() > 0)
+ log.info("Unresolved: " + unresolvedBundles);
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/BundleStructureDeployer.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.runtime.deployer;
+
+// $Id$
+
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Constants;
+
+/**
+ * Determine the structure of a Bundle deployment.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-Apr-2009
+ */
+public class BundleStructureDeployer extends AbstractVFSStructureDeployer
+{
+ /**
+ * Sets the default relative order 9000.
+ */
+ public BundleStructureDeployer()
+ {
+ setRelativeOrder(9000);
+ }
+
+ /**
+ * Determine the structure of a bundle deployment
+ *
+ * @param context the structure context
+ * @return true when it recognised the context
+ * @throws DeploymentException for an error
+ */
+ public boolean determineStructure(StructureContext structureContext) throws DeploymentException
+ {
+ ContextInfo context = null;
+ VirtualFile file = structureContext.getFile();
+ VirtualFile root = structureContext.getRoot();
+
+ try
+ {
+ // This file is not for me, because I'm only interested
+ // in root deployments that contain a MANIFEST.MF
+ Manifest manifest = VFSUtils.getManifest(file);
+ if (file != root || manifest == null)
+ return false;
+
+ // This file is also not for me, because I need to see Bundle-SymbolicName
+ Attributes attribs = manifest.getMainAttributes();
+ String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ if (symbolicName == null)
+ return false;
+
+ // Create a context for this jar file with META-INF as the location for metadata
+ context = createContext(structureContext, "META-INF");
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ // Remove the invalid context
+ if (context != null)
+ structureContext.removeChild(context);
+
+ throw DeploymentException.rethrowAsDeploymentException("Error determining structure: " + file.getName(), e);
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers (from rev 92694, projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers)
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/BundleDeploymentUnitFilter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/BundleDeploymentUnitFilter.java 2009-08-22 15:35:05 UTC (rev 92694)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/BundleDeploymentUnitFilter.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -19,7 +19,7 @@
* 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.deployer.helpers;
+package org.jboss.osgi.runtime.deployer.helpers;
// $Id$
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java 2009-08-22 15:35:05 UTC (rev 92694)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/DeploymentProvidedDeploymentUnitFilter.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -19,7 +19,7 @@
* 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.deployer.helpers;
+package org.jboss.osgi.runtime.deployer.helpers;
// $Id$
Modified: projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/PackageAdminDependencyItem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/PackageAdminDependencyItem.java 2009-08-22 15:35:05 UTC (rev 92694)
+++ projects/jboss-osgi/projects/runtime/deployers/trunk/src/main/java/org/jboss/osgi/runtime/deployer/helpers/PackageAdminDependencyItem.java 2009-08-22 18:13:15 UTC (rev 92696)
@@ -19,7 +19,7 @@
* 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.deployer.helpers;
+package org.jboss.osgi.runtime.deployer.helpers;
import org.jboss.dependency.plugins.AbstractDependencyItem;
import org.jboss.dependency.spi.ControllerState;
16 years, 4 months
JBoss-OSGI SVN: r92694 - in projects/jboss-osgi: trunk/reactor/blueprint/testsuite/src/test/resources and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 11:35:05 -0400 (Sat, 22 Aug 2009)
New Revision: 92694
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/log4j.xml
Log:
fix typos
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml 2009-08-22 14:35:28 UTC (rev 92693)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml 2009-08-22 15:35:05 UTC (rev 92694)
@@ -38,12 +38,6 @@
</category>
-->
- <!-- Show jboss deployer traces
- <category name="org.jboss.xb">
- <priority value="TRACE" />
- </category>
- -->
-
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/log4j.xml 2009-08-22 14:35:28 UTC (rev 92693)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/log4j.xml 2009-08-22 15:35:05 UTC (rev 92694)
@@ -38,12 +38,6 @@
</category>
-->
- <!-- Show jboss deployer traces
- <category name="org.jboss.xb">
- <priority value="TRACE" />
- </category>
- -->
-
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
16 years, 4 months
JBoss-OSGI SVN: r92693 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 10:35:28 -0400 (Sat, 22 Aug 2009)
New Revision: 92693
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
Log:
Add jira issues to FIXMEs
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-22 12:16:47 UTC (rev 92692)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/simple/SimpleBundleTestCase.java 2009-08-22 14:35:28 UTC (rev 92693)
@@ -60,7 +60,7 @@
assertEquals("simple-bundle", bundle.getSymbolicName());
bundle.start();
- System.out.println("FIXME: state==INSTALLED after bundle.start()");
+ System.out.println("FIXME [JBOSGI-130] Bundle in state INSTALLED after bundle.start()");
//assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
bundle.uninstall();
@@ -78,7 +78,7 @@
assertEquals("simple-bundle", bundle.getSymbolicName());
- System.out.println("FIXME: bundle.start() does not initalize BundleContext");
+ System.out.println("FIXME [JBOSGI-131] BundleContext not available after bundle.start()");
//bundle.start();
//assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
16 years, 4 months
JBoss-OSGI SVN: r92692 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 08:16:47 -0400 (Sat, 22 Aug 2009)
New Revision: 92692
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java
Log:
[JBOSGI-129] Filter behaviour change in r4v42
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java 2009-08-22 11:47:07 UTC (rev 92691)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/filter/test/AbstractFilterTest.java 2009-08-22 12:16:47 UTC (rev 92692)
@@ -85,7 +85,7 @@
assertInvalid("(<=b)");
assertInvalid("(>=b)");
assertInvalid("(~=b)");
- System.out.println("FIXME: verify: Invalid (*=b)");
+ System.out.println("FIXME [JBOSGI-129] - Invalid (*=b)");
//assertInvalid("(*=b)");
assertInvalid("(a=\\)");
@@ -94,7 +94,7 @@
assertMatch("(a =b)", properties);
assertMatch("(c= d)", properties);
assertMatch("(e=f )", properties);
- System.out.println("FIXME: verify: NoMatch (a=)");
+ System.out.println("FIXME [JBOSGI-129] - NoMatch (a=)");
// assertNoMatch("(a=)", properties);
assertNoMatch("(a=c)", properties);
assertNoMatch("(x=c)", properties);
@@ -123,16 +123,16 @@
assertMatch("(a<=2)", properties);
assertMatch("( a<=2)", properties);
assertMatch("(a <=2)", properties);
- System.out.println("FIXME: verify: NoMatch (a<= 2)");
+ System.out.println("FIXME [JBOSGI-129] - NoMatch (a<= 2)");
// assertNoMatch("(a<= 2)", properties);
- System.out.println("FIXME: verify: NoMatch (a<=2 )");
+ System.out.println("FIXME [JBOSGI-129] - NoMatch (a<=2 )");
// assertNoMatch("(a<=2 )", properties);
assertNoMatch("(a<=0)", properties);
assertNoMatch("( a<=0)", properties);
assertNoMatch("(a <=0)", properties);
assertNoMatch("(a<= 0)", properties);
assertNoMatch("(a<=0 )", properties);
- System.out.println("FIXME: verify: NumberFormatException (a<= )");
+ System.out.println("FIXME [JBOSGI-129] - NoMatch (a<= )");
// assertNoMatch("(a<= )", properties);
assertMatch("(string<=3)", properties);
@@ -157,16 +157,16 @@
assertMatch("(a>=0)", properties);
assertMatch("( a>=0)", properties);
assertMatch("(a >=0)", properties);
- System.out.println("FIXME: verify: NoMatch (a>= 0)");
+ System.out.println("FIXME [JBOSGI-129] - NoMatch (a>= 0)");
// assertNoMatch("(a>= 0)", properties);
- System.out.println("FIXME: verify: NoMatch (a>=0 )");
+ System.out.println("FIXME [JBOSGI-129] - NoMatch (a>=0 )");
//assertNoMatch("(a>=0 )", properties);
assertNoMatch("(a>=2)", properties);
assertNoMatch("( a>=2)", properties);
assertNoMatch("(a >=2)", properties);
assertNoMatch("(a>= 2)", properties);
assertNoMatch("(a>=2 )", properties);
- System.out.println("FIXME: verify: NumberFormatException (a>= )");
+ System.out.println("FIXME [JBOSGI-129] - NoMatch (a>= )");
// assertNoMatch("(a>= )", properties);
assertMatch("(string>=1)", properties);
16 years, 4 months
JBoss-OSGI SVN: r92691 - projects/jboss-osgi/projects/runtime/microcontainer/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-22 07:47:07 -0400 (Sat, 22 Aug 2009)
New Revision: 92691
Added:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/.project
Log:
Fix eclipse setup
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/.classpath 2009-08-22 11:47:07 UTC (rev 92691)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="target/generated-sources/javacc"/>
+ <classpathentry excluding="**" kind="src" path="src/main/resources"/>
+ <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>
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/.project
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/.project 2009-08-22 11:41:22 UTC (rev 92690)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/.project 2009-08-22 11:47:07 UTC (rev 92691)
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>jboss-osgi-runtime-microcontainer-parent</name>
+ <name>jboss-osgi-runtime-microcontainer</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>
@@ -13,5 +18,6 @@
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
16 years, 4 months