[jboss-svn-commits] JBL Code SVN: r24129 - in labs/jbossesb/workspace/skeagh: container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus and 11 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 28 00:04:48 EST 2008


Author: tfennelly
Date: 2008-11-28 00:04:48 -0500 (Fri, 28 Nov 2008)
New Revision: 24129

Added:
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleResourceLocator.java
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/package.html
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentActivator.java
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/package.html
Removed:
   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/DeploymentActivator.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/package.html
Modified:
   labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java
   labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java
   labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/config/OsgiConfigUtil.java
   labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/config.properties
   labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml
   labs/jbossesb/workspace/skeagh/performance/src/test/java/org/jboss/esb/SimpleSoakTest.java
   labs/jbossesb/workspace/skeagh/routing/jms/pom.xml
   labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBusProvider.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusFactory.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2182

Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -19,6 +19,8 @@
  */
 package org.jboss.esb.api.bus;
 
+import org.jboss.esb.api.context.ResourceLocator;
+
 import java.util.Properties;
 
 /**
@@ -33,6 +35,10 @@
      */
     private Properties properties;
     /**
+     * Bus resource locator.
+     */
+    private ResourceLocator resourceLocator;
+    /**
      * Deployment name.
      */
     private String deploymentName;
@@ -110,6 +116,24 @@
     }
 
     /**
+     * Get the resource locator instance for the Bus implementation.
+     * @return The resource locator.
+     */
+    public final ResourceLocator getResourceLocator()
+    {
+        return resourceLocator;
+    }
+
+    /**
+     * Set the resource locator instance for the Bus implementation.
+     * @param resourceLocator The resource locator.
+     */
+    public final void setResourceLocator(final ResourceLocator resourceLocator)
+    {
+        this.resourceLocator = resourceLocator;
+    }
+
+    /**
      * Get the bus message listener.
      *
      * @return Message listener.
@@ -154,15 +178,15 @@
      */
     public final void assertIsConfigured() 
     {
-        if (getDeploymentName() == null)
+        if (deploymentName == null)
         {
             throw new IllegalStateException("'deploymentName' not set on Bus.");
         }
-        else if (getDeploymentId() == null)
+        else if (deploymentId == null)
         {
             throw new IllegalStateException("'deploymentId' not set on Bus.");
         }
-        else if (getProperties() == null)
+        else if (properties == null)
         {
             throw new IllegalStateException("'properties' not set on Bus.");
         }

Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -19,6 +19,7 @@
  */
 package org.jboss.esb.api.bus;
 
+import org.jboss.esb.api.context.ResourceLocator;
 import org.jboss.esb.api.routing.RoutingException;
 
 import java.util.Properties;
@@ -60,6 +61,12 @@
     void setProperties(Properties properties);
 
     /**
+     * Set the resource locator instance for the Bus implementation.
+     * @param resourceLocator The resource locator.
+     */
+    void setResourceLocator(ResourceLocator resourceLocator);
+
+    /**
      * Connect to the bus.
      *
      * @throws RoutingException Connection exception.

Modified: labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -22,6 +22,7 @@
 import org.jboss.esb.api.bus.BusProvider;
 import org.jboss.esb.jms.JmsBusProvider;
 import org.jboss.esb.osgi.bus.AbstractBusProviderActivator;
+import org.jboss.esb.osgi.bundle.BundleResourceLocator;
 import org.osgi.framework.BundleContext;
 
 import java.util.Properties;
@@ -43,7 +44,7 @@
     public void start(final BundleContext bundleContext) throws Exception
     {
         Properties busProperties = loadBusConfiguration("jmsbus.properties", bundleContext);
-        BusProvider busProvider = new JmsBusProvider(busProperties);
+        BusProvider busProvider = new JmsBusProvider(busProperties, new BundleResourceLocator(bundleContext.getBundle()));
 
         registerBusProviderService(busProvider, bundleContext);
     }

Modified: labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml	2008-11-28 05:04:48 UTC (rev 24129)
@@ -23,10 +23,10 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke,org.jboss.esb.osgi.bus,org.jboss.esb.osgi.config</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.DeploymentActivator</Bundle-Activator>
+                        <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke,org.jboss.esb.osgi*</Export-Package>
+                        <Private-Package>org.jboss.esb.osgi.deploy</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.deploy.DeploymentActivator</Bundle-Activator>
                         <Embed-Dependency>quartz, xpp3_min, xstream, freemarker, jbossesb-commons, jbossesb-runtime, mvel, milyn-commons, milyn-smooks-core, milyn-smooks-javabean, commons-lang, commons-logging, log4j</Embed-Dependency>
                         <Embed-Transitive>true</Embed-Transitive>
                     </instructions>

Deleted: 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	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/BundleResourceLocator.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -1,190 +0,0 @@
-/*
- * 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);
-        }
-    }
-}

Deleted: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentActivator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentActivator.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentActivator.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -1,123 +0,0 @@
-/*
- * 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.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.util.tracker.ServiceTracker;
-
-/**
- * ESB OSGi Deployment Activator.
- * <p/>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public class DeploymentActivator implements BundleActivator, BundleListener
-{
-    /**
-     * Registry that hold the DeploymentRuntimes.
-     */
-    private DeploymentRegistry registry;
-
-    /**
-     * Bus Provider Service Tracker.
-     */
-    private ServiceTracker serviceTracker;
-
-    /**
-     * 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
-    {
-        registry = new DeploymentRegistry(context);
-        context.addBundleListener(this);
-
-        registry.scanForESBBundles();
-
-        // Create the ServiceTracker to tracking BusProvider deployments/registrations...
-        //serviceTracker = new ServiceTracker(context, BusProvider.class.getName(), registry.getServiceTrackerCustomizer());
-        //serviceTracker.open();
-    }
-
-    /**
-     * Activation method that will be called by the Service Component Runtime.
-     *
-     * @param cc The ComponentContext.
-     */
-    public final void activate(final ComponentContext cc)
-    {
-        registry.scanForESBBundles();
-    }
-
-    /**
-     * 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;
-        }
-    }
-
-    /**
-     * 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
-    {
-        try
-        {
-            if(serviceTracker != null)
-            {
-                serviceTracker.close();
-            }
-        }
-        finally
-        {
-            registry.close();
-        }
-    }
-}

Deleted: 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	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -1,437 +0,0 @@
-package org.jboss.esb.osgi;
-
-import org.apache.log4j.Logger;
-import org.jboss.esb.api.bus.Bus;
-import org.jboss.esb.api.bus.BusProvider;
-import org.jboss.esb.api.exception.DeploymentException;
-import org.jboss.esb.api.routing.RoutingException;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.federate.BusMediator;
-import org.jboss.esb.federate.DeploymentCoordinator;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/**
- * DeploymentRegistry keeps track of deployed runtimes.
- * <p/>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class DeploymentRegistry
-{
-    /**
-     * Logger.
-     */
-    private static Logger logger = Logger.getLogger(DeploymentRegistry.class);
-
-    /**
-     * 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";
-
-    /**
-     * The associated bundle context.
-     */
-    private BundleContext context;
-
-    /**
-     * Service Tracker Customizer for deployment {@link BusProvider BusProviders}.
-     */
-    private BusProviderCustomizer serviceTrackerCustomizer;
-
-    /**
-     * Set of active deployments.
-     */
-    private Map<Bundle, DeploymentRuntime> activeDeployments = new HashMap<Bundle, DeploymentRuntime>();
-    /**
-     * A map of BusMediator instances.
-     */
-    private Map<BusProvider, List<BusMediator>> mediatorMap = new HashMap<BusProvider, List<BusMediator>>();
-
-    /**
-     * Create DeploymentRegistry.
-     * @param context The associated bundle context.
-     */
-    public DeploymentRegistry(final BundleContext context)
-    {
-        this.context = context;
-        serviceTrackerCustomizer = new BusProviderCustomizer();
-    }
-
-    /**
-     * Get the Service Tracker Customizer for the registry.
-     * @return The Service Tracker Customizer for the registry.
-     */
-    protected final BusProviderCustomizer getServiceTrackerCustomizer()
-    {
-        return serviceTrackerCustomizer;
-    }
-
-    /**
-     * Get the list of active Deployments.
-     * @return The list of active deployments.
-     */
-    private final Collection<DeploymentRuntime> getActiveDeployments()
-    {
-        return Collections.unmodifiableCollection(activeDeployments.values());
-    }
-
-    /**
-     * Deploy and Register a DeploymentRuntime for the supplied bundle if it's
-     * an ESB bundle and is not already deployed.
-     *
-     * @param bundle The bundle.
-     */
-    public final void register(final Bundle bundle)
-    {
-        synchronized (activeDeployments)
-        {
-            if (activeDeployments.containsKey(bundle))
-            {
-                // already registered. Don't need to do anything
-                return;
-            }
-        }
-
-        final URL configUrl = getEsbConfigFile(bundle);
-        if (configUrl != null)
-        {
-            try
-            {
-                DeploymentRuntime runtime = DeploymentUtil.createRuntime(configUrl.openStream(), new BundleResourceLocator(bundle));
-                runtime.setDeploymentName(getDeploymentName(bundle));
-                runtime.deploy();
-
-                synchronized (activeDeployments)
-                {
-                    activeDeployments.put(bundle, runtime);
-
-                    ServiceReference[] busProviderRefs = context.getServiceReferences(BusProvider.class.getName(), null);
-
-                    if(busProviderRefs != null)
-                    {
-                        for(ServiceReference busProviderRef : busProviderRefs)
-                        {
-                            addBusMediator((BusProvider) context.getService(busProviderRef), runtime);
-                        }
-                    }
-                }
-            }
-            catch (final Exception e)
-            {
-                logger.error("Failed to deploy ESB DeploymentRuntime instance.", e);
-            }
-        }
-    }
-
-    /**
-     * Unregister any DeploymentRuntime instance that may be deployed
-     * for the supplied bundle.
-     *
-     * @param bundle The bundle.
-     */
-    public final void unregister(final Bundle bundle)
-    {
-        synchronized (activeDeployments)
-        {
-            if (!activeDeployments.containsKey(bundle))
-            {
-                return;
-            }
-
-            final DeploymentRuntime deploymentRuntime = activeDeployments.get(bundle);
-            try
-            {
-                try
-                {
-                    removeBusMediators(deploymentRuntime);
-                }
-                finally
-                {
-                    deploymentRuntime.undeploy();
-                }
-            }
-            catch (Throwable t)
-            {
-                logger.error("Failed to undeploy ESB DeploymentRuntime instance.", t);
-            }
-            finally
-            {
-                activeDeployments.remove(bundle);
-            }
-        }
-    }
-
-    /**
-     * Scan for and deploy ESB Deployment bundles that have not yet been deployed.
-     */
-    protected synchronized void scanForESBBundles()
-    {
-        // 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 ESB bundle...
-                register(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 = 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 = 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 = activeDeployments.keySet();
-        for (Bundle bundle : keySet)
-        {
-            unregister(bundle);
-        }
-    }
-
-    /**
-     * Get the current list of {@link BusMediator BusMediators} associated
-     * with the supplied {@link BusProvider}.
-     *
-     * @param busProvider The provider instance.
-     * @return The list of mediators
-     */
-    private List<BusMediator> getMediators(final BusProvider busProvider)
-    {
-        List<BusMediator> mediators = mediatorMap.get(busProvider);
-
-        if(mediators == null)
-        {
-            // Do not change the list type here from CopyOnWriteArrayList or
-            // concurrent mod exceptions will occur on undeploys...
-            mediators = new CopyOnWriteArrayList<BusMediator>();
-            mediatorMap.put(busProvider, mediators);
-        }
-
-        return mediators;
-    }
-
-    /**
-     * Add a {@link BusMediator} for the specified {@link BusProvider} and
-     * {@link DeploymentRuntime} combo.
-     *
-     * @param busProvider The Bus Provider.
-     * @param deploymentRuntime The deployment runtime.
-     * @throws org.jboss.esb.api.routing.RoutingException Unable to add a mediator instance.
-     * @throws DeploymentException
-     */
-    private void addBusMediator(final BusProvider busProvider, final DeploymentRuntime deploymentRuntime) throws RoutingException, DeploymentException
-    {
-        Bus bus = busProvider.newBusInstance();
-        BusMediator busMediator = null;
-        boolean added = false;
-
-        try
-        {
-            busMediator = new BusMediator(bus, deploymentRuntime);
-            bus.connect();
-            deploymentRuntime.getDeploymentCoordinator().addBusMediator(busMediator);
-            getMediators(busProvider).add(busMediator);
-            added = true;
-        }
-        finally
-        {
-            if(!added)
-            {
-                logger.error("Failed to connect JBossESB deployment '" + deploymentRuntime.getDeploymentName() + "' to Bus '" + bus.getClass().getName() + "'.");
-                if(busMediator != null)
-                {
-                    busMediator.disconnectBus();
-                }
-            }
-            else
-            {
-                logger.debug("Successfully connected JBossESB deployment '" + deploymentRuntime.getDeploymentName() + "' to Bus '" + bus.getClass().getName() + "'.");
-            }
-        }
-    }
-
-    /**
-     * Remove all the {@link BusMediator BusMediators} associated with the
-     * specified {@link DeploymentRuntime}.
-     *
-     * @param deploymentRuntime The {@link DeploymentRuntime}.
-     */
-    private void removeBusMediators(final DeploymentRuntime deploymentRuntime)
-    {
-        DeploymentCoordinator coordinator = deploymentRuntime.getDeploymentCoordinator();
-        Collection<List<BusMediator>> mediators = mediatorMap.values();
-        Iterator<BusMediator> runtimeMediators = coordinator.getBusMediators();
-
-        while(runtimeMediators.hasNext())
-        {
-            BusMediator mediator = runtimeMediators.next();
-            for (List<BusMediator> mediatorList : mediators)
-            {
-                if(mediatorList.remove(mediator))
-                {
-                    break;
-                }
-            }
-        }
-    }
-
-    /**
-     * Service Tracker Customizer for Bus Provider Services.
-     */
-    private class BusProviderCustomizer implements ServiceTrackerCustomizer
-    {
-
-        /**
-         * {@link BusProvider} added event handler.
-         *
-         * @param serviceReference Service reference.
-         * @return Track Object.  This will be supplied to the
-         *         {@link #modifiedService(org.osgi.framework.ServiceReference, Object)} and
-         *         {@link #removedService(org.osgi.framework.ServiceReference, Object)} methods.
-         */
-        public final Object addingService(final ServiceReference serviceReference)
-        {
-            try
-            {
-                synchronized (activeDeployments)
-                {
-                    BusProvider busProvider = (BusProvider) context.getService(serviceReference);
-                    Collection<DeploymentRuntime> activeDeployments = getActiveDeployments();
-
-                    for (DeploymentRuntime activeDeployment : activeDeployments)
-                    {
-                        addBusMediator(busProvider, activeDeployment);
-                    }
-                }
-            }
-            catch (Exception e)
-            {
-                logger.error("Unexpected exception while processing BusProvider service notification.", e);
-            }
-
-            return null;
-        }
-
-        /**
-         * {@link BusProvider} modified event handler.
-         *
-         * @param serviceReference Service reference.
-         * @param object           The Object returned by the {@link #addingService(org.osgi.framework.ServiceReference)}
-         *                         method for the referenced Service instance.
-         */
-        public final void modifiedService(final ServiceReference serviceReference, final Object object)
-        {
-            // TODO: Do we need to do anything here?
-        }
-
-        /**
-         * {@link BusProvider} removed event handler.
-         *
-         * @param serviceReference Service reference.
-         * @param object           The Object returned by the {@link #addingService(org.osgi.framework.ServiceReference)}
-         *                         method for the referenced Service instance.
-         */
-        public final void removedService(final ServiceReference serviceReference, final Object object)
-        {
-            try
-            {
-                synchronized (activeDeployments)
-                {
-                    BusProvider busProvider = (BusProvider) context.getService(serviceReference);
-                    List<BusMediator> mediators = getMediators(busProvider);
-
-                    for (BusMediator mediator : mediators)
-                    {
-                        mediator.getRuntime().getDeploymentCoordinator().removeBusMediator(mediator);
-                    }
-
-                    mediatorMap.remove(busProvider);
-                }
-            }
-            catch (Exception e)
-            {
-                logger.error("Unexpected exception while processing BusProvider service notification.", e);
-            }
-        }
-    }
-}
-
-

Copied: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleResourceLocator.java (from rev 24109, 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/bundle/BundleResourceLocator.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleResourceLocator.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -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.bundle;
+
+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/bundle/BundleResourceLocator.java
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/package.html (from rev 24109, 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/bundle/package.html	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/package.html	2008-11-28 05:04:48 UTC (rev 24129)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+JBoss ESB OSGi Bundle.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/config/OsgiConfigUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/config/OsgiConfigUtil.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/config/OsgiConfigUtil.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -22,7 +22,7 @@
 import org.jboss.esb.api.exception.DeploymentException;
 import org.jboss.esb.deploy.config.PropertiesUtil;
 import org.jboss.esb.deploy.config.ConfigUtil;
-import org.jboss.esb.osgi.BundleResourceLocator;
+import org.jboss.esb.osgi.bundle.BundleResourceLocator;
 import org.jboss.esb.properties.ApplicationProperties;
 import org.osgi.framework.BundleContext;
 

Copied: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentActivator.java (from rev 24109, labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/DeploymentActivator.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentActivator.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentActivator.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -0,0 +1,124 @@
+/*
+ * 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.deploy;
+
+import org.jboss.esb.api.bus.BusProvider;
+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.util.tracker.ServiceTracker;
+
+/**
+ * ESB OSGi Deployment Activator.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class DeploymentActivator implements BundleActivator, BundleListener
+{
+    /**
+     * Registry that hold the DeploymentRuntimes.
+     */
+    private DeploymentRegistry registry;
+
+    /**
+     * Bus Provider Service Tracker.
+     */
+    private ServiceTracker serviceTracker;
+
+    /**
+     * 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
+    {
+        registry = new DeploymentRegistry(context);
+        context.addBundleListener(this);
+
+        registry.scanForESBBundles();
+
+        // Create the ServiceTracker to tracking BusProvider deployments/registrations...
+        serviceTracker = new ServiceTracker(context, BusProvider.class.getName(), registry.getServiceTrackerCustomizer());
+        serviceTracker.open();
+    }
+
+    /**
+     * Activation method that will be called by the Service Component Runtime.
+     *
+     * @param cc The ComponentContext.
+     */
+    public final void activate(final ComponentContext cc)
+    {
+        registry.scanForESBBundles();
+    }
+
+    /**
+     * 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;
+        }
+    }
+
+    /**
+     * 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
+    {
+        try
+        {
+            if(serviceTracker != null)
+            {
+                serviceTracker.close();
+            }
+        }
+        finally
+        {
+            registry.close();
+        }
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentActivator.java
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java (from rev 24109, 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/deploy/DeploymentRegistry.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -0,0 +1,443 @@
+package org.jboss.esb.osgi.deploy;
+
+import org.apache.log4j.Logger;
+import org.jboss.esb.api.bus.Bus;
+import org.jboss.esb.api.bus.BusProvider;
+import org.jboss.esb.api.exception.DeploymentException;
+import org.jboss.esb.api.routing.RoutingException;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.federate.BusMediator;
+import org.jboss.esb.federate.DeploymentCoordinator;
+import org.jboss.esb.osgi.bundle.BundleResourceLocator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * DeploymentRegistry keeps track of deployed runtimes.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class DeploymentRegistry
+{
+    /**
+     * Logger.
+     */
+    private static Logger logger = Logger.getLogger(DeploymentRegistry.class);
+
+    /**
+     * 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";
+
+    /**
+     * The associated bundle context.
+     */
+    private BundleContext context;
+
+    /**
+     * Service Tracker Customizer for deployment {@link BusProvider BusProviders}.
+     */
+    private BusProviderCustomizer serviceTrackerCustomizer;
+
+    /**
+     * Set of active deployments.
+     */
+    private Map<Bundle, DeploymentRuntime> activeDeployments = new HashMap<Bundle, DeploymentRuntime>();
+    /**
+     * A map of BusMediator instances.
+     */
+    private Map<BusProvider, List<BusMediator>> mediatorMap = new HashMap<BusProvider, List<BusMediator>>();
+
+    /**
+     * Create DeploymentRegistry.
+     * @param context The associated bundle context.
+     */
+    public DeploymentRegistry(final BundleContext context)
+    {
+        this.context = context;
+        serviceTrackerCustomizer = new BusProviderCustomizer();
+    }
+
+    /**
+     * Get the Service Tracker Customizer for the registry.
+     * @return The Service Tracker Customizer for the registry.
+     */
+    protected final BusProviderCustomizer getServiceTrackerCustomizer()
+    {
+        return serviceTrackerCustomizer;
+    }
+
+    /**
+     * Get the list of active Deployments.
+     * @return The list of active deployments.
+     */
+    private final Collection<DeploymentRuntime> getActiveDeployments()
+    {
+        return Collections.unmodifiableCollection(activeDeployments.values());
+    }
+
+    /**
+     * Deploy and Register a DeploymentRuntime for the supplied bundle if it's
+     * an ESB bundle and is not already deployed.
+     *
+     * @param bundle The bundle.
+     */
+    public final void register(final Bundle bundle)
+    {
+        synchronized (activeDeployments)
+        {
+            if (activeDeployments.containsKey(bundle))
+            {
+                // already registered. Don't need to do anything
+                return;
+            }
+        }
+
+        final URL configUrl = getEsbConfigFile(bundle);
+        if (configUrl != null)
+        {
+            try
+            {
+                DeploymentRuntime runtime = DeploymentUtil.createRuntime(configUrl.openStream(), new BundleResourceLocator(bundle));
+                runtime.setDeploymentName(getDeploymentName(bundle));
+                runtime.deploy();
+
+                synchronized (activeDeployments)
+                {
+                    activeDeployments.put(bundle, runtime);
+
+                    ServiceReference[] busProviderRefs = context.getServiceReferences(BusProvider.class.getName(), null);
+
+                    if(busProviderRefs != null)
+                    {
+                        for(ServiceReference busProviderRef : busProviderRefs)
+                        {
+                            addBusMediator((BusProvider) context.getService(busProviderRef), runtime);
+                        }
+                    }
+                }
+            }
+            catch (final Exception e)
+            {
+                logger.error("Failed to deploy ESB DeploymentRuntime instance.", e);
+            }
+        }
+    }
+
+    /**
+     * Unregister any DeploymentRuntime instance that may be deployed
+     * for the supplied bundle.
+     *
+     * @param bundle The bundle.
+     */
+    public final void unregister(final Bundle bundle)
+    {
+        synchronized (activeDeployments)
+        {
+            if (!activeDeployments.containsKey(bundle))
+            {
+                return;
+            }
+
+            final DeploymentRuntime deploymentRuntime = activeDeployments.get(bundle);
+            try
+            {
+                try
+                {
+                    removeBusMediators(deploymentRuntime);
+                }
+                finally
+                {
+                    deploymentRuntime.undeploy();
+                }
+            }
+            catch (Throwable t)
+            {
+                logger.error("Failed to undeploy ESB DeploymentRuntime instance.", t);
+            }
+            finally
+            {
+                activeDeployments.remove(bundle);
+            }
+        }
+    }
+
+    /**
+     * Scan for and deploy ESB Deployment bundles that have not yet been deployed.
+     */
+    protected synchronized void scanForESBBundles()
+    {
+        // 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 ESB bundle...
+                register(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 = 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 = 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 = activeDeployments.keySet();
+        for (Bundle bundle : keySet)
+        {
+            unregister(bundle);
+        }
+    }
+
+    /**
+     * Get the current list of {@link BusMediator BusMediators} associated
+     * with the supplied {@link BusProvider}.
+     *
+     * @param busProvider The provider instance.
+     * @return The list of mediators
+     */
+    private List<BusMediator> getMediators(final BusProvider busProvider)
+    {
+        List<BusMediator> mediators = mediatorMap.get(busProvider);
+
+        if(mediators == null)
+        {
+            // Do not change the list type here from CopyOnWriteArrayList or
+            // concurrent mod exceptions will occur on undeploys...
+            mediators = new CopyOnWriteArrayList<BusMediator>();
+            mediatorMap.put(busProvider, mediators);
+        }
+
+        return mediators;
+    }
+
+    /**
+     * Add a {@link BusMediator} for the specified {@link BusProvider} and
+     * {@link DeploymentRuntime} combo.
+     *
+     * @param busProvider The Bus Provider.
+     * @param deploymentRuntime The deployment runtime.
+     * @throws org.jboss.esb.api.routing.RoutingException Unable to add a mediator instance.
+     * @throws DeploymentException
+     */
+    private void addBusMediator(final BusProvider busProvider, final DeploymentRuntime deploymentRuntime) throws RoutingException, DeploymentException
+    {
+        Bus bus = busProvider.newBusInstance();
+        BusMediator busMediator = null;
+        boolean added = false;
+
+        try
+        {
+            bus.setDeploymentId(deploymentRuntime.getDeploymentId());
+            bus.setDeploymentName(deploymentRuntime.getDeploymentName());
+            bus.connect();
+            if(bus.isConnected())
+            {
+                busMediator = new BusMediator(bus, deploymentRuntime);
+                deploymentRuntime.getDeploymentCoordinator().addBusMediator(busMediator);
+                getMediators(busProvider).add(busMediator);
+                added = true;
+            }
+        }
+        finally
+        {
+            if(!added)
+            {
+                logger.error("Failed to connect JBossESB deployment '" + deploymentRuntime.getDeploymentName() + "' to Bus '" + bus.getClass().getName() + "'.");
+                if(busMediator != null)
+                {
+                    busMediator.disconnectBus();
+                }
+            }
+            else
+            {
+                logger.debug("Successfully connected JBossESB deployment '" + deploymentRuntime.getDeploymentName() + "' to Bus '" + bus.getClass().getName() + "'.");
+            }
+        }
+    }
+
+    /**
+     * Remove all the {@link BusMediator BusMediators} associated with the
+     * specified {@link DeploymentRuntime}.
+     *
+     * @param deploymentRuntime The {@link DeploymentRuntime}.
+     */
+    private void removeBusMediators(final DeploymentRuntime deploymentRuntime)
+    {
+        DeploymentCoordinator coordinator = deploymentRuntime.getDeploymentCoordinator();
+        Collection<List<BusMediator>> mediators = mediatorMap.values();
+        Iterator<BusMediator> runtimeMediators = coordinator.getBusMediators();
+
+        while(runtimeMediators.hasNext())
+        {
+            BusMediator mediator = runtimeMediators.next();
+            for (List<BusMediator> mediatorList : mediators)
+            {
+                if(mediatorList.remove(mediator))
+                {
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * Service Tracker Customizer for Bus Provider Services.
+     */
+    private class BusProviderCustomizer implements ServiceTrackerCustomizer
+    {
+
+        /**
+         * {@link BusProvider} added event handler.
+         *
+         * @param serviceReference Service reference.
+         * @return Track Object.  This will be supplied to the
+         *         {@link #modifiedService(org.osgi.framework.ServiceReference, Object)} and
+         *         {@link #removedService(org.osgi.framework.ServiceReference, Object)} methods.
+         */
+        public final Object addingService(final ServiceReference serviceReference)
+        {
+            try
+            {
+                synchronized (activeDeployments)
+                {
+                    BusProvider busProvider = (BusProvider) context.getService(serviceReference);
+                    Collection<DeploymentRuntime> activeDeployments = getActiveDeployments();
+
+                    for (DeploymentRuntime activeDeployment : activeDeployments)
+                    {
+                        addBusMediator(busProvider, activeDeployment);
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                logger.error("Unexpected exception while processing BusProvider service notification.", e);
+            }
+
+            return null;
+        }
+
+        /**
+         * {@link BusProvider} modified event handler.
+         *
+         * @param serviceReference Service reference.
+         * @param object           The Object returned by the {@link #addingService(org.osgi.framework.ServiceReference)}
+         *                         method for the referenced Service instance.
+         */
+        public final void modifiedService(final ServiceReference serviceReference, final Object object)
+        {
+            // TODO: Do we need to do anything here?
+        }
+
+        /**
+         * {@link BusProvider} removed event handler.
+         *
+         * @param serviceReference Service reference.
+         * @param object           The Object returned by the {@link #addingService(org.osgi.framework.ServiceReference)}
+         *                         method for the referenced Service instance.
+         */
+        public final void removedService(final ServiceReference serviceReference, final Object object)
+        {
+            try
+            {
+                synchronized (activeDeployments)
+                {
+                    BusProvider busProvider = (BusProvider) context.getService(serviceReference);
+                    List<BusMediator> mediators = getMediators(busProvider);
+
+                    for (BusMediator mediator : mediators)
+                    {
+                        mediator.getRuntime().getDeploymentCoordinator().removeBusMediator(mediator);
+                    }
+
+                    mediatorMap.remove(busProvider);
+                }
+            }
+            catch (Exception e)
+            {
+                logger.error("Unexpected exception while processing BusProvider service notification.", e);
+            }
+        }
+    }
+}
+
+


Property changes on: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/package.html
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/package.html	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/package.html	2008-11-28 05:04:48 UTC (rev 24129)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+JBoss ESB OSGi Deploy.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file

Deleted: 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	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/package.html	2008-11-28 05:04:48 UTC (rev 24129)
@@ -1,8 +0,0 @@
-<html>
-<head></head>
-<body>
-JBoss ESB OSGi Runtime.
-
-<h2>Package Specification</h2>
-</body>
-</html>
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/config.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/config.properties	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/config.properties	2008-11-28 05:04:48 UTC (rev 24129)
@@ -25,6 +25,8 @@
  org.osgi.util.tracker; version=1.3.3 \
  ${jre-${java.specification.version}}
 
+org.osgi.framework.storage.clean=onFirstInit
+
 m2.path=${user.home}/.m2/repository
 apache.m2.path=${m2.path}/org/apache
 jbossesb.m2.path=${m2.path}/jboss/jbossesb
@@ -38,9 +40,10 @@
  "file:${jbossesb.m2.path}/jbossesb-api/5.0-SNAPSHOT/jbossesb-api-5.0-SNAPSHOT.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"
+ "file:${jbossesb.m2.path}/jbossesb-routing-jms/5.0-SNAPSHOT/jbossesb-osgi-jmsbus-5.0-SNAPSHOT.jar" \
+ "file:${jbossesb.m2.path}/jbossesb-examples-jms-router-esb-jms-router/5.0-SNAPSHOT/jbossesb-examples-jms-router-esb-jms-router-5.0-SNAPSHOT.jar"
 
-felix.log.level=1
+felix.log.level=4
 felix.startlevel.framework=1
 felix.startlevel.bundle=1
 #felix.service.urlhandlers=false

Modified: labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml	2008-11-28 05:04:48 UTC (rev 24129)
@@ -82,7 +82,7 @@
                 <configuration>
                     <instructions>
                         <Export-Package>org.jboss.esb.examples.jmsrouter, org.apache.activemq.jndi</Export-Package>
-                        <Import-Package>org.jboss.esb.jms, org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
+                        <Import-Package>org.jboss.esb.jms, org.jboss.esb.api.routing, org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
                         <Embed-Dependency>activemq-core, backport-util-concurrent, log4j, commons-logging, geronimo-j2ee-management_1.1_spec</Embed-Dependency>
                         <Embed-Transitive>true</Embed-Transitive>
                         <JBossESB-ConfigFile>/jboss-esb.xml</JBossESB-ConfigFile>

Modified: labs/jbossesb/workspace/skeagh/performance/src/test/java/org/jboss/esb/SimpleSoakTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/performance/src/test/java/org/jboss/esb/SimpleSoakTest.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/performance/src/test/java/org/jboss/esb/SimpleSoakTest.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -112,20 +112,20 @@
     private static final String EXPECTED_F_PROCLOG = "Message Processing Event Log:\n" +
             "\t1.   [deployment-01.xml:deployment-01.xml] ServiceProcessingEvent: service='Service:A'\n" +
             "\t2.   [deployment-01.xml:deployment-01.xml] ServiceProcessingEvent: service='Service:B'\n" +
-            "\t3.   [deployment-01.xml:deployment-01.xml] BusRouterProcessingEvent: to='Service:C', targetDeploymentId='deployment-02.xml:deployment-02.xml', busType='JMSBus'\n" +
+            "\t3.   [deployment-01.xml:deployment-01.xml] BusRouterProcessingEvent: to='Service:C', targetDeploymentId='deployment-02.xml:deployment-02.xml', busType='JmsBus'\n" +
             "\t4.   [deployment-02.xml:deployment-02.xml] ServiceProcessingEvent: service='Service:C'\n" +
             "\t5.   [deployment-02.xml:deployment-02.xml] ServiceProcessingEvent: service='Service:D'\n" +
-            "\t6.   [deployment-02.xml:deployment-02.xml] BusRouterProcessingEvent: to='Service:E', targetDeploymentId='deployment-03.xml:deployment-03.xml', busType='JMSBus'\n" +
+            "\t6.   [deployment-02.xml:deployment-02.xml] BusRouterProcessingEvent: to='Service:E', targetDeploymentId='deployment-03.xml:deployment-03.xml', busType='JmsBus'\n" +
             "\t7.   [deployment-03.xml:deployment-03.xml] ServiceProcessingEvent: service='Service:E'\n" +
             "\t8.   [deployment-03.xml:deployment-03.xml] ServiceProcessingEvent: service='Service:F'";
 
     private static final String EXPECTED_6_PROCLOG = "Message Processing Event Log:\n" +
             "\t1.   [deployment-01.xml:deployment-01.xml] ServiceProcessingEvent: service='Service:1'\n" +
             "\t2.   [deployment-01.xml:deployment-01.xml] ServiceProcessingEvent: service='Service:2'\n" +
-            "\t3.   [deployment-01.xml:deployment-01.xml] BusRouterProcessingEvent: to='Service:3', targetDeploymentId='deployment-02.xml:deployment-02.xml', busType='JMSBus'\n" +
+            "\t3.   [deployment-01.xml:deployment-01.xml] BusRouterProcessingEvent: to='Service:3', targetDeploymentId='deployment-02.xml:deployment-02.xml', busType='JmsBus'\n" +
             "\t4.   [deployment-02.xml:deployment-02.xml] ServiceProcessingEvent: service='Service:3'\n" +
             "\t5.   [deployment-02.xml:deployment-02.xml] ServiceProcessingEvent: service='Service:4'\n" +
-            "\t6.   [deployment-02.xml:deployment-02.xml] BusRouterProcessingEvent: to='Service:5', targetDeploymentId='deployment-03.xml:deployment-03.xml', busType='JMSBus'\n" +
+            "\t6.   [deployment-02.xml:deployment-02.xml] BusRouterProcessingEvent: to='Service:5', targetDeploymentId='deployment-03.xml:deployment-03.xml', busType='JmsBus'\n" +
             "\t7.   [deployment-03.xml:deployment-03.xml] ServiceProcessingEvent: service='Service:5'\n" +
             "\t8.   [deployment-03.xml:deployment-03.xml] ServiceProcessingEvent: service='Service:6'";
 }

Modified: labs/jbossesb/workspace/skeagh/routing/jms/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/pom.xml	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/routing/jms/pom.xml	2008-11-28 05:04:48 UTC (rev 24129)
@@ -76,6 +76,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
+                        <Private-Package>org.jboss.esb.jms*</Private-Package>
                         <Export-Package>org.jboss.esb.jms</Export-Package>
                         <Import-Package>*;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
                         <Embed-Dependency>jbossesb-commons, log4j</Embed-Dependency>

Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBusProvider.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBusProvider.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBusProvider.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -21,6 +21,7 @@
 
 import org.jboss.esb.api.bus.Bus;
 import org.jboss.esb.api.bus.BusProvider;
+import org.jboss.esb.api.context.ResourceLocator;
 import org.jboss.esb.api.routing.RoutingException;
 import org.jboss.esb.util.AssertArgument;
 
@@ -37,16 +38,22 @@
      * Bus Properties.
      */
     private Properties properties;
+    /**
+     * Bus resource locator.
+     */
+    private ResourceLocator resourceLocator;
 
     /**
      * Public constructor.
      *
      * @param properties Bus properties.
+     * @param resourceLocator The Bus resource locator.
      */
-    public JmsBusProvider(final Properties properties)
+    public JmsBusProvider(final Properties properties, final ResourceLocator resourceLocator)
     {
         AssertArgument.isNotNull(properties, "properties");
         this.properties = properties;
+        this.resourceLocator = resourceLocator;
     }
 
     /**
@@ -58,7 +65,8 @@
     public final Bus newBusInstance() throws RoutingException
     {
         JmsBus bus = new JmsBus();
-        bus.setProperties(properties);
+        bus.setProperties((Properties) properties.clone());
+        bus.setResourceLocator(resourceLocator);
         return bus;
     }
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -20,16 +20,10 @@
 package org.jboss.esb.deploy.config.digest;
 
 import static org.jboss.esb.api.annotations.AnnotationConstants.UNASSIGNED;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.jboss.esb.api.annotations.Property;
 import org.jboss.esb.api.annotations.Property.Use;
-import org.jboss.esb.classpath.ClassUtil;
 import org.jboss.esb.api.context.ResourceLocator;
+import org.jboss.esb.classpath.ClassUtil;
 import org.milyn.SmooksException;
 import org.milyn.cdr.SmooksConfigurationException;
 import org.milyn.cdr.annotation.ConfigParam;
@@ -41,6 +35,11 @@
 import org.milyn.xml.DomUtils;
 import org.w3c.dom.Element;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Create an object and set it in the Smooks bean repository.
  *
@@ -204,7 +203,6 @@
         }
         catch (Exception e)
         {
-            e.printStackTrace();
             throw new SmooksException("Unable to create class instance for class '" + objectClassName + "'.", e);
         }
     }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusFactory.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusFactory.java	2008-11-28 04:34:58 UTC (rev 24128)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusFactory.java	2008-11-28 05:04:48 UTC (rev 24129)
@@ -74,6 +74,7 @@
         bus.setDeploymentName(runtime.getDeploymentName());
         bus.setDeploymentId(runtime.getDeploymentId());
         bus.setProperties(busProperties);
+        bus.setResourceLocator(runtime.getResourceLocator());
 
         return bus;
     }




More information about the jboss-svn-commits mailing list