[jboss-svn-commits] JBL Code SVN: r24226 - in labs/jbossesb/workspace/skeagh: examples/file-routing/src/main/resources and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Dec 3 09:51:01 EST 2008


Author: beve
Date: 2008-12-03 09:51:01 -0500 (Wed, 03 Dec 2008)
New Revision: 24226

Added:
   labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/AbstractFileInboundRouter.java
   labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router.xml
Removed:
   labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/composers/
   labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router_01.xml
Modified:
   labs/jbossesb/workspace/skeagh/examples/file-routing/README.TXT
   labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml
   labs/jbossesb/workspace/skeagh/examples/file-routing/src/main/resources/jboss-esb.xml
   labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileInboundRouter.java
   labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileOutboundRouter.java
   labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/eval/PatternEvaluatorImpl.java
   labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java
   labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileOutboundRouterTest.java
   labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/MyTestService.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2200 "Refactor the FileInRouter to not use "Composers"


Modified: labs/jbossesb/workspace/skeagh/examples/file-routing/README.TXT
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-routing/README.TXT	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/examples/file-routing/README.TXT	2008-12-03 14:51:01 UTC (rev 24226)
@@ -9,12 +9,10 @@
         2.  Maven 2.x (http://maven.apache.org/download.html)
 
      Running:
-        1.  Run "mvn activemq:run". This starts the JMS Provider.
+        1.  Run "mvn clean install pax:provision". This starts the OSGi container (Felix) and deploys the ESB.
         2.  Open a new console window ("Window 2")
-        3.  Run "mvn clean install pax:provision". This starts the OSGi container (Felix) and deploys the ESB.
-        4.  Open a new console window ("Window 3")
-        5.  Copy src/text/resources/sample.txt to target/input. This file will be picked up by the the ESB. 
-			Switch back to "Window 2) and see the output from the Service.
+        3.  Copy src/text/resources/sample.txt to target/input. This file will be picked up by the the ESB. 
+			Switch back to "Window 1" and see the output from the Service.
 			The processed file will now have moved to the specified outbound routers configured directory.
 
 Things to try

Modified: labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/examples/file-routing/pom.xml	2008-12-03 14:51:01 UTC (rev 24226)
@@ -15,7 +15,7 @@
 
 	<properties>
 	    <!-- Felix debug level. 4 = debug -->
-		<felix.log.level>4</felix.log.level>
+		<felix.log.level>1</felix.log.level>
 		<example.work.dir>${basedir}/target</example.work.dir>
 	</properties>
 

Modified: labs/jbossesb/workspace/skeagh/examples/file-routing/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-routing/src/main/resources/jboss-esb.xml	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/examples/file-routing/src/main/resources/jboss-esb.xml	2008-12-03 14:51:01 UTC (rev 24226)
@@ -14,7 +14,7 @@
                 <property name="workingRenamePattern">${example.work.dir}/working/${name}-${timestamp}.working</property>
                 <property name="processedRenamePattern">${example.work.dir}/output/${name}-${timestamp}.done</property>
                 <property name="errrorRenamePattern">${example.work.dir}/error/${name}-${timestamp}.error</property>
-                <property name="messageComposer">org.jboss.esb.file.composers.FileStringMessageComposer</property>
+                <property name="payloadType">STRING</property>
             </inRouter>
             <outRouter name="fileOutboundRouter" class="org.jboss.esb.file.FileOutboundRouter">
                 <property name="fileNamePattern">${example.work.dir}/another-service-pickup-dir/${name}.out</property>

Added: 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	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/AbstractFileInboundRouter.java	2008-12-03 14:51:01 UTC (rev 24226)
@@ -0,0 +1,491 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006, JBoss Inc.
+ */
+package org.jboss.esb.file;
+
+import java.io.File;
+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;
+import org.jboss.esb.api.routing.InboundRouter;
+import org.jboss.esb.api.routing.MessageDispatcher;
+import org.jboss.esb.file.filtering.FileSelector;
+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.util.FileRouterUtil;
+import org.jboss.esb.schedule.AbstractScheduleListener;
+import org.jboss.esb.schedule.SchedulingException;
+import org.jboss.esb.util.FileUtil;
+
+/**
+ * Simple schedule based file {@link InboundRouter}. A FileInboundRouter is
+ * configured by specifying a reference to a configured schedule configured in
+ * the resources element. <p/>
+ *
+ * Example config:<br/>
+ * <pre>
+ * {@code
+ * <resources>
+ *     <resource id="schedule1" class="org.jboss.esb.schedule.SimpleSchedule">
+ *         <property name="frequency">100</property>
+ *         <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>
+ * </inRouter>
+ * }</pre>
+ *
+ * <p/> Property description:
+ * <lu>
+ *  <li><i>scheduleResourceId</i> - the id of the schedule that this router will use.</li>
+ *  <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>
+ * </lu>
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 5.0
+ */
+public abstract class AbstractFileInboundRouter extends AbstractScheduleListener implements InboundRouter
+{
+    /**
+     * Logger.
+     */
+    private static Logger logger = Logger.getLogger(AbstractFileInboundRouter.class);
+
+    /**
+     * File content type constant.
+     */
+    public static final String STRING_TYPE = "STRING";
+
+    /**
+     * File content type constant.
+     */
+    public static final String BYTES_TYPE = "BYTES";
+
+    /**
+     * File content type constant.
+     */
+    public static final String STREAM_TYPE = "STREAM";
+
+    /**
+     * Key used in the InvocationContext for the FileLifecycle.
+     */
+    public static final String PROP_FILE_LIFECYCLE = "in-file-lifecycle";
+
+    /**
+     * Key used in the InvocationContext for the File object.
+     */
+    public static final String PROP_FILE_OBJ = "in-file-obj";
+
+    /**
+     * Key used in the InvocationContext for the absolute path to the File.
+     */
+    public static final String PROP_FILE_PATH = "in-file-path";
+
+    /**
+     * Key used in the InvocationContext for the file lenght.
+     */
+    public static final String PROP_FILE_LENGTH = "in-file-length";
+
+    /**
+     * Key used in the InvocationContext for the files last modified date.
+     */
+    public static final String PROP_FILE_LASTMOD = "in-file-lastmod";
+
+    /**
+     * The file selector pattern use.
+     */
+    @Property(use = Use.OPTIONAL, name = "fileSelectorPattern", defaultVal = "*")
+    private String fileSelectorPattern;
+
+    /**
+     * The file selector implementation to use.
+     */
+    @Property(use = Use.OPTIONAL, name = "fileSelector", defaultVal = "org.jboss.esb.file.filtering.WildcardFileSelector")
+    private String fileSelectorImpl;
+
+    /**
+     * The file encoding of the file being read.
+     */
+    @Property(use = Use.OPTIONAL, name = "fileEncoding", 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")
+    private String workingRenamePattern;
+
+    /**
+     * The rename pattern for a file when an error occurs.
+     */
+    @Property(use = Use.OPTIONAL, name = "errorRenamePattern", defaultVal = "${name}.error")
+    private String errorRenamePattern;
+
+    /**
+     * The processed rename pattern for a successfully processed file.
+     */
+    @Property(use = Use.OPTIONAL, name = "processedRenamePattern", 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")
+    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 })
+    private String payloadType;
+
+    /**
+     * Additional properties. Any properties specified in the configuration that
+     * are not matched to fields of this class. These will be passed along to
+     * the message composer, file selector, and the lifecycle factory.
+     */
+    @org.jboss.esb.api.annotations.Properties
+    private Properties properties = new Properties();
+
+    /**
+     * The file object identifying the input directory.
+     */
+    private File inputDir;
+
+    /**
+     * FileSelector strategy.
+     */
+    private FileSelector fileSelector;
+
+    /**
+     * Lifecycle factory.
+     */
+    private FileLifecycleFactory fileLifecycleFactory;
+
+    /**
+     * The Message Dispatcher to be used with this inbound router.
+     */
+    private MessageDispatcher dispatcher;
+
+    /**
+     * Name of this router. Will be injected by the deployment runtime.
+     */
+    private Object objectName;
+
+    /**
+     * Flag used to determine if shutdown is in progress.
+     */
+    private volatile boolean shuttingDown;
+
+    /**
+     * Will check that the {@link #inputDirName} is valid. Will also set up the
+     * file selector, fileLifecycleFactory and message composer.
+     *
+     * @throws ConfigurationException
+     *             If a configuration error occurs.
+     */
+    @Initialize
+    public final void initialize() throws ConfigurationException
+    {
+        inputDir = FileRouterUtil.createTargetDirectory(fileSelectorPattern);
+
+        // Config the file selector...
+        properties.put(WildcardFileFilter.MATCH_PATTERN, FileUtil.removePath(fileSelectorPattern));
+        fileSelector = FileSelector.Factory.newInstance(fileSelectorImpl, properties);
+
+        // Config the file lifecycle factory...
+        properties.setProperty(FileLifecycle.WORKING_RENAME_PATTERN, workingRenamePattern);
+        properties.setProperty(FileLifecycle.ERROR_RENAME_PATTERN, errorRenamePattern);
+        properties.setProperty(FileLifecycle.PROCESSED_RENAME_PATTERN, processedRenamePattern);
+        fileLifecycleFactory = FileLifecycleFactory.Factory.newInstance(fileLifecycleFactoryName, properties);
+
+        if (logger.isDebugEnabled())
+        {
+            logger.debug(this);
+        }
+    }
+
+    /**
+     * Called every time the schedule linked with this FileInboundRouter is
+     * triggered. <p/> This method will create a {@link Message} object by
+     * delegating the actual creation to the configured MessageComposer
+     * strategy.
+     *
+     * @throws SchedulingException
+     *             If an exception occurs during processing.
+     */
+    @Override
+    public final void onSchedule() throws SchedulingException
+    {
+        logger.info("Schedule triggered for '" + objectName + "'");
+
+        if (shuttingDown)
+        {
+            return;
+        }
+
+        // TODO: add invocation parameters to the invocation context.
+        final InvocationContext invocationContext = new InvocationContext();
+
+        final FileLifecycle fileLifecycle = selectFile(invocationContext);
+        if (fileLifecycle != null)
+        {
+            final Message message = createEsbMessage(fileLifecycle, invocationContext);
+            // the call below will be removed in the near future. See comments on method.
+            setFileMetadata(fileLifecycle, invocationContext);
+            try
+            {
+                dispatcher.dispatch(message, invocationContext);
+                fileLifecycle.toProcessed();
+            }
+            catch (final Exception e)
+            {
+                fileLifecycle.toError();
+                throw new SchedulingException(e.getMessage(), e);
+            }
+            finally
+            {
+                onProcessingComplete(message, fileLifecycle);
+            }
+        }
+    }
+
+    /**
+     * Selects a file from the input directory and creates a
+     * {@link FileLifecycle} using the picked up file.
+     *
+     * @param invocationContext
+     *            The invocation context.
+     * @return FileLifecycle {@link FileLifecycle} associated with the file.
+     *
+     * @throws SchedulingException
+     *             If en exception occurs while trying to compose the message.
+     */
+    private FileLifecycle selectFile(final InvocationContext invocationContext) throws SchedulingException
+    {
+        final File[] files = fileSelector.select(inputDir);
+
+        if (files.length == 0)
+        {
+            return null;
+        }
+
+        // Store the FileLifecycle in the invocation context.
+        final FileLifecycle fileLifecycle = fileLifecycleFactory.newInstance();
+        invocationContext.setContextObject(FileLifecycle.class.getName(), fileLifecycle);
+
+        for (int i = 0; i < files.length; i++)
+        {
+            final File file = files[i];
+
+            fileLifecycle.setFile(file);
+            if (fileLifecycle.toWorking() != null)
+            {
+                // Moved the file to the working state. Break out fo the loop.
+                break;
+            } else if (i == files.length - 1)
+            {
+                // No more file. Just return and come back in again onSchedule
+                // ...
+                return null;
+            } else
+            {
+                // Another listener has already transitioned the file to working
+                // (in between calls). Try the next file...
+            }
+        }
+        return fileLifecycle;
+
+    }
+
+    /**
+     * Creates an esb Message Object by taking the content of one file and
+     * setting it as the messages payload.
+     *
+     * @param fileLifecycle The file lifecycle holding among other things the file in process.
+     * @param invocationContext The invocation context.
+     * @return Message Esb Message or null if no files were found.
+     *
+     * @throws SchedulingException If en exception occurs while trying to compose the message.
+     */
+    abstract Message createEsbMessage(final FileLifecycle fileLifecycle, final InvocationContext invocationContext) throws SchedulingException;
+
+    /**
+     * Optional method that will be called after the message has be dispatched to the ESB.
+     *
+     * @param message The ESB Message object.
+     * @param fileLifecycle The FileLifecycle.
+     * @throws SchedulingException If an exception occurs while decomposing.
+     */
+    abstract void onProcessingComplete(final Message message, final FileLifecycle fileLifecycle) throws SchedulingException;
+
+    /**
+     * Cleanup.
+     */
+    public final void uninitialize()
+    {
+        shuttingDown = true;
+    }
+
+    /**
+     * Sets the {@link MessageDispatcher} that will be used with this Router.
+     *
+     * @param dispatcher
+     *            The dispatcher used to dispatch to the ESB.
+     */
+    public final void setDispatcher(final MessageDispatcher dispatcher)
+    {
+        this.dispatcher = dispatcher;
+    }
+
+    /**
+     * Returs a string representation of this router.
+     *
+     * @return String The string representation.
+     */
+    @Override
+    public final String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append("InboundRouter[name='").append(objectName);
+        sb.append("', inputDir='").append(inputDir);
+        sb.append("', fileSelectorPattern='").append(fileSelectorPattern);
+        sb.append("', fileSelector='").append(fileSelector.getClass().getName());
+        sb.append("', payloadType='").append(payloadType);
+        sb.append("', fileLifecycleFactory : '" + fileLifecycleFactory.getClass().getName());
+        sb.append("']");
+        return sb.toString();
+    }
+
+    /**
+     * Gets the configured file content type.
+     *
+     * @return String The configured file content type.
+     */
+    public final String getPayloadType()
+    {
+        return payloadType;
+    }
+
+    /**
+     * Gets the configured file selector pattern.
+     *
+     * @return String The configured file selector pattern.
+     */
+    public final String getFileSelectorPattern()
+    {
+        return fileSelectorPattern;
+    }
+
+    /**
+     * Gets the configured file encoding.
+     *
+     * @return String The configured file encoding.
+     */
+    public final String getFileEncoding()
+    {
+        return fileEncoding;
+    }
+
+    /**
+     * Gets the configured working rename pattern.
+     *
+     * @return String The configured working rename pattern.
+     */
+    public final String getWorkingRenamePattern()
+    {
+        return workingRenamePattern;
+    }
+
+    /**
+     * Gets the configured error rename pattern.
+     *
+     * @return String The configured error rename pattern.
+     */
+    public final String getErrorRenamePattern()
+    {
+        return errorRenamePattern;
+    }
+
+    /**
+     * Gets the configured processed rename pattern.
+     *
+     * @return String The configured processed rename pattern.
+     */
+    public final String getProcessedRenamePattern()
+    {
+        return processedRenamePattern;
+    }
+
+    /**
+     * Gets the configured properties.
+     *
+     * @return Properties The configured propertis.
+     */
+    public final Properties getProperties()
+    {
+        return properties;
+    }
+
+    /**
+     * Sets metadata information into the InvocationContext. The following
+     * properties are currently set: <lu> <li>{@link #PROP_FILE_LIFECYCLE} - The
+     * {@link FileLifecycle}</li> <li>{@link #PROP_FILE_OBJ} - The File object
+     * itself</li> <li>{@link #PROP_FILE_PATH} - The absolute path to the file</li>
+     * <li>{@link #PROP_FILE_LENGTH} - The lenght of the file</li> <li>
+     * {@link #PROP_FILE_LASTMOD} - The last modified date for the file</li>
+     * </lu> Subclasses can override this method to add additional properties.
+     *
+     * @param fromFileLifecycle The {@link FileLifecycle}.
+     * @param toContext The {@link InvocationContext}.
+     *
+     * @TODO: These properties should be set as invocation parameters when the
+     *        InvocationContext is created. There is a separate
+     *        jira(https://jira.jboss.org/jira/browse/JBESB-2214) for this issue
+     *        which is why I'm leaving this for now./Daniel 2008-12-03.
+     */
+    protected final void setFileMetadata(final FileLifecycle fromFileLifecycle, final InvocationContext toContext)
+    {
+        // Add some metadata about the file to the InvocationContext.
+        final File currentFile = fromFileLifecycle.getFile();
+        toContext.setContextObject(PROP_FILE_LIFECYCLE, fromFileLifecycle);
+        toContext.setContextObject(PROP_FILE_OBJ, currentFile);
+        toContext.setContextObject(PROP_FILE_PATH, currentFile.getAbsolutePath());
+        toContext.setContextObject(PROP_FILE_LENGTH, currentFile.length());
+        toContext.setContextObject(PROP_FILE_LASTMOD, currentFile.lastModified());
+    }
+}

