[jboss-cvs] JBossAS SVN: r95177 - in projects/jboss-osgi/trunk: distribution/installer/src/main/resources/runtime/server/conf and 20 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 20 11:14:33 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-20 11:14:31 -0400 (Tue, 20 Oct 2009)
New Revision: 95177
Added:
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintInterceptor.java
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintProcessor.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/DeployerServicePlugin.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorServicePlugin.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
Removed:
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/DeploymentBase.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/BasicLifecycleInterceptor.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorPlugin.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorPluginImpl.java
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/reactor/deployment/pom.xml
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java
projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/LifecycleInterceptorTestCase.java
projects/jboss-osgi/trunk/reactor/framework/pom.xml
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
[JBOSGI-183] Initial implementation of OSGi Deployers
Use interceptor instead of Extender for Blueprint
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -123,6 +123,9 @@
<bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -117,6 +117,9 @@
<bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -72,6 +72,8 @@
org.jboss.dependency.spi*,
org.jboss.kernel.spi*,
org.jboss.osgi.common.log;version=1.0,
+ org.jboss.osgi.deployment.common;version=1.0,
+ org.jboss.osgi.deployment.interceptor;version=1.0,
org.jboss.osgi.jbossxb;version=2.0,
org.jboss.osgi.microcontainer;version=1.0,
org.jboss.osgi.spi;version=1.0,
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -38,6 +38,7 @@
public class BlueprintActivator implements BundleActivator
{
private BlueprintExtender extender;
+ private BlueprintInterceptor interceptor;
public void start(BundleContext context) throws Exception
{
@@ -45,15 +46,25 @@
BlueprintService service = new BlueprintService(){};
context.registerService(BlueprintService.class.getName(), service, null);
- extender = new BlueprintExtender(new BlueprintContextImpl(context));
- context.addBundleListener(extender);
+ BlueprintProcessor processor = new BlueprintProcessor(new BlueprintContextImpl(context));
+
+ interceptor = new BlueprintInterceptor(processor);
+ interceptor.start();
+
+ extender = new BlueprintExtender(processor);
+ extender.start();
}
public void stop(BundleContext context) throws Exception
{
+ if (interceptor != null)
+ {
+ interceptor.stop();
+ interceptor = null;
+ }
+
if (extender != null)
{
- context.removeBundleListener(extender);
extender.stop();
extender = null;
}
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -23,19 +23,9 @@
//$Id$
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
import org.jboss.osgi.blueprint.BlueprintContext;
-import org.jboss.osgi.blueprint.container.BlueprintContainerImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
-import org.osgi.framework.Constants;
import org.osgi.framework.SynchronousBundleListener;
/**
@@ -46,70 +36,49 @@
*/
public class BlueprintExtender implements SynchronousBundleListener
{
- private BlueprintContext context;
- private Map<String, BlueprintContainerImpl> containers = new LinkedHashMap<String, BlueprintContainerImpl>();
+ private BlueprintProcessor processor;
- public BlueprintExtender(BlueprintContext context)
+ public BlueprintExtender(BlueprintProcessor processor)
{
- this.context = context;
+ this.processor = processor;
}
- @SuppressWarnings("unchecked")
+ /**
+ * Start the BlueprintExtender
+ */
+ public void start()
+ {
+ BlueprintContext bpContext = processor.getBlueprintContext();
+ bpContext.getBundleContext().addBundleListener(this);
+ }
+
+ /**
+ * Stop the BlueprintExtender
+ */
+ public void stop()
+ {
+ BlueprintContext bpContext = processor.getBlueprintContext();
+ bpContext.getBundleContext().removeBundleListener(this);
+ processor.stopAllContainers();
+ }
+
+ /**
+ * Handle the bundle event
+ */
public void bundleChanged(BundleEvent event)
{
Bundle bundle = event.getBundle();
- String key = getBundleKey(bundle);
- int eventType = event.getType();
+ int eventType = event.getType();
if (eventType == BundleEvent.STARTING)
{
- // If a Bundle-Blueprint manifest header is defined, then this header contains a list of paths.
- // If this header is not defined, then resources ending in .xml in the bundle’s
- // OSGI-INF/blueprint directory must be used. These are the resources that
- // would be found by calling the Bundle findEntries("OSGI-INF/blueprint", "*.xml", false) method.
-
- boolean hasBlueprintMetadata = false;
-
- String descriptorPaths = (String)bundle.getHeaders().get(BlueprintContainerImpl.HEADER_BUNDLE_BLUEPRINT);
- hasBlueprintMetadata = (descriptorPaths != null);
-
- Enumeration foundEntries = bundle.findEntries("OSGI-INF/blueprint", "*.xml", false);
- hasBlueprintMetadata |= (foundEntries != null);
-
- if (hasBlueprintMetadata == true)
- {
- BlueprintContainerImpl container = new BlueprintContainerImpl(context, bundle);
- container.initialize();
-
- containers.put(key, container);
- }
+ if (processor.hasContainer(bundle) == false)
+ processor.createContainer(bundle);
}
-
else if (eventType == BundleEvent.STOPPED)
{
- BlueprintContainerImpl container = containers.remove(key);
- if (container != null)
- container.shutdown();
+ if (processor.hasContainer(bundle))
+ processor.stopContainer(bundle);
}
}
-
- /**
- * Stop the BlueprintExtender
- */
- public void stop()
- {
- Collection<BlueprintContainerImpl> values = containers.values();
- List<BlueprintContainerImpl> list = new ArrayList<BlueprintContainerImpl>(values);
- Collections.reverse(list);
-
- for (BlueprintContainerImpl container : list)
- container.shutdown();
- }
-
- private String getBundleKey(Bundle bundle)
- {
- String symbolicName = bundle.getSymbolicName();
- String version = (String)bundle.getHeaders().get(Constants.BUNDLE_VERSION);
- return symbolicName + "-" + version;
- }
}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintInterceptor.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintInterceptor.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.blueprint.extender;
+
+//$Id$
+
+import org.jboss.osgi.blueprint.BlueprintContext;
+import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * The Blueprint extender
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BlueprintInterceptor extends AbstractLifecycleInterceptor implements LifecycleInterceptor
+{
+ private BlueprintProcessor processor;
+ private ServiceTracker serviceTracker;
+
+ public BlueprintInterceptor(BlueprintProcessor processor)
+ {
+ this.processor = processor;
+ }
+
+ /**
+ * Start the BlueprintExtender
+ */
+ public void start()
+ {
+ BlueprintContext bpContext = processor.getBlueprintContext();
+ BundleContext context = bpContext.getBundleContext();
+
+ final LifecycleInterceptor interceptor = this;
+ serviceTracker = new ServiceTracker(context, LifecycleInterceptorService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ LifecycleInterceptorService service = (LifecycleInterceptorService)super.addingService(reference);
+ service.addInterceptor(interceptor);
+ return service;
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object service)
+ {
+ ((LifecycleInterceptorService)service).removeInterceptor(interceptor);
+ super.removedService(reference, service);
+ }
+ };
+ serviceTracker.open();
+ }
+
+ /**
+ * Stop the BlueprintExtender
+ */
+ public void stop()
+ {
+ processor.stopAllContainers();
+ if (serviceTracker != null)
+ {
+ serviceTracker.close();
+ serviceTracker = null;
+ }
+ }
+
+ public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ {
+ Bundle bundle = dep.getAttachment(Bundle.class);
+ if (state == Bundle.STARTING)
+ {
+ processor.createContainer(bundle);
+ }
+ else if (state == Bundle.STOPPING)
+ {
+ processor.stopContainer(bundle);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintProcessor.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintProcessor.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintProcessor.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.blueprint.extender;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.osgi.blueprint.BlueprintContext;
+import org.jboss.osgi.blueprint.container.BlueprintContainerImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * The Blueprint metadata processor
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 20-Oct-2009
+ */
+class BlueprintProcessor
+{
+ private BlueprintContext bpContext;
+ private Map<String, BlueprintContainerImpl> containers = new LinkedHashMap<String, BlueprintContainerImpl>();
+
+ public BlueprintProcessor(BlueprintContext bpContext)
+ {
+ this.bpContext = bpContext;
+ }
+
+ public BlueprintContext getBlueprintContext()
+ {
+ return bpContext;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void createContainer(Bundle bundle)
+ {
+ // If a Bundle-Blueprint manifest header is defined, then this header contains a list of paths.
+ // If this header is not defined, then resources ending in .xml in the bundle’s
+ // OSGI-INF/blueprint directory must be used. These are the resources that
+ // would be found by calling the Bundle findEntries("OSGI-INF/blueprint", "*.xml", false) method.
+
+ boolean hasBlueprintMetadata = false;
+
+ String descriptorPaths = (String)bundle.getHeaders().get(BlueprintContainerImpl.HEADER_BUNDLE_BLUEPRINT);
+ hasBlueprintMetadata = (descriptorPaths != null);
+
+ Enumeration foundEntries = bundle.findEntries("OSGI-INF/blueprint", "*.xml", false);
+ hasBlueprintMetadata |= (foundEntries != null);
+
+ if (hasBlueprintMetadata)
+ {
+ BlueprintContainerImpl container = new BlueprintContainerImpl(bpContext, bundle);
+ container.initialize();
+
+ String key = getBundleKey(bundle);
+ containers.put(key, container);
+ }
+ }
+
+ protected boolean hasContainer(Bundle bundle)
+ {
+ String key = getBundleKey(bundle);
+ return containers.containsKey(key);
+ }
+
+ protected void stopContainer(Bundle bundle)
+ {
+ String key = getBundleKey(bundle);
+ BlueprintContainerImpl container = containers.remove(key);
+ if (container != null)
+ container.shutdown();
+ }
+
+ protected void stopAllContainers()
+ {
+ Collection<BlueprintContainerImpl> values = containers.values();
+ List<BlueprintContainerImpl> list = new ArrayList<BlueprintContainerImpl>(values);
+ Collections.reverse(list);
+
+ for (BlueprintContainerImpl container : list)
+ container.shutdown();
+ }
+
+ private String getBundleKey(Bundle bundle)
+ {
+ String symbolicName = bundle.getSymbolicName();
+ String version = (String)bundle.getHeaders().get(Constants.BUNDLE_VERSION);
+ return symbolicName + "-" + version;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/pom.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -10,16 +10,12 @@
<!-- ====================================================================== -->
<!-- $Id$ -->
-
- <!--
- Set these VM properties in your IDE debugger
-
- -Dlog4j.output.dir=${workspace_loc:jboss-osgi-blueprint-testsuite/target}
- -Djboss.osgi.framework.properties=jboss-osgi-felix.properties
- -Dorg.jboss.osgi.husky.Invoker=org.jboss.osgi.husky.internal.OSGiInvoker
- -Dtest.archive.directory=${workspace_loc:jboss-osgi-blueprint-testsuite/target}/test-libs
+
+ <!--
+ Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-blueprint-testsuite/target}
+ -Dorg.jboss.osgi.husky.Invoker=org.jboss.osgi.husky.internal.OSGiInvoker -Dtest.archive.directory=${workspace_loc:jboss-osgi-blueprint-testsuite/target}/test-libs
-->
-
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -39,7 +35,7 @@
<properties>
<jboss.osgi.framework.properties>jboss-osgi-felix.properties</jboss.osgi.framework.properties>
</properties>
-
+
<!-- Dependencies -->
<dependencies>
<dependency>
@@ -52,8 +48,8 @@
<version>${version}</version>
<scope>provided</scope>
</dependency>
-
- <!-- Bundle Dependencies -->
+
+ <!-- Bundle Dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.log</artifactId>
@@ -89,7 +85,7 @@
<artifactId>jboss-osgi-jmx</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- Test Dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
@@ -145,7 +141,7 @@
<!-- Profiles -->
<profiles>
-
+
<!--
Name: framework-equinox
Descr: Setup for Equinox framework integration testing
@@ -218,7 +214,7 @@
</execution>
</executions>
</plugin>
- </plugins>
+ </plugins>
</build>
</profile>
@@ -243,7 +239,7 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
</dependencies>
<build>
@@ -268,7 +264,7 @@
</execution>
</executions>
</plugin>
- </plugins>
+ </plugins>
</build>
</profile>
<profile>
@@ -287,7 +283,7 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
</dependencies>
<build>
@@ -312,7 +308,7 @@
</execution>
</executions>
</plugin>
- </plugins>
+ </plugins>
</build>
</profile>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -100,9 +100,12 @@
<bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorPluginImpl">
+ <bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorServiceImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<!--
********************************
Modified: projects/jboss-osgi/trunk/reactor/deployment/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/pom.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/deployment/pom.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -10,7 +10,7 @@
<!-- ====================================================================== -->
<!-- $Id$ -->
-
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -56,6 +56,13 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- Test Dependecies -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -82,5 +89,5 @@
</plugin>
</plugins>
</build>
-
+
</project>
Deleted: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/DeploymentBase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/DeploymentBase.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/DeploymentBase.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -1,121 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.deployment.common;
-
-// $Id$
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-
-
-/**
- * Basic attachments.
- *
- * @author Thomas.Diesler at jboss.com
- * @since 20-Apr-2007
- */
-public abstract class DeploymentBase implements Attachments
-{
- private Map<Key, Object> attachments = new HashMap<Key, Object>();
-
- /** Construct the execution context with no attachments */
- public DeploymentBase()
- {
-
- }
-
- /** Construct the execution context with given attachments */
- public DeploymentBase(Attachments att)
- {
- if (att != null)
- {
- for (Key key : att.getAttachmentKeys())
- {
- Object value = att.getAttachment(key.getClassPart(), key.getNamePart());
- this.attachments.put(key, value);
- }
- }
- }
-
- public Collection<Key> getAttachmentKeys()
- {
- return attachments.keySet();
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz)
- {
- return (T)attachments.get(new Key(clazz, null));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz, String name)
- {
- return (T)attachments.get(new Key(clazz, name));
- }
-
- public Object getAttachment(String name)
- {
- return attachments.get(new Key(null, name));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, Object obj)
- {
- return (T)attachments.put(new Key(clazz, null), obj);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, String name, Object obj)
- {
- return (T)attachments.put(new Key(clazz, name), obj);
- }
-
- public Object addAttachment(String name, Object obj)
- {
- return attachments.put(new Key(null, name), obj);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz)
- {
- return (T)attachments.remove(new Key(clazz, null));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz, String name)
- {
- return (T)attachments.remove(new Key(clazz, name));
- }
-
- public Object removeAttachment(String name)
- {
- return attachments.remove(new Key(null, name));
- }
-
- public String toString()
- {
- return attachments.toString();
- }
-}
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -21,10 +21,6 @@
*/
package org.jboss.osgi.deployment.deployer;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.internal.DeploymentImpl;
import org.jboss.osgi.spi.util.BundleInfo;
@@ -42,41 +38,7 @@
{
public Deployment createDeployment(String location) throws BundleException
{
- // Try location as URL
- URL url = null;
- try
- {
- url = new URL(location);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- // Try location as File
- if (url == null)
- {
- try
- {
- File file = new File(location);
- if (file.exists())
- url = file.toURI().toURL();
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- }
-
- if (url == null)
- throw new IllegalArgumentException("Invalid bundle location: " + location);
-
- return createDeploymentInternal(url);
- }
-
- private Deployment createDeploymentInternal(URL url) throws BundleException
- {
- BundleInfo info = BundleInfo.createBundleInfo(url);
+ BundleInfo info = BundleInfo.createBundleInfo(location);
return new DeploymentImpl(info);
}
}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java (from rev 95159, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/BasicLifecycleInterceptor.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.deployment.interceptor;
+
+//$Id$
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * An abstract implementation of a LifecycleInterceptor.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 15-Oct-2009
+ */
+public abstract class AbstractLifecycleInterceptor implements LifecycleInterceptor
+{
+ private Set<Class<?>> input;
+ private Set<Class<?>> output;
+
+ /**
+ * No relative order
+ * @return 0
+ */
+ public int getRelativeOrder()
+ {
+ return 0;
+ }
+
+ /**
+ * Get the required set of inputs.
+ *
+ * @return null if there are no inputs required
+ */
+ public Set<Class<?>> getInput()
+ {
+ return input;
+ }
+
+ /**
+ * Get the provided set of outputs.
+ *
+ * @return null if there are no outputs provided
+ */
+ public Set<Class<?>> getOutput()
+ {
+ return output;
+ }
+
+ /**
+ * Add an input requirement.
+ */
+ public void addInput(Class<?> in)
+ {
+ if (input == null)
+ input = new HashSet<Class<?>>();
+
+ input.add(in);
+ }
+
+ /**
+ * Add an output capability.
+ */
+ public void addOutput(Class<?> out)
+ {
+ if (output == null)
+ output = new HashSet<Class<?>>();
+
+ output.add(out);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -31,8 +31,11 @@
import java.util.Set;
import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.spi.util.ConstantsHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A basic service that manages bundle lifecycle interceptors.
@@ -42,6 +45,9 @@
*/
public abstract class AbstractLifecycleInterceptorService implements LifecycleInterceptorService
{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(AbstractLifecycleInterceptorService.class);
+
// The interceptor chain
private List<LifecycleInterceptor> interceptorChain = new ArrayList<LifecycleInterceptor>();
@@ -189,9 +195,29 @@
dep.addAttachment(Bundle.class, bundle);
// Call the interceptor chain
- for (LifecycleInterceptor interceptor : interceptorChain)
+ for (LifecycleInterceptor aux : interceptorChain)
{
- interceptor.invoke(state, dep);
+ Set<Class<?>> input = aux.getInput();
+ boolean doInvocation = true;
+ if (input != null)
+ {
+ // Check if all required input is available
+ for (Class<?> clazz : input)
+ {
+ if (dep.getAttachment(clazz) == null)
+ {
+ doInvocation = false;
+ break;
+ }
+ }
+ }
+ if (doInvocation)
+ {
+ String className = aux.getClass().getName();
+ String stateName = ConstantsHelper.bundleState(state);
+ log.debug("Invoke: " + className + " with state " + stateName + " on " + dep.getLocation());
+ aux.invoke(state, dep);
+ }
}
}
}
Deleted: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/BasicLifecycleInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/BasicLifecycleInterceptor.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/BasicLifecycleInterceptor.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.deployment.interceptor;
-
-//$Id$
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.osgi.deployment.common.Deployment;
-
-/**
- * A basic implementation of a LifecycleInterceptor.
- *
- * @author thomas.diesler at jboss.com
- * @since 15-Oct-2009
- */
-public class BasicLifecycleInterceptor implements LifecycleInterceptor
-{
- private Set<Class<?>> input;
- private Set<Class<?>> output;
-
- /**
- * No relative order
- * @return 0
- */
- public int getRelativeOrder()
- {
- return 0;
- }
-
- /**
- * Get the required set of inputs.
- *
- * @return null if there are no inputs required
- */
- public Set<Class<?>> getInput()
- {
- return input;
- }
-
- /**
- * Get the provided set of outputs.
- *
- * @return null if there are no outputs provided
- */
- public Set<Class<?>> getOutput()
- {
- return output;
- }
-
- /**
- * Add an input requirement.
- */
- public void addInput(Class<?> in)
- {
- if (input == null)
- input = new HashSet<Class<?>>();
-
- input.add(in);
- }
-
- /**
- * Add an output capability.
- */
- public void addOutput(Class<?> out)
- {
- if (output == null)
- output = new HashSet<Class<?>>();
-
- output.add(out);
- }
-
- /**
- * Does nothing.
- * Overwrite to provide a meaningful implementation.
- */
- public void invoke(int state, Deployment dep)
- {
- // do nothing
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java (from rev 95159, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/DeploymentBase.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.deployment.internal;
+
+// $Id$
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.osgi.deployment.common.Attachments;
+
+/**
+ * Basic attachment support.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public abstract class AttachmentSupport implements Attachments
+{
+ private Map<Key, Object> attachments = new HashMap<Key, Object>();
+
+ /** Construct the execution context with no attachments */
+ public AttachmentSupport()
+ {
+
+ }
+
+ /** Construct the execution context with given attachments */
+ public AttachmentSupport(Attachments att)
+ {
+ if (att != null)
+ {
+ for (Key key : att.getAttachmentKeys())
+ {
+ Object value = att.getAttachment(key.getClassPart(), key.getNamePart());
+ this.attachments.put(key, value);
+ }
+ }
+ }
+
+ public Collection<Key> getAttachmentKeys()
+ {
+ return attachments.keySet();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T)attachments.get(new Key(clazz, null));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.get(new Key(clazz, name));
+ }
+
+ public Object getAttachment(String name)
+ {
+ return attachments.get(new Key(null, name));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, Object obj)
+ {
+ return (T)attachments.put(new Key(clazz, null), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, String name, Object obj)
+ {
+ return (T)attachments.put(new Key(clazz, name), obj);
+ }
+
+ public Object addAttachment(String name, Object obj)
+ {
+ return attachments.put(new Key(null, name), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz)
+ {
+ return (T)attachments.remove(new Key(clazz, null));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.remove(new Key(clazz, name));
+ }
+
+ public Object removeAttachment(String name)
+ {
+ return attachments.remove(new Key(null, name));
+ }
+
+ public String toString()
+ {
+ return attachments.toString();
+ }
+}
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -25,7 +25,6 @@
import java.net.URL;
import org.jboss.osgi.deployment.common.Deployment;
-import org.jboss.osgi.deployment.common.DeploymentBase;
import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.virtual.VirtualFile;
@@ -37,7 +36,7 @@
* @author thomas.diesler at jboss.com
* @since 27-May-2009
*/
-public class DeploymentImpl extends DeploymentBase implements Deployment, Serializable
+public class DeploymentImpl extends AttachmentSupport implements Deployment, Serializable
{
private static final long serialVersionUID = 1L;
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/LifecycleInterceptorTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/LifecycleInterceptorTestCase.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/LifecycleInterceptorTestCase.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -27,8 +27,10 @@
import java.util.List;
+import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
-import org.jboss.osgi.deployment.interceptor.BasicLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
import org.jboss.osgi.deployment.internal.LifecycleInterceptorServiceImpl;
import org.junit.Test;
@@ -81,10 +83,10 @@
{
}
- BasicLifecycleInterceptor inA = new BasicLifecycleInterceptor();
+ AbstractLifecycleInterceptor inA = new BasicLifecycleInterceptor();
inA.addInput(A.class);
- BasicLifecycleInterceptor outA = new BasicLifecycleInterceptor();
+ AbstractLifecycleInterceptor outA = new BasicLifecycleInterceptor();
outA.addOutput(A.class);
// Add ordered
@@ -107,4 +109,12 @@
assertEquals(outA, chain.get(0));
assertEquals(inA, chain.get(1));
}
+
+ class BasicLifecycleInterceptor extends AbstractLifecycleInterceptor
+ {
+ public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ {
+ // do nothing
+ }
+ }
}
Modified: projects/jboss-osgi/trunk/reactor/framework/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/pom.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/pom.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -1,18 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!-- ======================================================================
--->
+ <!-- ====================================================================== -->
<!-- -->
<!-- JBoss, the OpenSource J2EE webOS -->
<!-- -->
<!-- Distributable under LGPL license. -->
<!-- See terms of license at http://www.gnu.org. -->
<!-- -->
- <!-- ======================================================================
--->
+ <!-- ====================================================================== -->
- <!-- $Id$
--->
+ <!-- $Id$ -->
<!--
Set these VM properties in your IDE debugger
@@ -29,7 +26,7 @@
<packaging>bundle</packaging>
<version>1.0.0.Alpha2</version>
-
+
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi</artifactId>
@@ -42,7 +39,6 @@
<version.jboss.aop>2.1.0.CR3</version.jboss.aop>
<version.jboss.classloading>2.0.7.CR2</version.jboss.classloading>
<version.jboss.deployers>2.0.8.GA</version.jboss.deployers>
- <version.jboss.logging.log4j>2.1.0.GA</version.jboss.logging.log4j>
<version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
<version.jboss.test>1.1.4.GA</version.jboss.test>
</properties>
@@ -147,6 +143,13 @@
<artifactId>jboss-osgi-deployers</artifactId>
</dependency>
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
<!-- OSGi Dependencies -->
<dependency>
<groupId>org.osgi</groupId>
@@ -288,9 +291,9 @@
<descriptors>
<descriptor>scripts/assembly-all.xml</descriptor>
</descriptors>
- <archive>
+ <archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
+ </archive>
</configuration>
</execution>
</executions>
@@ -342,12 +345,12 @@
<Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
<Bundle-Version>${version}</Bundle-Version>
<Export-Package>
- org.osgi.framework;version="1.5",
- org.osgi.framework.launch;version="1.0",
- org.osgi.framework.hooks.service;version="1.0",
- org.osgi.service.packageadmin;version="1.2",
- org.osgi.service.startlevel;version="1.1",
- org.osgi.util.tracker;version="1.4"
+ org.osgi.framework;version="1.5",
+ org.osgi.framework.launch;version="1.0",
+ org.osgi.framework.hooks.service;version="1.0",
+ org.osgi.service.packageadmin;version="1.2",
+ org.osgi.service.startlevel;version="1.1",
+ org.osgi.util.tracker;version="1.4"
</Export-Package>
</instructions>
</configuration>
@@ -373,7 +376,7 @@
</plugin>
</plugins>
</build>
-
+
<!-- Repositories -->
<repositories>
<repository>
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -39,7 +39,7 @@
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
-import org.jboss.osgi.framework.plugins.LifecycleInterceptorPlugin;
+import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.util.collection.ConcurrentSet;
@@ -690,7 +690,7 @@
// Invoke the bundle lifecycle interceptors
if (getBundleManager().isActive() && getBundleId() != 0)
{
- LifecycleInterceptorPlugin plugin = getBundleManager().getPlugin(LifecycleInterceptorPlugin.class);
+ LifecycleInterceptorServicePlugin plugin = getBundleManager().getPlugin(LifecycleInterceptorServicePlugin.class);
plugin.handleStateChange(state, getBundleInternal());
}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -1037,7 +1037,6 @@
registeredServices.add(result);
FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
plugin.fireServiceEvent(bundleState, ServiceEvent.REGISTERED, result);
- log.debug("Registered service : " + result.toLongString());
return result;
}
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -25,12 +25,10 @@
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
-import java.util.Vector;
import org.jboss.logging.Logger;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -72,7 +70,6 @@
return getClass().getClassLoader().loadClass(name);
}
- @SuppressWarnings("unchecked")
public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse)
{
log.warn("[JBOSGI-138] findEntries(" + path + "," + filePattern + "," + recurse + ")");
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -33,7 +33,6 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.logging.Logger;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.virtual.VirtualFile;
@@ -47,9 +46,6 @@
*/
public class OSGiClassLoaderFactory implements ClassLoaderFactory
{
- /** The log */
- private static final Logger log = Logger.getLogger(OSGiClassLoaderFactory.class);
-
/** The classloader system */
private ClassLoaderSystem system;
Added: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/DeployerServicePlugin.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/DeployerServicePlugin.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/DeployerServicePlugin.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.plugins;
+
+import org.jboss.osgi.deployment.deployer.DeployerService;
+
+/**
+ * The DeployerService service plugin
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 19-Oct-2009
+ */
+public interface DeployerServicePlugin extends ServicePlugin, DeployerService
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/DeployerServicePlugin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorPlugin.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorPlugin.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorPlugin.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.plugins;
-
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
-
-/**
- * The LifecycleInterceptorService service plugin
- *
- * @author thomas.diesler at jboss.com
- * @since 19-Oct-2009
- */
-public interface LifecycleInterceptorPlugin extends ServicePlugin, LifecycleInterceptorService
-{
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorServicePlugin.java (from rev 95159, projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorPlugin.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorServicePlugin.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorServicePlugin.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.plugins;
+
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+
+/**
+ * The LifecycleInterceptorService service plugin
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 19-Oct-2009
+ */
+public interface LifecycleInterceptorServicePlugin extends ServicePlugin, LifecycleInterceptorService
+{
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -85,6 +85,9 @@
allPackages.add("javax.xml.transform.sax");
allPackages.add("javax.xml.transform.stream");
+ allPackages.add("org.jboss.osgi.deployment.common");
+ allPackages.add("org.jboss.osgi.deployment.deployer");
+ allPackages.add("org.jboss.osgi.deployment.interceptor");
allPackages.add("org.jboss.osgi.microcontainer");
allPackages.add("org.jboss.virtual");
Added: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.internal.DeploymentImpl;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.DeployerServicePlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePluginImpl;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A plugin that manages bundle deployments.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 19-Oct-2009
+ */
+public class DeployerServiceImpl extends AbstractServicePluginImpl implements DeployerServicePlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(DeployerServiceImpl.class);
+
+ private ServiceRegistration registration;
+
+ public DeployerServiceImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void startService()
+ {
+ BundleContext context = getSystemContext();
+ registration = context.registerService(DeployerService.class.getName(), this, null);
+ }
+
+ public void stopService()
+ {
+ if (registration != null)
+ {
+ registration.unregister();
+ registration = null;
+ }
+ }
+
+ public Deployment createDeployment(String location) throws BundleException
+ {
+ BundleInfo info = BundleInfo.createBundleInfo(location);
+ return new DeploymentImpl(info);
+ }
+
+ public void deploy(URL url) throws BundleException
+ {
+ bundleManager.install(url);
+ }
+
+ public void undeploy(URL url) throws BundleException
+ {
+ Bundle bundle = bundleManager.getBundleByLocation(url.toExternalForm());
+ if (bundle != null)
+ bundle.uninstall();
+ }
+
+ public void deploy(Deployment[] bundleDeps) throws BundleException
+ {
+ throw new NotImplementedException();
+ }
+
+ public void undeploy(Deployment[] bundleDeps) throws BundleException
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorPluginImpl.java 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorPluginImpl.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.service.internal;
-
-//$Id$
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.common.Deployment;
-import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.plugins.LifecycleInterceptorPlugin;
-import org.jboss.osgi.framework.plugins.internal.AbstractPluginImpl;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.Version;
-
-/**
- * A plugin that manages bundle lifecycle interceptors.
- *
- * @author thomas.diesler at jboss.com
- * @since 19-Oct-2009
- */
-public class LifecycleInterceptorPluginImpl extends AbstractPluginImpl implements LifecycleInterceptorPlugin
-{
- // Provide logging
- final Logger log = Logger.getLogger(LifecycleInterceptorPluginImpl.class);
-
- private LifecycleInterceptorService service;
- private ServiceRegistration registration;
-
- public LifecycleInterceptorPluginImpl(OSGiBundleManager bundleManager)
- {
- super(bundleManager);
- }
-
- public BundleContext getSystemContext()
- {
- return bundleManager.getSystemBundle();
- }
-
- public void startService()
- {
- BundleContext context = getSystemContext();
- service = new AbstractLifecycleInterceptorService()
- {
- protected Deployment getDeployment(String name, Version version)
- {
- OSGiBundleState bundle = (OSGiBundleState)bundleManager.getBundle(name, version);
- if (bundle == null)
- throw new IllegalStateException("Cannot obtain bundle for: " + name + "-" + version);
-
- DeploymentUnit unit = bundle.getDeploymentUnit();
- Deployment dep = unit.getAttachment(Deployment.class);
- if (dep == null)
- throw new IllegalStateException("Cannot obtain deployment for: " + bundle);
-
- return dep;
- }
- };
- registration = context.registerService(LifecycleInterceptorService.class.getName(), service, null);
- }
-
- public void stopService()
- {
- if (registration != null)
- {
- registration.unregister();
- registration = null;
- service = null;
- }
- }
-
- public void addInterceptor(LifecycleInterceptor interceptor)
- {
- service.addInterceptor(interceptor);
- }
-
- public void removeInterceptor(LifecycleInterceptor interceptor)
- {
- service.removeInterceptor(interceptor);
- }
-
- public void handleStateChange(int state, Bundle bundle)
- {
- service.handleStateChange(state, bundle);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java (from rev 95159, projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2009-10-20 15:14:31 UTC (rev 95177)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePluginImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.Version;
+
+/**
+ * A plugin that manages bundle lifecycle interceptors.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 19-Oct-2009
+ */
+public class LifecycleInterceptorServiceImpl extends AbstractServicePluginImpl implements LifecycleInterceptorServicePlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(LifecycleInterceptorServiceImpl.class);
+
+ private LifecycleInterceptorService service;
+ private ServiceRegistration registration;
+
+ public LifecycleInterceptorServiceImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void startService()
+ {
+ BundleContext context = getSystemContext();
+ service = new AbstractLifecycleInterceptorService()
+ {
+ protected Deployment getDeployment(String name, Version version)
+ {
+ OSGiBundleState bundle = (OSGiBundleState)bundleManager.getBundle(name, version);
+ if (bundle == null)
+ throw new IllegalStateException("Cannot obtain bundle for: " + name + "-" + version);
+
+ DeploymentUnit unit = bundle.getDeploymentUnit();
+ Deployment dep = unit.getAttachment(Deployment.class);
+ if (dep == null)
+ throw new IllegalStateException("Cannot obtain deployment for: " + bundle);
+
+ return dep;
+ }
+ };
+ registration = context.registerService(LifecycleInterceptorService.class.getName(), service, null);
+ }
+
+ public void stopService()
+ {
+ if (registration != null)
+ {
+ registration.unregister();
+ registration = null;
+ service = null;
+ }
+ }
+
+ public void addInterceptor(LifecycleInterceptor interceptor)
+ {
+ service.addInterceptor(interceptor);
+ }
+
+ public void removeInterceptor(LifecycleInterceptor interceptor)
+ {
+ service.removeInterceptor(interceptor);
+ }
+
+ public void handleStateChange(int state, Bundle bundle)
+ {
+ service.handleStateChange(state, bundle);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -72,9 +72,12 @@
<bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorPluginImpl">
+ <bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorServiceImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<!--
********************************
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -100,9 +100,12 @@
<bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorPluginImpl">
+ <bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorServiceImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<!--
********************************
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -99,9 +99,12 @@
<bean name="PackageAdminService" class="org.jboss.osgi.framework.service.internal.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorPluginImpl">
+ <bean name="DeployerService" class="org.jboss.osgi.framework.service.internal.DeployerServiceImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+ <bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorServiceImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
<!--
********************************
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-10-20 15:06:31 UTC (rev 95176)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-10-20 15:14:31 UTC (rev 95177)
@@ -252,6 +252,11 @@
<artifactId>jboss-osgi-framework</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
@@ -277,6 +282,11 @@
<artifactId>jboss-osgi-framework</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
More information about the jboss-cvs-commits
mailing list