[jboss-svn-commits] JBL Code SVN: r24250 - in labs/jbossesb/workspace/skeagh: api/src/main/java/org/jboss/esb/api/context and 41 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Dec 5 10:02:56 EST 2008


Author: tfennelly
Date: 2008-12-05 10:02:56 -0500 (Fri, 05 Dec 2008)
New Revision: 24250

Added:
   labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/AbstractResourceLocator.java
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/pom.xml
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/com/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/com/acme/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/com/acme/Customer.java
   labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/test/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/run.bat
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/CustomerToString.java
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/StringToCustomer.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/ContextResourceLocator.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/ResourceLocatorObjectInputStream.java
Removed:
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DefaultResourceLocator.java
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/context/ResourceLocator.java
   labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java
   labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java
   labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/JMSSession.java
   labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java
   labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java
   labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleResourceLocator.java
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml
   labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml
   labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/AbstractFileInboundRouter.java
   labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java
   labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/util/RouterUtil.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.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/deploy/config/digest/DigestUtil.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/invoke/ServiceInvoker.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/util/XsdDOMValidator.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/InboundFilterConfigTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/util/XsdDOMValidatorTest.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2220

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-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -37,7 +37,7 @@
     /**
      * Bus resource locator.
      */
-    private ResourceLocator resourceLocator;
+    protected ResourceLocator resourceLocator;
     /**
      * Deployment name.
      */
@@ -117,6 +117,7 @@
 
     /**
      * Get the resource locator instance for the Bus implementation.
+     *
      * @return The resource locator.
      */
     public final ResourceLocator getResourceLocator()
@@ -125,15 +126,6 @@
     }
 
     /**
-     * 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.
@@ -176,7 +168,7 @@
     /**
      * Assert that the {@link Bus} is configured.
      */
