[jboss-svn-commits] JBL Code SVN: r21117 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/actions/converters and 5 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 18 10:21:23 EDT 2008


Author: kevin.conner at jboss.com
Date: 2008-07-18 10:21:22 -0400 (Fri, 18 Jul 2008)
New Revision: 21117

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/
   labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayMemoryUsageAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayTimeAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/FileToStream.java
Removed:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayMemoryUsageAction.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayTimeAction.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/converters/FileToStream.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayMemoryUsageActionUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayTimeActionUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/FileToStreamUnitTest.java
   labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb.xml
Modified:
   labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb-unfiltered.xml
Log:
Tidy up some actions: JBESB-1871

Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayMemoryUsageAction.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayMemoryUsageAction.java	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayMemoryUsageAction.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated 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.soa.esb.actions;
-
-import org.jboss.soa.esb.message.Message;
-
-/**
- * Simple action that shows JVM memory usage. 
- * </p>
- * Exemple configuration:
- * <pre>
- *&lt;action name="logMemoryUsageAfter" class="org.jboss.soa.esb.actions.DisplayMemoryUsageAction"&gt;
- *&lt;/action&gt;
- * </pre>
- * This action support all configuration properties that {@link LogAction} supports.
- * 
- * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
- * @since 4.3
- *
- */
-public class DisplayMemoryUsageAction extends LogAction implements BeanConfiguredAction
-{
-	public Message process( final Message message )
-	{
-		final Runtime runtime = Runtime.getRuntime();
-		final long maxMemory = runtime.maxMemory();
-		final long allocatedMemory = runtime.totalMemory();
-		final long freeMemory = runtime.freeMemory();
-		
-		StringBuilder sb = new StringBuilder();
-		sb.append( "Max mem [" ).append( maxMemory /1024 );
-		sb.append( "], Allocated mem [" ).append( allocatedMemory / 1024 );
-		sb.append( "], Free mem [" ).append( freeMemory / 1024 );
-		sb.append( "], Total Free mem [" ).append( (freeMemory + (maxMemory - allocatedMemory)) / 1024 );
-		sb.append( "]");
-		log( sb.toString() );
-		
-		return message;
-	}
-
-}

Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayTimeAction.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayTimeAction.java	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayTimeAction.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated 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.soa.esb.actions;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.jboss.soa.esb.message.Message;
-
-/**
- * Simple action that displays the current time.
- * </p>
- * Exemple configuration:
- * <pre>
- *&lt;action name="displayTime" class="org.jboss.soa.esb.actions.DisplayTimeAction"&gt;
- *	&lt;property name="format" value="HH:mm:ss:S"/&gt;
- *&lt;/action&gt;
- * </pre>
- * This action support all configuration properties that {@link LogAction} supports.
- * 
- * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
- * @since 4.3
- *
- */
-public class DisplayTimeAction extends LogAction
-{
-	private String format;
-	
-	public Message process( final Message message )
-	{
-		SimpleDateFormat formatter = format == null ? new SimpleDateFormat() : new SimpleDateFormat( format );
-		log( formatter.format( new Date() ) );
-		
-		return message;
-	}
-
-	public String getFormat()
-	{
-		return format;
-	}
-
-	public void setFormat( String format )
-	{
-		this.format = format;
-	}
-
-}