Modified: labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileInboundRouter.java	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileInboundRouter.java	2008-12-03 14:51:01 UTC (rev 24226)
@@ -20,371 +20,81 @@
 package org.jboss.esb.file;
 
 import java.io.File;
-import java.util.Properties;
+import java.io.FileInputStream;
+import java.io.IOException;
 
-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;
-import org.jboss.esb.api.message.MessageComposer;
-import org.jboss.esb.api.message.MessageProcessingException;
-import org.jboss.esb.api.routing.InboundRouter;
-import org.jboss.esb.api.routing.MessageDispatcher;
-import org.jboss.esb.file.filtering.FileSelector;
-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.util.FileRouterUtil;
-import org.jboss.esb.schedule.AbstractScheduleListener;
 import org.jboss.esb.schedule.SchedulingException;
 import org.jboss.esb.util.FileUtil;
 
 /**
- * Simple schedule based file {@link InboundRouter}.
- * A FileInboundRouter is configured by specifying a reference to a
- * configured schedule configured in the resources element.
- * <p/>
+ * Concrete implementation of {@link AbstractFileInboundRouter}.
  *
- * Example config:<br/>
- * <pre>{@code
- *
- * <resources>
- *     <resource id="schedule1" class="org.jboss.esb.schedule.SimpleSchedule">
- *         <property name="frequency">100</property>
- *         <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>
- * </inRouter>
- *
- * }</pre>
- * <p/>
- * Property description:
- * <lu>
- *  <li>scheduleResourceId      - the id of the schedule that this router will use.</li>
- *  <li>fileSelectorPattern     - the file matching pattern used to filter files to pick up from the inputDir. Default: '*'</li>
- *  <li>fileSelector            - the concrete {@link FileSelector} implementation to use. Default: org.jboss.esb.file.filtering.WildcardFileSelector </li>
- *  <li>fileEncoding            - the file encoding to use when reading the file. Default: UTF-8.</li>
- *  <li>workingRenamePattern    - the pattern used for naming files that the esb is processing. Default: ${name}.working</li>
- *  <li>processedRenamePattern  - the pattern used for naming files that have be processed successfully. Default: ${name}.processed}</li>
- *  <li>errorRenamePattern      - the pattern used for naming files when a processing error occurs. Default: ${name}.error</li>
- *  <li>messageComposer         - the concrete {@link MessageComposer} implementation to use. Default: org.jboss.esb.file.composers.FileStringMessageComposer</li>
- *  <li>fileLifecycleFactory    - the concrete {@link FileLifecycleFactory} implementation to use. Default: org.jboss.esb.file.lifecycle.DefaultFileLifecycleFactory</li>
- * </lu>
- *
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ * @see AbstractFileInboundRouter
  */
