JBoss-OSGI SVN: r95473 - projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 05:58:58 -0400 (Fri, 23 Oct 2009)
New Revision: 95473
Modified:
projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java
Log:
Skip parsing if metadata is available already
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-23 09:56:57 UTC (rev 95472)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java 2009-10-23 09:58:58 UTC (rev 95473)
@@ -96,7 +96,8 @@
public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
{
- if (state == Bundle.STARTING)
+ WebApp webApp = dep.getAttachment(WebApp.class);
+ if (webApp == null && state == Bundle.STARTING)
{
try
{
@@ -104,7 +105,7 @@
if (webXML != null)
{
log.debug("Create and attach WebApp metadata");
- WebApp webApp = createWebAppMetadata(dep, webXML);
+ webApp = createWebAppMetadata(dep, webXML);
dep.addAttachment(WebApp.class, webApp);
}
}
16 years, 2 months
JBoss-OSGI SVN: r95472 - in projects/jboss-osgi/trunk: reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint and 18 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 05:56:57 -0400 (Fri, 23 Oct 2009)
New Revision: 95472
Added:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/InterceptorTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/endpoint/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/endpoint/EndpointServlet.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/
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/InterceptorActivator.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/interceptor/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor-bundle.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/http-metadata.properties
Modified:
projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java
projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java
projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java
Log:
Add interceptor example
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/pom.xml 2009-10-23 09:56:57 UTC (rev 95472)
@@ -92,6 +92,7 @@
org.osgi.service.blueprint.reflect;version=1.0,
org.osgi.service.log;version=1.3,
org.osgi.util.tracker;version=1.4,
+ org.slf4j;version="[1.5,2.0)",
org.w3c.dom,
org.xml.sax,
</Import-Package>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -25,7 +25,6 @@
import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
/**
* The context of the Blueprint implementation
@@ -37,8 +36,6 @@
{
String XMLNS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
- LogService getLog();
-
BundleContext getBundleContext();
BlueprintParser getBlueprintParser();
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -34,7 +34,8 @@
import org.osgi.framework.ServiceReference;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* For each of the ComponentMetadata objects, the Blueprint Container has a
@@ -51,7 +52,7 @@
*/
public abstract class AbstractManager
{
- protected LogService log;
+ protected Logger log = LoggerFactory.getLogger(getClass());
protected BlueprintContext context;
protected BlueprintContainer container;
@@ -59,7 +60,6 @@
public AbstractManager(BlueprintContext context, BlueprintContainer container, ComponentMetadata component)
{
- this.log = context.getLog();
this.context = context;
this.container = container;
this.component = component;
@@ -82,17 +82,17 @@
public void install()
{
- log.log(LogService.LOG_DEBUG, "install: " + component);
+ log.debug("install: " + component);
}
public void activate()
{
- log.log(LogService.LOG_DEBUG, "activate: " + component);
+ log.debug("activate: " + component);
}
public void shutdown()
{
- log.log(LogService.LOG_DEBUG, "shutdown: " + component);
+ log.debug("shutdown: " + component);
}
public Object getTargetBean()
@@ -111,7 +111,7 @@
try
{
KernelControllerContext ctrlContext = getKernelController().install(kernelBean);
- log.log(LogService.LOG_DEBUG, "installed: " + ctrlContext);
+ log.debug("installed: " + ctrlContext);
return ctrlContext;
}
catch (RuntimeException rte)
@@ -127,7 +127,7 @@
protected void uninstallKernelBean(BeanMetaData kernelBean)
{
getKernelController().uninstall(kernelBean.getName());
- log.log(LogService.LOG_DEBUG, "uninstalled: " + kernelBean.getName());
+ log.debug("uninstalled: " + kernelBean.getName());
}
protected KernelController getKernelController()
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -25,9 +25,7 @@
import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.BlueprintParser;
-import org.jboss.osgi.common.log.LogServiceTracker;
import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
/**
* The context of the Blueprint implementation
@@ -39,23 +37,16 @@
{
public static final String XMLNS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
- private LogService log;
private BundleContext context;
private BlueprintParser parser;
public BlueprintContextImpl(BundleContext context)
{
- this.log = new LogServiceTracker(context);
this.context = context;
this.parser = new BlueprintParser(this);
}
- public LogService getLog()
- {
- return log;
- }
-
public BundleContext getBundleContext()
{
return context;
Modified: projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -30,7 +30,8 @@
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.osgi.framework.Bundle;
-import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
//$Id$
@@ -42,13 +43,14 @@
*/
public class BlueprintParser
{
- private LogService log;
+ // Provide Logging
+ private Logger log = LoggerFactory.getLogger(BlueprintParser.class);
+
private BlueprintContext context;
private JBossXBParser parser;
public BlueprintParser(BlueprintContext context)
{
- this.log = context.getLog();
this.context = context;
this.parser = new SchemaResolverParser(context);
@@ -67,7 +69,7 @@
String descriptorPaths = (String)bundle.getHeaders().get(HEADER_BUNDLE_BLUEPRINT);
if (descriptorPaths != null)
{
- log.log(LogService.LOG_INFO, HEADER_BUNDLE_BLUEPRINT + ": " + descriptorPaths + " in bundle: " + bundle);
+ log.info(HEADER_BUNDLE_BLUEPRINT + ": " + descriptorPaths + " in bundle: " + bundle);
String[] descritors = descriptorPaths.split(", ");
for (String descriptor : descritors)
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-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -34,6 +34,7 @@
import org.jboss.osgi.deployment.internal.InterceptorWrapper;
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,10 +49,23 @@
{
// Provide logging
private Logger log = LoggerFactory.getLogger(AbstractLifecycleInterceptorService.class);
+
+ // The system bundle context
+ private BundleContext context;
// The interceptor chain
private List<LifecycleInterceptor> interceptorChain = new ArrayList<LifecycleInterceptor>();
+ protected AbstractLifecycleInterceptorService(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return context;
+ }
+
/**
* Add a LifecycleInterceptor to the service.
*
@@ -212,6 +226,11 @@
if (attBundle == null)
dep.addAttachment(Bundle.class, bundle);
+ // 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)
{
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-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/LifecycleInterceptorServiceImpl.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -41,11 +41,9 @@
*/
public class LifecycleInterceptorServiceImpl extends AbstractLifecycleInterceptorService
{
- private BundleContext context;
-
public LifecycleInterceptorServiceImpl(BundleContext context)
{
- this.context = context;
+ super(context);
}
@Override
@@ -63,10 +61,10 @@
private DeploymentRegistryService getDeploymentRegistryService()
{
- ServiceReference sref = context.getServiceReference(DeploymentRegistryService.class.getName());
+ ServiceReference sref = getBundleContext().getServiceReference(DeploymentRegistryService.class.getName());
if (sref == null)
throw new IllegalStateException("Cannot obtain deployment registry service");
- return (DeploymentRegistryService)context.getService(sref);
+ return (DeploymentRegistryService)getBundleContext().getService(sref);
}
}
\ 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-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -62,7 +62,7 @@
public void startService()
{
final BundleContext context = getSystemContext();
- delegate = new AbstractLifecycleInterceptorService()
+ delegate = new AbstractLifecycleInterceptorService(context)
{
protected Deployment getDeployment(String name, Version version)
{
Modified: projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/OSGiRuntime.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -96,6 +96,15 @@
OSGiServiceReference getServiceReference(String clazz);
/**
+ * Returns a ServiceReference object for a service that implements and was registered
+ * under the specified class.
+ *
+ * @param timeout the timeout to wait for the service to become available
+ * @return A ServiceReference object, or null if no services are registered which implement the named class.
+ */
+ OSGiServiceReference getServiceReference(String clazz, long timeout);
+
+ /**
* Returns an array of ServiceReference objects.
* The returned array of ServiceReference objects contains services that were registered under the specified
* class and match the specified filter criteria.
Modified: projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/reactor/testing/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -195,6 +195,26 @@
return bundle;
}
+ public OSGiServiceReference getServiceReference(String clazz, long timeout)
+ {
+ int fraktion = 200;
+ timeout = timeout/fraktion;
+ OSGiServiceReference sref = getServiceReference(clazz);
+ while (sref == null && 0 < timeout--)
+ {
+ try
+ {
+ Thread.sleep(fraktion);
+ }
+ catch (InterruptedException e)
+ {
+ // ignore
+ }
+ sref = getServiceReference(clazz);
+ }
+ return sref;
+ }
+
protected OSGiBundle getBundle(String symbolicName, Version version, boolean mustExist)
{
OSGiBundle bundle = null;
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-23 09:56:57 UTC (rev 95472)
@@ -237,6 +237,7 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
+ <exclude>org/jboss/test/osgi/example/interceptor/**</exclude>
<exclude>org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.class</exclude>
</excludes>
</configuration>
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-10-23 09:56:57 UTC (rev 95472)
@@ -48,6 +48,10 @@
<!-- http -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-http.jar" files="${tests.resources.dir}/http/example-http.bnd" />
+ <!-- interceptor -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-interceptor.jar" files="${tests.resources.dir}/interceptor/example-interceptor.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-interceptor-bundle.jar" files="${tests.resources.dir}/interceptor/example-interceptor-bundle.bnd" />
+
<!-- jmx -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-jmx.jar" files="${tests.resources.dir}/jmx/example-jmx.bnd" />
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -31,7 +31,6 @@
import java.net.URL;
import org.jboss.osgi.spi.capability.HttpServiceCapability;
-import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiServiceReference;
import org.jboss.osgi.testing.OSGiTestHelper;
@@ -57,18 +56,10 @@
runtime.addCapability(new HttpServiceCapability());
// Allow 10s for the HttpService to become available
- long timeout = 50;
- OSGiServiceReference sref = runtime.getServiceReference(HttpService.class.getName());
- while (sref == null && 0 < timeout--)
- {
- Thread.sleep(200);
- sref = runtime.getServiceReference(HttpService.class.getName());
- }
-
+ OSGiServiceReference sref = runtime.getServiceReference(HttpService.class.getName(), 10000);
assertNotNull("HttpService not null", sref);
- OSGiBundle bundle = runtime.installBundle("example-http.jar");
- bundle.start();
+ runtime.installBundle("example-http.jar").start();
}
@AfterClass
@@ -81,40 +72,42 @@
@Test
public void testServletAccess() throws Exception
{
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Servlet", br.readLine());
+ String line = getHttpResponse("/servlet?test=plain");
+ assertEquals("Hello from Servlet", line);
}
@Test
public void testServletInitProps() throws Exception
{
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("initProp=SomeValue", br.readLine());
+ String line = getHttpResponse("/servlet?test=initProp");
+ assertEquals("initProp=SomeValue", line);
}
@Test
public void testServletBundleContext() throws Exception
{
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("example-http", br.readLine());
+ String line = getHttpResponse("/servlet?test=context");
+ assertEquals("example-http", line);
}
@Test
public void testServletStartLevel() throws Exception
{
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("startLevel=1", br.readLine());
+ String line = getHttpResponse("/servlet?test=startLevel");
+ assertEquals("startLevel=1", line);
}
@Test
public void testResourceAccess() throws Exception
{
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
+ String line = getHttpResponse("/file/message.txt");
+ assertEquals("Hello from Resource", line);
+ }
+
+ private String getHttpResponse(String reqPath) throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090" + reqPath);
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Resource", br.readLine());
+ return br.readLine();
}
}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/InterceptorTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/InterceptorTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/InterceptorTestCase.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.interceptor;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.spi.capability.HttpServiceCapability;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiServiceReference;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.service.http.HttpService;
+
+/**
+ * A test that deployes a bundle that contains some metadata and an interceptor bundle
+ * that processes the metadata and registeres an http endpoint from it.
+ *
+ * The idea is that the bundle does not process its own metadata. Instead this work
+ * is delegated to some specialized metadata processor (i.e. the interceptor)
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Oct-2009
+ */
+public class InterceptorTestCase
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+ runtime.addCapability(new HttpServiceCapability());
+
+ // Allow 10s for the HttpService to become available
+ OSGiServiceReference sref = runtime.getServiceReference(HttpService.class.getName(), 10000);
+ assertNotNull("HttpService not null", sref);
+
+ runtime.installBundle("example-interceptor.jar").start();
+ runtime.installBundle("example-interceptor-bundle.jar").start();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+
+ @Test
+ public void testServletAccess() throws Exception
+ {
+ String line = getHttpResponse("/servlet");
+ assertEquals("Hello from Servlet", line);
+ }
+
+ private String getHttpResponse(String reqPath) throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090" + reqPath);
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ return br.readLine();
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/InterceptorTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/endpoint/EndpointServlet.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/endpoint/EndpointServlet.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/endpoint/EndpointServlet.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,46 @@
+/*
+ * 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.example.interceptor.endpoint;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@SuppressWarnings("serial")
+public class EndpointServlet extends HttpServlet
+{
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ PrintWriter out = res.getWriter();
+
+ out.println("Hello from Servlet");
+
+ out.close();
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/endpoint/EndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/HttpMetadata.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,46 @@
+/*
+ * 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.example.interceptor.processor;
+
+//$Id$
+
+
+/**
+ * Metadata the represent an Http endpoint
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Oct-2009
+ */
+public class HttpMetadata
+{
+ private String servletName;
+
+ HttpMetadata(String servletName)
+ {
+ this.servletName = servletName;
+ }
+
+ public String getServletName()
+ {
+ return servletName;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/HttpMetadata.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/InterceptorActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/InterceptorActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/InterceptorActivator.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,64 @@
+/*
+ * 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.example.interceptor.processor;
+
+//$Id$
+
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Registers the interceptors with the {@link LifecycleInterceptorService}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Oct-2009
+ */
+public class InterceptorActivator implements BundleActivator
+{
+ private LifecycleInterceptorService service;
+ private PublisherInterceptor publisher;
+ private ParserInterceptor parser;
+
+ public void start(BundleContext context)
+ {
+ publisher = new PublisherInterceptor();
+ parser = new ParserInterceptor();
+
+ // This is a system service, which should always be available
+ ServiceReference sref = context.getServiceReference(LifecycleInterceptorService.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("Required LifecycleInterceptorService not available");
+
+ // Add the interceptors, the order of which is handles by the service
+ service = (LifecycleInterceptorService)context.getService(sref);
+ service.addInterceptor(publisher);
+ service.addInterceptor(parser);
+ }
+
+ public void stop(BundleContext context)
+ {
+ service.removeInterceptor(publisher);
+ service.removeInterceptor(parser);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/InterceptorActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,71 @@
+/*
+ * 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.example.interceptor.processor;
+
+//$Id$
+
+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.LifecycleInterceptorException;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An interceptor that creates and attaches HttpMetadata.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Oct-2009
+ */
+public class ParserInterceptor extends AbstractLifecycleInterceptor
+{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(ParserInterceptor.class);
+
+ public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ {
+ HttpMetadata metadata = dep.getAttachment(HttpMetadata.class);
+ if (metadata == null && state == Bundle.STARTING)
+ {
+ try
+ {
+ VirtualFile propsFile = dep.getRoot().getChild("/http-metadata.properties");
+ if (propsFile != null)
+ {
+ log.info("Create and attach HttpMetadata");
+ Properties props = new Properties();
+ props.load(propsFile.openStream());
+ metadata = new HttpMetadata(props.getProperty("servlet.name"));
+ dep.addAttachment(HttpMetadata.class, metadata);
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new LifecycleInterceptorException("Cannot parse metadata", ex);
+ }
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,95 @@
+/*
+ * 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.example.interceptor.processor;
+
+//$Id$
+
+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.LifecycleInterceptorException;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An interceptor that publishes HttpMetadata.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Oct-2009
+ */
+public class PublisherInterceptor extends AbstractLifecycleInterceptor
+{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(PublisherInterceptor.class);
+
+ PublisherInterceptor()
+ {
+ // Add the required input
+ addInput(HttpMetadata.class);
+ }
+
+ public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ {
+ if (state == Bundle.STARTING)
+ {
+ HttpMetadata metadata = dep.getAttachment(HttpMetadata.class);
+ String servletName = metadata.getServletName();
+ try
+ {
+ log.info("Publish HttpMetadata");
+
+ // 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);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new LifecycleInterceptorException("Cannot publish: " + servletName, ex);
+ }
+ }
+ }
+
+ 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;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/PublisherInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -71,19 +71,22 @@
@Test
public void testResourceAccess() throws Exception
{
- assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
+ String line = getHttpResponse("/message.txt");
+ assertEquals("Hello from Resource", line);
}
@Test
public void testServletAccess() throws Exception
{
- assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
+ String line = getHttpResponse("/servlet?test=plain");
+ assertEquals("Hello from Servlet", line);
}
@Test
public void testServletInitProps() throws Exception
{
- assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
+ String line = getHttpResponse("/servlet?test=initProp");
+ assertEquals("initProp=SomeValue", line);
}
// Due to the nature of asynchronous event processing by the
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java 2009-10-23 08:09:55 UTC (rev 95471)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java 2009-10-23 09:56:57 UTC (rev 95472)
@@ -70,28 +70,28 @@
@Test
public void testResourceAccess() throws Exception
{
- assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
+ String line = getHttpResponse("/message.txt");
+ assertEquals("Hello from Resource", line);
}
@Test
public void testServletAccess() throws Exception
{
- assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
+ String line = getHttpResponse("/servlet?test=plain");
+ assertEquals("Hello from Servlet", line);
}
@Test
public void testServletInitProps() throws Exception
{
- assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
+ String line = getHttpResponse("/servlet?test=initProp");
+ assertEquals("initProp=SomeValue", line);
}
private String getHttpResponse(String reqPath) throws Exception
{
URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
-
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- String line = br.readLine();
-
- return line;
+ return br.readLine();
}
}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor-bundle.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor-bundle.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor-bundle.bnd 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,7 @@
+# bnd build -classpath target/test-classes -output target/test-libs/example/example-interceptor-bundle.jar src/test/resources/example/interceptor/example-interceptor-bundle.bnd
+
+Bundle-SymbolicName: example-interceptor-bundle
+Export-Package: org.jboss.test.osgi.example.interceptor.endpoint
+Import-Package: javax.servlet, javax.servlet.http
+
+Include-Resource: http-metadata.properties
\ No newline at end of file
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/example-interceptor.bnd 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1,5 @@
+# bnd build -classpath target/test-classes -output target/test-libs/example/example-interceptor.jar src/test/resources/example/interceptor/example-interceptor.bnd
+
+Bundle-SymbolicName: example-interceptor
+Bundle-Activator: org.jboss.test.osgi.example.interceptor.processor.InterceptorActivator
+Export-Package: org.jboss.test.osgi.example.interceptor.processor
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/http-metadata.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/http-metadata.properties (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/http-metadata.properties 2009-10-23 09:56:57 UTC (rev 95472)
@@ -0,0 +1 @@
+servlet.name=org.jboss.test.osgi.example.interceptor.endpoint.EndpointServlet
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/interceptor/http-metadata.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 2 months
JBoss-OSGI SVN: r95470 - in projects/jboss-osgi: trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 03:41:20 -0400 (Fri, 23 Oct 2009)
New Revision: 95470
Added:
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorWrapper.java
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/WebXMLParserInterceptor.java
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/interceptor/AbstractLifecycleInterceptor.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java
Log:
More interceptor logging
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-23 07:31:34 UTC (rev 95469)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppPublisherInterceptor.java 2009-10-23 07:41:20 UTC (rev 95470)
@@ -34,6 +34,8 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The WebApp lifecycle interceptor.
@@ -43,6 +45,9 @@
*/
public class WebAppPublisherInterceptor extends AbstractLifecycleInterceptor implements LifecycleInterceptor
{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(WebAppPublisherInterceptor.class);
+
private BundleContext context;
private ServiceTracker serviceTracker;
private WebAppPublisherExt publisher;
@@ -92,11 +97,15 @@
{
if (state == Bundle.STARTING)
{
+ log.debug("Publish WebApp metadata");
+
WebApp webApp = dep.getAttachment(WebApp.class);
publisher.publish(webApp);
}
else if (state == Bundle.STOPPING)
{
+ log.debug("Unpublish WebApp metadata");
+
WebApp webApp = dep.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-23 07:31:34 UTC (rev 95469)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java 2009-10-23 07:41:20 UTC (rev 95470)
@@ -37,6 +37,8 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The WebApp lifecycle interceptor.
@@ -46,6 +48,9 @@
*/
public class WebXMLParserInterceptor extends AbstractLifecycleInterceptor implements LifecycleInterceptor
{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(WebXMLParserInterceptor.class);
+
private BundleContext context;
private ServiceTracker serviceTracker;
@@ -98,7 +103,7 @@
VirtualFile webXML = dep.getRoot().getChild("/WEB-INF/web.xml");
if (webXML != null)
{
- // Create and attach the the WebApp metadata
+ log.debug("Create and attach WebApp metadata");
WebApp webApp = createWebAppMetadata(dep, webXML);
dep.addAttachment(WebApp.class, webApp);
}
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-23 07:31:34 UTC (rev 95469)
+++ projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintInterceptor.java 2009-10-23 07:41:20 UTC (rev 95470)
@@ -33,15 +33,20 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
- * The Blueprint extender
+ * The Blueprint interceptor
*
* @author thomas.diesler(a)jboss.com
- * @since 13-May-2009
+ * @since 20-Oct-2009
*/
public class BlueprintInterceptor extends AbstractLifecycleInterceptor implements LifecycleInterceptor
{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(BlueprintInterceptor.class);
+
private BlueprintProcessor processor;
private ServiceTracker serviceTracker;
@@ -50,9 +55,6 @@
this.processor = processor;
}
- /**
- * Start the BlueprintExtender
- */
public void start()
{
BlueprintContext bpContext = processor.getBlueprintContext();
@@ -79,9 +81,6 @@
serviceTracker.open();
}
- /**
- * Stop the BlueprintExtender
- */
public void stop()
{
processor.stopAllContainers();
@@ -97,10 +96,12 @@
Bundle bundle = dep.getAttachment(Bundle.class);
if (state == Bundle.STARTING)
{
+ log.debug("Create blueprint container");
processor.createContainer(bundle);
}
else if (state == Bundle.STOPPING)
{
+ log.debug("Stop blueprint container");
processor.stopContainer(bundle);
}
}
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 07:31:34 UTC (rev 95469)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java 2009-10-23 07:41:20 UTC (rev 95470)
@@ -38,12 +38,12 @@
private Set<Class<?>> output;
/**
- * No relative order
- * @return 0
+ * Get default relative order
+ * @return 1000
*/
public int getRelativeOrder()
{
- return 0;
+ return 1000;
}
/**
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-23 07:31:34 UTC (rev 95469)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptorService.java 2009-10-23 07:41:20 UTC (rev 95470)
@@ -31,6 +31,7 @@
import java.util.Set;
import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.internal.InterceptorWrapper;
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
@@ -61,6 +62,11 @@
*/
public void addInterceptor(LifecycleInterceptor interceptor)
{
+ if (interceptor == null)
+ throw new IllegalArgumentException("Null interceptor");
+
+ log.debug("Add interceptor: " + new InterceptorWrapper(interceptor));
+
synchronized (interceptorChain)
{
Set<LifecycleInterceptor> unsortedSet = new HashSet<LifecycleInterceptor>();
@@ -112,6 +118,13 @@
addWithRelativeOrder(sortedList, aux);
}
+ // Log the interceptor order
+ for (LifecycleInterceptor aux : sortedList)
+ {
+ InterceptorWrapper wrapper = new InterceptorWrapper(aux);
+ log.debug("\n " + wrapper.toLongString());
+ }
+
// Use the sorted result as the new interceptor chain
interceptorChain.clear();
interceptorChain.addAll(sortedList);
@@ -154,6 +167,11 @@
*/
public void removeInterceptor(LifecycleInterceptor interceptor)
{
+ if (interceptor == null)
+ throw new IllegalArgumentException("Null interceptor");
+
+ log.debug("Remove interceptor: " + new InterceptorWrapper(interceptor));
+
synchronized (interceptorChain)
{
interceptorChain.remove(interceptor);
@@ -213,9 +231,9 @@
}
if (doInvocation)
{
- String className = aux.getClass().getName();
+ InterceptorWrapper wrapper = new InterceptorWrapper(aux);
String stateName = ConstantsHelper.bundleState(state);
- log.debug("Invoke: " + className + " with state " + stateName + " on " + dep.getLocation());
+ log.trace("Invoke: " + wrapper + " with state " + stateName + " on " + dep.getLocation());
aux.invoke(state, dep);
}
}
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorWrapper.java 2009-10-23 07:41:20 UTC (rev 95470)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.deployment.internal;
+
+//$Id$
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.osgi.deployment.common.Deployment;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
+
+/**
+ * A wrapper around lifecycle interceptors.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 15-Oct-2009
+ */
+public class InterceptorWrapper implements LifecycleInterceptor
+{
+ private LifecycleInterceptor delegate;
+
+ public InterceptorWrapper(LifecycleInterceptor delegate)
+ {
+ if (delegate == null)
+ throw new IllegalArgumentException("Null interceptor");
+
+ this.delegate = delegate;
+ }
+
+ public Set<Class<?>> getInput()
+ {
+ return delegate.getInput();
+ }
+
+ public Set<Class<?>> getOutput()
+ {
+ return delegate.getOutput();
+ }
+
+ public int getRelativeOrder()
+ {
+ return delegate.getRelativeOrder();
+ }
+
+ public void invoke(int state, Deployment dep) throws LifecycleInterceptorException
+ {
+ delegate.invoke(state, dep);
+ }
+
+ public String toLongString()
+ {
+ String classToken = getLastNameToken(delegate.getClass());
+
+ Set<String> input = null;
+ if (getInput() != null)
+ {
+ input = new HashSet<String>();
+ for(Class<?> aux : getInput())
+ input.add(getLastNameToken(aux.getClass()));
+ }
+
+ Set<String> output = null;
+ if (getOutput() != null)
+ {
+ output = new HashSet<String>();
+ for(Class<?> aux : getOutput())
+ output.add(getLastNameToken(aux.getClass()));
+ }
+
+ return "[" + classToken + ",order=" + getRelativeOrder() + ",input=" + input + ",output=" + output + "]";
+ }
+
+ @Override
+ public String toString()
+ {
+ String className = delegate.getClass().getName();
+ return "[" + className + ",order=" + getRelativeOrder() + "]";
+ }
+
+ private String getLastNameToken(Class<?> clazz)
+ {
+ String token = clazz.getName();
+ return token.substring(token.lastIndexOf(".") + 1);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InterceptorWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 2 months
JBoss-OSGI SVN: r95465 - in projects/jboss-osgi/trunk: testsuite and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 01:59:57 -0400 (Fri, 23 Oct 2009)
New Revision: 95465
Added:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java
Removed:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java
Modified:
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Update to pax-web-0.7.2-SNAPSHOT
Resurect WebApp support for Felix
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/pom.xml 2009-10-23 05:59:57 UTC (rev 95465)
@@ -68,10 +68,10 @@
<version.jboss.osgi.runtime.jbossas>1.0.2-SNAPSHOT</version.jboss.osgi.runtime.jbossas>
<version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.testing>0.0.1-SNAPSHOT</version.jboss.osgi.testing>
- <version.jboss.osgi.webapp>0.7.1-SNAPSHOT</version.jboss.osgi.webapp>
+ <version.jboss.osgi.webapp>0.7.2-SNAPSHOT</version.jboss.osgi.webapp>
<version.jboss.osgi.webconsole>1.0.2</version.jboss.osgi.webconsole>
<version.jboss.osgi.xml.binding>2.0.1.SP1</version.jboss.osgi.xml.binding>
- <version.ops4j.pax.web>0.7.1</version.ops4j.pax.web>
+ <version.ops4j.pax.web>0.7.2-20091021.163357-3</version.ops4j.pax.web>
<version.osgi>4.2.0</version.osgi>
<surefire.memory.args>-Xmx512m</surefire.memory.args>
@@ -240,6 +240,11 @@
<!-- OPS4J -->
<dependency>
<groupId>org.ops4j.pax.web</groupId>
+ <artifactId>pax-web-extender-war</artifactId>
+ <version>${version.ops4j.pax.web}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.web</groupId>
<artifactId>pax-web-jetty-bundle</artifactId>
<version>${version.ops4j.pax.web}</version>
</dependency>
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-23 05:59:57 UTC (rev 95465)
@@ -237,7 +237,7 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
- <exclude>org/jboss/test/osgi/example/webapp/**</exclude>
+ <exclude>org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.class</exclude>
</excludes>
</configuration>
</plugin>
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2009-10-23 05:59:57 UTC (rev 95465)
@@ -29,6 +29,7 @@
<include>*:org.apache.felix.configadmin:jar</include>
<include>*:org.apache.felix.log:jar</include>
<include>*:org.apache.felix.metatype:jar</include>
+ <include>*:pax-web-extender-war:jar</include>
<include>*:pax-web-jetty-bundle:jar</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java 2009-10-23 05:59:57 UTC (rev 95465)
@@ -58,11 +58,8 @@
@AfterClass
public static void tearDownClass() throws Exception
{
- if (runtime != null)
- {
- runtime.shutdown();
- runtime = null;
- }
+ runtime.shutdown();
+ runtime = null;
}
@Test
@@ -70,7 +67,7 @@
{
OSGiBundle bundle = runtime.installBundle("example-jmx.jar");
bundle.start();
-
+
FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBEAN_NAME, runtime.getMBeanServer());
assertEquals("hello", foo.echo("hello"));
}
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java 2009-10-23 05:59:57 UTC (rev 95465)
@@ -57,11 +57,8 @@
@AfterClass
public static void tearDownClass() throws Exception
{
- if (runtime != null)
- {
- runtime.shutdown();
- runtime = null;
- }
+ runtime.shutdown();
+ runtime = null;
}
@Test
@@ -69,7 +66,7 @@
{
OSGiBundle bundle = runtime.installBundle("example-jndi.jar");
bundle.start();
-
+
InitialContext iniCtx = runtime.getInitialContext();
String lookup = (String)iniCtx.lookup("test/Foo");
assertEquals("JNDI bound String expected", "Bar", lookup);
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-10-23 05:59:57 UTC (rev 95465)
@@ -57,7 +57,7 @@
runtime.addCapability(new JMXCapability());
runtime.addCapability(new XMLBindingCapability());
runtime.addCapability(new MicrocontainerCapability());
-
+
OSGiBundle bundleA = runtime.installBundle("example-mcservice-bundleA.jar");
bundleA.start();
}
@@ -65,11 +65,8 @@
@AfterClass
public static void tearDownClass() throws Exception
{
- if (runtime != null)
- {
- runtime.shutdown();
- runtime = null;
- }
+ runtime.shutdown();
+ runtime = null;
}
@Test
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java (from rev 95426, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java 2009-10-23 05:59:57 UTC (rev 95465)
@@ -0,0 +1,118 @@
+/*
+ * 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.example.webapp;
+
+//$Id:$
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.spi.capability.HttpServiceCapability;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * A test that deployes a WAR bundle
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 06-Oct-2009
+ */
+public class WebAppExtenderTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception
+ {
+ OSGiTestHelper osgiTestHelper = new OSGiTestHelper();
+
+ runtime = osgiTestHelper.getDefaultRuntime();
+ runtime.addCapability(new HttpServiceCapability());
+
+ runtime.installBundle("bundles/pax-web-extender-war.jar").start();
+
+ runtime.installBundle("example-webapp.war").start();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+
+ @Test
+ public void testResourceAccess() throws Exception
+ {
+ assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
+ }
+
+ @Test
+ public void testServletAccess() throws Exception
+ {
+ assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
+ }
+
+ @Test
+ public void testServletInitProps() throws Exception
+ {
+ assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
+ }
+
+ // Due to the nature of asynchronous event processing by the
+ // extender pattern, we cannot assume that the endpoint is
+ // available immediately
+ private String getHttpResponse(String reqPath) throws Exception
+ {
+ String line = null;
+ IOException lastException = null;
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
+
+ int timeout = 25;
+ while (line == null && 0 < timeout--)
+ {
+ Thread.sleep(200);
+ try
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ line = br.readLine();
+ }
+ catch (IOException ex)
+ {
+ lastException = ex;
+ }
+ }
+
+ if (line == null && lastException != null)
+ throw lastException;
+
+ return line;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java (from rev 95426, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java 2009-10-23 05:59:57 UTC (rev 95465)
@@ -0,0 +1,97 @@
+/*
+ * 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.example.webapp;
+
+// $Id: $
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.webapp.WebAppCapability;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * A test that deployes a WAR bundle
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 06-Oct-2009
+ */
+public class WebAppInterceptorTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception
+ {
+ OSGiTestHelper osgiTestHelper = new OSGiTestHelper();
+
+ runtime = osgiTestHelper.getDefaultRuntime();
+ runtime.addCapability(new WebAppCapability());
+
+ OSGiBundle bundle = runtime.installBundle("example-webapp.war");
+ bundle.start();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+
+ @Test
+ public void testResourceAccess() throws Exception
+ {
+ assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
+ }
+
+ @Test
+ public void testServletAccess() throws Exception
+ {
+ assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
+ }
+
+ @Test
+ public void testServletInitProps() throws Exception
+ {
+ assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
+ }
+
+ private String getHttpResponse(String reqPath) throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ String line = br.readLine();
+
+ return line;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java 2009-10-23 05:59:57 UTC (rev 95465)
@@ -1,115 +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.example.webapp;
-
-//$Id:$
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.webapp.WebAppCapability;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * A test that deployes a WAR bundle
- *
- * @author thomas.diesler(a)jboss.com
- * @since 06-Oct-2009
- */
-public class WebAppTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
-
- @BeforeClass
- public static void setUpClass() throws Exception
- {
- OSGiTestHelper osgiTestHelper = new OSGiTestHelper();
-
- runtime = osgiTestHelper.getDefaultRuntime();
- runtime.addCapability(new WebAppCapability());
-
- OSGiBundle bundle = runtime.installBundle("example-webapp.war");
- bundle.start();
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception
- {
- runtime.shutdown();
- runtime = null;
- }
-
- @Test
- public void testResourceAccess() throws Exception
- {
- assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
- }
-
- @Test
- public void testServletAccess() throws Exception
- {
- assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
- }
-
- @Test
- public void testServletInitProps() throws Exception
- {
- assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
- }
-
- private String getHttpResponse(String reqPath) throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
-
- int timeout = 40;
- String line = null;
- IOException lastException = null;
- while (line == null && 0 < timeout--)
- {
- Thread.sleep(500);
- try
- {
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- line = br.readLine();
- }
- catch (IOException ex)
- {
- lastException = ex;
- }
- }
-
- if (line == null && lastException != null)
- throw lastException;
-
- return line;
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-10-23 05:59:57 UTC (rev 95465)
@@ -141,6 +141,11 @@
<!-- OPS4J -->
<dependency>
<groupId>org.ops4j.pax.web</groupId>
+ <artifactId>pax-web-extender-war</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.web</groupId>
<artifactId>pax-web-jetty-bundle</artifactId>
<scope>provided</scope>
</dependency>
16 years, 2 months
JBoss-OSGI SVN: r95463 - in projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org: ops4j/pax/web/extender/war/internal and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 01:54:50 -0400 (Fri, 23 Oct 2009)
New Revision: 95463
Modified:
projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppActivator.java
projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java
Log:
Gracefully wait 5000ms for the WebContainer to become available
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppActivator.java 2009-10-23 05:45:19 UTC (rev 95462)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebAppActivator.java 2009-10-23 05:54:50 UTC (rev 95463)
@@ -50,7 +50,8 @@
webappParserInterceptor.start();
// Register the WebApp publisher interceptor
- webappPublishInterceptor = new WebAppPublisherInterceptor(context, new WebAppPublisherExt());
+ WebAppPublisherExt publisher = new WebAppPublisherExt(context);
+ webappPublishInterceptor = new WebAppPublisherInterceptor(context, publisher);
webappPublishInterceptor.start();
}
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-23 05:45:19 UTC (rev 95462)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisherExt.java 2009-10-23 05:54:50 UTC (rev 95463)
@@ -21,6 +21,11 @@
*/
package org.ops4j.pax.web.extender.war.internal;
+import org.ops4j.pax.web.extender.war.internal.model.WebApp;
+import org.ops4j.pax.web.service.WebContainer;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
//$Id$
/**
@@ -31,4 +36,39 @@
*/
public class WebAppPublisherExt extends WebAppPublisher
{
+ private BundleContext context;
+
+ public WebAppPublisherExt(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ @Override
+ public void publish(WebApp webapp)
+ {
+ // Gracefully wait 5000ms for the WebContainer to become available
+ int timeout = 25;
+ ServiceReference sref = null;
+ while (sref == null && 0 < timeout--)
+ {
+ sref = context.getServiceReference(WebContainer.class.getName());
+ if (sref == null)
+ {
+ try
+ {
+ Thread.sleep(200);
+ }
+ catch (InterruptedException ex)
+ {
+ // ignore
+ }
+ }
+ }
+
+ if (sref == null)
+ throw new IllegalStateException("WebContainer not available");
+
+ // Publish the WebApp metadata
+ super.publish(webapp);
+ }
}
\ No newline at end of file
16 years, 2 months
JBoss-OSGI SVN: r95461 - projects/jboss-osgi/projects/bundles/webapp/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-23 00:58:45 -0400 (Fri, 23 Oct 2009)
New Revision: 95461
Modified:
projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
Log:
Update to 0.7.2-SNAPSHOT
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml 2009-10-23 03:44:09 UTC (rev 95460)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml 2009-10-23 04:58:45 UTC (rev 95461)
@@ -21,7 +21,7 @@
<artifactId>jboss-osgi-webapp</artifactId>
<packaging>bundle</packaging>
- <version>0.7.1-SNAPSHOT</version>
+ <version>0.7.2-SNAPSHOT</version>
<!-- Parent -->
<parent>
@@ -40,7 +40,7 @@
<!-- Properties -->
<properties>
<version.jboss.osgi.deployment>0.0.1-SNAPSHOT</version.jboss.osgi.deployment>
- <version.ops4j.pax.web>0.7.1</version.ops4j.pax.web>
+ <version.ops4j.pax.web>0.7.2-20091021.163357-3</version.ops4j.pax.web>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -124,4 +124,16 @@
</plugins>
</build>
+ <!-- Repositories -->
+ <repositories>
+ <repository>
+ <id>ops4j.snapshots</id>
+ <name>The OPS4J Snapshot Repository</name>
+ <url>http://repository.ops4j.org/mvn-snapshots/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
</project>
16 years, 2 months
JBoss-OSGI SVN: r95452 - in projects/jboss-osgi/projects/bundles: jboss-vfs/trunk and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-22 18:49:21 -0400 (Thu, 22 Oct 2009)
New Revision: 95452
Modified:
projects/jboss-osgi/projects/bundles/jboss-common-core/trunk/pom.xml
projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/pom.xml
projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
Log:
Use proper version ranges
Modified: projects/jboss-osgi/projects/bundles/jboss-common-core/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-common-core/trunk/pom.xml 2009-10-22 22:32:34 UTC (rev 95451)
+++ projects/jboss-osgi/projects/bundles/jboss-common-core/trunk/pom.xml 2009-10-22 22:49:21 UTC (rev 95452)
@@ -14,22 +14,30 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Bundles - Common Core</name>
+ <name>JBossOSGi Bundles - JBoss Common Core</name>
<description>A JBossOSGi provided JBoss Common Core bundle</description>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-common-core</artifactId>
<packaging>bundle</packaging>
- <version>2.2-SNAPSHOT</version>
+ <version>2.2.13-SNAPSHOT</version>
<!-- Parent -->
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.2</version>
+ <version>1.0.4-SNAPSHOT</version>
</parent>
+ <!-- Subversion -->
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/projects/bundles/jbo...</developerConnection>
+ <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
+ </scm>
+
+ <!-- Properties -->
<properties>
<version.jboss.common.core>2.2.13.GA</version.jboss.common.core>
</properties>
@@ -61,7 +69,7 @@
org.xml.sax*,
<!-- import -->
- org.jboss.logging,
+ org.jboss.logging;version="[2.0,2.1)",
<!-- ignore -->
!org.apache.commons.httpclient,
@@ -81,10 +89,4 @@
</plugins>
</build>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/tags/j...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/tags/jbos...</developerConnection>
- <url>http://fisheye.jboss.com/qsearch/JBossOSGi/tags/jboss-osgi-common-core-2....</url>
- </scm>
</project>
Modified: projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/pom.xml 2009-10-22 22:32:34 UTC (rev 95451)
+++ projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/pom.xml 2009-10-22 22:49:21 UTC (rev 95452)
@@ -59,12 +59,12 @@
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Import-Package>
- org.jboss.logging;version=2.0,
- org.jboss.util;version=2.2,
- org.jboss.util.builder;version=2.2,
- org.jboss.util.collection;version=2.2,
- org.jboss.util.file;version=2.2,
- org.jboss.util.id;version=2.2,
+ org.jboss.logging;version="[2.0,2.1)",
+ org.jboss.util;version="[2.2,2.3)",
+ org.jboss.util.builder;version="[2.2,2.3)",
+ org.jboss.util.collection;version="[2.2,2.3)",
+ org.jboss.util.file;version="[2.2,2.3)",
+ org.jboss.util.id;version="[2.2,2.3)",
org.xml.sax
</Import-Package>
<Embed-Transitive>true</Embed-Transitive>
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-10-22 22:32:34 UTC (rev 95451)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-10-22 22:49:21 UTC (rev 95452)
@@ -21,7 +21,7 @@
<artifactId>jboss-osgi-microcontainer</artifactId>
<packaging>bundle</packaging>
- <version>1.0.3-SNAPSHOT</version>
+ <version>2.0.9-SNAPSHOT</version>
<!-- Parent -->
<parent>
16 years, 2 months
JBoss-OSGI SVN: r95450 - in projects/jboss-osgi/projects/bundles: jboss-vfs and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-22 18:25:57 -0400 (Thu, 22 Oct 2009)
New Revision: 95450
Added:
projects/jboss-osgi/projects/bundles/jboss-vfs/
projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/
Removed:
projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/src/main/java/org/jboss/osgi/jbossxb/
projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/src/main/resources/META-INF/
Modified:
projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/pom.xml
Log:
Add jboss-vfs
Copied: projects/jboss-osgi/projects/bundles/jboss-vfs/trunk (from rev 95449, projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk)
Modified: projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jboss-xml-binding/trunk/pom.xml 2009-10-22 21:59:40 UTC (rev 95449)
+++ projects/jboss-osgi/projects/bundles/jboss-vfs/trunk/pom.xml 2009-10-22 22:25:57 UTC (rev 95450)
@@ -14,62 +14,40 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Bundles - JBossXB</name>
- <description>A JBossOSGi provided JBossXB bundle</description>
+ <name>JBossOSGi Bundles - VFS</name>
+ <description>A JBossOSGi provided Virtual File System</description>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-xml-binding</artifactId>
+ <artifactId>jboss-osgi-vfs</artifactId>
<packaging>bundle</packaging>
- <version>2.0-SNAPSHOT</version>
+ <version>2.1.3-SNAPSHOT</version>
<!-- Parent -->
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.3-SNAPSHOT</version>
+ <version>1.0.4-SNAPSHOT</version>
</parent>
+ <!-- Subversion -->
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
+ <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
+ </scm>
+
<!-- Properties -->
<properties>
- <version.jboss.xb>2.0.1.GA</version.jboss.xb>
- <version.javassist>3.9.0.GA</version.javassist>
- <version.jboss.osgi.jaxb>2.1.10.SP2</version.jboss.osgi.jaxb>
- <version.jboss.reflect>2.0.0.GA</version.jboss.reflect>
- <version.osgi>r4v42</version.osgi>
+ <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
</properties>
<dependencies>
<dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jaxb</artifactId>
- <version>${version.jboss.osgi.jaxb}</version>
- </dependency>
-
- <dependency>
<groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <version>${version.jboss.xb}</version>
+ <artifactId>jboss-vfs</artifactId>
+ <version>${version.jboss.vfs}</version>
</dependency>
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>${version.javassist}</version>
- </dependency>
-
- <!-- Provided Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
@@ -80,50 +58,21 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.jbossxb.internal.XMLBindingActivator</Bundle-Activator>
- <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
- <Embed-Transitive>true</Embed-Transitive>
- <Export-Package>
- org.jboss.osgi.jbossxb;version=${version}
- </Export-Package>
<Import-Package>
- <!-- system -->
- javax.activation,
- javax.xml.bind.*,
- javax.xml.namespace,
- javax.xml.parsers,
- org.w3c.dom*,
- org.xml.sax*,
-
- <!-- import -->
- com.wutka.dtd,
- org.apache.xerces.*,
- org.jboss.logging,
- org.jboss.osgi.common.log;version=1.0,
- org.jboss.osgi.jaxb;version=1.0,
- org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.service;version=1.0,
- org.jboss.util*,
- org.osgi.framework,
- org.osgi.service.log,
- org.osgi.util.tracker,
-
- <!-- ignore -->
- !com.sun.jdi*
+ org.jboss.logging;version=2.0,
+ org.jboss.util;version=2.2,
+ org.jboss.util.builder;version=2.2,
+ org.jboss.util.collection;version=2.2,
+ org.jboss.util.file;version=2.2,
+ org.jboss.util.id;version=2.2,
+ org.xml.sax
</Import-Package>
+ <Embed-Transitive>true</Embed-Transitive>
<Embed-Dependency>
- javassist;inline=false,
- jbossxb;inline=false,
- jboss-reflect;inline=false,
+ jboss-vfs;inline=false,
</Embed-Dependency>
<_exportcontents>
- org.jboss.beans.info.*;version=${version.jboss.reflect},
- org.jboss.config.*;version=${version.jboss.reflect},
- org.jboss.classadapter.*;version=${version.jboss.reflect},
- org.jboss.joinpoint.*;version=${version.jboss.reflect},
- org.jboss.reflect*;version=${version.jboss.reflect},
- org.jboss.xb.*;version=${version.jboss.xb},
- javassist*;version=${version.javassist},
+ org.jboss.virtual;version=${version.jboss.vfs},
</_exportcontents>
</instructions>
</configuration>
@@ -131,11 +80,4 @@
</plugins>
</build>
- <!-- Subversion -->
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
- <url>http://fisheye.jboss.com/qsearch/JBossOSGi/projects/bundles/xml-binding/t...</url>
- </scm>
-
</project>
16 years, 2 months
JBoss-OSGI SVN: r95429 - in projects/jboss-osgi/projects/runtime: equinox/trunk/src/main/java/org/jboss/osgi/equinox and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-22 13:01:01 -0400 (Thu, 22 Oct 2009)
New Revision: 95429
Modified:
projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
Log:
Log version info on runtime bootstrap
Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml 2009-10-22 16:42:48 UTC (rev 95428)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/pom.xml 2009-10-22 17:01:01 UTC (rev 95429)
@@ -14,7 +14,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Runtime Equinox</name>
+ <name>JBossOSGi Equinox</name>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-equinox</artifactId>
Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java 2009-10-22 16:42:48 UTC (rev 95428)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java 2009-10-22 17:01:01 UTC (rev 95429)
@@ -23,9 +23,13 @@
//$Id$
+import java.net.URL;
+
import org.jboss.osgi.deployment.DeploymentActivator;
import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A bootstrap provider for Equinox.
@@ -35,9 +39,23 @@
*/
public class EquinoxBootstrapProvider extends PropertiesBootstrapProvider
{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(EquinoxBootstrapProvider.class);
+
private DeploymentActivator deploymentActivator;
@Override
+ public void configure(URL urlConfig)
+ {
+ super.configure(urlConfig);
+
+ // Log INFO about this implementation
+ String implTitle = getClass().getPackage().getImplementationTitle();
+ String impVersion = getClass().getPackage().getImplementationVersion();
+ log.info(implTitle + " - " + impVersion);
+ }
+
+ @Override
protected void registerSystemServices(BundleContext context)
{
deploymentActivator = new DeploymentActivator();
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml 2009-10-22 16:42:48 UTC (rev 95428)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml 2009-10-22 17:01:01 UTC (rev 95429)
@@ -14,7 +14,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Runtime Felix</name>
+ <name>JBossOSGi Felix</name>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java 2009-10-22 16:42:48 UTC (rev 95428)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java 2009-10-22 17:01:01 UTC (rev 95429)
@@ -23,10 +23,14 @@
//$Id$
+import java.net.URL;
+
import org.jboss.osgi.deployment.DeploymentActivator;
import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.launch.Framework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A bootstrap provider for Felix.
@@ -36,9 +40,23 @@
*/
public class FelixBootstrapProvider extends PropertiesBootstrapProvider
{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(FelixBootstrapProvider.class);
+
private DeploymentActivator deploymentActivator;
@Override
+ public void configure(URL urlConfig)
+ {
+ super.configure(urlConfig);
+
+ // Log INFO about this implementation
+ String implTitle = getClass().getPackage().getImplementationTitle();
+ String impVersion = getClass().getPackage().getImplementationVersion();
+ log.info(implTitle + " - " + impVersion);
+ }
+
+ @Override
public Framework getFramework()
{
Framework framework = super.getFramework();
16 years, 2 months
JBoss-OSGI SVN: r95428 - projects/jboss-osgi/projects/runtime/felix/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-22 12:42:48 -0400 (Thu, 22 Oct 2009)
New Revision: 95428
Modified:
projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
Log:
Use org.osgi.core-4.2.0
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml 2009-10-22 16:29:58 UTC (rev 95427)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/pom.xml 2009-10-22 16:42:48 UTC (rev 95428)
@@ -41,6 +41,7 @@
<version.jboss.osgi.deployment>0.0.1-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.testing>0.0.1-SNAPSHOT</version.jboss.osgi.testing>
+ <version.osgi>4.2.0</version.osgi>
</properties>
<!-- Dependencies -->
@@ -60,7 +61,27 @@
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>${version.felix.framework}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
<dependency>
<groupId>org.jboss.osgi</groupId>
16 years, 2 months