Deleted: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/converters/FileToStream.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/converters/FileToStream.java	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/converters/FileToStream.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated 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.soa.esb.actions.converters;
-
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.BeanConfiguredAction;
-import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.message.Message;
-
-/**
- * FileToStream is a converter that open a Stream to the filename
- * specified by the property filename.
- * Usage:
- * <pre>
- * &lt;action name="fileToStream" class="org.jboss.soa.esb.actions.converters.FileToStream"&gt;
- * &lt;/action&gt;
- * 
- * Optional parameters (default value(s) shown):
- *    &lt;proptery name="fileNameLocation" value="org.jboss.soa.esb.gateway.file" /&gt;
- * </pre>
- * Note that 'fileNameLocation' defaults to {@link Environment#ORIGINAL_FILE}
- * 
- * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
- *
- */
-public class FileToStream implements BeanConfiguredAction
-{
-	private Logger log = Logger.getLogger( FileToStream.class );
-	
-	private String fileNameLocation;
-	
-	public FileToStream()
-	{
-	}
-	
-	/**
-	 * Populates the ESB Message objects body with a InputStream for
-	 * the file identified by the {@link #fileNameLocation} field.
-	 * 
-	 * @param message 	- ESB message object
-	 * @return Message	- ESB message object which a payload that is an InputStream
-	 * @throws ActionProcessingException
-	 */
-	public Message process( final Message message ) throws ActionProcessingException
-	{
-		BufferedInputStream bin = getInputStream( getFileName( message ) );
-		message.getBody().add( bin );
-		
-		return message;
-	}
-
-	public String getFileNameLocation()
-	{
-		return fileNameLocation;
-	}
-
-	public void setFileNameLocation( final String fileNameLocation )
-	{
-		this.fileNameLocation = fileNameLocation;
-	}
-	
-	private String getFileName (final Message message ) throws ActionProcessingException
-	{
-		String fileName = fileNameLocation == null ? 
-				(String) message.getBody().get() :
-				(String) message.getBody().get( fileNameLocation );
-		
-		log.debug( "FileName : [" + fileName + "]" );
-		
-		if ( fileName == null )
-			throw new ActionProcessingException( "Didn't find a file as in property location [" + fileNameLocation + "] or as the default object in the message body." );
-		
-		return fileName;
-	}
-	
-	private BufferedInputStream getInputStream( final String fileName ) throws ActionProcessingException
-	{
-		BufferedInputStream bin = null;
-		try
-		{
-			bin = new BufferedInputStream( new FileInputStream ( fileName ));
-		} 
-		catch (FileNotFoundException e)
-		{
-			log.error( "FileNotFoundException : ", e);
-			if ( bin != null )
-			{
-				try
-				{
-					bin.close();
-				} 
-				catch (IOException e1)
-				{
-					log.error( "IOException while trying to clone FileInputStream to file : [" + fileName + "]", e1);
-				}
-			}
-			throw new ActionProcessingException( "IOException while creating InputStream for file : [" + fileName + "]", e );
-		}
-		return bin;
-	}
-
-
-}

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayMemoryUsageActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayMemoryUsageActionUnitTest.java	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayMemoryUsageActionUnitTest.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated 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.soa.esb.actions;
-
-import static org.junit.Assert.assertEquals;
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Level;
-import org.junit.Test;
-
-/**
- * Unit test for DisplayMemoryUsageAction
- * 
- * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
- *
- */
-public class DisplayMemoryUsageActionUnitTest
-{
-	@Test
-	public void setLogLevelToInfo()
-	{
-		DisplayMemoryUsageAction action = new DisplayMemoryUsageAction();
-		action.setLogger( action.getClass().getName() );
-		action.setLogLevel( "info" );
-		assertEquals( Level.INFO, action.getLevel() );
-	}
-	
-	public static junit.framework.Test suite()
-	{
-		return new JUnit4TestAdapter( DisplayMemoryUsageActionUnitTest.class );
-	}
-
-}

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayTimeActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayTimeActionUnitTest.java	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/DisplayTimeActionUnitTest.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated 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.soa.esb.actions;
-
-import static org.junit.Assert.*;
-import junit.framework.JUnit4TestAdapter;
-
-import org.junit.Test;
-
-/**
- * Unit test for {@link DisplyTimeAction}
- * <p/> 
- * 
- * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
- *
- */
-public class DisplayTimeActionUnitTest
-{
-	@Test
-	public void process()
-	{
-		final String format = "HH:mm:ss:S"; 
-		DisplayTimeAction action = new DisplayTimeAction();
-		action.setFormat( format );
-		assertEquals( format, action.getFormat() );
-	}
-	
-	public static junit.framework.Test suite()
-	{
-		return new JUnit4TestAdapter( DisplayTimeActionUnitTest.class );
-	}
-
-}

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/FileToStreamUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/FileToStreamUnitTest.java	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/FileToStreamUnitTest.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
- * individual contributors as indicated 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.soa.esb.actions.converters;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Unit test for {@link FileToStream}
- * 
- * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
- */
-public class FileToStreamUnitTest
-{
-	private FileToStream fileToStream;
-
-	@Test
-	public void defaultFileNameLocation()
-	{
-		String fileNameLocation = fileToStream.getFileNameLocation();
-		assertNull( fileNameLocation );
-	}
-	
-	@Test
-	public void customFileNameLocation()
-	{
-		final String customLocation = "custom-location";
-		fileToStream.setFileNameLocation( customLocation );
-		assertEquals( customLocation, fileToStream.getFileNameLocation() );
-	}
-	
-	@Test ( expected = ActionProcessingException.class )
-	public void processNegative() throws IOException, ActionProcessingException
-	{
-		Message message = MessageFactory.getInstance().getMessage();
-		fileToStream.process( message );
-	}
-	
-	@Test
-	public void process() throws IOException, ActionProcessingException
-	{
-		Message message = MessageFactory.getInstance().getMessage();
-		File file = File.createTempFile( "testing", ".xml" );
-		message.getBody().add( file.getAbsolutePath() );
-		
-		Message processedMsg = fileToStream.process( message );
-		
-		assertTrue ( processedMsg.getBody().get() instanceof InputStream );
-	}
-	
-	@Before
-	public void setup()
-	{
-		fileToStream = new FileToStream();
-	}
-	
-	public static junit.framework.Test suite()
-	{
-		return new JUnit4TestAdapter( FileToStreamUnitTest.class );
-	}
-
-}