-public class FileInboundRouter extends AbstractScheduleListener implements InboundRouter
+public class FileInboundRouter extends AbstractFileInboundRouter
 {
     /**
-     * Logger.
-     */
-    private static Logger logger = Logger.getLogger(FileInboundRouter.class);
-
-    /**
-     * The file selector pattern use.
-     */
-     @Property(use = Use.OPTIONAL, name = "fileSelectorPattern", defaultVal = "*")
-    private String fileSelectorPattern;
-
-    /**
-     * The file selector implementation to use.
-     */
-     @Property(use = Use.OPTIONAL, name = "fileSelector", defaultVal = "org.jboss.esb.file.filtering.WildcardFileSelector")
-    private String fileSelectorImpl;
-
-    /**
-     * The file encoding of the file being read.
-     */
-     @Property(use = Use.OPTIONAL, name = "fileEncoding", 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")
-    private String workingRenamePattern;
-
-    /**
-     * The rename pattern for a file when an error occurs.
-     */
-    @Property(use = Use.OPTIONAL, name = "errorRenamePattern", defaultVal = "${name}.error")
-    private String errorRenamePattern;
-
-    /**
-     * The processed rename pattern for a successfully processed file.
-     */
-    @Property(use = Use.OPTIONAL, name = "processedRenamePattern", defaultVal = "${name}.processed")
-    private String processedRenamePattern;
-
-    /**
-     * The message composer to use.
-     */
-     @Property(use = Use.OPTIONAL, name = "messageComposer", defaultVal = "org.jboss.esb.file.composers.FileBytesMessageComposer")
-    private String messageComposerClass;
-
-    /**
-     * The file lifecycle factory to use.
-     */
-     @Property(use = Use.REQUIRED, name = "fileLifecycleFactory", defaultVal = "org.jboss.esb.file.lifecycle.DefaultFileLifecycleFactory")
-    private String fileLifecycleFactoryName;
-
-    /**
-     * Additional properties.
-     * Any properties specified in the configuration that are not matched to fields of
-     * this class.
-     * These will be passed along to the message composer, file selector, and the lifecycle factory.
-     */
-    @org.jboss.esb.api.annotations.Properties
-    private Properties properties = new Properties();
-
-    /**
-     * The file object identifying the input directory.
-     */
-    private File inputDir;
-
-    /**
-     * FileSelector strategy.
-     */
-    private FileSelector fileSelector;
-
-    /**
-     * Lifecycle factory.
-     */
-    private FileLifecycleFactory fileLifecycleFactory;
-
-    /**
-     * MessageComposer strategy.
-     */
-    private MessageComposer<FileLifecycle> messageComposer;
-
-    /**
-     * The Message Dispatcher to be used with this inbound router.
-     */
-    private MessageDispatcher dispatcher;
-
-    /**
-     * Name of this router. Will be injected by the deployment runtime.
-     */
-    private Object objectName;
-
-    /**
-     * Flag used to determine if shutdown is in progress.
-     */
-    private volatile boolean shuttingDown;
-
-    /**
-     * Will check that the {@link #inputDirName} is valid.
-     * Will also set up the file selector, fileLifecycleFactory and message composer.
+     * Creates an esb Message Object by taking the content of one file and
+     * setting it as the messages payload.
      *
-     * @throws ConfigurationException If a configuration error occurs.
-     */
-    @Initialize
-    public final void initialize() throws ConfigurationException
-    {
-        inputDir = FileRouterUtil.createTargetDirectory(fileSelectorPattern);
-
-        // Config the file selector...
-        properties.put(WildcardFileFilter.MATCH_PATTERN, FileUtil.removePath(fileSelectorPattern));
-        fileSelector = FileSelector.Factory.newInstance(fileSelectorImpl, properties);
-
-        // Config the file lifecycle factory...
-        properties.setProperty(FileLifecycle.WORKING_RENAME_PATTERN, workingRenamePattern);
-        properties.setProperty(FileLifecycle.ERROR_RENAME_PATTERN, errorRenamePattern);
-        properties.setProperty(FileLifecycle.PROCESSED_RENAME_PATTERN, processedRenamePattern);
-        fileLifecycleFactory = FileLifecycleFactory.Factory.newInstance(fileLifecycleFactoryName, properties);
-
-        // Config the message composer...
-        messageComposer = (MessageComposer<FileLifecycle>) FileRouterUtil.createInstance(messageComposerClass);
-        properties.put("encoding", fileEncoding);
-        messageComposer.setConfiguration(properties);
-
-        if (logger.isDebugEnabled())
-        {
-            logger.debug(this);
-        }
-    }
-
-    /**
-     * Called every time the schedule linked with this FileInboundRouter is triggered.
-     * <p/>
-     * This method will create a {@link Message} object by delegating the
-     * actual creation to the configured MessageComposer strategy.
+     * @param fileLifecycle The file lifecycle holding among other things the file in process.
+     * @param invocationContext The invocation context.
+     * @return Message          Esb Message or null if no files were found.
      *
-     * @throws SchedulingException If an exception occurs during processing.
+     * @throws SchedulingException If en exception occurs while trying to compose the message.
      */
     @Override
-    public final void onSchedule() throws SchedulingException
+    protected final Message createEsbMessage(final FileLifecycle fileLifecycle, final InvocationContext invocationContext) throws SchedulingException
     {
-        if (shuttingDown)
-        {
-            return;
-        }
-        logger.info(" Schedule triggered for '" + objectName + "'");
-
-        final InvocationContext invocationContext = new InvocationContext();
-
-        final FileLifecycle fileLifecycle = selectFile(invocationContext);
-        if (fileLifecycle == null)
-        {
-            // no file so just return.
-            return;
-        }
-
-        final Message message = createEsbMessage(fileLifecycle, invocationContext);
+        final File inputFile = fileLifecycle.getFile();
         try
         {
-            dispatcher.dispatch(message, invocationContext);
-            fileLifecycle.toProcessed();
-        }
-        catch (final Exception e)
-        {
-            fileLifecycle.toError();
-            throw new SchedulingException(e.getMessage(), e);
-        }
-        finally
-        {
-            onProcessingComplete(message, fileLifecycle);
-        }
-    }
-
-    /**
-     * Cleanup.
-     */
-    public final void uninitialize()
-    {
-        shuttingDown = true;
-    }
-
-    /**
-     * Sets the {@link MessageDispatcher} that will be used with this Router.
-     *
-     * @param dispatcher The dispatcher used to dispatch to the ESB.
-     */
-    public final void setDispatcher(final MessageDispatcher dispatcher)
-    {
-        this.dispatcher = dispatcher;
-    }
-
-    /**
-     * Returs a string representation of this router.
-     *
-     * @return String The string representation.
-     */
-    @Override
-    public final String toString()
-    {
-        StringBuilder sb = new StringBuilder();
-        sb.append("InboundRouter[name='").append(objectName);
-        sb.append("', inputDir='").append(inputDir);
-        sb.append("', fileSelectorPattern='").append(fileSelectorPattern);
-        sb.append("', fileSelector='").append(fileSelector.getClass().getName());
-        sb.append("', fileLifecycleFactory : '" + fileLifecycleFactory.getClass().getName());
-        sb.append("', messageComposer : '" + messageComposer.getClass().getName());
-        sb.append("']");
-        return sb.toString();
-    }
-
-    /**
-     * Selects a file from the input directory and creates a {@link FileLifecycle}
-     * using the picked up file.
-     *
-     * @param invocationContext The invocation context.
-     * @return FileLifecycle    {@link FileLifecycle} associated with the file.
-     *
-     * @throws SchedulingException If en exception occurs while trying to compose the message.
-     */
-    private FileLifecycle selectFile(final InvocationContext invocationContext) throws SchedulingException
-    {
-        final File[] files = fileSelector.select(inputDir);
-
-        if (files.length == 0)
-        {
-            return null;
-        }
-
-        // Store the FileLifecycle in the invocation context.
-        final FileLifecycle fileLifecycle = fileLifecycleFactory.newInstance();
-        invocationContext.setContextObject(FileLifecycle.class.getName(), fileLifecycle);
-
-        for (int i = 0; i < files.length; i++)
-        {
-            final File file = files[i];
-
-            fileLifecycle.setFile(file);
-            if (fileLifecycle.toWorking() != null)
+            final Message message = new Message();
+            final Object payload;
+            if (getPayloadType().equalsIgnoreCase(STRING_TYPE))
             {
-                // Moved the file to the working state. Break out fo the loop.
-                break;
+                payload = FileUtil.readTextFile(inputFile);
             }
-            else if (i == files.length - 1)
+            else if (getPayloadType().equalsIgnoreCase(BYTES_TYPE))
             {
-                // No more file.  Just return and come back in again onSchedule ...
-                return null;
+                payload = FileUtil.readFile(inputFile);
             }
             else
             {
-                // Another listener has already transitioned the file to working (in between calls).  Try the next file...
+                payload = new FileInputStream(inputFile);
             }
-        }
-        return fileLifecycle;
+            message.setPayload(payload);
 
-    }
+            // We store the original payload on the lifecycle. Might be needed during cleanup...
+            fileLifecycle.setPayload(payload);
 
-    /**
-     * Creates an esb Message Object by taking the content of one file and
-     * setting it as the messages payload.
-     *
-     * @param fileLifecycle The file lifecycle holding among other things the file in process.
-     * @param invocationContext The invocation context.
-     * @return Message          Esb Message or null if no files were found.
-     *
-     * @throws SchedulingException If en exception occurs while trying to compose the message.
-     */
-    private Message createEsbMessage(final FileLifecycle fileLifecycle, final InvocationContext invocationContext) throws SchedulingException
-    {
-        try
-        {
-            return messageComposer.compose(fileLifecycle, invocationContext);
+            return message;
         }
-        catch (final MessageProcessingException e)
+        catch (final IOException e)
         {
             fileLifecycle.toError();
-            throw new SchedulingException("Unable to compose message from file '" + fileLifecycle.getFile().getAbsolutePath() + "'.", e);
+            throw new SchedulingException("IOException while trying to read the contents of file '" + inputFile.getAbsolutePath() + "' as a String.", e);
         }
     }
 
     /**
-     * TODO: not sure if this method is actually needed.
+     * Optional method that will be called after the message has be dispatched to the ESB.
      *
      * @param message       The ESB Message object.
      * @param fileLifecycle The FileLifecycle.
-     * @return Message      The ESB Message object.
      *
      * @throws SchedulingException If an exception occurs while decomposing.
      */
-    private Message onProcessingComplete(final Message message, final FileLifecycle fileLifecycle) throws SchedulingException
+    @Override
+    protected void onProcessingComplete(final Message message, final FileLifecycle fileLifecycle) throws SchedulingException
     {
-        try
-        {
-            // The composer can decide whether or not to write out a response...
-            if (message != null)
-            {
-                messageComposer.decompose(message, fileLifecycle);
-            }
-        }
-        catch (final MessageProcessingException e)
-        {
-            throw new SchedulingException("Unable to decompose message from file '" + fileLifecycle.getFile().getAbsolutePath() + "'.", e);
-        }
-        return null;
+        // NoOp
     }
 
 }

Modified: labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileOutboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileOutboundRouter.java	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/FileOutboundRouter.java	2008-12-03 14:51:01 UTC (rev 24226)
@@ -51,7 +51,7 @@
  *
  * <outRouter name="outfileRouter" class="org.jboss.esb.file.FileOutboundRouter">
  *     <property name="scheduleResourceId">schedule1</property>
- *     <property name="fileNamePattern">target/{name}.out</property>
+ *     <property name="fileNamePattern">target/${name}.out</property>
  * </outRouter>
  *
  * }</pre>

