[jboss-cvs] JBossAS SVN: r95542 - in projects/jboss-osgi: projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal and 17 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Oct 24 03:24:35 EDT 2009
Author: thomas.diesler at 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 at 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 at 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 at 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 at 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
More information about the jboss-cvs-commits
mailing list