Modified: labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb-unfiltered.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb-unfiltered.xml	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb-unfiltered.xml	2008-07-18 14:21:22 UTC (rev 21117)
@@ -53,17 +53,17 @@
                    		<property name="logBody"	value="true"/>
                     </action>
 
-					<action name="fileToStream" class="org.jboss.soa.esb.actions.converters.FileToStream"/>
+					<action name="fileToStream" class="org.jboss.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions.FileToStream"/>
 
 					<action name="createSourceResult" class="org.jboss.soa.esb.actions.converters.StreamToSourceResult"/>
 
-					<action name="startTime" class="org.jboss.soa.esb.actions.DisplayTimeAction">
+					<action name="startTime" class="org.jboss.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions.DisplayTimeAction">
                    		<property name="logger"		value="SmooksQuickstart"/>
                    		<property name="logLevel"	value="info"/>
                    		<property name="format"		value="HH:mm:ss"/>
 					</action>
 
-					<action name="memUsageBefore" class="org.jboss.soa.esb.actions.DisplayMemoryUsageAction">
+					<action name="memUsageBefore" class="org.jboss.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions.DisplayMemoryUsageAction">
                    		<property name="logger"		value="SmooksQuickstart"/>
                    		<property name="logLevel"	value="info"/>
 					</action>
@@ -81,13 +81,13 @@
                    		<property name="logBody"	value="true"/>
 					</action>
 
-					<action name="endTime" class="org.jboss.soa.esb.actions.DisplayTimeAction">
+					<action name="endTime" class="org.jboss.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions.DisplayTimeAction">
                    		<property name="logger"		value="SmooksQuickstart"/>
                    		<property name="logLevel"	value="info"/>
                    		<property name="format"		value="HH:mm:ss"/>
 					</action>
 
