[jboss-svn-commits] JBL Code SVN: r23473 - in labs/jbossesb/workspace/skeagh: container/osgi/runtime and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Oct 16 06:32:18 EDT 2008
Author: tfennelly
Date: 2008-10-16 06:32:18 -0400 (Thu, 16 Oct 2008)
New Revision: 23473
Added:
labs/jbossesb/workspace/skeagh/container/osgi/api/
labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
labs/jbossesb/workspace/skeagh/container/osgi/runtime/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/osgi.bnd
labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/BundleResourceLocator.java
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/EsbServiceDeploymentActivator.java
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/package.html
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/resources/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/test/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/test/java/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/test/java/org/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/test/java/org/jboss/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/test/java/org/jboss/esb/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/test/java/org/jboss/esb/osgi/
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/test/resources/
labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties
Removed:
labs/jbossesb/workspace/skeagh/container/osgi/osgi.bnd
labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
labs/jbossesb/workspace/skeagh/container/osgi/src/
Modified:
labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml
Log:
Rejigging some of the OSGi stuff
Deleted: labs/jbossesb/workspace/skeagh/container/osgi/osgi.bnd
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/osgi.bnd 2008-10-16 10:09:30 UTC (rev 23472)
+++ labs/jbossesb/workspace/skeagh/container/osgi/osgi.bnd 2008-10-16 10:32:18 UTC (rev 23473)
@@ -1,45 +0,0 @@
-#-----------------------------------------------------------------
-# Use this file to add customized Bnd instructions for the bundle
-#
-# We need to sort out a package clash with the routing package. It's
-# in both the api and runtime modules. Rename the runtime package
-# to "invoke".
-#
-#-----------------------------------------------------------------
-
-# TODO: Create an API bundle and export these packages from there.
-Export-Package: org.jboss.esb.test,\
- org.jboss.esb.annotations, \
- org.jboss.esb.context, \
- org.jboss.esb.routing, \
- org.jboss.esb.exception, \
- org.jboss.esb.service, \
- org.jboss.esb.message
-Private-Package: org.jboss.esb.osgi
-
-# TODO: Replace global import with explicit package imports?
-Import-Package: *;resolution:=optional
-
-Bundle-Activator: org.jboss.esb.osgi.EsbServiceDeploymentActivator
-
-Embed-Dependency: quartz,\
- xpp3_min, \
- xstream, \
- freemarker,\
- hsqldb, \
- jbossesb-commons, \
- jbossesb-api-service, \
- jbossesb-api-routing, \
- jbossesb-rt, \
- mvel, \
- milyn-commons, \
- milyn-smooks-core, \
- milyn-smooks-javabean, \
- backport, \
- commons-lang, \
- commons-logging, \
- log4j
-
-Embed-Transitive: true
-
-
Deleted: labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/pom.xml 2008-10-16 10:09:30 UTC (rev 23472)
+++ labs/jbossesb/workspace/skeagh/container/osgi/pom.xml 2008-10-16 10:32:18 UTC (rev 23473)
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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>
- <parent>
- <groupId>jboss.jbossesb</groupId>
- <artifactId>container</artifactId>
- <version>5.0-SNAPSHOT</version>
- </parent>
- <groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-container-osgi</artifactId>
- <packaging>bundle</packaging>
- <version>${jboss.esb.version}</version>
- <name>JBoss ESB OSGi</name>
- <url>http://www.jboss.org/jbossesb/</url>
-
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi_R4_core</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-routing-jms</artifactId>
- <version>${jboss.esb.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <version>1.1</version>
- </dependency>
- </dependencies>
-
-</project>
Added: labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/pom.xml 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>container</artifactId>
+ <version>5.0-SNAPSHOT</version>
+ </parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi</artifactId>
+ <version>5.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss ESB OSGi (Base POM)</name>
+ <url>http://www.jboss.org/jbossesb/</url>
+
+ <modules>
+ <module>runtime</module>
+ </modules>
+
+</project>
Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/osgi.bnd
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/osgi.bnd (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/osgi.bnd 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,45 @@
+#-----------------------------------------------------------------
+# Use this file to add customized Bnd instructions for the bundle
+#
+# We need to sort out a package clash with the routing package. It's
+# in both the api and runtime modules. Rename the runtime package
+# to "invoke".
+#
+#-----------------------------------------------------------------
+
+# TODO: Create an API bundle and export these packages from there.
+Export-Package: org.jboss.esb.test,\
+ org.jboss.esb.annotations, \
+ org.jboss.esb.context, \
+ org.jboss.esb.routing, \
+ org.jboss.esb.exception, \
+ org.jboss.esb.service, \
+ org.jboss.esb.message
+Private-Package: org.jboss.esb.osgi
+
+# TODO: Replace global import with explicit package imports?
+Import-Package: *;resolution:=optional
+
+Bundle-Activator: org.jboss.esb.osgi.EsbServiceDeploymentActivator
+
+Embed-Dependency: quartz,\
+ xpp3_min, \
+ xstream, \
+ freemarker,\
+ hsqldb, \
+ jbossesb-commons, \
+ jbossesb-api-service, \
+ jbossesb-api-routing, \
+ jbossesb-rt, \
+ mvel, \
+ milyn-commons, \
+ milyn-smooks-core, \
+ milyn-smooks-javabean, \
+ backport, \
+ commons-lang, \
+ commons-logging, \
+ log4j
+
+Embed-Transitive: true
+
+
Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi</artifactId>
+ <version>5.0-SNAPSHOT</version>
+ </parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-osgi-runtime</artifactId>
+ <packaging>bundle</packaging>
+ <version>${jboss.esb.version}</version>
+ <name>JBoss ESB OSGi Runtime</name>
+ <url>http://www.jboss.org/jbossesb/</url>
+
+</project>
Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/BundleResourceLocator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/BundleResourceLocator.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/BundleResourceLocator.java 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.esb.osgi;
+
+import org.jboss.esb.classpath.ClassUtil;
+import org.jboss.esb.context.ResourceLocator;
+import org.osgi.framework.Bundle;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+/**
+ * BundleResourceLocator is an OSGi implementation of ResourceLocator.
+ * <p/>
+ * This locator will look for and load resources by first looking in
+ * the bundles classpath. Does this violate the OSGi classloading?
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class BundleResourceLocator implements ResourceLocator
+{
+ /**
+ * The OSGi BundleContext instance.
+ */
+ private final Bundle bundle;
+ /**
+ * Bundle ClassLoader.
+ */
+ private BundleClassLoader classLoader;
+
+ /**
+ * Creates and instance and stores the passed-in BundleContext.
+ *
+ * @param bundle - the OSGi Bundle.
+ */
+ public BundleResourceLocator(final Bundle bundle)
+ {
+ this.bundle = bundle;
+ classLoader = new BundleClassLoader(bundle, getClass().getClassLoader());
+ }
+
+ /**
+ * Load the specified class. Ignores the callers classloader.
+ *
+ * @param className The name of the class to load.
+ * @param caller The class of the caller. Ignored
+ * @return Class The specified class.
+ * @throws ClassNotFoundException If the class cannot be found.
+ */
+ public final Class<?> forName(final String className, final Class<?> caller) throws ClassNotFoundException
+ {
+ try
+ {
+ return forName(className);
+ }
+ catch (final ClassNotFoundException e)
+ {
+ // fallback to normal classloading
+ return ClassUtil.forName(className, caller);
+ }
+ }
+
+ /**
+ * Load the specified class.
+ *
+ * @param className The name of the class to load.
+ * @return Class The specified class.
+ * @throws ClassNotFoundException If the class cannot be found.
+ */
+ public final Class<?> forName(final String className) throws ClassNotFoundException
+ {
+ return bundle.loadClass(className);
+ }
+
+ /**
+ * Get a resource from the callers classpath.
+ *
+ * @param resourceName - the name of the resource to be retrieved.
+ * @param caller - the class of the caller. The classes classloader will be used to search for the resource.
+ *
+ * @return InputStream - the InputStream for the resource.
+ */
+ public final InputStream getResourceAsStream(final String resourceName, final Class<?> caller)
+ {
+ final URL entry = bundle.getEntry(resourceName);
+ if (entry != null)
+ {
+ try
+ {
+ return entry.openStream();
+ }
+ catch (final IOException ignore)
+ {
+ ignore.printStackTrace();
+ // ignore. Will fallback to normal classloading
+ }
+ }
+ return ClassUtil.getResourceAsStream(resourceName, caller);
+ }
+
+ /**
+ * Get the underlying classloader.
+ * @return The underlying ClassLoader.
+ */
+ public final ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
+
+ /**
+ * Bundle ClassLoader.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ public class BundleClassLoader extends ClassLoader
+ {
+ private Bundle bundle;
+
+ public BundleClassLoader(final Bundle bundle, final ClassLoader parent)
+ {
+ super(parent);
+ this.bundle = bundle;
+ }
+
+ protected Class<?> findClass(String name) throws ClassNotFoundException
+ {
+ return bundle.loadClass(name);
+ }
+
+ protected URL findResource(String name)
+ {
+ return bundle.getResource(name);
+ }
+
+ protected Enumeration<URL> findResources(String name) throws IOException
+ {
+ return bundle.getResources(name);
+ }
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/BundleResourceLocator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,180 @@
+package org.jboss.esb.osgi;
+
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.jboss.esb.deploy.DeploymentException;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.osgi.framework.Bundle;
+
+/**
+ * DeploymentRegistry keeps tracks of deployed runtimes.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class DeploymentRegistry
+{
+ /**
+ * Default name of the config file.
+ */
+ private static final String DEFAULT_CONFIG_FILENAME = "/jboss-esb.xml";
+
+ /**
+ * Header that can be placed in the MANIFEST.MF file to
+ * specify a different config file name then the default one.
+ */
+ private static final String CONFIG_FILE_HEADER = "JBossESB-ConfigFile";
+
+ /**
+ * Header that can be placed in the MANIFEST.MF file to
+ * specify a different deployment name then the default, which
+ * is the bundle name.
+ */
+ private static final String DEPLOYMENT_NAME_HEADER = "JBossESB-DeploymentName";
+
+ /**
+ * Set of activated deployments.
+ */
+ private HashMap<Bundle,DeploymentRuntime> activated = new HashMap<Bundle,DeploymentRuntime>();
+
+ /**
+ * Unregisters the DeploymentRuntime.
+ *
+ * @param bundle The bundle to register.
+ */
+ public final void register(final Bundle bundle)
+ {
+ synchronized (activated)
+ {
+ if (activated.containsKey(bundle))
+ {
+ // already registered. Don't need to do anything
+ return;
+ }
+ }
+
+ final URL configUrl = getEsbConfigFile(bundle);
+ if (configUrl == null)
+ {
+ return;
+ }
+
+ try
+ {
+ //TODO: Use logging service
+ System.out.println("Found config : " + configUrl + " for bundle : " + bundle);
+ DeploymentRuntime runtime = DeploymentUtil.createRuntime(configUrl.openStream(), new BundleResourceLocator(bundle));
+ runtime.setDeploymentName(getDeploymentName(bundle));
+ runtime.deploy();
+
+ synchronized (activated)
+ {
+ activated.put(bundle, runtime);
+ }
+ }
+ catch (final Throwable t)
+ {
+ //TODO: add exception handling.
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ * Unregisters the DeploymentRuntime.
+ *
+ * @param bundle the bundle.
+ */
+ public final void unregister(final Bundle bundle)
+ {
+ //TODO: Use logging service
+ System.out.println("unregister bundle: " + bundle);
+ synchronized (activated)
+ {
+ if (!activated.containsKey(bundle))
+ {
+ return;
+ }
+
+ final DeploymentRuntime deploymentRuntime = activated.get(bundle);
+ try
+ {
+ deploymentRuntime.undeploy();
+ }
+ catch (DeploymentException e)
+ {
+ //TODO: Handle exception.
+ e.printStackTrace();
+ }
+ finally
+ {
+ activated.remove(bundle);
+ }
+ }
+ }
+
+ /**
+ * Gets the Esb configuration file from the bundle.
+ *
+ * @param bundle The Bundle being activated.
+ * @return URL URL to the configuration file.
+ *
+ */
+ private URL getEsbConfigFile(final Bundle bundle)
+ {
+ String configFileName = (String) getHeader(bundle, CONFIG_FILE_HEADER);
+ if (configFileName == null)
+ {
+ configFileName = DEFAULT_CONFIG_FILENAME;
+ }
+ return bundle.getEntry(configFileName);
+ }
+
+ /**
+ * Get the deployment name from the MANIFEST header {@link DeploymentRegistry#DEPLOYMENT_NAME_HEADER}.
+ * If that header has not been set the deployment name will be set to the bundles sympolic name.
+ *
+ * @param bundle The current bundle
+ * @return String The name of the deployment. Either the value of the deployement header or the bundles sympolic name
+ */
+ private String getDeploymentName(final Bundle bundle)
+ {
+ String deploymentName = (String) getHeader(bundle, DEPLOYMENT_NAME_HEADER);
+ if (deploymentName == null)
+ {
+ deploymentName = bundle.getSymbolicName();
+ }
+ return deploymentName;
+ }
+
+ /**
+ * Get the the specified header from the passed in bundle.
+ *
+ * @param from The Bundle to retrieve the header from.
+ * @param headerName The header name
+ * @return String The value of the header of null if the header has not been set.
+ */
+ private String getHeader(final Bundle from, final String headerName)
+ {
+ final Dictionary<?,?> headers = from.getHeaders();
+ return (String) headers.get(headerName);
+ }
+
+ /**
+ * Close this registry.
+ */
+ public final void close()
+ {
+ Set<Bundle> keySet = activated.keySet();
+ for (Bundle bundle : keySet)
+ {
+ unregister(bundle);
+ }
+ }
+}
+
+
Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/EsbServiceDeploymentActivator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/EsbServiceDeploymentActivator.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/EsbServiceDeploymentActivator.java 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors 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.esb.osgi;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * EsbServiceDeploymentActivator is an OSGi Activator that takes care
+ * registering the EsbServiceDeployer service.
+ * <p>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class EsbServiceDeploymentActivator implements BundleActivator, BundleListener
+{
+ /**
+ * The BundleContext for this listener.
+ */
+ private BundleContext bundleContext;
+
+ /**
+ * Registry that hold the DeploymentRuntimes.
+ */
+ private DeploymentRegistry registry = new DeploymentRegistry();
+
+ /**
+ * Log service.
+ */
+ private LogService log;
+
+ /**
+ * Activation method that will be called by the Service Component Runtime.
+ * @param cc The ComponentContext.
+ */
+ public final void activate(final ComponentContext cc)
+ {
+ System.out.println("activate...ContextClassLoader : " + Thread.currentThread().getContextClassLoader());
+ this.bundleContext = cc.getBundleContext();
+ System.out.println("activate...bundleClassLoader : " + getClass().getClassLoader());
+ log.log(LogService.LOG_DEBUG, "activate....");
+
+ bundleContext.addBundleListener(this);
+
+ // get all the currently installed bundles.
+ final Bundle[] bundles = bundleContext.getBundles();
+ for (Bundle bundle : bundles)
+ {
+ if ((bundle.getState() & (Bundle.STARTING | Bundle.ACTIVE)) != 0)
+ {
+ // register the bundles that are esb bundles.
+ registry.register(bundle);
+ }
+ }
+ }
+
+ /**
+ * Called when the OSGi Component Runtime notifies about
+ * changed bundles.
+ *
+ * @param event The event that occured. This method only handles STARTED and STOPPED events.
+ */
+ public final void bundleChanged(final BundleEvent event)
+ {
+ switch (event.getType())
+ {
+ case BundleEvent.STARTED:
+ registry.register(event.getBundle());
+ break;
+
+ case BundleEvent.STOPPED:
+ registry.unregister(event.getBundle());
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Starts the bundle.
+ * Will add this instance as a bundle listener, and register any bundles
+ * containing an esb configuration file.
+ *
+ * @param context The bundle context.
+ * @throws Exception If an exception occurs during startup.
+ */
+ public final void start(final BundleContext context) throws Exception
+ {
+ this.bundleContext = context;
+
+ context.addBundleListener(this);
+
+ // get all the currently installed bundles.
+ final Bundle[] bundles = context.getBundles();
+ for (final Bundle bundle : bundles)
+ {
+ if ((bundle.getState() & (Bundle.STARTING | Bundle.ACTIVE)) != 0)
+ {
+ // register and deploy the bundles that are esb bundles.
+ registry.register(bundle);
+ }
+ }
+ }
+
+ /**
+ * Stops this bundle.
+ * Will close the underlying registry of DeploymentRuntime, going
+ * through them and undeploying them.
+ *
+ * @param unused The bundle context.
+ * @throws Exception If an exception occurs during startup.
+ */
+ public final void stop(final BundleContext unused) throws Exception
+ {
+ registry.close();
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/EsbServiceDeploymentActivator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/package.html
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/package.html 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+OSGi Handling.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties 2008-10-16 10:32:18 UTC (rev 23473)
@@ -0,0 +1,484 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.4.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.1.0, \
+ org.osgi.service.url; version=1.0.0, \
+ org.osgi.util.tracker; version=1.3.3 \
+ ${jre-${java.specification.version}}
+
+m2.path=${user.home}/.m2/repository
+apache.m2.path=${m2.path}/org/apache
+jbossesb.m2.path=${m2.path}/jboss/jbossesb
+
+#org.osgi.framework.bootdelegation=sun.*,com.sun.*
+#felix.cache.profile=foo
+felix.auto.start.1= \
+ "file:${apache.m2.path}/felix/org.apache.felix.shell/1.0.2/org.apache.felix.shell-1.0.2.jar" \
+ "file:${apache.m2.path}/felix/org.apache.felix.shell.tui/1.0.2/org.apache.felix.shell.tui-1.0.2.jar" \
+ "file:${apache.m2.path}/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar" \
+ "file:${jbossesb.m2.path}/jbossesb-osgi-runtime/5.0-SNAPSHOT/jbossesb-osgi-runtime-5.0-SNAPSHOT.jar" \
+ "file:${jbossesb.m2.path}/jbossesb-routing-jms/5.0-SNAPSHOT/jbossesb-routing-jms-5.0-SNAPSHOT.jar" \
+ "file:${jbossesb.m2.path}/jbossesb-examples-helloworld/5.0-SNAPSHOT/jbossesb-examples-helloworld-5.0-SNAPSHOT.jar"
+
+felix.log.level=1
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+#felix.service.urlhandlers=false
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+osgi.shell.telnet=on
+obr.repository.url=http://felix.apache.org/obr/releases.xml
+
+
+#
+# Java platform package export properties.
+#
+jre-1.3=, \
+ javax.accessibility; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ version="1.3.0"
+
+jre-1.4=, \
+ javax.accessibility; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml.parsers; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stream; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.4.0"
+
+jre-1.5=, \
+ javax.accessibility; \
+ javax.activity; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version="1.5.0"
+
+jre-1.6=, \
+ javax.accessibility; \
+ javax.activation; \
+ javax.activity; \
+ javax.annotation; \
+ javax.annotation.processing; \
+ javax.crypto; \
+ javax.crypto.interfaces; \
+ javax.crypto.spec; \
+ javax.imageio; \
+ javax.imageio.event; \
+ javax.imageio.metadata; \
+ javax.imageio.plugins.bmp; \
+ javax.imageio.plugins.jpeg; \
+ javax.imageio.spi; \
+ javax.imageio.stream; \
+ javax.jws; \
+ javax.jws.soap; \
+ javax.lang.model; \
+ javax.lang.model.element; \
+ javax.lang.model.type; \
+ javax.lang.model.util; \
+ javax.management; \
+ javax.management.loading; \
+ javax.management.modelmbean; \
+ javax.management.monitor; \
+ javax.management.openmbean; \
+ javax.management.relation; \
+ javax.management.remote; \
+ javax.management.remote.rmi; \
+ javax.management.timer; \
+ javax.naming; \
+ javax.naming.directory; \
+ javax.naming.event; \
+ javax.naming.ldap; \
+ javax.naming.spi; \
+ javax.net; \
+ javax.net.ssl; \
+ javax.print; \
+ javax.print.attribute; \
+ javax.print.attribute.standard; \
+ javax.print.event; \
+ javax.rmi; \
+ javax.rmi.CORBA; \
+ javax.rmi.ssl; \
+ javax.script; \
+ javax.security.auth; \
+ javax.security.auth.callback; \
+ javax.security.auth.kerberos; \
+ javax.security.auth.login; \
+ javax.security.auth.spi; \
+ javax.security.auth.x500; \
+ javax.security.cert; \
+ javax.security.sasl; \
+ javax.sound.midi; \
+ javax.sound.midi.spi; \
+ javax.sound.sampled; \
+ javax.sound.sampled.spi; \
+ javax.sql; \
+ javax.sql.rowset; \
+ javax.sql.rowset.serial; \
+ javax.sql.rowset.spi; \
+ javax.swing; \
+ javax.swing.border; \
+ javax.swing.colorchooser; \
+ javax.swing.event; \
+ javax.swing.filechooser; \
+ javax.swing.plaf; \
+ javax.swing.plaf.basic; \
+ javax.swing.plaf.metal; \
+ javax.swing.plaf.multi; \
+ javax.swing.plaf.synth; \
+ javax.swing.table; \
+ javax.swing.text; \
+ javax.swing.text.html; \
+ javax.swing.text.html.parser; \
+ javax.swing.text.rtf; \
+ javax.swing.tree; \
+ javax.swing.undo; \
+ javax.tools; \
+ javax.transaction; \
+ javax.transaction.xa; \
+ javax.xml; \
+ javax.xml.bind; \
+ javax.xml.bind.annotation; \
+ javax.xml.bind.annotation.adapters; \
+ javax.xml.bind.attachment; \
+ javax.xml.bind.helpers; \
+ javax.xml.bind.util; \
+ javax.xml.crypto; \
+ javax.xml.crypto.dom; \
+ javax.xml.crypto.dsig; \
+ javax.xml.crypto.dsig.dom; \
+ javax.xml.crypto.dsig.keyinfo; \
+ javax.xml.crypto.dsig.spec; \
+ javax.xml.datatype; \
+ javax.xml.namespace; \
+ javax.xml.parsers; \
+ javax.xml.soap; \
+ javax.xml.stream; \
+ javax.xml.stream.events; \
+ javax.xml.stream.util; \
+ javax.xml.transform; \
+ javax.xml.transform.dom; \
+ javax.xml.transform.sax; \
+ javax.xml.transform.stax; \
+ javax.xml.transform.stream; \
+ javax.xml.validation; \
+ javax.xml.ws; \
+ javax.xml.ws.handler; \
+ javax.xml.ws.handler.soap; \
+ javax.xml.ws.http; \
+ javax.xml.ws.soap; \
+ javax.xml.ws.spi; \
+ javax.xml.xpath; \
+ org.ietf.jgss; \
+ org.omg.CORBA; \
+ org.omg.CORBA_2_3; \
+ org.omg.CORBA_2_3.portable; \
+ org.omg.CORBA.DynAnyPackage; \
+ org.omg.CORBA.ORBPackage; \
+ org.omg.CORBA.portable; \
+ org.omg.CORBA.TypeCodePackage; \
+ org.omg.CosNaming; \
+ org.omg.CosNaming.NamingContextExtPackage; \
+ org.omg.CosNaming.NamingContextPackage; \
+ org.omg.Dynamic; \
+ org.omg.DynamicAny; \
+ org.omg.DynamicAny.DynAnyFactoryPackage; \
+ org.omg.DynamicAny.DynAnyPackage; \
+ org.omg.IOP; \
+ org.omg.IOP.CodecFactoryPackage; \
+ org.omg.IOP.CodecPackage; \
+ org.omg.Messaging; \
+ org.omg.PortableInterceptor; \
+ org.omg.PortableInterceptor.ORBInitInfoPackage; \
+ org.omg.PortableServer; \
+ org.omg.PortableServer.CurrentPackage; \
+ org.omg.PortableServer.POAManagerPackage; \
+ org.omg.PortableServer.POAPackage; \
+ org.omg.PortableServer.portable; \
+ org.omg.PortableServer.ServantLocatorPackage; \
+ org.omg.SendingContext; \
+ org.omg.stub.java.rmi; \
+ org.omg.stub.javax.management.remote.rmi; \
+ org.w3c.dom; \
+ org.w3c.dom.bootstrap; \
+ org.w3c.dom.css; \
+ org.w3c.dom.events; \
+ org.w3c.dom.html; \
+ org.w3c.dom.ls; \
+ org.w3c.dom.ranges; \
+ org.w3c.dom.stylesheets; \
+ org.w3c.dom.traversal; \
+ org.w3c.dom.views; \
+ org.w3c.dom.xpath; \
+ org.xml.sax; \
+ org.xml.sax.ext; \
+ org.xml.sax.helpers; \
+ version=\"1.6.0\"
Property changes on: labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml 2008-10-16 10:09:30 UTC (rev 23472)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml 2008-10-16 10:32:18 UTC (rev 23473)
@@ -103,7 +103,7 @@
<!-- JBossESB OSGi bundle -->
<dependency>
<groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-container-osgi</artifactId>
+ <artifactId>jbossesb-osgi-runtime</artifactId>
<version>${jboss.esb.version}</version>
</dependency>
More information about the jboss-svn-commits
mailing list