JBoss-OSGI SVN: r95558 - in projects/jboss-osgi: trunk/testsuite/example and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-26 04:06:36 -0400 (Mon, 26 Oct 2009)
New Revision: 95558
Modified:
projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
Log:
Add links to 3rd party jira
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java 2009-10-26 08:05:53 UTC (rev 95557)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java 2009-10-26 08:06:36 UTC (rev 95558)
@@ -31,6 +31,8 @@
/**
* Public visibility for the package protected WebAppPublisher
*
+ * http://issues.ops4j.org/browse/PAXWEB-183
+ *
* @author thomas.diesler(a)jboss.com
* @since 20-Oct-2009
*/
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-26 08:05:53 UTC (rev 95557)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-26 08:06:36 UTC (rev 95558)
@@ -238,6 +238,8 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
+
+ <!-- https://issues.apache.org/jira/browse/FELIX-1804 -->
<exclude>org/jboss/test/osgi/example/interceptor/**</exclude>
<exclude>org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.class</exclude>
</excludes>
16 years, 1 month
JBoss-OSGI SVN: r95557 - projects/jboss-osgi/projects/bundles/hotdeploy/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-26 04:05:53 -0400 (Mon, 26 Oct 2009)
New Revision: 95557
Modified:
projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
Log:
Fix outdated import of deployment.common
Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml 2009-10-26 06:45:23 UTC (rev 95556)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml 2009-10-26 08:05:53 UTC (rev 95557)
@@ -98,7 +98,6 @@
<Import-Package>
javax.management,
org.jboss.osgi.common.log;version=1.0,
- org.jboss.osgi.deployment.common,
org.jboss.osgi.deployment.deployer,
org.jboss.osgi.spi.service;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
16 years, 1 month
JBoss-OSGI SVN: r95545 - projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-24 16:03:37 -0400 (Sat, 24 Oct 2009)
New Revision: 95545
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
Log:
Restore format
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-24 19:11:18 UTC (rev 95544)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-24 20:03:37 UTC (rev 95545)
@@ -44,46 +44,46 @@
{
// Provide logging
private Logger log = LoggerFactory.getLogger(ParserInterceptor.class);
-
+
ParserInterceptor()
{
// Add the provided output
addOutput(HttpMetadata.class);
}
-
-public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
-{
- // Do nothing if the metadata is already available
- HttpMetadata metadata = context.getAttachment(HttpMetadata.class);
- if (metadata != null)
- return;
-
- // Parse and create metadta on STARTING
- if (state == Bundle.STARTING)
+
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
{
- try
+ // Do nothing if the metadata is already available
+ HttpMetadata metadata = context.getAttachment(HttpMetadata.class);
+ if (metadata != null)
+ return;
+
+ // Parse and create metadta on STARTING
+ if (state == Bundle.STARTING)
{
- VirtualFile root = context.getRoot();
- VirtualFile propsFile = root.getChild("/http-metadata.properties");
- if (propsFile != null)
+ try
{
- log.info("Create and attach HttpMetadata");
- metadata = createHttpMetadata(propsFile);
- context.addAttachment(HttpMetadata.class, metadata);
+ VirtualFile root = context.getRoot();
+ VirtualFile propsFile = root.getChild("/http-metadata.properties");
+ if (propsFile != null)
+ {
+ log.info("Create and attach HttpMetadata");
+ metadata = createHttpMetadata(propsFile);
+ context.addAttachment(HttpMetadata.class, metadata);
+ }
}
+ catch (IOException ex)
+ {
+ throw new LifecycleInterceptorException("Cannot parse metadata", ex);
+ }
}
- catch (IOException ex)
- {
- throw new LifecycleInterceptorException("Cannot parse metadata", ex);
- }
}
-}
private HttpMetadata createHttpMetadata(VirtualFile propsFile) throws IOException
{
Properties props = new Properties();
props.load(propsFile.openStream());
-
+
HttpMetadata metadata = new HttpMetadata(props.getProperty("servlet.name"));
return metadata;
}
16 years, 2 months
JBoss-OSGI SVN: r95543 - in projects/jboss-osgi/trunk/reactor: framework/src/main/java/org/jboss/osgi/framework/plugins and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-24 03:51:30 -0400 (Sat, 24 Oct 2009)
New Revision: 95543
Modified:
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptorService.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/LifecycleInterceptorServiceImpl.java
Log:
Remove handleStateChange from LifecycleInterceptorService
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptorService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptorService.java 2009-10-24 07:24:34 UTC (rev 95542)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptorService.java 2009-10-24 07:51:30 UTC (rev 95543)
@@ -23,7 +23,6 @@
//$Id$
-import org.osgi.framework.Bundle;
/**
* A service that manages bundle lifecycle interceptors.
@@ -49,13 +48,5 @@
* @param interceptor The interceptor
*/
void removeInterceptor(LifecycleInterceptor interceptor);
-
- /**
- * Invoke the registered set of interceptors for the given bundle state change.
- *
- * @param state The future state of the bundle
- * @param bundle The bundle that changes state
- * @throws LifecycleInterceptorException if the invocation of an interceptor fails
- */
- void handleStateChange(int state, Bundle bundle);
+
}
\ No newline at end of file
Modified: 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/plugins/LifecycleInterceptorServicePlugin.java 2009-10-24 07:24:34 UTC (rev 95542)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/LifecycleInterceptorServicePlugin.java 2009-10-24 07:51:30 UTC (rev 95543)
@@ -21,7 +21,9 @@
*/
package org.jboss.osgi.framework.plugins;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.osgi.framework.Bundle;
/**
* The LifecycleInterceptorService service plugin
@@ -31,4 +33,12 @@
*/
public interface LifecycleInterceptorServicePlugin extends ServicePlugin, LifecycleInterceptorService
{
+ /**
+ * Invoke the registered set of interceptors for the given bundle state change.
+ *
+ * @param state The future state of the bundle
+ * @param bundle The bundle that changes state
+ * @throws LifecycleInterceptorException if the invocation of an interceptor fails
+ */
+ void handleStateChange(int state, Bundle bundle);
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2009-10-24 07:51:30 UTC (rev 95543)
@@ -51,7 +51,7 @@
// Provide logging
final Logger log = Logger.getLogger(LifecycleInterceptorServiceImpl.class);
- private LifecycleInterceptorService delegate;
+ private AbstractLifecycleInterceptorService delegate;
private ServiceRegistration registration;
public LifecycleInterceptorServiceImpl(OSGiBundleManager bundleManager)
16 years, 2 months
JBoss-OSGI SVN: r95542 - in projects/jboss-osgi: projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal and 17 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-24 03:24:34 -0400 (Sat, 24 Oct 2009)
New Revision: 95542
Added:
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorContextImpl.java
Removed:
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/
Modified:
projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java
projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java
projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppPublisherInterceptor.java
projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java
projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
projects/jboss-osgi/trunk/distribution/docbook/src/main/graphics/jbossosgi-interceptor.odp
projects/jboss-osgi/trunk/pom.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/BlueprintInterceptor.java
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/DeployerService.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentRegistryService.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/interceptor/LifecycleInterceptor.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java
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/DeploymentRegistryServiceImpl.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorWrapper.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.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/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
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/MANIFEST.MF
Log:
Separate InvocationContext from Deployment
Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/DeploymentScannerService.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,7 +25,7 @@
import java.net.URL;
-import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.deployer.Deployment;
/**
Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -34,8 +34,8 @@
import java.util.List;
import java.util.Map;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.hotdeploy.DeploymentScannerService;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/AbstractMicrocontainerService.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -47,8 +47,8 @@
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
import org.jboss.osgi.spi.OSGiConstants;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml 2009-10-24 07:24:34 UTC (rev 95542)
@@ -101,7 +101,6 @@
javax.servlet.http,
javax.xml.parsers,
org.apache.commons.logging;version=1.1,
- org.jboss.osgi.deployment.common,
org.jboss.osgi.deployment.interceptor,
org.jboss.osgi.spi.capability;version=1.0,
org.jboss.virtual,
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppPublisherInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppPublisherInterceptor.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppPublisherInterceptor.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -23,8 +23,8 @@
//$Id$
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
@@ -93,20 +93,18 @@
}
}
- public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
{
if (state == Bundle.STARTING)
{
log.debug("Publish WebApp metadata");
-
- WebApp webApp = dep.getAttachment(WebApp.class);
+ WebApp webApp = context.getAttachment(WebApp.class);
publisher.publish(webApp);
}
else if (state == Bundle.STOPPING)
{
log.debug("Unpublish WebApp metadata");
-
- WebApp webApp = dep.getAttachment(WebApp.class);
+ WebApp webApp = context.getAttachment(WebApp.class);
publisher.unpublish(webApp);
}
}
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,8 +25,8 @@
import java.io.IOException;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
@@ -94,19 +94,20 @@
}
}
- public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
{
- WebApp webApp = dep.getAttachment(WebApp.class);
+ WebApp webApp = context.getAttachment(WebApp.class);
if (webApp == null && state == Bundle.STARTING)
{
try
{
- VirtualFile webXML = dep.getRoot().getChild("/WEB-INF/web.xml");
+ VirtualFile root = context.getRoot();
+ VirtualFile webXML = root.getChild("/WEB-INF/web.xml");
if (webXML != null)
{
log.debug("Create and attach WebApp metadata");
- webApp = createWebAppMetadata(dep, webXML);
- dep.addAttachment(WebApp.class, webApp);
+ webApp = createWebAppMetadata(context, webXML);
+ context.addAttachment(WebApp.class, webApp);
}
}
catch (IOException ex)
@@ -116,19 +117,19 @@
}
}
- private WebApp createWebAppMetadata(Deployment dep, VirtualFile webXML) throws IOException
+ private WebApp createWebAppMetadata(InvocationContext context, VirtualFile webXML) throws IOException
{
// Parse the web.xml
DOMWebXmlParser parser = new DOMWebXmlParser();
WebApp webApp = parser.parse(webXML.openStream());
// Associate the Bundle with the WebApp metadata
- Bundle bundle = dep.getAttachment(Bundle.class);
+ Bundle bundle = context.getBundle();
webApp.setBundle(bundle);
// Set the context name as first looking for a manifest entry named Webapp-Context
// if not set use bundle symbolic name
- String contextName = dep.getManifestHeader("Webapp-Context");
+ String contextName = (String)bundle.getHeaders().get("Webapp-Context");
if (contextName == null)
{
contextName = bundle.getSymbolicName();
Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-10-24 07:24:34 UTC (rev 95542)
@@ -30,7 +30,7 @@
</parent>
<properties>
- <version.jboss.osgi.microcontainer>1.0.3-SNAPSHOT</version.jboss.osgi.microcontainer>
+ <version.jboss.osgi.microcontainer>2.0.9-SNAPSHOT</version.jboss.osgi.microcontainer>
<version.osgi>4.2.0</version.osgi>
</properties>
Modified: projects/jboss-osgi/trunk/distribution/docbook/src/main/graphics/jbossosgi-interceptor.odp
===================================================================
(Binary files differ)
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/pom.xml 2009-10-24 07:24:34 UTC (rev 95542)
@@ -61,7 +61,7 @@
<version.jboss.osgi.jaxb>2.1.10.SP2</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.1</version.jboss.osgi.jmx>
<version.jboss.osgi.jndi>1.0.1</version.jboss.osgi.jndi>
- <version.jboss.osgi.microcontainer>1.0.3-SNAPSHOT</version.jboss.osgi.microcontainer>
+ <version.jboss.osgi.microcontainer>2.0.9-SNAPSHOT</version.jboss.osgi.microcontainer>
<version.jboss.osgi.runtime.deployers>1.0.3-SNAPSHOT</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.runtime.equinox>3.5-SNAPSHOT</version.jboss.osgi.runtime.equinox>
<version.jboss.osgi.runtime.felix>2.0.0-SNAPSHOT</version.jboss.osgi.runtime.felix>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-10-24 07:24:34 UTC (rev 95542)
@@ -76,7 +76,6 @@
org.jboss.dependency.spi*,
org.jboss.kernel.spi*,
org.jboss.osgi.common.log;version=1.0,
- org.jboss.osgi.deployment.common,
org.jboss.osgi.deployment.interceptor,
org.jboss.osgi.jbossxb;version=2.0,
org.jboss.osgi.microcontainer;version=1.0,
Modified: 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 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintInterceptor.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -24,8 +24,8 @@
//$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.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
@@ -91,9 +91,9 @@
}
}
- public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
{
- Bundle bundle = dep.getAttachment(Bundle.class);
+ Bundle bundle = context.getBundle();
if (state == Bundle.STARTING)
{
log.debug("Create blueprint container");
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-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,7 +25,6 @@
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;
import org.jboss.virtual.VirtualFile;
Copied: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java (from rev 95510, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/Attachments.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -0,0 +1,160 @@
+/*
+ * 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.deployer;
+
+// $Id$
+
+import java.util.Collection;
+
+/**
+ * An interface for general Attachments
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 20-Apr-2007
+ */
+public interface Attachments
+{
+ /** Get attachment keys */
+ Collection<Key> getAttachmentKeys();
+
+ /** Add arbitrary attachment */
+ <T> T addAttachment(Class<T> clazz, Object value);
+
+ /** Add arbitrary attachment with name */
+ <T> T addAttachment(Class<T> clazz, String name, Object value);
+
+ /** Add arbitrary attachment with name */
+ Object addAttachment(String name, Object value);
+
+ /** Get an arbitrary attachment */
+ <T> T getAttachment(Class<T> clazz);
+
+ /** Get an arbitrary attachment */
+ <T> T getAttachment(Class<T> clazz, String name);
+
+ /** Get an arbitrary attachment */
+ Object getAttachment(String name);
+
+ /** Remove arbitrary attachments */
+ <T> T removeAttachment(Class<T> clazz);
+
+ /** Remove arbitrary attachments */
+ <T> T removeAttachment(Class<T> clazz, String name);
+
+ /** Remove arbitrary attachments */
+ Object removeAttachment(String name);
+
+ /**
+ * A key for attachements
+ */
+ public static class Key
+ {
+ private Class<?> clazz;
+ private String name;
+
+ /**
+ * Construct the key with optional class and name
+ */
+ public Key(Class<?> clazz, String name)
+ {
+ this.clazz = clazz;
+ this.name = name;
+ }
+
+ public static Key valueOf(String key)
+ {
+ int index = key.indexOf(",");
+ if (key.startsWith("[") && key.endsWith("]") && index > 0)
+ {
+ Class<?> classPart = null;
+ String className = key.substring(1, index);
+ String namePart = key.substring(index + 1, key.length() - 1);
+ if (className.length() > 0 && !className.equals("null"))
+ {
+ try
+ {
+ classPart = Class.forName(className);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new IllegalArgumentException("Cannot find class '" + className + "' in: " + key);
+ }
+ }
+ return new Key(classPart, namePart);
+ }
+ return null;
+ }
+
+ /**
+ * Get the class part for this key
+ *
+ * @return maybe null
+ */
+ public Class<?> getClassPart()
+ {
+ return clazz;
+ }
+
+ /**
+ * Get the name part for this key
+ *
+ * @return maybe null
+ */
+ public String getNamePart()
+ {
+ return name;
+ }
+
+ /**
+ * Two keys are equal if their {@link #toString()} is equal
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof Key))
+ return false;
+ if (obj == this)
+ return true;
+ return obj.toString().equals(toString());
+ }
+
+ /**
+ * Two keys have the same hashCode if their {@link #toString()} is equal
+ */
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ /**
+ * Returns the String repesentation of this Key.
+ * <p/>
+ *
+ * <pre>
+ * "[" + clazz + "," + name + "]"
+ * </pre>
+ */
+ public String toString()
+ {
+ return "[" + clazz + "," + name + "]";
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/DeployerService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/DeployerService.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/DeployerService.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -27,7 +27,6 @@
import javax.management.ObjectName;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.spi.management.ObjectNameFactory;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.BundleException;
Copied: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java (from rev 95510, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/common/Deployment.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public-
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.deployment.deployer;
+
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+
+
+//$Id$
+
+/**
+ * An abstraction of a bundle deployment
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 27-May-2009
+ */
+public interface Deployment extends Attachments
+{
+ /**
+ * Get the root virtual file
+ */
+ public VirtualFile getRoot();
+
+ /**
+ * Get the bundle location
+ */
+ public URL getLocation();
+
+ /**
+ * Get the bundle symbolic name
+ */
+ public String getSymbolicName();
+
+ /**
+ * Get the bundle version
+ */
+ public String getVersion();
+
+ /**
+ * Get the manifest header for the given key.
+ */
+ public String getManifestHeader(String key);
+
+ /**
+ * Get the start level associated with this deployment
+ */
+ public int getStartLevel();
+
+ /**
+ * Set the start level associated with this deployment
+ */
+ public void setStartLevel(int startLevel);
+
+ /**
+ * Get the autostart flag associated with this deployment
+ */
+ public boolean isAutoStart();
+
+ /**
+ * Set the autostart flag associated with this deployment
+ */
+ public void setAutoStart(boolean autoStart);
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentRegistryService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentRegistryService.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentRegistryService.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,7 +25,6 @@
import java.net.URL;
-import org.jboss.osgi.deployment.common.Deployment;
import org.osgi.framework.Version;
/**
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-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -30,9 +30,11 @@
import java.util.List;
import java.util.Set;
-import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.internal.InterceptorContextImpl;
import org.jboss.osgi.deployment.internal.InterceptorWrapper;
import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;
@@ -221,16 +223,9 @@
if (dep == null)
throw new IllegalStateException("Cannot get deployment for: " + name + "-" + version);
- // Attach the bundle if not already done so
- Bundle attBundle = dep.getAttachment(Bundle.class);
- if (attBundle == null)
- dep.addAttachment(Bundle.class, bundle);
+ VirtualFile root = dep.getRoot();
+ InterceptorContextImpl intContext = new InterceptorContextImpl(context, bundle, root, dep);
- // Attach the bundle context if not already done so
- BundleContext attBundleContext = dep.getAttachment(BundleContext.class);
- if (attBundleContext == null)
- dep.addAttachment(BundleContext.class, context);
-
// Call the interceptor chain
for (LifecycleInterceptor aux : interceptorChain)
{
@@ -253,7 +248,7 @@
InterceptorWrapper wrapper = new InterceptorWrapper(aux);
String stateName = ConstantsHelper.bundleState(state);
log.trace("Invoke: " + wrapper + " with state " + stateName + " on " + dep.getLocation());
- aux.invoke(state, dep);
+ aux.invoke(state, intContext);
}
}
}
Added: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -0,0 +1,53 @@
+/*
+ * 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 org.jboss.osgi.deployment.deployer.Attachments;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The context passed between Interceptors
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Oct-2009
+ */
+public interface InvocationContext extends Attachments
+{
+ /**
+ * Get the system bundle context
+ */
+ BundleContext getSystemContext();
+
+ /**
+ * Get the root virtual file
+ */
+ VirtualFile getRoot();
+
+ /**
+ * Get the bundle
+ */
+ Bundle getBundle();
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,9 +25,6 @@
import java.util.Set;
-import org.jboss.osgi.deployment.common.Deployment;
-import org.osgi.framework.Bundle;
-
/**
* An OSGi bundle lifecycle interceptor.
*
@@ -62,12 +59,9 @@
* Called by the {@link LifecycleInterceptorService} when the
* given bundle is about to change to the given state
*
- * The deployment that represents the bundle has the {@link Bundle}
- * object attached.
- *
* @param state The future state of the bundle
- * @param dep The deployment that represents the bundle
+ * @param context The interceptor context
* @throws LifecycleInterceptorException if the invocation of the interceptor fails
*/
- void invoke(int state, Deployment dep) throws LifecycleInterceptorException;
+ void invoke(int state, InvocationContext context) throws LifecycleInterceptorException;
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -27,7 +27,7 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.osgi.deployment.common.Attachments;
+import org.jboss.osgi.deployment.deployer.Attachments;
/**
* Basic attachment support.
@@ -37,85 +37,77 @@
*/
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);
- }
- }
- }
+ private Map<Key, Object> attachments = new HashMap<Key, Object>();
- public Collection<Key> getAttachmentKeys()
- {
- return attachments.keySet();
- }
+ /** Construct with no attachments */
+ public AttachmentSupport()
+ {
+ }
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz)
- {
- return (T)attachments.get(new Key(clazz, null));
- }
+ /** Construct with given attachments */
+ public AttachmentSupport(AttachmentSupport att)
+ {
+ attachments = att.attachments;
+ }
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz, String name)
- {
- return (T)attachments.get(new Key(clazz, name));
- }
+ public Collection<Key> getAttachmentKeys()
+ {
+ return attachments.keySet();
+ }
- public Object getAttachment(String name)
- {
- return attachments.get(new Key(null, name));
- }
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T)attachments.get(new Key(clazz, null));
+ }
- @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 getAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.get(new Key(clazz, name));
+ }
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, String name, Object obj)
- {
- return (T)attachments.put(new Key(clazz, name), obj);
- }
+ public Object getAttachment(String name)
+ {
+ return attachments.get(new Key(null, name));
+ }
- public Object addAttachment(String name, Object obj)
- {
- return attachments.put(new Key(null, name), obj);
- }
+ @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 removeAttachment(Class<T> clazz)
- {
- return (T)attachments.remove(new Key(clazz, null));
- }
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, String name, Object obj)
+ {
+ return (T)attachments.put(new Key(clazz, name), obj);
+ }
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz, String name)
- {
- return (T)attachments.remove(new Key(clazz, name));
- }
+ public Object addAttachment(String name, Object obj)
+ {
+ return attachments.put(new Key(null, name), obj);
+ }
- public Object removeAttachment(String name)
- {
- return attachments.remove(new Key(null, name));
- }
-
- public String toString()
- {
- return attachments.toString();
- }
+ @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-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,7 +25,7 @@
import java.net.MalformedURLException;
import java.net.URL;
-import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.virtual.VirtualFile;
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentRegistryServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentRegistryServiceImpl.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentRegistryServiceImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -27,8 +27,8 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;
Added: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorContextImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorContextImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -0,0 +1,126 @@
+/*
+ * 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 org.jboss.osgi.deployment.deployer.Attachments;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The context passed between Interceptors
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 27-May-2009
+ */
+public class InterceptorContextImpl implements InvocationContext
+{
+ private Attachments attachments;
+ private BundleContext systemContext;
+ private VirtualFile root;
+ private Bundle bundle;
+
+ public InterceptorContextImpl(BundleContext systemContext, Bundle bundle, VirtualFile root, Attachments attachments)
+ {
+ if (systemContext == null)
+ throw new IllegalArgumentException("Null system context");
+ if (bundle == null)
+ throw new IllegalArgumentException("Null bundle");
+ if (root == null)
+ throw new IllegalArgumentException("Null root file");
+
+ this.systemContext = systemContext;
+ this.root = root;
+ this.bundle = bundle;
+ this.attachments = attachments;
+ }
+
+ public BundleContext getSystemContext()
+ {
+ return systemContext;
+ }
+
+ public Bundle getBundle()
+ {
+ return bundle;
+ }
+
+ public VirtualFile getRoot()
+ {
+ return root;
+ }
+
+ public <T> T addAttachment(Class<T> clazz, Object value)
+ {
+ return attachments.addAttachment(clazz, value);
+ }
+
+ public <T> T addAttachment(Class<T> clazz, String name, Object value)
+ {
+ return attachments.addAttachment(clazz, name, value);
+ }
+
+ public Object addAttachment(String name, Object value)
+ {
+ return attachments.addAttachment(name, value);
+ }
+
+ public <T> T getAttachment(Class<T> clazz, String name)
+ {
+ return attachments.getAttachment(clazz, name);
+ }
+
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return attachments.getAttachment(clazz);
+ }
+
+ public Object getAttachment(String name)
+ {
+ return attachments.getAttachment(name);
+ }
+
+ public Collection<Key> getAttachmentKeys()
+ {
+ return attachments.getAttachmentKeys();
+ }
+
+ public <T> T removeAttachment(Class<T> clazz, String name)
+ {
+ return attachments.removeAttachment(clazz, name);
+ }
+
+ public <T> T removeAttachment(Class<T> clazz)
+ {
+ return attachments.removeAttachment(clazz);
+ }
+
+ public Object removeAttachment(String name)
+ {
+ return attachments.removeAttachment(name);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorWrapper.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorWrapper.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorWrapper.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -26,7 +26,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
@@ -63,9 +63,9 @@
return delegate.getRelativeOrder();
}
- public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
{
- delegate.invoke(state, dep);
+ delegate.invoke(state, context);
}
public String toLongString()
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/LifecycleInterceptorServiceImpl.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/LifecycleInterceptorServiceImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,7 +25,7 @@
import java.util.List;
-import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -34,9 +34,9 @@
import javax.management.MBeanServer;
import javax.management.StandardMBean;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.deployer.DeployerService;
import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
import org.jboss.osgi.spi.management.ManagedBundleService;
import org.jboss.osgi.spi.util.ExportedPackageHelper;
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -28,8 +28,8 @@
import java.util.List;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
@@ -115,7 +115,7 @@
class BasicLifecycleInterceptor extends AbstractLifecycleInterceptor
{
- public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
{
// do nothing
}
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-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -85,7 +85,6 @@
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");
Modified: 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 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -27,8 +27,8 @@
import java.util.Properties;
import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
import org.jboss.osgi.deployment.internal.DeploymentRegistryServiceImpl;
import org.jboss.osgi.deployment.internal.SystemDeployerService;
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,8 +25,8 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -26,8 +26,8 @@
import java.io.IOException;
import java.util.Properties;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
@@ -51,32 +51,33 @@
addOutput(HttpMetadata.class);
}
- public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
+{
+ // Do nothing if the metadata is already available
+ HttpMetadata metadata = context.getAttachment(HttpMetadata.class);
+ if (metadata != null)
+ return;
+
+ // Parse and create metadta on STARTING
+ if (state == Bundle.STARTING)
{
- // Do nothing if the metadata is already available
- HttpMetadata metadata = dep.getAttachment(HttpMetadata.class);
- if (metadata != null)
- return;
-
- // Parse and create metadta on STARTING
- if (state == Bundle.STARTING)
+ try
{
- try
+ VirtualFile root = context.getRoot();
+ VirtualFile propsFile = root.getChild("/http-metadata.properties");
+ if (propsFile != null)
{
- VirtualFile propsFile = dep.getRoot().getChild("/http-metadata.properties");
- if (propsFile != null)
- {
- log.info("Create and attach HttpMetadata");
- metadata = createHttpMetadata(propsFile);
- dep.addAttachment(HttpMetadata.class, metadata);
- }
+ log.info("Create and attach HttpMetadata");
+ metadata = createHttpMetadata(propsFile);
+ context.addAttachment(HttpMetadata.class, metadata);
}
- catch (IOException ex)
- {
- throw new LifecycleInterceptorException("Cannot parse metadata", ex);
- }
}
+ catch (IOException ex)
+ {
+ throw new LifecycleInterceptorException("Cannot parse metadata", ex);
+ }
}
+}
private HttpMetadata createHttpMetadata(VirtualFile propsFile) throws IOException
{
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java 2009-10-24 07:24:34 UTC (rev 95542)
@@ -25,8 +25,8 @@
import javax.servlet.http.HttpServlet;
-import org.jboss.osgi.deployment.common.Deployment;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -52,11 +52,11 @@
addInput(HttpMetadata.class);
}
- public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
{
// HttpMetadata is guaratied to be available because we registered
// this type as required input
- HttpMetadata metadata = dep.getAttachment(HttpMetadata.class);
+ HttpMetadata metadata = context.getAttachment(HttpMetadata.class);
// Register HttpMetadata on STARTING
if (state == Bundle.STARTING)
@@ -66,12 +66,13 @@
{
log.info("Publish HttpMetadata: " + metadata);
- // Load the endpoint servlet from the attached bundle (is always attached)
- Bundle bundle = dep.getAttachment(Bundle.class);
- HttpServlet servlet = (HttpServlet)bundle.loadClass(servletName).newInstance();
+ // Load the endpoint servlet from the bundle
+ Bundle bundle = context.getBundle();
+ Class<?> servletClass = bundle.loadClass(servletName);
+ HttpServlet servlet = (HttpServlet)servletClass.newInstance();
// Register the servlet with the HttpService
- getHttpService(dep).registerServlet("/servlet", servlet, null, null);
+ getHttpService(context).registerServlet("/servlet", servlet, null, null);
}
catch (RuntimeException rte)
{
@@ -87,20 +88,18 @@
else if (state == Bundle.STOPPING)
{
log.info("Unpublish HttpMetadata: " + metadata);
- getHttpService(dep).unregister("/servlet");
+ getHttpService(context).unregister("/servlet");
}
}
- private HttpService getHttpService(Deployment dep)
+ private HttpService getHttpService(InvocationContext context)
{
- // Get the system bundle context (is always attached)
- BundleContext context = dep.getAttachment(BundleContext.class);
-
- ServiceReference sref = context.getServiceReference(HttpService.class.getName());
+ BundleContext syscontext = context.getSystemContext();
+ ServiceReference sref = syscontext.getServiceReference(HttpService.class.getName());
if (sref == null)
throw new IllegalStateException("Required HttpService not available");
- HttpService httpService = (HttpService)context.getService(sref);
+ HttpService httpService = (HttpService)syscontext.getService(sref);
return httpService;
}
}
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/MANIFEST.MF 2009-10-24 05:41:19 UTC (rev 95541)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/MANIFEST.MF 2009-10-24 07:24:34 UTC (rev 95542)
@@ -3,5 +3,5 @@
Bundle-ManifestVersion: 2
Bundle-SymbolicName: example-webapp
Bundle-ClassPath: .,WEB-INF/classes
-Import-Package: org.osgi.service.http,org.ops4j.pax.web.service,javax.servlet,javax.servlet.http
+Import-Package: javax.servlet,javax.servlet.http,org.osgi.service.http,org.ops4j.pax.web.service
16 years, 2 months
JBoss-OSGI SVN: r95541 - projects/jboss-osgi/trunk/testsuite/example.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-24 01:41:19 -0400 (Sat, 24 Oct 2009)
New Revision: 95541
Modified:
projects/jboss-osgi/trunk/testsuite/example/pom.xml
Log:
Exclude interceptor test for equinox
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-24 03:03:09 UTC (rev 95540)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-24 05:41:19 UTC (rev 95541)
@@ -185,6 +185,7 @@
<exclude>${target.container.excludes}</exclude>
<exclude>org/jboss/test/osgi/example/blueprint/**</exclude>
<exclude>org/jboss/test/osgi/example/http/**</exclude>
+ <exclude>org/jboss/test/osgi/example/interceptor/**</exclude>
<exclude>org/jboss/test/osgi/example/jmx/**</exclude>
<exclude>org/jboss/test/osgi/example/jndi/**</exclude>
<exclude>org/jboss/test/osgi/example/microcontainer/**</exclude>
16 years, 2 months
JBoss-OSGI SVN: r95508 - in projects/jboss-osgi/trunk: testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 10:18:13 -0400 (Fri, 23 Oct 2009)
New Revision: 95508
Added:
projects/jboss-osgi/trunk/distribution/docbook/src/main/graphics/jbossosgi-interceptor.odp
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/HttpMetadata.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java
Log:
Unregister endpoint on STOPPING
Added: projects/jboss-osgi/trunk/distribution/docbook/src/main/graphics/jbossosgi-interceptor.odp
===================================================================
(Binary files differ)
Property changes on: projects/jboss-osgi/trunk/distribution/docbook/src/main/graphics/jbossosgi-interceptor.odp
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/HttpMetadata.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/HttpMetadata.java 2009-10-23 14:14:15 UTC (rev 95507)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/HttpMetadata.java 2009-10-23 14:18:13 UTC (rev 95508)
@@ -43,4 +43,10 @@
{
return servletName;
}
+
+ @Override
+ public String toString()
+ {
+ return "HttpMetadata [servletName=" + servletName + "]";
+ }
}
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-23 14:14:15 UTC (rev 95507)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-23 14:18:13 UTC (rev 95508)
@@ -45,6 +45,12 @@
// Provide logging
private Logger log = LoggerFactory.getLogger(ParserInterceptor.class);
+ ParserInterceptor()
+ {
+ // Add the provided output
+ addOutput(HttpMetadata.class);
+ }
+
public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
{
// Do nothing if the metadata is already available
@@ -61,9 +67,7 @@
if (propsFile != null)
{
log.info("Create and attach HttpMetadata");
- Properties props = new Properties();
- props.load(propsFile.openStream());
- metadata = new HttpMetadata(props.getProperty("servlet.name"));
+ metadata = createHttpMetadata(propsFile);
dep.addAttachment(HttpMetadata.class, metadata);
}
}
@@ -73,4 +77,13 @@
}
}
}
+
+ private HttpMetadata createHttpMetadata(VirtualFile propsFile) throws IOException
+ {
+ Properties props = new Properties();
+ props.load(propsFile.openStream());
+
+ HttpMetadata metadata = new HttpMetadata(props.getProperty("servlet.name"));
+ return metadata;
+ }
}
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java 2009-10-23 14:14:15 UTC (rev 95507)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java 2009-10-23 14:18:13 UTC (rev 95508)
@@ -45,7 +45,7 @@
{
// Provide logging
private Logger log = LoggerFactory.getLogger(PublisherInterceptor.class);
-
+
PublisherInterceptor()
{
// Add the required input
@@ -54,18 +54,22 @@
public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
{
+ // HttpMetadata is guaratied to be available because we registered
+ // this type as required input
+ HttpMetadata metadata = dep.getAttachment(HttpMetadata.class);
+
+ // Register HttpMetadata on STARTING
if (state == Bundle.STARTING)
{
- HttpMetadata metadata = dep.getAttachment(HttpMetadata.class);
String servletName = metadata.getServletName();
try
{
- log.info("Publish HttpMetadata");
-
+ log.info("Publish HttpMetadata: " + metadata);
+
// Load the endpoint servlet from the attached bundle (is always attached)
Bundle bundle = dep.getAttachment(Bundle.class);
HttpServlet servlet = (HttpServlet)bundle.loadClass(servletName).newInstance();
-
+
// Register the servlet with the HttpService
getHttpService(dep).registerServlet("/servlet", servlet, null, null);
}
@@ -78,17 +82,24 @@
throw new LifecycleInterceptorException("Cannot publish: " + servletName, ex);
}
}
+
+ // Unregister the endpoint on STOPPING
+ else if (state == Bundle.STOPPING)
+ {
+ log.info("Unpublish HttpMetadata: " + metadata);
+ getHttpService(dep).unregister("/servlet");
+ }
}
private HttpService getHttpService(Deployment dep)
{
// Get the system bundle context (is always attached)
BundleContext context = dep.getAttachment(BundleContext.class);
-
+
ServiceReference sref = context.getServiceReference(HttpService.class.getName());
if (sref == null)
throw new IllegalStateException("Required HttpService not available");
-
+
HttpService httpService = (HttpService)context.getService(sref);
return httpService;
}
16 years, 2 months
JBoss-OSGI SVN: r95477 - in projects/jboss-osgi/trunk/reactor/deployment/src: test/java/org/jboss/test/osgi/deployment/interceptor and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 07:09:40 -0400 (Fri, 23 Oct 2009)
New Revision: 95477
Modified:
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/interceptor/LifecycleInterceptor.java
projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java
Log:
Move RELATIVE_ORDER_DEFAULT
Modified: 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/interceptor/AbstractLifecycleInterceptor.java 2009-10-23 11:08:37 UTC (rev 95476)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java 2009-10-23 11:09:40 UTC (rev 95477)
@@ -34,9 +34,6 @@
*/
public abstract class AbstractLifecycleInterceptor implements LifecycleInterceptor
{
- /** The default relative order: 1000 */
- public static final int RELATIVE_ORDER_DEFAULT = 1000;
-
private Set<Class<?>> input;
private Set<Class<?>> output;
@@ -46,7 +43,7 @@
*/
public int getRelativeOrder()
{
- return RELATIVE_ORDER_DEFAULT;
+ return LifecycleInterceptor.RELATIVE_ORDER_DEFAULT;
}
/**
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.java 2009-10-23 11:08:37 UTC (rev 95476)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/LifecycleInterceptor.java 2009-10-23 11:09:40 UTC (rev 95477)
@@ -36,6 +36,9 @@
*/
public interface LifecycleInterceptor
{
+ /** The default relative order: 1000 */
+ public static final int RELATIVE_ORDER_DEFAULT = 1000;
+
/**
* Get the relative order of this interceptor
*/
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java 2009-10-23 11:08:37 UTC (rev 95476)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java 2009-10-23 11:09:40 UTC (rev 95477)
@@ -23,7 +23,7 @@
//$Id$
-import static org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor.RELATIVE_ORDER_DEFAULT;
+import static org.jboss.osgi.deployment.interceptor.LifecycleInterceptor.RELATIVE_ORDER_DEFAULT;
import static org.junit.Assert.assertEquals;
import java.util.List;
16 years, 2 months
JBoss-OSGI SVN: r95475 - in projects/jboss-osgi/trunk/reactor/deployment/src: test/java/org/jboss/test/osgi/deployment/interceptor and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 07:07:33 -0400 (Fri, 23 Oct 2009)
New Revision: 95475
Added:
projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java
Removed:
projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/LifecycleInterceptorTestCase.java
Modified:
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java
Log:
Fix InterceptorOrderTestCase
Modified: 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/interceptor/AbstractLifecycleInterceptor.java 2009-10-23 10:01:27 UTC (rev 95474)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java 2009-10-23 11:07:33 UTC (rev 95475)
@@ -34,6 +34,9 @@
*/
public abstract class AbstractLifecycleInterceptor implements LifecycleInterceptor
{
+ /** The default relative order: 1000 */
+ public static final int RELATIVE_ORDER_DEFAULT = 1000;
+
private Set<Class<?>> input;
private Set<Class<?>> output;
@@ -43,7 +46,7 @@
*/
public int getRelativeOrder()
{
- return 1000;
+ return RELATIVE_ORDER_DEFAULT;
}
/**
Copied: projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java (from rev 95471, 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/InterceptorOrderTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/InterceptorOrderTestCase.java 2009-10-23 11:07:33 UTC (rev 95475)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.deployment.interceptor;
+
+//$Id$
+
+import static org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor.RELATIVE_ORDER_DEFAULT;
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+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.jboss.osgi.deployment.internal.LifecycleInterceptorServiceImpl;
+import org.junit.Test;
+
+/**
+ * Test the {@link LifecycleInterceptorService}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 19-Oct-2009
+ */
+public class InterceptorOrderTestCase
+{
+ static final int RELATIVE_ORDER = RELATIVE_ORDER_DEFAULT + 1000;
+
+ @Test
+ public void testRelativeOrder()
+ {
+ LifecycleInterceptor rel0000 = new BasicLifecycleInterceptor();
+ LifecycleInterceptor rel2000 = new BasicLifecycleInterceptor()
+ {
+ public int getRelativeOrder()
+ {
+ return RELATIVE_ORDER;
+ }
+ };
+
+ // Add ordered
+ LifecycleInterceptorServiceImpl service = new LifecycleInterceptorServiceImpl(null);
+ service.addInterceptor(rel0000);
+ service.addInterceptor(rel2000);
+
+ List<LifecycleInterceptor> chain = service.getInterceptorChain();
+ assertEquals(2, chain.size());
+ assertEquals(RELATIVE_ORDER_DEFAULT, chain.get(0).getRelativeOrder());
+ assertEquals(RELATIVE_ORDER, chain.get(1).getRelativeOrder());
+
+ // Add unordered
+ service = new LifecycleInterceptorServiceImpl(null);
+ service.addInterceptor(rel2000);
+ service.addInterceptor(rel0000);
+
+ chain = service.getInterceptorChain();
+ assertEquals(2, chain.size());
+ assertEquals(RELATIVE_ORDER_DEFAULT, chain.get(0).getRelativeOrder());
+ assertEquals(RELATIVE_ORDER, chain.get(1).getRelativeOrder());
+ }
+
+ @Test
+ public void testInputOutput()
+ {
+ class A
+ {
+ }
+
+ AbstractLifecycleInterceptor inA = new BasicLifecycleInterceptor();
+ inA.addInput(A.class);
+
+ AbstractLifecycleInterceptor outA = new BasicLifecycleInterceptor();
+ outA.addOutput(A.class);
+
+ // Add ordered
+ LifecycleInterceptorServiceImpl service = new LifecycleInterceptorServiceImpl(null);
+ service.addInterceptor(outA);
+ service.addInterceptor(inA);
+
+ List<LifecycleInterceptor> chain = service.getInterceptorChain();
+ assertEquals(2, chain.size());
+ assertEquals(outA, chain.get(0));
+ assertEquals(inA, chain.get(1));
+
+ // Add unordered
+ service = new LifecycleInterceptorServiceImpl(null);
+ service.addInterceptor(inA);
+ service.addInterceptor(outA);
+
+ chain = service.getInterceptorChain();
+ assertEquals(2, chain.size());
+ 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
+ }
+ }
+}
Deleted: 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-23 10:01:27 UTC (rev 95474)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/test/java/org/jboss/test/osgi/deployment/interceptor/LifecycleInterceptorTestCase.java 2009-10-23 11:07:33 UTC (rev 95475)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.deployment.interceptor;
-
-//$Id$
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.jboss.osgi.deployment.common.Deployment;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
-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;
-
-/**
- * Test the {@link LifecycleInterceptorService}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 19-Oct-2009
- */
-public class LifecycleInterceptorTestCase
-{
- @Test
- public void testRelativeOrder()
- {
- LifecycleInterceptor rel000 = new BasicLifecycleInterceptor();
- LifecycleInterceptor rel100 = new BasicLifecycleInterceptor()
- {
- public int getRelativeOrder()
- {
- return 100;
- }
- };
-
- // Add ordered
- LifecycleInterceptorServiceImpl service = new LifecycleInterceptorServiceImpl(null);
- service.addInterceptor(rel000);
- service.addInterceptor(rel100);
-
- List<LifecycleInterceptor> chain = service.getInterceptorChain();
- assertEquals(2, chain.size());
- assertEquals(0, chain.get(0).getRelativeOrder());
- assertEquals(100, chain.get(1).getRelativeOrder());
-
- // Add unordered
- service = new LifecycleInterceptorServiceImpl(null);
- service.addInterceptor(rel100);
- service.addInterceptor(rel000);
-
- chain = service.getInterceptorChain();
- assertEquals(2, chain.size());
- assertEquals(0, chain.get(0).getRelativeOrder());
- assertEquals(100, chain.get(1).getRelativeOrder());
- }
-
- @Test
- public void testInputOutput()
- {
- class A
- {
- }
-
- AbstractLifecycleInterceptor inA = new BasicLifecycleInterceptor();
- inA.addInput(A.class);
-
- AbstractLifecycleInterceptor outA = new BasicLifecycleInterceptor();
- outA.addOutput(A.class);
-
- // Add ordered
- LifecycleInterceptorServiceImpl service = new LifecycleInterceptorServiceImpl(null);
- service.addInterceptor(outA);
- service.addInterceptor(inA);
-
- List<LifecycleInterceptor> chain = service.getInterceptorChain();
- assertEquals(2, chain.size());
- assertEquals(outA, chain.get(0));
- assertEquals(inA, chain.get(1));
-
- // Add unordered
- service = new LifecycleInterceptorServiceImpl(null);
- service.addInterceptor(inA);
- service.addInterceptor(outA);
-
- chain = service.getInterceptorChain();
- assertEquals(2, chain.size());
- 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
- }
- }
-}
16 years, 2 months
JBoss-OSGI SVN: r95474 - projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 06:01:27 -0400 (Fri, 23 Oct 2009)
New Revision: 95474
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
Log:
Do nothing if the metadata is already available
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-23 09:58:58 UTC (rev 95473)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-23 10:01:27 UTC (rev 95474)
@@ -47,8 +47,13 @@
public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
{
+ // Do nothing if the metadata is already available
HttpMetadata metadata = dep.getAttachment(HttpMetadata.class);
- if (metadata == null && state == Bundle.STARTING)
+ if (metadata != null)
+ return;
+
+ // Parse and create metadta on STARTING
+ if (state == Bundle.STARTING)
{
try
{
16 years, 2 months