-					<action name="memUsageAfter" class="org.jboss.soa.esb.actions.DisplayMemoryUsageAction">
+					<action name="memUsageAfter" class="org.jboss.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions.DisplayMemoryUsageAction">
                    		<property name="logger"		value="SmooksQuickstart"/>
                    		<property name="logLevel"	value="info"/>
 					</action>

Deleted: labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb.xml	2008-07-18 14:08:42 UTC (rev 21116)
+++ labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/jboss-esb.xml	2008-07-18 14:21:22 UTC (rev 21117)
@@ -1,115 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5" >
-
-    <providers>
-          <fs-provider name="FSprovider1">
-          	<fs-bus busid="smooksFileChannel">
-          		<fs-message-filter
-          			directory="/opt/jboss/esb/source/trunk2/product/samples/quickstarts/smooks_file_splitter_router/build/dirs/input"
-          			input-suffix=".xml"
-          			work-suffix=".esbWorking"
-          			post-delete="false"
-          			post-rename="false"
-          			post-directory="/opt/jboss/esb/source/trunk2/product/samples/quickstarts/smooks_file_splitter_router/build/dirs/output"
-          			post-suffix=".sentToEsb"
-          			error-delete="false"
-          			error-directory="/opt/jboss/esb/source/trunk2/product/samples/quickstarts/smooks_file_splitter_router/build/dirs/error"
-          			error-suffix=".IN_ERROR"
-          		/>
-          	</fs-bus>
-          </fs-provider>
-          
-          <jms-provider name="JBossMessaging" connection-factory="ConnectionFactory"> 
-			    <jms-bus busid="quickstartEsbChannel">
-			        <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_smooks_file_splitter_router_esb"/>
-			    </jms-bus>
-			
-		   </jms-provider>
-
-      </providers>
-      
-      <services>
-          
-        <service 
-			category="smooksFileSplitterRouter"
-			name="service"
-        	description="Smooks Quickstart File Router Splitter" >
-            <listeners>
-            	<fs-listener name="FileGateway"
-            		busidref="smooksFileChannel"
-            		maxThreads="1"
-            		is-gateway="true"
-					schedule-frequency="10">
-					<property name="composer-class" value="org.jboss.soa.esb.listeners.gateway.LocalFileNameMessageComposer"/>
-				</fs-listener>
-                <jms-listener name="helloWorldFileAction" busidref="quickstartEsbChannel" maxThreads="1" />
-            </listeners>
-            <actions mep="OneWay">       
-
-                    <action name="logBodyOnEntry" class="org.jboss.soa.esb.actions.LogAction">
-                   		<property name="logger"		value="SmooksQuickstart"/>
-                   		<property name="logLevel"	value="info"/>
-                   		<property name="message"	value="Body upon entering :"/>
-                   		<property name="logBody"	value="true"/>
-                    </action>
-
-					<action name="fileToStream" class="org.jboss.soa.esb.actions.converters.FileToStream"/>
-
-					<action name="createSourceResult" class="org.jboss.soa.esb.actions.converters.StreamToSourceResult"/>
-
-					<action name="startTime" class="org.jboss.soa.esb.actions.DisplayTimeAction">
-                   		<property name="logger"		value="SmooksQuickstart"/>
-                   		<property name="logLevel"	value="info"/>
-                   		<property name="format"		value="HH:mm:ss"/>
-					</action>
-
-					<action name="memUsageBefore" class="org.jboss.soa.esb.actions.DisplayMemoryUsageAction">
-                   		<property name="logger"		value="SmooksQuickstart"/>
-                   		<property name="logLevel"	value="info"/>
-					</action>
-
-					<action name="transform" class="org.jboss.soa.esb.smooks.SmooksAction">
-						<property name="smooksConfig" value="smooks-config.xml" />
-					</action>
-
-					<action name="getFileList" class="org.jboss.soa.esb.sample.quickstart.smooksfilesplitterrouter.GetFileListFromExecutionContext"/>
-
-                    <action name="logBodyAfterTransform" class="org.jboss.soa.esb.actions.LogAction">
-                   		<property name="logger"		value="SmooksQuickstart"/>
-                   		<property name="logLevel"	value="info"/>
-                   		<property name="message"	value="Body after transform :"/>
-                   		<property name="logBody"	value="true"/>
-					</action>
-
-					<action name="endTime" class="org.jboss.soa.esb.actions.DisplayTimeAction">
-                   		<property name="logger"		value="SmooksQuickstart"/>
-                   		<property name="logLevel"	value="info"/>
-                   		<property name="format"		value="HH:mm:ss"/>
-					</action>
-
-					<action name="memUsageAfter" class="org.jboss.soa.esb.actions.DisplayMemoryUsageAction">
-                   		<property name="logger"		value="SmooksQuickstart"/>
-                   		<property name="logLevel"	value="info"/>
-					</action>
-
-					<action name="notificationAction" class="org.jboss.soa.esb.actions.Notifier">
-						<property name="okMethod" value="notifyOK" />
-						<property name="notification-details">
-							<NotificationList type="ok">
-								<target class="NotifyFTPList">
-									<ftp URL="ftp://sifo:sifo@localhost//home/sifo/input" 
-										filename="{org.jboss.soa.esb.gateway.file}"
-										listFiles="true"
-										deleteListFile="true"/>
-								</target>
-							</NotificationList>
-						</property>
-					</action>
-
-					<!-- The next action is for Continuous Integration testing -->
-                   	<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore" />
-            </actions>
-        </service>
-      </services>
-     
-</jbossesb>