Modified: labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/eval/PatternEvaluatorImpl.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/eval/PatternEvaluatorImpl.java	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/eval/PatternEvaluatorImpl.java	2008-12-03 14:51:01 UTC (rev 24226)
@@ -23,7 +23,7 @@
 import java.io.File;
 
 import org.jboss.esb.api.context.InvocationContext;
-import org.jboss.esb.file.composers.AbstractFileMessageComposer;
+import org.jboss.esb.file.AbstractFileInboundRouter;
 import org.jboss.esb.util.FileUtil;
 
 /**
@@ -44,7 +44,7 @@
     {
         String newName = FileUtil.removePath(filePattern);
 
-        File file = (File) invocationContext.getContextObject(AbstractFileMessageComposer.PROP_FILE_OBJ);
+        File file = (File) invocationContext.getContextObject(AbstractFileInboundRouter.PROP_FILE_OBJ);
         if (file != null)
         {
             newName = newName.replace(FILE_NAME, file.getName());

Modified: labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java	2008-12-03 14:51:01 UTC (rev 24226)
@@ -28,6 +28,7 @@
 import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.io.InputStream;
 
 import org.jboss.esb.api.context.InvocationContext;
 import org.jboss.esb.api.exception.ConfigurationException;
@@ -37,7 +38,6 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.deploy.config.InboundRouterConfig;
-import org.jboss.esb.file.composers.AbstractFileMessageComposer;
 import org.jboss.esb.schedule.SchedulingException;
 import org.jboss.esb.util.FileUtil;
 import org.junit.After;
@@ -63,37 +63,48 @@
     final MockDispatcher dispatcher = new MockDispatcher();
 
     @Test
-    public void onSchedule() throws IOException, SchedulingException, ConfigurationException
+    public void pickupStringPayload() throws IOException, SchedulingException, ConfigurationException
     {
-        final FileInboundRouter fileRouter = (FileInboundRouter) inboundRouterConfig.getRouter();
-        fileRouter.setDispatcher(dispatcher);
+        triggerOnSchedule("stringType");
 
-        fileRouter.initialize();
-        fileRouter.onSchedule();
+        assertThatFileWasCreated();
+        assertEquals(testPayload, new String(FileUtil.readTextFile(processedFile)));
+        assertTrue(dispatcher.getMessage().getPayload() instanceof String);
+    }
 
-        String[] list = getFilesFromDir(inputFile.getParentFile(), "-processed");
-        assertTrue("One file should have been created", list.length == 1);
-        processedFile = new File(inputFile.getParentFile(), list[0]);
+    @Test
+    public void pickupStreamPayload() throws IOException, SchedulingException, ConfigurationException
+    {
+        triggerOnSchedule("streamType");
 
-        assertEquals(testPayload, new String(FileUtil.readTextFile(processedFile)));
+        assertThatFileWasCreated();
+        assertEquals(testPayload, new String(FileUtil.readFile(processedFile)));
+        assertTrue(dispatcher.getMessage().getPayload() instanceof InputStream);
     }
 
     @Test
+    public void pickupBytesPayload() throws IOException, SchedulingException, ConfigurationException
+    {
+        triggerOnSchedule("bytesType");
+
+        assertThatFileWasCreated();
+        assertEquals(testPayload, new String(FileUtil.readFile(processedFile)));
+        assertTrue(dispatcher.getMessage().getPayload() instanceof byte[]);
+    }
+
+    @Test
     public void verifyThatFileMetaDataHasBeenSetOnInvocationContext() throws SchedulingException, ConfigurationException
     {
-        final FileInboundRouter fileRouter = (FileInboundRouter) inboundRouterConfig.getRouter();
-        fileRouter.setDispatcher(dispatcher);
+        triggerOnSchedule("stringType");
 
-        fileRouter.initialize();
-        fileRouter.onSchedule();
-
         InvocationContext context = dispatcher.getInvocationContext();
-        assertNotNull(context.getContextObject(AbstractFileMessageComposer.PROP_FILE_LASTMOD));
-        assertNotNull(context.getContextObject(AbstractFileMessageComposer.PROP_FILE_PATH));
-        assertNotNull(context.getContextObject(AbstractFileMessageComposer.PROP_FILE_LIFECYCLE));
-        assertNotNull(context.getContextObject(AbstractFileMessageComposer.PROP_FILE_OBJ));
-        assertNotNull(context.getContextObject(AbstractFileMessageComposer.PROP_FILE_LENGTH));
 
+        assertNotNull(context.getContextObject(AbstractFileInboundRouter.PROP_FILE_LASTMOD));
+        assertNotNull(context.getContextObject(AbstractFileInboundRouter.PROP_FILE_PATH));
+        assertNotNull(context.getContextObject(AbstractFileInboundRouter.PROP_FILE_LIFECYCLE));
+        assertNotNull(context.getContextObject(AbstractFileInboundRouter.PROP_FILE_OBJ));
+        assertNotNull(context.getContextObject(AbstractFileInboundRouter.PROP_FILE_LENGTH));
+
         final String[] list = getFilesFromDir(inputFile.getParentFile(), "-processed");
         processedFile = new File(inputFile.getParentFile(), list[0]);
     }
@@ -101,15 +112,10 @@
     @Test
     public void onScheduleWithDifferentOutputDirectory() throws IOException, ConfigurationException, SchedulingException, DeploymentException
     {
-        final InboundRouterConfig routerConfig = DeploymentUtil.getInboundRouter("fileRouter2", runtime);
-        final FileInboundRouter fileRouter = (FileInboundRouter) routerConfig.getRouter();
-        fileRouter.setDispatcher(dispatcher);
-
         final File processedDir = new File(inputFile.getParentFile() + File.separator + "processedDir");
         processedDir.mkdir();
 
-        fileRouter.initialize();
-        fileRouter.onSchedule();
+        triggerOnSchedule("fileRouter2");
 
         final String[] list = getFilesFromDir(processedDir, ".processed");
         assertNotNull(list);
@@ -136,11 +142,27 @@
     @BeforeClass
     public static void classSetup() throws DeploymentException, IOException
     {
-        runtime = DeploymentUtil.createRuntime(FileInboundRouterTest.class.getResourceAsStream("file-inbound-router_01.xml"));
-        inboundRouterConfig = DeploymentUtil.getInboundRouter("fileRouter", runtime);
-        assertNotNull("There should have been an router named 'fileRouter' in the config", inboundRouterConfig);
+        runtime = DeploymentUtil.createRuntime(FileInboundRouterTest.class.getResourceAsStream("file-inbound-router.xml"));
+        inboundRouterConfig = DeploymentUtil.getInboundRouter("stringType", runtime);
+        assertNotNull("There should have been an router named 'stringType' in the config", inboundRouterConfig);
     }
 
+    private void triggerOnSchedule(final String routerNameInConfig) throws ConfigurationException, SchedulingException
+    {
+        final InboundRouterConfig routerConfig = DeploymentUtil.getInboundRouter(routerNameInConfig, runtime);
+        final FileInboundRouter fileRouter = (FileInboundRouter) routerConfig.getRouter();
+        fileRouter.setDispatcher(dispatcher);
+        fileRouter.initialize();
+        fileRouter.onSchedule();
+    }
+
+    private void assertThatFileWasCreated()
+    {
+        String[] list = getFilesFromDir(inputFile.getParentFile(), "-processed");
+        assertTrue("One file should have been created", list.length == 1);
+        processedFile = new File(inputFile.getParentFile(), list[0]);
+    }
+
     private File createFile(final FileInboundRouter fileRouter, final String payload) throws IOException
     {
         final File workingDir = new File("target" + File.separator + "test-classes");

Modified: labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileOutboundRouterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileOutboundRouterTest.java	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileOutboundRouterTest.java	2008-12-03 14:51:01 UTC (rev 24226)
@@ -33,7 +33,6 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.deploy.config.OutboundRouterConfig;
-import org.jboss.esb.file.composers.AbstractFileMessageComposer;
 import org.jboss.esb.util.FileUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -87,7 +86,7 @@
     private void setFileNameInInvocationContext(final String fileName)
     {
         InvocationContext invocationContext = new InvocationContext();
-        invocationContext.setContextObject(AbstractFileMessageComposer.PROP_FILE_OBJ, new File(fileName));
+        invocationContext.setContextObject(AbstractFileInboundRouter.PROP_FILE_OBJ, new File(fileName));
         InvocationContext.setContext(invocationContext);
     }
 

Modified: labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/MyTestService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/MyTestService.java	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/MyTestService.java	2008-12-03 14:51:01 UTC (rev 24226)
@@ -32,7 +32,7 @@
 {
     private static Message message;
 
-    public Message process(Message message) throws ServiceException
+    public Message process(final Message message) throws ServiceException
     {
         MyTestService.message = message;
         return message;

Copied: labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router.xml (from rev 24222, labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router_01.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router.xml	2008-12-03 14:51:01 UTC (rev 24226)
@@ -0,0 +1,46 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+	<resources>
+        <resource id="schedule1" class="org.jboss.esb.schedule.SimpleSchedule">
+            <property name="frequency">100</property>
+            <property name="execCount">1</property>
+        </resource>
+    </resources>
+
+    <services>
+        <service serviceCategory="service-cat" serviceName="service-a" serviceDescription="TestService" class="org.jboss.esb.file.MyTestService">
+            <inRouter name="stringType" class="org.jboss.esb.file.FileInboundRouter">
+                <property name="scheduleResourceId">schedule1</property>
+                <property name="fileSelectorPattern">target\test-classes\*.txt</property>
+                <property name="workingRenamePattern">${name}-${timestamp}.${suffix}</property>
+                <property name="processedRenamePattern">${name}-${timestamp}-processed</property>
+                <property name="payloadType">STRING</property>
+            </inRouter>
+            <inRouter name="bytesType" class="org.jboss.esb.file.FileInboundRouter">
+                <property name="scheduleResourceId">schedule1</property>
+                <property name="fileSelectorPattern">target\test-classes\*.txt</property>
+                <property name="workingRenamePattern">${name}-${timestamp}.${suffix}</property>
+                <property name="processedRenamePattern">${name}-${timestamp}-processed</property>
+                <property name="payloadType">BYTES</property>
+            </inRouter>
+            <inRouter name="streamType" class="org.jboss.esb.file.FileInboundRouter">
+                <property name="scheduleResourceId">schedule1</property>
+                <property name="fileSelectorPattern">target\test-classes\*.txt</property>
+                <property name="workingRenamePattern">${name}-${timestamp}.${suffix}</property>
+                <property name="processedRenamePattern">${name}-${timestamp}-processed</property>
+                <property name="payloadType">STREAM</property>
+            </inRouter>
+        </service>
+        
+        <service serviceCategory="service-cat" serviceName="service-b" serviceDescription="TestService" class="org.jboss.esb.file.MyTestService">
+            <inRouter name="fileRouter2" class="org.jboss.esb.file.FileInboundRouter">
+                <property name="scheduleResourceId">schedule1</property>
+                <property name="fileSelectorPattern">target\test-classes\*.txt</property>
+                <property name="workingRenamePattern">target/test/classes\${name}-${timestamp}.${suffix}</property>
+                <property name="processedRenamePattern">target/test-classes/processedDir/${name}.processed</property>
+                <property name="payloadType">STRING</property>
+            </inRouter>
+        </service>
+    </services> 
+    
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router_01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router_01.xml	2008-12-03 10:18:01 UTC (rev 24225)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/file-inbound-router_01.xml	2008-12-03 14:51:01 UTC (rev 24226)
@@ -1,30 +0,0 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
-
-	<resources>
-        <resource id="schedule1" class="org.jboss.esb.schedule.SimpleSchedule">
-            <property name="frequency">100</property>
-            <property name="execCount">1</property>
-        </resource>
-    </resources>
-
-    <services>
-        <service serviceCategory="service-cat" serviceName="service-a" serviceDescription="TestService" class="org.jboss.esb.file.MyTestService">
-            <inRouter name="fileRouter" class="org.jboss.esb.file.FileInboundRouter">
-                <property name="scheduleResourceId">schedule1</property>
-                <property name="fileSelectorPattern">target\test-classes\*.txt</property>
-                <property name="workingRenamePattern">${name}-${timestamp}.${suffix}</property>
-                <property name="processedRenamePattern">${name}-${timestamp}-processed</property>
-            </inRouter>
-        </service>
-        
-        <service serviceCategory="service-cat" serviceName="service-b" serviceDescription="TestService" class="org.jboss.esb.file.MyTestService">
-            <inRouter name="fileRouter2" class="org.jboss.esb.file.FileInboundRouter">
-                <property name="scheduleResourceId">schedule1</property>
-                <property name="fileSelectorPattern">target\test-classes\*.txt</property>
-                <property name="workingRenamePattern">target/test/classes\${name}-${timestamp}.${suffix}</property>
-                <property name="processedRenamePattern">target/test-classes/processedDir/${name}.processed</property>
-            </inRouter>
-        </service>
-    </services> 
-    
-</jbossesb>
\ No newline at end of file




More information about the jboss-svn-commits mailing list