-    public final void assertIsConfigured() 
+    public final void assertIsConfigured()
     {
         if (deploymentName == null)
         {

Added: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/AbstractResourceLocator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/AbstractResourceLocator.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/AbstractResourceLocator.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.api.context;
+
+/**
+ * Abstract {@link ResourceLocator}.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class AbstractResourceLocator implements ResourceLocator
+{
+    /**
+     * The {@link ClassLoader ClassLoaders} to be used by the locator instance.
+     */
+    private ClassLoader[] classLoaders;
+
+    /**
+     * Public constructor.
+     *
+     * @param classLoader The {@link ClassLoader ClassLoader} to be used by the locator instance.
+     */
+    public AbstractResourceLocator(final ClassLoader classLoader)
+    {
+        if (classLoader == null)
+        {
+            throw new IllegalArgumentException("null 'classLoader' arg supplied in method call.");
+        }
+        this.classLoaders = new ClassLoader[] {classLoader};
+    }
+
+    /**
+     * Public constructor.
+     *
+     * @param classLoaders The {@link ClassLoader ClassLoaders} to be used by the locator instance.
+     */
+    public AbstractResourceLocator(final ClassLoader[] classLoaders)
+    {
+        if (classLoaders == null)
+        {
+            throw new IllegalArgumentException("null 'classLoaders' arg supplied in method call.");
+        }
+        this.classLoaders = classLoaders;
+    }
+
+    /**
+     * Get the classloaders.
+     *
+     * @return The ClassLoaders.
+     */
+    public final ClassLoader[] getClassLoaders()
+    {
+        return classLoaders;
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/AbstractResourceLocator.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/ResourceLocator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/ResourceLocator.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/context/ResourceLocator.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -44,27 +44,17 @@
     Class<?> forName(final String className) throws ClassNotFoundException;
 
     /**
-     * Load the specified class using the passed in class's classloader.
-     *
-     * @param className The name of the class to load.
-     * @param caller    The class of the caller.
-     * @return The specified class.
-     * @throws ClassNotFoundException If the class cannot be found.
-     */
-    Class<?> forName(final String className, final Class<?> caller) throws ClassNotFoundException;
-
-    /**
      * 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.
      */
-    InputStream getResourceAsStream(final String resourceName, final Class<?> caller);
+    InputStream getResourceAsStream(final String resourceName);
 
     /**
-     * Get the underlying classloader.
-     * @return The underlying ClassLoader.
+     * Get the ClassLoader list used by the locator instance.
+     *
+     * @return The ClassLoaders.
      */
-    ClassLoader getClassLoader();
+    ClassLoader[] getClassLoaders();
 }

Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ClassUtil.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -54,15 +54,39 @@
      * @return The specified class.
      * @throws ClassNotFoundException If the class cannot be found.
      */
-    public static Class<?> forName(final String className, final Class<?> caller)
-            throws ClassNotFoundException
+    public static Class<?> forName(final String className, final Class<?> caller) throws ClassNotFoundException
     {
-        final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
-        if (threadClassLoader != null)
+        return forName(className, new ClassLoader[] {caller.getClassLoader()});
+    }
+
+    /**
+     * Load the specified class.
+     *
+     * @param className The name of the class to load.
+     * @param fallbackClassLoaders The ClassLoaders to be used if the Thread Context ClassLoader
+     * fails to load the class.
+     * @return The specified class.
+     * @throws ClassNotFoundException If the class cannot be found.
+     */
+    public static Class<?> forName(final String className, final ClassLoader[] fallbackClassLoaders) throws ClassNotFoundException
+    {
+        try
         {
+            return findClassFromContext(className);
+        }
+        catch (final ClassNotFoundException cnfe)
+        {
+            if (cnfe.getException() != null)
+            {
+                throw cnfe;
+            }
+        }
+
+        if (fallbackClassLoaders != null)
+        {
             try
             {
-                return Class.forName(className, true, threadClassLoader);
+                return  findClass(className, fallbackClassLoaders);
             }
             catch (final ClassNotFoundException cnfe)
             {
@@ -73,9 +97,19 @@
             }
         }
 
-        final ClassLoader classLoader = caller.getClassLoader();
-        if (classLoader != null)
-        {
+        return Class.forName(className, true, ClassLoader.getSystemClassLoader());
+    }
+
+    /**
+     * Find the specified class over the list of ClassLoaders.
+     * @param className The name of the class.
+     * @param classLoaders The ClassLoaders to be used.
+     * @return The Class instance.
+     * @throws ClassNotFoundException Failed to locate the class.
+     */
+    public static Class<?> findClass(final String className, final ClassLoader[] classLoaders) throws ClassNotFoundException
+    {
+        for(ClassLoader classLoader : classLoaders) {
             try
             {
                 return Class.forName(className, true, classLoader);
@@ -89,19 +123,47 @@
             }
         }
 
-        return Class.forName(className, true, ClassLoader.getSystemClassLoader());
+        throw new ClassNotFoundException("Failed to locate class '" + className + "'.");
     }
 
+
     /**
+     * Find the specified class from the Thread Context ClassLoaders.
+     * @param className The name of the class.
+     * @return The Class instance.
+     * @throws ClassNotFoundException Failed to locate the class.
+     */
+    public static Class<?> findClassFromContext(final String className) throws ClassNotFoundException
+    {
+        final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
+
+        if (threadClassLoader != null)
+        {
+            try
+            {
+                return Class.forName(className, true, threadClassLoader);
+            }
+            catch (final ClassNotFoundException cnfe)
+            {
+                if (cnfe.getException() != null)
+                {
+                    throw cnfe;
+                }
+            }
+        }
+
+        throw new ClassNotFoundException("Failed to locate class '" + className + "'.");
+    }
+
+    /**
      * Resolve a proxy for the specified interfaces.
      *
      * @param interfaces The interfaces associated with the proxy.
-     * @param caller     The class of the caller.
+     * @param fallbackClassLoaders   The ClassLoaders to be used for classpath lookups.
      * @return The specified proxy class.
      * @throws ClassNotFoundException If the class cannot be found.
      */
-    public static Class<?> resolveProxy(final String[] interfaces, final Class<?> caller)
-            throws ClassNotFoundException
+    public static Class<?> resolveProxy(final String[] interfaces, final ClassLoader[] fallbackClassLoaders) throws ClassNotFoundException
     {
         final int numInterfaces = (interfaces == null ? 0 : interfaces.length);
         if (numInterfaces == 0)
@@ -112,7 +174,7 @@
         final Class<?>[] interfaceClasses = new Class[numInterfaces];
         for (int count = 0; count < numInterfaces; count++)
         {
-            interfaceClasses[count] = forName(interfaces[count], caller);
+            interfaceClasses[count] = forName(interfaces[count], fallbackClassLoaders);
         }
 
         final ClassLoader proxyClassLoader;
@@ -122,10 +184,10 @@
             proxyClassLoader = threadClassLoader;
         } else
         {
-            final ClassLoader classLoader = caller.getClassLoader();
-            if (classLoader != null)
+            if (fallbackClassLoaders != null && fallbackClassLoaders.length > 0)
             {
-                proxyClassLoader = classLoader;
+                // TODO: What if there are multiple fallback classloaders?
+                proxyClassLoader = fallbackClassLoaders[0];
             } else
             {
                 proxyClassLoader = ClassLoader.getSystemClassLoader();
@@ -173,34 +235,36 @@
      * Get the specified resources.
      *
      * @param resourceName The resource name.
-     * @param caller The caller class.
+     * @param fallbackClassLoaders The {@link ClassLoader ClassLoaders} to be used if the Thread Context Classloader
+     * fails to load the resource.
      * @return The resource URLs.
      */
-    public static Enumeration<URL> getResources(final String resourceName, final Class<?> caller) throws IOException
+    public static Enumeration<URL> getResources(final String resourceName, final ClassLoader[] fallbackClassLoaders) throws IOException
     {
-        final String resource = resolveResourceName(resourceName, caller);
         final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
 
         if (threadClassLoader != null)
         {
-            final Enumeration<URL> resources = threadClassLoader.getResources(resource);
+            final Enumeration<URL> resources = threadClassLoader.getResources(resourceName);
             if (resources != null)
             {
                 return resources;
             }
         }
 
-        final ClassLoader classLoader = caller.getClassLoader();
-        if (classLoader != null)
+        if (fallbackClassLoaders != null)
         {
-            final Enumeration<URL> resources = classLoader.getResources(resource);
-            if (resources != null)
+            for(ClassLoader fallbackClassLoader : fallbackClassLoaders)
             {
-                return resources;
+                final Enumeration<URL> resources = fallbackClassLoader.getResources(resourceName);
+                if (resources != null)
+                {
+                    return resources;
+                }
             }
         }
 
-        return ClassLoader.getSystemResources(resource);
+        return ClassLoader.getSystemResources(resourceName);
     }
 
     /**
@@ -213,8 +277,31 @@
     public static InputStream getResourceAsStream(final String resourceName, final Class<?> caller)
     {
         final String resource = resolveResourceName(resourceName, caller);
+        return getResourceAsStream(resource, new ClassLoader[] {caller.getClassLoader()});
+    }
+
+    /**
+     * Get the specified resource as a stream.
+     *
+     * @param resourceName The name of the class to load.
+     * @param fallbackClassLoaders The {@link ClassLoader ClassLoaders} to be used if the Thread Context Classloader
+     * fails to load the resource.
+     * @return The input stream for the resource or null if not found.
+     */
+    public static InputStream getResourceAsStream(final String resourceName, final ClassLoader[] fallbackClassLoaders)
+    {
         final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
-        
+        String resource;
+
+        if (resourceName.startsWith("/"))
+        {
+            resource = resourceName.substring(1);
+        }
+        else
+        {
+            resource = resourceName;
+        }
+
         if (threadClassLoader != null)
         {
             final InputStream is = threadClassLoader.getResourceAsStream(resource);
@@ -224,13 +311,15 @@
             }
         }
 
-        final ClassLoader classLoader = caller.getClassLoader();
-        if (classLoader != null)
+        if (fallbackClassLoaders != null)
         {
-            final InputStream is = classLoader.getResourceAsStream(resource);
-            if (is != null)
+            for(ClassLoader fallbackClassLoader : fallbackClassLoaders)
             {
-                return is;
+                final InputStream is = fallbackClassLoader.getResourceAsStream(resource);
+                if (is != null)
+                {
+                    return is;
+                }
             }
         }
 

Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -78,6 +78,6 @@
     @Override
     public final Class<?> resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException
     {
-        return ClassUtil.resolveProxy(interfaces, ContextObjectInputStream.class);
+        return ClassUtil.resolveProxy(interfaces, new ClassLoader[] {ContextObjectInputStream.class.getClassLoader()});
     }
 }

Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/JMSSession.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/JMSSession.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/JMSSession.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -74,9 +74,9 @@
      */
     private ConnectionExceptionListener exceptionListener = new ConnectionExceptionListener();
     /**
-     * Provider classloader.
+     * Provider classloader chain.
      */
-    private ClassLoader classLoader;
+    private ClassLoader[] classLoaders;
 
     /**
      * Session Type enumeration.
@@ -164,21 +164,21 @@
     }
 
     /**
-     * Get the ClassLoader used by the session instance.
-     * @return The ClassLoader.
+     * Get the ClassLoaders used by the session instance.
+     * @return The ClassLoaders.
      */
-    public final ClassLoader getClassLoader()
+    public final ClassLoader[] getClassLoaders()
     {
-        return classLoader;
+        return classLoaders;
     }
 
     /**
-     * Set the ClassLoader used by the session instance.
-     * @param classLoader The ClassLoader.
+     * Set the ClassLoaders used by the session instance.
+     * @param classLoaders The ClassLoaders.
      */
-    public final void setClassLoader(final ClassLoader classLoader)
+    public final void setClassLoaders(final ClassLoader[] classLoaders)
     {
-        this.classLoader = classLoader;
+        this.classLoaders = classLoaders;
     }
 
     /**
@@ -315,16 +315,17 @@
     {
         String connectionFactoryRuntime = jndiProperties.getProperty(ConnectionFactory.class.getName(), "ConnectionFactory");
         ConnectionFactory factory;
-        ClassLoader tcClassLoader = Thread.currentThread().getContextClassLoader();
 
-        if(classLoader != null)
-        {
-            Thread.currentThread().setContextClassLoader(classLoader);
-        }
-        
         try
         {
-            factory = (ConnectionFactory) JNDIUtil.lookup(connectionFactoryRuntime, jndiProperties);
+            if(classLoaders != null)
+            {
+                return (ConnectionFactory) JNDIUtil.lookup(connectionFactoryRuntime, jndiProperties, classLoaders);
+            }
+            else
+            {
+                return (ConnectionFactory) JNDIUtil.lookup(connectionFactoryRuntime, jndiProperties);
+            }
         }
         catch (NamingException e)
         {
@@ -334,12 +335,6 @@
         {
             throw (JMSException) (new JMSException("JNDI lookup of JMS Connection Factory failed.  Class [" + connectionFactoryRuntime + "] is not an instance of [" + ConnectionFactory.class.getName() + "].").initCause(e));
         }
-        finally
-        {
-            Thread.currentThread().setContextClassLoader(tcClassLoader);
-        }
-
-        return factory;
     }
 
 
@@ -352,25 +347,24 @@
      */
     public final Destination lookupDestination(final String destinationName) throws JMSException
     {
-        ClassLoader tcClassLoader = Thread.currentThread().getContextClassLoader();
-
-        if(classLoader != null)
-        {
-            Thread.currentThread().setContextClassLoader(classLoader);
-        }
-
-        // Lookup the destination...
         try
         {
-            return (Destination) JNDIUtil.lookup(destinationName, jndiProperties);
+            if(classLoaders != null)
+            {
+                return (Destination) JNDIUtil.lookup(destinationName, jndiProperties, classLoaders);
+            }
+            else
+            {
+                return (Destination) JNDIUtil.lookup(destinationName, jndiProperties);
+            }
         }
         catch (NamingException e)
         {
-            throw (JMSException) (new JMSException("Destination lookup failed.  Destination name '" + destinationName + "'.").initCause(e));
+            throw (JMSException) (new JMSException("JMS Destination lookup failed.  Destination name '" + destinationName + "'.").initCause(e));
         }
-        finally
+        catch (ClassCastException e)
         {
-            Thread.currentThread().setContextClassLoader(tcClassLoader);
+            throw (JMSException) (new JMSException("JMS Destination lookup failed.  Class [" + destinationName + "] is not an instance of [" + Destination.class.getName() + "].").initCause(e));
         }
     }
 

Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -106,4 +106,40 @@
 
         return object;
     }
+
+    /**
+     * Lookup an object through the JNDI context.
+     *
+     * @param objectName The name of the object to be looked up.
+     * @param jndiProperties JNDI properties.
+     * @param classLoaders The {@link ClassLoader ClassLoaders) to be used during the lookup.
+     * @return The object.
+     * @throws NamingException Error getting object.
+     */
+    public static Object lookup(final String objectName, final Properties jndiProperties, final ClassLoader[] classLoaders) throws NamingException
+    {
+        ClassLoader tcClassLoader = Thread.currentThread().getContextClassLoader();
+
+        try
+        {
+            for(ClassLoader classLoader : classLoaders)
+            {
+                Thread.currentThread().setContextClassLoader(classLoader);
+                try
+                {
+                    return JNDIUtil.lookup(objectName, jndiProperties);
+                }
+                catch (NamingException e)
+                {
+                    // Try the other ClassLoaders...
+                }
+            }
+        }
+        finally
+        {
+            Thread.currentThread().setContextClassLoader(tcClassLoader);
+        }
+
+        throw new NamingException("JNDI lookup of Object [" + objectName + "] failed.");
+    }
 }

Modified: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -20,9 +20,8 @@
  */
 package org.jboss.esb.microcontainer.config;
 
+import org.jboss.esb.api.context.AbstractResourceLocator;
 import org.jboss.esb.classpath.ClassUtil;
-import org.jboss.esb.util.AssertArgument;
-import org.jboss.esb.api.context.ResourceLocator;
 
 import java.io.InputStream;
 
@@ -36,13 +35,8 @@
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
  * @since 5.0
  */
-public class DeploymentUnitResourceLocator implements ResourceLocator
+public class DeploymentUnitResourceLocator extends AbstractResourceLocator
 {
-    /**
-     * The classloader of the deployment unit. This will make
-     * classes and recources in a .esb archive available.
-     */
-    private ClassLoader deploymentUnitClassloader;
 
     /**
      * Sole contructor.
@@ -51,8 +45,7 @@
      */
     public DeploymentUnitResourceLocator(final ClassLoader classloader)
     {
-        AssertArgument.isNotNull(classloader, "classloader");
-        this.deploymentUnitClassloader = classloader;
+        super(classloader);
     }
 
     /**
@@ -64,28 +57,13 @@
      */
     public final Class<?> forName(final String className) throws ClassNotFoundException
     {
-       return deploymentUnitClassloader.loadClass(className);
-    }
-
-    /**
-     * First tries the deployment units classloader and falls back to
-     * {@link ClassUtil#forName(String, Class)} if not successful.
-     *
-     * @param className - the class to load.
-     * @return Class - the loaded class.
-     * @param caller - the class which should be used as the callers class.
-     * @throws ClassNotFoundException - if the class could not be found.
-     */
-    public final Class<?> forName(final String className, final Class<?> caller) throws ClassNotFoundException
-    {
         try
         {
-            return forName(className);
+            return ClassUtil.findClass(className, getClassLoaders());
         }
         catch (final ClassNotFoundException e)
         {
-            // fallback to normal classloading
-            return ClassUtil.forName(className, caller);
+            return ClassUtil.findClassFromContext(className);
         }
     }
 
@@ -94,27 +72,11 @@
      * {@link ClassUtil#forName(String, Class)} if not successful.
      *
      * @param resourceName - the name of the resource to locate.
-     * @param caller - the class which should be used as the callers class.
      * @return InputStream - the input stream for the resource.
      *
      */
-    public final InputStream getResourceAsStream(final String resourceName, final Class<?> caller)
+    public final InputStream getResourceAsStream(final String resourceName)
     {
-        InputStream resourceAsStream = deploymentUnitClassloader.getResourceAsStream(resourceName);
-        if (resourceAsStream == null)
-        {
-            resourceAsStream = ClassUtil.getResourceAsStream(resourceName, caller);
-        }
-        return resourceAsStream;
+        return ClassUtil.getResourceAsStream(resourceName, getClassLoaders());
     }
-
-    /**
-     * Get the underlying classloader.
-     * @return The underlying ClassLoader.
-     */
-    public final ClassLoader getClassLoader()
-    {
-        return deploymentUnitClassloader;
-    }
-
 }

Modified: 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/BundleResourceLocator.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/bundle/BundleResourceLocator.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -20,8 +20,8 @@
  */
 package org.jboss.esb.osgi.bundle;
 
+import org.jboss.esb.api.context.AbstractResourceLocator;
 import org.jboss.esb.classpath.ClassUtil;
-import org.jboss.esb.api.context.ResourceLocator;
 import org.osgi.framework.Bundle;
 
 import java.io.IOException;
@@ -38,16 +38,12 @@
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
  *
  */
-public class BundleResourceLocator implements ResourceLocator
+public class BundleResourceLocator extends AbstractResourceLocator
 {
     /**
      * The OSGi BundleContext instance.
      */
     private final Bundle bundle;
-    /**
-     * Bundle ClassLoader.
-     */
-    private BundleClassLoader classLoader;
 
     /**
      * Creates and instance and stores the passed-in BundleContext.
@@ -56,32 +52,11 @@
      */
     public BundleResourceLocator(final Bundle bundle)
     {
+        super(createBundleClassLoader(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.
@@ -97,11 +72,9 @@
      * 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)
+    public final InputStream getResourceAsStream(final String resourceName)
     {
         final URL entry = bundle.getEntry(resourceName);
         if (entry != null)
@@ -116,23 +89,24 @@
                 // ignore. Will fallback to normal classloading
             }
         }
-        return ClassUtil.getResourceAsStream(resourceName, caller);
+        return ClassUtil.getResourceAsStream(resourceName, getClassLoaders());
     }
 
     /**
-     * Get the underlying classloader.
-     * @return The underlying ClassLoader.
+     * Create the bundle classloader instance.
+     * @param bundle The bundle.
+     * @return The bundle classloader.
      */
-    public final ClassLoader getClassLoader()
+    private static ClassLoader[] createBundleClassLoader(final Bundle bundle)
     {
-        return classLoader;
+        return new ClassLoader[] {new BundleClassLoader(bundle, BundleResourceLocator.class.getClassLoader())};
     }
 
     /**
      * Bundle ClassLoader.
      * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
      */
-    public class BundleClassLoader extends ClassLoader
+    public static class BundleClassLoader extends ClassLoader
     {
         /**
          * The OSGi Bundle associated with this ClassLoader.

Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/pom.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/pom.xml	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>jboss.jbossesb</groupId>
+        <artifactId>jbossesb-examples-jms-bus</artifactId>
+        <version>${jboss.esb.version}</version>
+    </parent>
+    <name>JBoss ESB - JMS Bus Routing Example (Common Model)</name>
+    <groupId>jboss.jbossesb</groupId>
+    <artifactId>jbossesb-examples-jms-bus-cm</artifactId>
+    <version>${jboss.esb.version}</version>
+    <url>http://www.jboss.org/jbossesb/</url>
+    <packaging>jar</packaging>
+
+</project>


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/pom.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/com/acme/Customer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/com/acme/Customer.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/com/acme/Customer.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package com.acme;
+
+import java.io.Serializable;
+
+/**
+ * Customer object.
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class Customer implements Serializable
+{
+    private String name;
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    public String toString()
+    {
+        return "Customer: " + name;
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/common-model/src/main/java/com/acme/Customer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt	2008-12-05 15:02:56 UTC (rev 24250)
@@ -1 +1 @@
-Hi there... JBoss ESB 5.0!!!
\ No newline at end of file
+Tom Fennelly
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/pom.xml	2008-12-05 15:02:56 UTC (rev 24250)
@@ -19,7 +19,14 @@
 	</properties>
 
 	<dependencies>
-		<dependency>
+        
+        <dependency>
+            <groupId>jboss.jbossesb</groupId>
+            <artifactId>jbossesb-examples-jms-bus-cm</artifactId>
+            <version>${jboss.esb.version}</version>
+        </dependency>
+
+        <dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.main</artifactId>
 			<version>1.2.1</version>
@@ -97,9 +104,10 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.commons.logging</Export-Package> <!-- Exporting commons-logging because activemq needs it and there doesn't seem to be a bundled version available. -->
+                        <Private-Package>com.acme.transformers</Private-Package>
+                        <Export-Package>com.acme,org.apache.commons.logging</Export-Package> <!-- Exporting commons-logging because activemq needs it and there doesn't seem to be a bundled version available. -->
                         <Import-Package>org.jboss.esb.api.routing, org.jboss.esb.api.*, org.jboss.esb.file, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
-                        <Embed-Dependency>log4j, commons-logging</Embed-Dependency>
+                        <Embed-Dependency>log4j, commons-logging, jbossesb-examples-jms-bus-cm</Embed-Dependency>
                         <Embed-Transitive>true</Embed-Transitive>
                         <JBossESB-ConfigFile>/jboss-esb.xml</JBossESB-ConfigFile>
                         <JBossESB-DeploymentName>JMS-Bus-Example-OSGi-ESB1</JBossESB-DeploymentName>

Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/run.bat
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/run.bat	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/run.bat	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,17 @@
+ at echo off
+
+setlocal
+
+del %USERPROFILE%\.felix\runner
+
+set JAVA_OPTS=-Dfelix.config.properties=file:./runner/felix/config.ini -Dorg.jboss.esb.properties.dir=../
+
+if "%1" == "-debug" (
+	set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
+)
+
+set FELIX_JAR="%USERPROFILE%\.m2\repository\org\apache\felix\org.apache.felix.main\1.2.1\org.apache.felix.main-1.2.1.jar"
+
+"%JAVA_HOME%\bin\java" %JAVA_OPTS% -jar %FELIX_JAR%
+
+endlocal
\ No newline at end of file

Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/CustomerToString.java
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/CustomerToString.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/CustomerToString.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package com.acme.transformers;
+
+import org.jboss.esb.api.message.Message;
+import org.jboss.esb.api.message.MessageProcessingException;
+import org.jboss.esb.api.message.MessageProcessor;
+import com.acme.Customer;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class CustomerToString implements MessageProcessor
+{
+    public Message process(Message message) throws MessageProcessingException
+    {
+        Customer customer = (Customer) message.getPayload();
+
+        message.setPayload(customer.getName());
+
+        return message;
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/CustomerToString.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/StringToCustomer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/StringToCustomer.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/StringToCustomer.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package com.acme.transformers;
+
+import org.jboss.esb.api.message.Message;
+import org.jboss.esb.api.message.MessageProcessingException;
+import org.jboss.esb.api.message.MessageProcessor;
+import com.acme.Customer;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class StringToCustomer implements MessageProcessor
+{
+    public Message process(Message message) throws MessageProcessingException
+    {
+        Customer customer = new Customer();
+
+        customer.setName((String) message.getPayload());
+        message.setPayload(customer);
+
+        return message;
+    }
+}


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/java/com/acme/transformers/StringToCustomer.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml	2008-12-05 15:02:56 UTC (rev 24250)
@@ -9,8 +9,11 @@
     <services>
         <service serviceCategory="ESB1" serviceName="Service1" serviceDescription="ESB1 Service1" class="org.jboss.esb.test.PrintlnService">
             <inRouter name="fileRouter" class="org.jboss.esb.file.FileInboundRouter">
+                <processors>
+                    <processor class="com.acme.transformers.StringToCustomer" />
+                </processors>
                 <property name="scheduleResourceId">schedule1</property>
-                <property name="fileSelectorPattern">../target/*.txt</property>
+                <property name="fileSelectorPattern">./target/*.txt</property>
             </inRouter>
             <outRouter name="route-to-ESB2-Service" class="org.jboss.esb.invoke.ServiceRouter">
                 <property name="toCategory">ESB2</property>
@@ -22,7 +25,10 @@
 
         <service serviceCategory="ESB1" serviceName="Service2" serviceDescription="ESB1 Service2" class="org.jboss.esb.test.PrintlnService">
             <outRouter name="fileOutboundRouter" class="org.jboss.esb.file.FileOutboundRouter">
-                <property name="fileNamePattern">../target/service2-received/${name}.out</property>
+                <processors>
+                    <processor class="com.acme.transformers.CustomerToString" />
+                </processors>
+                <property name="fileNamePattern">./target/service2-received/message.out</property>
             </outRouter>
         </service>
     </services>

Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml	2008-12-05 15:02:56 UTC (rev 24250)
@@ -19,7 +19,14 @@
 	</properties>
 
 	<dependencies>
-		<dependency>
+                
+        <dependency>
+            <groupId>jboss.jbossesb</groupId>
+            <artifactId>jbossesb-examples-jms-bus-cm</artifactId>
+            <version>${jboss.esb.version}</version>
+        </dependency>
+
+        <dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.main</artifactId>
 			<version>1.2.1</version>
@@ -94,7 +101,7 @@
                     <instructions>
                         <Export-Package>org.apache.commons.logging</Export-Package> <!-- Exporting commons-logging because activemq needs it and there doesn't seem to be a bundled version available. -->
                         <Import-Package>org.jboss.esb.api.routing, org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
-                        <Embed-Dependency>log4j, commons-logging</Embed-Dependency>
+                        <Embed-Dependency>log4j, commons-logging, jbossesb-examples-jms-bus-cm</Embed-Dependency>
                         <Embed-Transitive>true</Embed-Transitive>
                         <JBossESB-ConfigFile>/jboss-esb.xml</JBossESB-ConfigFile>
                         <JBossESB-DeploymentName>JMS-Bus-Example-OSGi-ESB2</JBossESB-DeploymentName>

Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/pom.xml	2008-12-05 15:02:56 UTC (rev 24250)
@@ -14,6 +14,7 @@
 	<packaging>pom</packaging>
 
 	<modules>
+        <module>common-model</module>
         <module>esb1</module>
         <module>esb2</module>
 	</modules>

Modified: labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/AbstractFileInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/AbstractFileInboundRouter.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/AbstractFileInboundRouter.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -19,14 +19,9 @@
  */
 package org.jboss.esb.file;
 
-import java.io.File;
-import java.util.Map;
-import java.util.Properties;
-
 import org.apache.log4j.Logger;
 import org.jboss.esb.api.annotations.Initialize;
 import org.jboss.esb.api.annotations.Property;
-import org.jboss.esb.api.annotations.Property.Use;
 import org.jboss.esb.api.context.InvocationContext;
 import org.jboss.esb.api.exception.ConfigurationException;
 import org.jboss.esb.api.message.Message;
@@ -36,11 +31,16 @@
 import org.jboss.esb.file.filtering.WildcardFileFilter;
 import org.jboss.esb.file.lifecycle.FileLifecycle;
 import org.jboss.esb.file.lifecycle.FileLifecycleFactory;
+import org.jboss.esb.file.lifecycle.DefaultFileLifecycleFactory;
 import org.jboss.esb.file.util.FileRouterUtil;
 import org.jboss.esb.schedule.AbstractScheduleListener;
 import org.jboss.esb.schedule.SchedulingException;
 import org.jboss.esb.util.FileUtil;
 
+import java.io.File;
+import java.util.Map;
+import java.util.Properties;
+
 /**
  * Simple schedule based file {@link InboundRouter}. A FileInboundRouter is
  * configured by specifying a reference to a configured schedule configured in
@@ -55,7 +55,7 @@
  *         <property name="execCount">1</property>
  *     </resource>
  * </resources>
- *
+ *
  * <inRouter name="fileRouter" class="org.jboss.esb.file.FileInboundRouter">
  *     <property name="scheduleResourceId">schedule1</property>
  *     <property name="fileSelectorPattern">target/*.txt</property>
@@ -68,11 +68,11 @@
  *  <li><i>fileSelectorPattern</i> - the file matching pattern used to filter files to pick up from the inputDir. Default: '*'</li>
  *  <li><i>fileSelector</i> - the concrete {@link FileSelector} implementationto use. Default: org.jboss.esb.file.filtering.WildcardFileSelector</li>
  *  <li><i>fileEncoding</i> - the file encoding to use when reading the file. Default:UTF-8.</li>
- *  <li><i>fileContentType</i> - the Java Object type that the file contents should be read into. Can be "STRING", "BYTES", "STREAM"</li>
- *  <li><i>workingRenamePattern</i> - the pattern used for naming files that the esb is processing. Default: ${name}.working</li>
- *  <li><i>processedRenamePattern</i> - the pattern used for naming files that have be processed successfully. Default:${name}.processed}</li>
- *  <li><i>errorRenamePattern</i> - the pattern used for naming files when a processing error occurs. Default: ${name}.error</li>
- *  <li><i>fileLifecycleFactory</i> - the concrete {@link FileLifecycleFactory} implementation to use. Default:org.jboss.esb.file.lifecycle.DefaultFileLifecycleFactory</li>
+ *  <li><i>payloadType</i> - the Java Object type that the file contents should be read into. Can be "STRING", "BYTES", "STREAM"</li>
+ *  <li><i>workingRenamePattern</i> - the pattern used for naming files that the esb is processing. Default: "${name}.working"</li>
+ *  <li><i>processedRenamePattern</i> - the pattern used for naming files that have be processed successfully. Default: "${name}.processed"</li>
+ *  <li><i>errorRenamePattern</i> - the pattern used for naming files when a processing error occurs. Default: "${name}.error"</li>
+ *  <li><i>fileLifecycleFactory</i> - the concrete {@link FileLifecycleFactory} implementation to use. Default: {@link DefaultFileLifecycleFactory org.jboss.esb.file.lifecycle.DefaultFileLifecycleFactory}</li>
  * </lu>
  *
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -104,49 +104,50 @@
     /**
      * The file selector pattern use.
      */
-    @Property(use = Use.OPTIONAL, name = "fileSelectorPattern", defaultVal = "*")
+    @Property(defaultVal = "*")
     private String fileSelectorPattern;
 
     /**
      * The file selector implementation to use.
      */
-    @Property(use = Use.OPTIONAL, name = "fileSelector", defaultVal = "org.jboss.esb.file.filtering.WildcardFileSelector")
+    @Property(name = "fileSelector", defaultVal = "org.jboss.esb.file.filtering.WildcardFileSelector")
     private String fileSelectorImpl;
 
     /**
      * The file encoding of the file being read.
+     * // TODO Change fileEncoding to type Charset - get validation and remove need to convert it locally etc 
      */
-    @Property(use = Use.OPTIONAL, name = "fileEncoding", defaultVal = "UTF-8")
+    @Property(defaultVal = "UTF-8")
     private String fileEncoding;
 
     /**
      * The rename pattern for a file that is in the working state.
      */
-    @Property(use = Use.OPTIONAL, name = "workingRenamePattern", defaultVal = "${name}.working")
+    @Property(defaultVal = "${name}.working")
     private String workingRenamePattern;
 
     /**
      * The rename pattern for a file when an error occurs.
      */
-    @Property(use = Use.OPTIONAL, name = "errorRenamePattern", defaultVal = "${name}.error")
+    @Property(defaultVal = "${name}.error")
     private String errorRenamePattern;
 
     /**
      * The processed rename pattern for a successfully processed file.
      */
-    @Property(use = Use.OPTIONAL, name = "processedRenamePattern", defaultVal = "${name}.processed")
+    @Property(defaultVal = "${name}.processed")
     private String processedRenamePattern;
 
     /**
      * The file lifecycle factory to use.
      */
-    @Property(use = Use.REQUIRED, name = "fileLifecycleFactory", defaultVal = "org.jboss.esb.file.lifecycle.DefaultFileLifecycleFactory")
+    @Property(name = "fileLifecycleFactory", defaultVal = "org.jboss.esb.file.lifecycle.DefaultFileLifecycleFactory")
     private String fileLifecycleFactoryName;
 
     /**
      * The Object type the file contents should be represented by in the message.
      */
-    @Property(use = Use.REQUIRED, name = "payloadType", choice = { STRING_TYPE, BYTES_TYPE, STREAM_TYPE })
+    @Property(choice = { STRING_TYPE, BYTES_TYPE, STREAM_TYPE }, defaultVal = STRING_TYPE)
     private String payloadType;
 
     /**

Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -96,6 +96,16 @@
      * Java Serializer.
      */
     private JavaSerializer javaSerializer = new JavaSerializer();
+    
+    /**
+     * Set the resource locator instance for the Bus implementation.
+     * @param resourceLocator The resource locator.
+     */
+    public void setResourceLocator(ResourceLocator resourceLocator)
+    {
+        this.resourceLocator = resourceLocator;
+        javaSerializer.setResourceLocator(resourceLocator);
+    }
 
     /**
      * Connect the bus.
@@ -375,7 +385,7 @@
         {
             if (resourceLocator != null)
             {
-                topicSession.setClassLoader(resourceLocator.getClassLoader());
+                topicSession.setClassLoaders(resourceLocator.getClassLoaders());
             }
             topicSession.connect();
         }
@@ -389,7 +399,7 @@
             queueSession = new JMSSession(JMSSession.Type.QUEUE, localBusProperties);
             if (resourceLocator != null)
             {
-                queueSession.setClassLoader(resourceLocator.getClassLoader());
+                queueSession.setClassLoaders(resourceLocator.getClassLoaders());
             }
             queueSession.connect();
         }

Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/util/RouterUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/util/RouterUtil.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/util/RouterUtil.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -91,7 +91,7 @@
     public static JMSSession createJMSSession(final Properties jmsProperties, final ResourceLocator resourceLocator) throws JMSException
     {
         final JMSSession session = new JMSSession(jmsProperties);
-        session.setClassLoader(resourceLocator.getClassLoader());
+        session.setClassLoaders(resourceLocator.getClassLoaders());
         return session;
     }
 

Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/ContextResourceLocator.java (from rev 24236, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DefaultResourceLocator.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/ContextResourceLocator.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/ContextResourceLocator.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,83 @@
+/*
+ * 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.deploy;
+
+import org.jboss.esb.classpath.ClassUtil;
+import org.jboss.esb.api.context.AbstractResourceLocator;
+
+import java.io.InputStream;
+
+
+/**
+ * Thread Context {@link ClassLoader} resource locator.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class ContextResourceLocator extends AbstractResourceLocator
+{
+    /**
+     * Public constructor.
+     *
+     * @param classLoader The {@link ClassLoader ClassLoader} to be used by the locator instance.
+     */
+    public ContextResourceLocator(final ClassLoader classLoader)
+    {
+        super(classLoader);
+    }
+
+    /**
+     * Public constructor.
+     * @param fallbackClassLoaders The {@link ClassLoader ClassLoaders} to be used
+     * if the Thread Context {@link ClassLoader} fails to load the class/resource.
+     */
+    public ContextResourceLocator(final ClassLoader[] fallbackClassLoaders)
+    {
+        super(fallbackClassLoaders);
+    }
+
+    /**
+     * Simply delegates to {@link org.jboss.esb.classpath.ClassUtil#forName(String, Class)} and passes this
+     * classes class as the second argument.
+     *
+     * @param className - the class to load.
+     * @return Class - the loaded class.
+     * @throws ClassNotFoundException - if the class could not be found.
+     */
+    public final Class<?> forName(final String className) throws ClassNotFoundException
+    {
+        return ClassUtil.forName(className, getClassLoaders());
+    }
+
+    /**
+     * Simply delegates to {@link ClassUtil#getResourceAsStream(String, Class)}.
+     * classes class as the second argument.
+     *
+     * @param resourceName - the name of the resource to locate.
+     * @return InputStream - the input stream for the resource.
+     *
+     */
+    public final InputStream getResourceAsStream(final String resourceName)
+    {
+        return ClassUtil.getResourceAsStream(resourceName, getClassLoaders());
+    }
+
+}


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/ContextResourceLocator.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DefaultResourceLocator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DefaultResourceLocator.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DefaultResourceLocator.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -1,89 +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.deploy;
-
-import org.jboss.esb.classpath.ClassUtil;
-import org.jboss.esb.api.context.ResourceLocator;
-
-import java.io.InputStream;
-
-
-/**
- * Default resource locator works like you would expect a traditional
- * Java resource locator.
- * <p/>
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- *
- */
-public class DefaultResourceLocator implements ResourceLocator
-{
-    /**
-     * Simply delegates to {@link org.jboss.esb.classpath.ClassUtil#forName(String, Class)} and passes this
-     * classes class as the second argument.
-     *
-     * @param className - the class to load.
-     * @return Class - the loaded class.
-     * @throws ClassNotFoundException - if the class could not be found.
-     */
-    public final Class<?> forName(final String className) throws ClassNotFoundException
-    {
-        return ClassUtil.forName(className, getClass());
-    }
-
-    /**
-     * Simply delegates to {@link ClassUtil#forName(String, Class)} and passes this
-     * classes class as the second argument.
-     *
-     * @param className - the class to load.
-     * @return Class - the loaded class.
-     * @param caller - the class which should be used as the callers class.
-     * @throws ClassNotFoundException - if the class could not be found.
-     */
-    public final Class<?> forName(final String className, final Class<?> caller) throws ClassNotFoundException
-    {
-       return ClassUtil.forName(className, caller);
-    }
-
-    /**
-     * Simply delegates to {@link ClassUtil#getResourceAsStream(String, Class)}.
-     * classes class as the second argument.
-     *
-     * @param resourceName - the name of the resource to locate.
-     * @param caller - the class which should be used as the callers class.
-     * @return InputStream - the input stream for the resource.
-     *
-     */
-    public final InputStream getResourceAsStream(final String resourceName, final Class<?> caller)
-    {
-        return ClassUtil.getResourceAsStream(resourceName, caller);
-    }
-
-    /**
-     * Get the underlying classloader.
-     * @return The underlying ClassLoader.
-     */
-    public final ClassLoader getClassLoader()
-    {
-        return null;
-    }
-
-}

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -157,11 +157,11 @@
 
     /**
      * Constructs a DeploymentRuntime and sets its {@link org.jboss.esb.api.context.ResourceLocator}
-     * to {@link DefaultResourceLocator}.
+     * to {@link ContextResourceLocator}.
      */
     public DeploymentRuntime()
     {
-        resourceLocator = new DefaultResourceLocator();
+        resourceLocator = new ContextResourceLocator(getClass().getClassLoader());
     }
 
     /**
@@ -972,7 +972,7 @@
                 continue;
             }
 
-            BusInboundRouter inRouter = new BusInboundRouter();
+            BusInboundRouter inRouter = new BusInboundRouter(context);
             BusDispatcher dispatcher = new BusDispatcher(context, dispatchChainMap.get(serviceName));
 
             busRouters.put(serviceName, inRouter);

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -83,7 +83,7 @@
         {
             // 2nd: Check for a config using the resource locator...
             String cpCheckPath = getClassPath(configPath);
-            configStream = resourceLocator.getResourceAsStream(cpCheckPath, ConfigUtil.class);
+            configStream = resourceLocator.getResourceAsStream(cpCheckPath);
         }
 
         return configStream;

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-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -80,14 +80,13 @@
      * @param resourceLocator The {@link ResourceLocator} to use.
      * @throws SmooksConfigurationException Unable to load the expected type class.
      */
-    //@Initialize
     public final void initialize(final ResourceLocator resourceLocator) throws SmooksConfigurationException
     {
         if (expectedTypeName != null)
         {
             try
             {
-                expectedType = resourceLocator.forName(expectedTypeName, CreateObject.class);
+                expectedType = resourceLocator.forName(expectedTypeName);
             }
             catch (ClassNotFoundException e)
             {
@@ -170,7 +169,7 @@
     {
         try
         {
-            Class objectClass = resourceLocator.forName(objectClassName, CreateObject.class);
+            Class objectClass = resourceLocator.forName(objectClassName);
             Constructor defaultConstructor;
 
             if (expectedType != null && !expectedType.isAssignableFrom(objectClass))

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -275,13 +275,13 @@
                 String resPathString = "/META-INF" + namespace.getPath() + "-smooks.xml";
                 File resPath = new File(resPathString);
                 String baseURI = resPath.getParent().replace('\\', '/');
-                InputStream configStream = resourceLocator.getResourceAsStream(resPathString, DigestUtil.class);
+                InputStream configStream = resourceLocator.getResourceAsStream(resPathString);
 
                 if (configStream != null)
                 {
                     try
                     {
-                        list = XMLConfigDigester.digestConfig(resourceLocator.getResourceAsStream(resPathString, DigestUtil.class), baseURI);
+                        list = XMLConfigDigester.digestConfig(resourceLocator.getResourceAsStream(resPathString), baseURI);
                     }
                     catch (URISyntaxException e)
                     {

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -20,32 +20,33 @@
 package org.jboss.esb.dispatch;
 
 import org.apache.log4j.Logger;
+import org.jboss.esb.api.bus.BusMessage;
 import org.jboss.esb.api.context.AddressingContext;
 import org.jboss.esb.api.context.DeploymentContext;
 import org.jboss.esb.api.context.FaultContext;
 import org.jboss.esb.api.context.InvocationContext;
+import org.jboss.esb.api.message.Message;
+import org.jboss.esb.api.message.MessageProcessor;
+import org.jboss.esb.api.routing.FilterEvaluator;
+import org.jboss.esb.api.routing.MessageDispatcher;
+import org.jboss.esb.api.routing.OutboundRouter;
+import org.jboss.esb.api.routing.RoutingException;
+import org.jboss.esb.api.service.ServiceException;
+import org.jboss.esb.api.service.ServiceMEP;
+import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.config.FilterConfig;
 import org.jboss.esb.deploy.config.OutboundRouterConfig;
 import org.jboss.esb.deploy.config.ServiceConfig;
 import org.jboss.esb.failure.PersistedDeadLetterService;
-import org.jboss.esb.api.bus.BusMessage;
 import org.jboss.esb.federate.bus.BusOutboundRouter;
 import org.jboss.esb.federate.bus.BusUtil;
 import org.jboss.esb.history.ProcessingEventLogAccessor;
 import org.jboss.esb.history.events.OutboundRouterProcessingEvent;
 import org.jboss.esb.history.events.ServiceProcessingEvent;
-import org.jboss.esb.api.message.Message;
-import org.jboss.esb.api.message.MessageProcessor;
-import org.jboss.esb.api.routing.FilterEvaluator;
-import org.jboss.esb.api.routing.MessageDispatcher;
-import org.jboss.esb.api.routing.OutboundRouter;
-import org.jboss.esb.api.routing.RoutingException;
 import org.jboss.esb.invoke.ServiceInvoker;
 import org.jboss.esb.serialization.SerializationException;
 import org.jboss.esb.serialization.java.JavaSerializer;
-import org.jboss.esb.api.service.ServiceException;
-import org.jboss.esb.api.service.ServiceMEP;
-import org.jboss.esb.api.service.ServiceName;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -83,6 +84,10 @@
      * Active message list.
      */
     private List<Message> activeMessageList = Collections.synchronizedList(new ArrayList<Message>());
+    /**
+     * Java Serializer.
+     */
+    private JavaSerializer javaSerializer;
 
     /**
      * Public constructor.
@@ -96,6 +101,7 @@
         this.deploymentContext = deploymentContext;
         logger = Logger.getLogger(getClass());
         serviceInvoker = new ServiceInvoker(deploymentContext);
+        javaSerializer = new JavaSerializer(DeploymentRuntime.getRuntime(deploymentContext).getResourceLocator());
     }
 
     /**
@@ -157,7 +163,7 @@
     /**
      * Apply the supplied processor set.
      *
-     * @param message    The message.
+     * @param message       The message.
      * @param processorList The processors to be applied.
      * @throws org.jboss.esb.api.routing.RoutingException
      *          Error applying processor.
@@ -185,7 +191,7 @@
      *
      * @param theMessage    The message.
      * @param serviceConfig The service configuration.
-     * @param processorList    Processors to be applied before dispatching to the service.
+     * @param processorList Processors to be applied before dispatching to the service.
      * @return The processed message.  Can be a new Message instance.
      */
     protected final Message dispatchToService(final Message theMessage, final ServiceConfig serviceConfig, final List<MessageProcessor> processorList)
@@ -333,12 +339,12 @@
                         FilterConfig filterConfig = outboundRouterConfig.getFilterConfig();
                         FilterEvaluator filterEvaluator = null;
 
-                        if(filterConfig != null)
+                        if (filterConfig != null)
                         {
                             filterEvaluator = filterConfig.getEvaluator();
                         }
 
-                        if(filterEvaluator == null || filterEvaluator.filterMessage(message))
+                        if (filterEvaluator == null || filterEvaluator.filterMessage(message))
                         {
                             // TODO: Optimize... only clone if we need to...
                             Message outMessage = cloneMessage(message);
@@ -384,7 +390,7 @@
     {
         try
         {
-            return JavaSerializer.copy(message);
+            return javaSerializer.copy(message);
         }
         catch (SerializationException e)
         {
@@ -462,8 +468,8 @@
     /**
      * Route the supplied message to the Dead Letter Service.
      *
-     * @param theMessage The message.
-     * @param theFault   The fault that triggered the routing of the message to the Dead Letter Service.
+     * @param theMessage        The message.
+     * @param theFault          The fault that triggered the routing of the message to the Dead Letter Service.
      * @param addressingContext The {@link org.jboss.esb.api.context.AddressingContext} for the failed delivery.
      */
     protected final void routeToDeadLetterService(final Message theMessage, final Throwable theFault, final AddressingContext addressingContext)
@@ -477,10 +483,10 @@
     /**
      * Route the supplied message to the Dead Letter Service.
      *
-     * @param theMessage     The message.
-     * @param theFault       The fault that triggered the routing of the message to the Dead Letter Service.
+     * @param theMessage        The message.
+     * @param theFault          The fault that triggered the routing of the message to the Dead Letter Service.
      * @param addressingContext The {@link org.jboss.esb.api.context.AddressingContext} for the failed delivery.
-     * @param serviceInvoker The ServiceInvoker instance to use for the delivery.
+     * @param serviceInvoker    The ServiceInvoker instance to use for the delivery.
      * @return True if the message was delivered to the Dead Letter Service.
      */
     public static boolean routeToDeadLetterService(final Message theMessage, final Throwable theFault, final AddressingContext addressingContext, final ServiceInvoker serviceInvoker)

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -34,6 +34,7 @@
 import org.jboss.esb.schedule.SchedulingException;
 import org.jboss.esb.serialization.java.JavaSerializer;
 import org.jboss.esb.serialization.SerializationException;
+import org.jboss.esb.deploy.DeploymentRuntime;
 
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -74,6 +75,10 @@
      * ServiceInvoker.
      */
     private ServiceInvoker serviceInvoker;
+    /**
+     * Java Serializer.
+     */
+    private JavaSerializer javaSerializer;
 
     /**
      * Initialize the router.
@@ -83,6 +88,7 @@
     public final void initialize() throws DeploymentException
     {
         serviceInvoker = new ServiceInvoker(deploymentContext);
+        javaSerializer = new JavaSerializer(DeploymentRuntime.getRuntime(deploymentContext).getResourceLocator());
     }
     
     /**
@@ -145,7 +151,7 @@
                         try
                         {
                             logger.info("Redelivering message from DLQ.  Addressing: '" + message.getAddressingContext() + "'.");
-                            serviceInvoker.send(JavaSerializer.deserialize(message.getMessage()), message.getAddressingContext());
+                            serviceInvoker.send(javaSerializer.deserialize(message.getMessage()), message.getAddressingContext());
                         }
                         catch (SerializationException e)
                         {

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -35,6 +35,7 @@
 import org.jboss.esb.serialization.SerializationException;
 import org.jboss.esb.serialization.java.JavaSerializer;
 import org.jboss.esb.util.AssertArgument;
+import org.jboss.esb.deploy.DeploymentRuntime;
 
 /**
  * Deployment Monitor.
@@ -75,7 +76,7 @@
     /**
      * Java Serializer.
      */
-    private JavaSerializer javaSerializer = new JavaSerializer();
+    private JavaSerializer javaSerializer;
 
     /**
      * Constructor.
@@ -93,6 +94,7 @@
         this.online = true;
 
         serviceInvoker = new ServiceInvoker(deploymentContext);
+        javaSerializer = new JavaSerializer(DeploymentRuntime.getRuntime(deploymentContext).getResourceLocator());
     }
 
     /**
@@ -230,7 +232,7 @@
 
                 try
                 {
-                    faultContext.setFaultMessage(JavaSerializer.deserialize(message.getMessage()));
+                    faultContext.setFaultMessage(javaSerializer.deserialize(message.getMessage()));
                 }
                 catch (SerializationException e)
                 {

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -21,6 +21,7 @@
 
 import org.jboss.esb.api.context.AddressingContext;
 import org.jboss.esb.api.context.InvocationContext;
+import org.jboss.esb.api.context.DeploymentContext;
 import org.jboss.esb.api.history.ProcessingEventLog;
 import org.jboss.esb.api.message.Message;
 import org.jboss.esb.api.routing.MessageDispatcher;
@@ -29,6 +30,7 @@
 import org.jboss.esb.api.bus.BusMessage;
 import org.jboss.esb.serialization.java.JavaSerializer;
 import org.jboss.esb.serialization.SerializationException;
+import org.jboss.esb.deploy.DeploymentRuntime;
 
 /**
  * Bus inbound router for a specific Service.
@@ -44,8 +46,21 @@
      * Message dispatcher.
      */
     private MessageDispatcher dispatcher;
+    /**
+     * Java Serializer.
+     */
+    private JavaSerializer javaSerializer;
 
     /**
+     * Public constructor.
+     * @param context The deployment context of the router instance.
+     */
+    public BusInboundRouter(final DeploymentContext context)
+    {
+        javaSerializer = new JavaSerializer(DeploymentRuntime.getRuntime(context).getResourceLocator());
+    }
+
+    /**
      * Get the {@link MessageDispatcher} for the router.
      *
      * @return The {@link MessageDispatcher} instance.
@@ -89,7 +104,7 @@
         AddressingContext.setContext(addressingContext);
         try
         {
-            Message esbMessage = JavaSerializer.deserialize(busMessage.getMessage());
+            Message esbMessage = javaSerializer.deserialize(busMessage.getMessage());
             dispatch(esbMessage, invocationContext);
         }
         catch (SerializationException e)

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -24,6 +24,7 @@
 import org.jboss.esb.api.bus.AbstractNotification;
 import org.jboss.esb.api.bus.BusMessage;
 import org.jboss.esb.api.routing.RoutingException;
+import org.jboss.esb.api.context.ResourceLocator;
 import org.jboss.esb.serialization.SerializationException;
 import org.jboss.esb.serialization.java.JavaSerializer;
 
@@ -58,6 +59,10 @@
      * Threadpool executor.
      */
     private ExecutorService executor;
+    /**
+     * Java Serializer.
+     */
+    private JavaSerializer javaSerializer = new JavaSerializer();
 
     /**
      * Default constructor.
@@ -69,6 +74,16 @@
     }
 
     /**
+     * Set the resource locator instance for the Bus implementation.
+     * @param resourceLocator The resource locator.
+     */
+    public void setResourceLocator(ResourceLocator resourceLocator)
+    {
+        this.resourceLocator = resourceLocator;
+        javaSerializer.setResourceLocator(resourceLocator);
+    }
+
+    /**
      * Connect to the bus.
      *
      * @throws RoutingException Connection exception.
@@ -139,7 +154,7 @@
 
         try
         {
-            executor.execute(new MessageDeliveryJob(targetInterface, (BusMessage) JavaSerializer.copyObject(message)));
+            executor.execute(new MessageDeliveryJob(targetInterface, (BusMessage) javaSerializer.copyObject(message)));
         }
         catch (SerializationException e)
         {
@@ -163,7 +178,7 @@
             {
                 try
                 {
-                    executor.execute(new NotificationDeliveryJob(targetInterface, (AbstractNotification) JavaSerializer.copyObject(notification)));
+                    executor.execute(new NotificationDeliveryJob(targetInterface, (AbstractNotification) javaSerializer.copyObject(notification)));
                 }
                 catch (SerializationException e)
                 {

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/invoke/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/invoke/ServiceInvoker.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/invoke/ServiceInvoker.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -66,6 +66,10 @@
      * Deployment runtime.
      */
     private DeploymentRuntime deploymentRuntime;
+    /**
+     * Java Serializer.
+     */
+    private JavaSerializer javaSerializer;
 
     /**
      * Public constructor.
@@ -76,6 +80,7 @@
         AssertArgument.isNotNull(deploymentContext, "deploymentContext");
         this.deploymentContext = deploymentContext;
         deploymentRuntime = DeploymentRuntime.getRuntime(deploymentContext);
+        javaSerializer = new JavaSerializer(deploymentRuntime.getResourceLocator());
     }
 
     /**
@@ -162,7 +167,7 @@
                 try
                 {
                     // TODO: Make this optional i.e. on by default, but can be turned off for performance reasons if required.
-                    clone = JavaSerializer.copy(message);
+                    clone = javaSerializer.copy(message);
                 }
                 catch (SerializationException e)
                 {

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -19,8 +19,9 @@
  */
 package org.jboss.esb.serialization.java;
 
+import org.jboss.esb.api.context.ResourceLocator;
 import org.jboss.esb.api.message.Message;
-import org.jboss.esb.classpath.ContextObjectInputStream;
+import org.jboss.esb.deploy.ContextResourceLocator;
 import org.jboss.esb.serialization.SerializationException;
 import org.jboss.esb.serialization.Serializer;
 import org.jboss.esb.util.AssertArgument;
@@ -48,8 +49,54 @@
      * Singleton Serializer.
      */
     private static final JavaSerializer SERIALIZER = new JavaSerializer();
+    /**
+     * The resource locator to be used during message deserialization.
+     */
+    private ResourceLocator resourceLocator = new ContextResourceLocator(getClass().getClassLoader());
 
     /**
+     * Public constructor.
+     */
+    public JavaSerializer()
+    {
+    }
+
+    /**
+     * Public constructor.
+     * @param resourceLocator Resource Locator to be used during deserialization.
+     */
+    public JavaSerializer(final ResourceLocator resourceLocator)
+    {
+        AssertArgument.isNotNull(resourceLocator, "resourceLocator");
+        this.resourceLocator = resourceLocator;
+    }
+
+    /**
+     * Get the {@link ResourceLocator}.
+     * <p/>
+     * This is the resource locator used during deserialization.
+     *
+     * @return The {@link ResourceLocator} instance.
+     */
+    public final ResourceLocator getResourceLocator()
+    {
+        return resourceLocator;
+    }
+
+    /**
+     * Set the {@link ResourceLocator}.
+     * <p/>
+     * This is the resource locator used during deserialization.
+     *
+     * @param resourceLocator The {@link ResourceLocator} instance.
+     */
+    public void setResourceLocator(final ResourceLocator resourceLocator)
+    {
+        AssertArgument.isNotNull(resourceLocator, "resourceLocator");
+        this.resourceLocator = resourceLocator;
+    }
+
+    /**
      * Serialize the supplied {@link Message} to the supplied {@link OutputStream}.
      *
      * @param message   The Message.
@@ -113,10 +160,22 @@
      * @return The Message.
      * @throws SerializationException Failed to deserialize message.
      */
-    public static Message deserialize(byte[] messageBytes) throws SerializationException
+    public static Message deserializeBytes(final byte[] messageBytes) throws SerializationException
     {
+        return SERIALIZER.deserialize(messageBytes);
+    }
+
+    /**
+     * Deserialize the {@link Message} from the supplied {@link InputStream}.
+     *
+     * @param messageBytes Message bytes.
+     * @return The Message.
+     * @throws SerializationException Failed to deserialize message.
+     */
+    public final Message deserialize(final byte[] messageBytes) throws SerializationException
+    {
         ByteArrayInputStream byteStream = new ByteArrayInputStream(messageBytes);
-        return SERIALIZER.deserialize(byteStream);
+        return deserialize(byteStream);
     }
 
     /**
@@ -126,7 +185,7 @@
      * @return The Message.
      * @throws SerializationException Failed to deserialize message.
      */
-    public Message deserialize(InputStream messageStream) throws SerializationException
+    public final Message deserialize(final InputStream messageStream) throws SerializationException
     {
         return (Message) deserializeObject(messageStream);
     }
@@ -140,10 +199,10 @@
      */
     public final Object deserializeObject(final InputStream messageStream) throws SerializationException
     {
-        ObjectInputStream input = null;
+        ObjectInputStream input;
         try
         {
-            input = new ContextObjectInputStream(messageStream);
+            input = new ResourceLocatorObjectInputStream(messageStream, resourceLocator);
         }
         catch (IOException e)
         {
@@ -177,7 +236,6 @@
         }
     }
 
-
     /**
      * Make a complete copy the supplied ESB message.
      * <p/>
@@ -187,7 +245,7 @@
      * @return A full copy of the object.
      * @throws SerializationException Failed to serialize/deserialize the object.
      */
-    public static Message copy(final Message message) throws SerializationException
+    public final Message copy(final Message message) throws SerializationException
     {
         return (Message) copyObject(message);
     }
@@ -201,16 +259,30 @@
      * @return A full copy of the object.
      * @throws SerializationException Failed to serialize/deserialize the object.
      */
-    public static Object copyObject(final Serializable object) throws SerializationException
+    public final Object copyObject(final Serializable object) throws SerializationException
     {
         AssertArgument.isNotNull(object, "object");
 
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
 
-        SERIALIZER.serializeObject(object, outStream);
+        serializeObject(object, outStream);
 
         ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
 
-        return SERIALIZER.deserializeObject(inStream);
+        return deserializeObject(inStream);
     }
+
+    /**
+     * Make a complete copy the supplied ESB message.
+     * <p/>
+     * Serializes and then deserializes the message.
+     *
+     * @param message The message.
+     * @return A full copy of the object.
+     * @throws SerializationException Failed to serialize/deserialize the object.
+     */
+    public static Message copyMessage(final Message message) throws SerializationException
+    {
+        return SERIALIZER.copy(message);
+    }
 }

Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/ResourceLocatorObjectInputStream.java (from rev 24236, labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/classpath/ContextObjectInputStream.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/ResourceLocatorObjectInputStream.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/ResourceLocatorObjectInputStream.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.serialization.java;
+
+import org.jboss.esb.api.context.ResourceLocator;
+import org.jboss.esb.classpath.ClassUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+/**
+ * {@link java.io.ObjectInputStream} that delegates class loading to a ResourceLocator's
+ * {@link ClassLoader}.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ResourceLocatorObjectInputStream extends ObjectInputStream
+{
+    /**
+     * Resource Locator.
+     */
+    private ResourceLocator resourceLocator;
+
+    /**
+     * Construct a context aware object input stream using the specified input stream.
+     *
+     * @param in The associated input stream.
+     * @param resourceLocator Resource Locator.
+     * @throws java.io.IOException for IO errors reading from the stream.
+     */
+    public ResourceLocatorObjectInputStream(final InputStream in, final ResourceLocator resourceLocator) throws IOException
+    {
+        super(in);
+        this.resourceLocator = resourceLocator;
+    }
+
+    /**
+     * Resolve the class using the active context.
+     *
+     * @param desc The object stream class description.
+     * @return The associated class.
+     * @throws ClassNotFoundException if the class cannot be found.
+     * @throws java.io.IOException            for I/O Errors.
+     */
+    @Override
+    public final Class<?> resolveClass(final ObjectStreamClass desc) throws IOException, ClassNotFoundException
+    {
+        return resourceLocator.forName(desc.getName());
+    }
+
+    /**
+     * Resolve the proxy class using the active context.
+     *
+     * @param interfaces The interfaces associated with the proxy.
+     * @return The associated class.
+     * @throws ClassNotFoundException if an interface cannot be found.
+     * @throws java.io.IOException            for I/O Errors.
+     */
+    @Override
+    public final Class<?> resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException
+    {
+        ClassLoader[] classLoaders = resourceLocator.getClassLoaders();
+
+        return ClassUtil.resolveProxy(interfaces, classLoaders);
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/ResourceLocatorObjectInputStream.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/util/XsdDOMValidator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/util/XsdDOMValidator.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/util/XsdDOMValidator.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -182,7 +182,7 @@
     private Source getNamespaceSource(final URI namespace, final ResourceLocator resourceLocator) throws SAXException
     {
         String resourcePath = "/META-INF" + namespace.getPath();
-        InputStream xsdStream = resourceLocator.getResourceAsStream(resourcePath, getClass());
+        InputStream xsdStream = resourceLocator.getResourceAsStream(resourcePath);
 
 
         if (xsdStream == null)

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -23,7 +23,7 @@
 import org.jboss.esb.api.service.ServiceMEP;
 import org.jboss.esb.api.service.ServiceName;
 import org.jboss.esb.api.exception.DeploymentException;
-import org.jboss.esb.deploy.DefaultResourceLocator;
+import org.jboss.esb.deploy.ContextResourceLocator;
 import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -500,7 +500,7 @@
 
     private DeploymentUnit digest(String config) throws IOException, DeploymentException
     {
-        DefaultConfigurationDigester digester = new DefaultConfigurationDigester(new DefaultResourceLocator());
+        DefaultConfigurationDigester digester = new DefaultConfigurationDigester(new ContextResourceLocator(getClass().getClassLoader()));
         return digester.digest(getClass().getResourceAsStream(config));
     }
 }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/InboundFilterConfigTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/InboundFilterConfigTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/InboundFilterConfigTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -21,7 +21,7 @@
 
 import junit.framework.TestCase;
 import org.jboss.esb.api.exception.DeploymentException;
-import org.jboss.esb.deploy.DefaultResourceLocator;
+import org.jboss.esb.deploy.ContextResourceLocator;
 import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
 import org.jboss.esb.api.message.Message;
 import org.jboss.esb.api.routing.FilterEvaluator;
@@ -180,7 +180,7 @@
 
     private DeploymentUnit digest(String config) throws IOException, DeploymentException
     {
-        DefaultConfigurationDigester digester = new DefaultConfigurationDigester(new DefaultResourceLocator());
+        DefaultConfigurationDigester digester = new DefaultConfigurationDigester(new ContextResourceLocator(getClass().getClassLoader()));
         return digester.digest(getClass().getResourceAsStream(config));
     }
 }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -69,7 +69,7 @@
             // to the service instance and then to the outrouter...
             assertEquals("Hi there!!", serviceA.getMessage());
             BusMessage faultMessage = (BusMessage) serviceB.getMessage();
-            assertEquals("Hi there!!", JavaSerializer.deserialize(faultMessage.getMessage()).getPayload());
+            assertEquals("Hi there!!", JavaSerializer.deserializeBytes(faultMessage.getMessage()).getPayload());
             assertEquals("Service:A", faultMessage.getAddressingContext().getTo().toString());
             assertEquals("Service:B", faultMessage.getAddressingContext().getFaultTo().toString());
             assertTrue(faultMessage.getFault() instanceof ServiceException);

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -67,7 +67,7 @@
             // to the service instance and then to the outrouter...
             assertEquals("Hi there!!", serviceA.getMessage());
             BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek();
-            assertEquals("Hi there!!", JavaSerializer.deserialize(dlsMessage.getMessage()).getPayload());
+            assertEquals("Hi there!!", JavaSerializer.deserializeBytes(dlsMessage.getMessage()).getPayload());
             assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
             assertTrue(dlsMessage.getFault() instanceof RuntimeException);
             assertEquals(faultString, dlsMessage.getFault().getMessage());

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -71,7 +71,7 @@
             // to the service instance and then to the outrouter...
             assertEquals("Hi there!!", serviceA.getMessage());
             BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek();
-            assertEquals("Hi there!!", JavaSerializer.deserialize(dlsMessage.getMessage()).getPayload());
+            assertEquals("Hi there!!", JavaSerializer.deserializeBytes(dlsMessage.getMessage()).getPayload());
             assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
             assertTrue(dlsMessage.getFault() instanceof ServiceException);
             assertEquals(faultString, dlsMessage.getFault().getMessage());

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -72,7 +72,7 @@
             // to the service instance and then to the outrouter...
             assertEquals("Hi there!!", serviceA.getMessage());
             BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek();
-            assertEquals("Hi there!!", JavaSerializer.deserialize(dlsMessage.getMessage()).getPayload());
+            assertEquals("Hi there!!", JavaSerializer.deserializeBytes(dlsMessage.getMessage()).getPayload());
             assertEquals("Service:A", dlsMessage.getAddressingContext().getFrom().toString()); // The service was applied, so the from address should reflect this.
             assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
             assertTrue(dlsMessage.getFault() instanceof RoutingException);

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/serialization/java/JavaSerializerTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -35,7 +35,7 @@
 
         original.getAttachments().put("a", 12345);
 
-        Message copy = JavaSerializer.copy(original);
+        Message copy = JavaSerializer.copyMessage(original);
 
         assertTrue(copy != original);
         assertTrue(copy.getPayload() != original.getPayload());

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/util/XsdDOMValidatorTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/util/XsdDOMValidatorTest.java	2008-12-05 13:06:36 UTC (rev 24249)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/util/XsdDOMValidatorTest.java	2008-12-05 15:02:56 UTC (rev 24250)
@@ -21,7 +21,7 @@
 
 import junit.framework.TestCase;
 import org.jboss.esb.api.context.ResourceLocator;
-import org.jboss.esb.deploy.DefaultResourceLocator;
+import org.jboss.esb.deploy.ContextResourceLocator;
 import org.jboss.esb.xml.XMLParseUtils;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
@@ -34,7 +34,7 @@
  * @author <a href="mailto:tom.fennelly at gmail.com">tom.fennelly at gmail.com</a>
  */
 public class XsdDOMValidatorTest extends TestCase {
-    private ResourceLocator resourceLocator = new DefaultResourceLocator();
+    private ResourceLocator resourceLocator = new ContextResourceLocator(getClass().getClassLoader());
 
     public void test_namespace_gathering() throws IOException, SAXException, ParserConfigurationException {
         Document document = XMLParseUtils.parse(getClass().getResourceAsStream("xsdDomValidator-test-01.xml"));




More information about the jboss-svn-commits mailing list