Copied: labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayMemoryUsageAction.java (from rev 21021, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayMemoryUsageAction.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayMemoryUsageAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayMemoryUsageAction.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
+ * individual contributors as indicated 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.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions;
+
+import org.jboss.soa.esb.actions.BeanConfiguredAction;
+import org.jboss.soa.esb.actions.LogAction;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Simple action that shows JVM memory usage. 
+ * </p>
+ * Exemple configuration:
+ * <pre>
+ *&lt;action name="logMemoryUsageAfter" class="org.jboss.soa.esb.actions.DisplayMemoryUsageAction"&gt;
+ *&lt;/action&gt;
+ * </pre>
+ * This action support all configuration properties that {@link LogAction} supports.
+ * 
+ * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
+ * @since 4.3
+ *
+ */
+public class DisplayMemoryUsageAction extends LogAction implements BeanConfiguredAction
+{
+	public Message process( final Message message )
+	{
+		final Runtime runtime = Runtime.getRuntime();
+		final long maxMemory = runtime.maxMemory();
+		final long allocatedMemory = runtime.totalMemory();
+		final long freeMemory = runtime.freeMemory();
+		
+		StringBuilder sb = new StringBuilder();
+		sb.append( "Max mem [" ).append( maxMemory /1024 );
+		sb.append( "], Allocated mem [" ).append( allocatedMemory / 1024 );
+		sb.append( "], Free mem [" ).append( freeMemory / 1024 );
+		sb.append( "], Total Free mem [" ).append( (freeMemory + (maxMemory - allocatedMemory)) / 1024 );
+		sb.append( "]");
+		log( sb.toString() );
+		
+		return message;
+	}
+
+}

Copied: labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayTimeAction.java (from rev 21021, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/DisplayTimeAction.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayTimeAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/DisplayTimeAction.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
+ * individual contributors as indicated 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.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.jboss.soa.esb.actions.LogAction;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Simple action that displays the current time.
+ * </p>
+ * Exemple configuration:
+ * <pre>
+ *&lt;action name="displayTime" class="org.jboss.soa.esb.actions.DisplayTimeAction"&gt;
+ *	&lt;property name="format" value="HH:mm:ss:S"/&gt;
+ *&lt;/action&gt;
+ * </pre>
+ * This action support all configuration properties that {@link LogAction} supports.
+ * 
+ * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
+ * @since 4.3
+ *
+ */
+public class DisplayTimeAction extends LogAction
+{
+	private String format;
+	
+	public Message process( final Message message )
+	{
+		SimpleDateFormat formatter = format == null ? new SimpleDateFormat() : new SimpleDateFormat( format );
+		log( formatter.format( new Date() ) );
+		
+		return message;
+	}
+
+	public String getFormat()
+	{
+		return format;
+	}
+
+	public void setFormat( String format )
+	{
+		this.format = format;
+	}
+
+}

Copied: labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/FileToStream.java (from rev 21021, labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/converters/FileToStream.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/FileToStream.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/smooks_file_splitter_router/src/org/jboss/soa/esb/sample/quickstart/smooksfilesplitterrouter/actions/FileToStream.java	2008-07-18 14:21:22 UTC (rev 21117)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
+ * individual contributors as indicated 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.soa.esb.sample.quickstart.smooksfilesplitterrouter.actions;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.BeanConfiguredAction;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * FileToStream is a converter that open a Stream to the filename
+ * specified by the property filename.
+ * Usage:
+ * <pre>
+ * &lt;action name="fileToStream" class="org.jboss.soa.esb.actions.converters.FileToStream"&gt;
+ * &lt;/action&gt;
+ * 
+ * Optional parameters (default value(s) shown):
+ *    &lt;proptery name="fileNameLocation" value="org.jboss.soa.esb.gateway.file" /&gt;
+ * </pre>
+ * Note that 'fileNameLocation' defaults to {@link Environment#ORIGINAL_FILE}
+ * 
+ * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>			
+ *
+ */
+public class FileToStream implements BeanConfiguredAction
+{
+	private Logger log = Logger.getLogger( FileToStream.class );
+	
+	private String fileNameLocation;
+	
+	public FileToStream()
+	{
+	}
+	
+	/**
+	 * Populates the ESB Message objects body with a InputStream for
+	 * the file identified by the {@link #fileNameLocation} field.
+	 * 
+	 * @param message 	- ESB message object
+	 * @return Message	- ESB message object which a payload that is an InputStream
+	 * @throws ActionProcessingException
+	 */
+	public Message process( final Message message ) throws ActionProcessingException
+	{
+		BufferedInputStream bin = getInputStream( getFileName( message ) );
+		message.getBody().add( bin );
+		
+		return message;
+	}
+
+	public String getFileNameLocation()
+	{
+		return fileNameLocation;
+	}
+
+	public void setFileNameLocation( final String fileNameLocation )
+	{
+		this.fileNameLocation = fileNameLocation;
+	}
+	
+	private String getFileName (final Message message ) throws ActionProcessingException
+	{
+		String fileName = fileNameLocation == null ? 
+				(String) message.getBody().get() :
+				(String) message.getBody().get( fileNameLocation );
+		
+		log.debug( "FileName : [" + fileName + "]" );
+		
+		if ( fileName == null )
+			throw new ActionProcessingException( "Didn't find a file as in property location [" + fileNameLocation + "] or as the default object in the message body." );
+		
+		return fileName;
+	}
+	
+	private BufferedInputStream getInputStream( final String fileName ) throws ActionProcessingException
+	{
+		BufferedInputStream bin = null;
+		try
+		{
+			bin = new BufferedInputStream( new FileInputStream ( fileName ));
+		} 
+		catch (FileNotFoundException e)
+		{
+			log.error( "FileNotFoundException : ", e);
+			if ( bin != null )
+			{
+				try
+				{
+					bin.close();
+				} 
+				catch (IOException e1)
+				{
+					log.error( "IOException while trying to clone FileInputStream to file : [" + fileName + "]", e1);
+				}
+			}
+			throw new ActionProcessingException( "IOException while creating InputStream for file : [" + fileName + "]", e );
+		}
+		return bin;
+	}
+
+
+}




More information about the jboss-svn-commits mailing list