[jboss-svn-commits] JBL Code SVN: r24052 - in labs/jbossesb/workspace/skeagh: container/osgi and 16 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Nov 23 15:04:55 EST 2008


Author: tfennelly
Date: 2008-11-23 15:04:54 -0500 (Sun, 23 Nov 2008)
New Revision: 24052

Added:
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/
   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/
Removed:
   labs/jbossesb/workspace/skeagh/container/osgi/src/
Modified:
   labs/jbossesb/workspace/skeagh/container/
   labs/jbossesb/workspace/skeagh/container/osgi/
   labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
   labs/jbossesb/workspace/skeagh/examples/
   labs/jbossesb/workspace/skeagh/routing/
   labs/jbossesb/workspace/skeagh/runtime/
Log:
https://jira.jboss.org/jira/browse/JBESB-2182


Property changes on: labs/jbossesb/workspace/skeagh/container
___________________________________________________________________
Name: svn:ignore
   - container.iml

   + container.iml
*.iml



Property changes on: labs/jbossesb/workspace/skeagh/container/osgi
___________________________________________________________________
Name: svn:ignore
   - jbossesb-osgi-runtime.iml

   + jbossesb-osgi-runtime.iml
*.iml


Modified: labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/pom.xml	2008-11-23 19:39:02 UTC (rev 24051)
+++ labs/jbossesb/workspace/skeagh/container/osgi/pom.xml	2008-11-23 20:04:54 UTC (rev 24052)
@@ -8,12 +8,16 @@
         <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>
+    <artifactId>jbossesb-osgi</artifactId>
+    <packaging>pom</packaging>
+    <version>5.0-SNAPSHOT</version>
+    <name>JBoss ESB OSGi Container Modules (Base POM)</name>
     <url>http://www.jboss.org/jbossesb/</url>
 
+    <modules>
+        <module>runtime</module>
+    </modules>
+
     <dependencies>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -31,25 +35,4 @@
         </dependency>
     </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>1.4.0</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke</Export-Package>
-                        <Private-Package>org.jboss.esb.osgi</Private-Package>
-                        <Import-Package>org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
-                        <Bundle-Activator>org.jboss.esb.osgi.EsbServiceDeploymentActivator</Bundle-Activator>
-                        <Embed-Dependency>quartz, xpp3_min, xstream, freemarker, jbossesb-commons, jbossesb-rt, mvel, milyn-commons, milyn-smooks-core, milyn-smooks-javabean, commons-lang, commons-logging, log4j</Embed-Dependency>
-                        <Embed-Transitive>true</Embed-Transitive>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
 </project>


Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime
___________________________________________________________________
Name: svn:ignore
   + *.iml


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-11-23 20:04:54 UTC (rev 24052)
@@ -0,0 +1,38 @@
+<?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>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>1.4.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke</Export-Package>
+                        <Private-Package>org.jboss.esb.osgi</Private-Package>
+                        <Import-Package>org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
+                        <Bundle-Activator>org.jboss.esb.osgi.EsbServiceDeploymentActivator</Bundle-Activator>
+                        <Embed-Dependency>quartz, xpp3_min, xstream, freemarker, jbossesb-commons, jbossesb-rt, mvel, milyn-commons, milyn-smooks-core, milyn-smooks-javabean, commons-lang, commons-logging, log4j</Embed-Dependency>
+                        <Embed-Transitive>true</Embed-Transitive>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</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-11-23 20:04:54 UTC (rev 24052)
@@ -0,0 +1,190 @@
+/*
+ * 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.api.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
+    {
+        /**
+         * The OSGi Bundle associated with this ClassLoader.
+         */
+        private Bundle bundle;
+
+        /**
+         * Sole constructor.
+         *
+         * @param bundle The OSGi Bundle to associate with this ClassLoader.
+         * @param parent The ClassLoader that will be set as the parent of this ClassLoader.
+         */
+        public BundleClassLoader(final Bundle bundle, final ClassLoader parent)
+        {
+            super(parent);
+            this.bundle = bundle;
+        }
+
+        /**
+         *
+         *
+         * @param name The class to find.
+         * @return Class The Class.
+         * @throws ClassNotFoundException If the class cannot be found.
+         */
+        @Override
+        protected final Class<?> findClass(final String name) throws ClassNotFoundException
+        {
+            return bundle.loadClass(name);
+        }
+
+        /**
+         *
+         * @param name The class to find.
+         * @return URL The url to the resource.
+         */
+        @Override
+        protected final URL findResource(final String name)
+        {
+            return bundle.getResource(name);
+        }
+
+        /**
+         *
+         * @param name The class to find.
+         * @return Enumeration The urls found.
+         * @throws IOException If the resources cannot be located.
+         */
+        @Override
+        protected final Enumeration<URL> findResources(final 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-11-23 20:04:54 UTC (rev 24052)
@@ -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-11-23 20:04:54 UTC (rev 24052)
@@ -0,0 +1,132 @@
+/*
+ * 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;
+
+/**
+ * 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();
+
+    /**
+     * Activation method that will be called by the Service Component Runtime.
+     * @param cc The ComponentContext.
+     */
+    public final void activate(final ComponentContext cc)
+    {
+        this.bundleContext = cc.getBundleContext();
+
+        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-11-23 20:04:54 UTC (rev 24052)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+OSGi Handling.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/examples
___________________________________________________________________
Name: svn:ignore
   - examples.iml

   + examples.iml
*.iml



Property changes on: labs/jbossesb/workspace/skeagh/routing
___________________________________________________________________
Name: svn:ignore
   - routing.iml

   + routing.iml
*.iml



Property changes on: labs/jbossesb/workspace/skeagh/runtime
___________________________________________________________________
Name: svn:ignore
   - jbossesb-rt.iml

   + jbossesb-rt.iml
*.iml





More information about the jboss-svn-commits mailing list