[jboss-svn-commits] JBL Code SVN: r11752 - in labs/jbossesb/workspace/dbevenius/product: core/listeners/src/org/jboss/soa/esb/listeners/gateway and 8 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue May 8 10:59:26 EDT 2007
Author: beve
Date: 2007-05-08 10:59:26 -0400 (Tue, 08 May 2007)
New Revision: 11752
Added:
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml
Modified:
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java
labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd
labs/jbossesb/workspace/dbevenius/product/etc/test/resources/log4j/dev/log4j.xml
labs/jbossesb/workspace/dbevenius/product/install/build.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/build.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-unfiltered.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/log4j.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt
Log:
Added to the read-only property to the ftp-message-filter configuration.
This will then cause the ReadOnlyRemoteFileSystemStrategy to be used.
Updated the helloworld_ftp_action quickstart so that this can be run by using 'ant run-readonly'
Note that currently on has to modify ftpfile-cache-config.xml before running. This is an issue with jboss cache which I am investigating.
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java 2007-05-08 14:59:26 UTC (rev 11752)
@@ -31,6 +31,7 @@
import org.jboss.soa.esb.listeners.config.FtpProviderDocument.FtpProvider;
import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
import org.jboss.soa.esb.listeners.gateway.RemoteGatewayListener;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.ReadOnlyRemoteFileSystemStrategy;
import org.w3c.dom.Element;
/**
@@ -79,6 +80,11 @@
MapperUtil.mapProperties(listener.getPropertyList(), listenerNode);
if(listener.getIsGateway()) {
listenerNode.setAttribute("gatewayClass", RemoteGatewayListener.class.getName());
+ if ( messageFilter.getReadOnly() )
+ {
+ listenerNode.setAttribute(RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CLASS,
+ ReadOnlyRemoteFileSystemStrategy.class.getName());
+ }
// Map EPR related attributes onto the listener - from the bus and provider and listener.
// Note: This will change - the Gateways will also support the EPR element...
mapFtpEprProperties(listenerNode, provider, messageFilter);
@@ -112,7 +118,6 @@
inputDir += FTP_SEPARATOR + inputDir;
toElement.setAttribute(ListenerTagNames.URL_TAG, messageFilter.getProtocol() + "://" + messageFilter.getUsername() + ":"
-// + messageFilter.getPassword() + "@" + provider.getHostname() + ":" + messageFilter.getDirectory());
+ messageFilter.getPassword() + "@" + provider.getHostname() + inputDir );
toElement.setAttribute(FTPEpr.INPUT_SUFFIX_TAG, messageFilter.getInputSuffix());
toElement.setAttribute(FTPEpr.WORK_SUFFIX_TAG, messageFilter.getWorkSuffix());
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-05-08 14:59:26 UTC (rev 11752)
@@ -51,7 +51,7 @@
* Property name
*/
public static final String REMOTE_FILE_SYSTEM_STRATEGY_CLASS = "remoteFileSystemStrategy-class";
- public static final String STRATEGY_CONFIG_FILE = "strategy-configFile";
+ public static final String REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE = "remoteFileSystemStrategy-configFile";
/**
* A strategy from handling call related to write operations
*/
@@ -109,19 +109,16 @@
if ( strategy != null )
{
remotefileSystemStrategy = strategy;
- String configFile = _config.getAttribute( STRATEGY_CONFIG_FILE );
- if ( configFile != null )
+ String configFile = _config.getAttribute( REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE );
+ try
{
- try
- {
- remotefileSystemStrategy.init( configFile );
- }
- catch( Exception e )
- {
- throw new ConfigurationException(e);
- }
-
+ remotefileSystemStrategy.init( configFile );
}
+ catch( Exception e )
+ {
+ _logger.error( "Could not configure the remoteFileSystemStrategy.", e );
+ throw new ConfigurationException(e);
+ }
}
}
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java 2007-05-08 14:59:26 UTC (rev 11752)
@@ -1,6 +1,11 @@
package org.jboss.soa.esb.listeners.gateway.remotestrategies.cache;
+import java.io.Closeable;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
import org.apache.log4j.Logger;
import org.jboss.cache.CacheException;
@@ -23,28 +28,74 @@
@SuppressWarnings("unused")
private Logger log = Logger.getLogger( FtpFileCache.class );
+ /**
+ * Default configuration file for jboss cache.
+ * Used if no config is specified upon calling the constructor.
+ * Note that this file must then exist on the classpath
+ */
+ private static final String DEFAULT_CONFIG_FILE = "/ftpfile-cache-config.xml";
+ /**
+ * The fqn to use.
+ */
private String fqn = "/ftp/cache/";
-
+ /**
+ * The configuration file used to configure the tree cache
+ */
private String config;
+ /**
+ * The JBoss TreeCache instance
+ */
private TreeCache treeCache;
+ /**
+ *
+ * @param config either an absolute path of a relative path
+ * @throws Exception
+ */
public FtpFileCache ( String config ) throws Exception
{
- if (config == null)
- throw new IllegalArgumentException("config must not be null");
+ if ( config == null )
+ config = DEFAULT_CONFIG_FILE;
- File configFile = new File( config );
-
- if ( !configFile.exists() )
- throw new IllegalArgumentException("config file: " + config + " must exist.");
-
this.config = config;
treeCache = new TreeCache();
- PropertyConfigurator configurator = new PropertyConfigurator();
- configurator.configure( treeCache, config );
+ InputStream in = getConfigInputStream( this.config );
+ try
+ {
+ PropertyConfigurator configurator = new PropertyConfigurator();
+ configurator.configure( treeCache, in );
+ }
+ finally
+ {
+ close( in );
+ }
}
+
+ protected InputStream getConfigInputStream( String path )
+ {
+ InputStream in = null;
+ File configFile = new File( path );
+ if ( configFile.exists() )
+ {
+ log.debug("Reading jboss cache configuration from : " + path );
+
+ try
+ {
+ in = new FileInputStream ( path );
+ }
+ catch (FileNotFoundException e) {
+ log.error( e );
+ }
+ }
+ else
+ {
+ log.debug("Reading jgroups configuration classpath : " + path );
+ in = getClass().getResourceAsStream( path );
+ }
+ return in;
+ }
public void start() throws Exception
{
@@ -119,5 +170,20 @@
{
treeCache.removeData( fqn );
}
+
+ private void close( Closeable c )
+ {
+ if ( c == null )
+ return;
+
+ try
+ {
+ c.close();
+ }
+ catch ( IOException e )
+ {
+ log.warn( "Error while trying to close Closable", e);
+ }
+ }
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java 2007-05-08 14:59:26 UTC (rev 11752)
@@ -21,22 +21,31 @@
*/
package org.jboss.soa.esb.listeners.config.mappers;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
+import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.config.Bus;
import org.jboss.soa.esb.listeners.config.Generator;
import org.jboss.soa.esb.listeners.config.Listener;
+import org.jboss.soa.esb.listeners.config.FtpBusDocument.FtpBus;
import org.jboss.soa.esb.listeners.config.FtpListenerDocument.FtpListener;
import org.jboss.soa.esb.listeners.config.FtpMessageFilterDocument.FtpMessageFilter;
import org.jboss.soa.esb.listeners.config.Generator.XMLBeansModel;
+import org.jboss.soa.esb.listeners.gateway.RemoteGatewayListener;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
*
@@ -45,54 +54,66 @@
*/
public class FtpListenerMapperTest
{
+ private Logger log = Logger.getLogger(FtpListenerMapperTest.class);
+ private static final String ESB_CONFIG_READ_ONLY = "jbossesb_config_readonly.xml";
+
+ private static final String GATEWAY_CLASS_ATTRIBUTE = "gatewayClass";
+
@Test
- public void test() throws ConfigurationException, IOException
+ public void testReadOnlyConfiguration() throws ConfigurationException, IOException
{
- Document doc = YADOMUtil.createDocument();
- Element root;
+ Element root = createRootElement();
+ XMLBeansModel model = getXmlBeanModel( ESB_CONFIG_READ_ONLY );
- root = YADOMUtil.addElement(doc, "jbossesb-gateways");
- root.setAttribute("parameterReloadSecs", "1000" );
-
- InputStream inputStream = getClass().getResourceAsStream("jbossesb_config_01.xml");
- assertNotNull ( "Input stream should not be null", inputStream );
- GeneratorMock mock = new GeneratorMock( inputStream );
- XMLBeansModel model = mock.getModel();
List<Listener> gateways = model.getGatewayListeners();
-
FtpListener ftpListener = (FtpListener) gateways.get(0);
- @SuppressWarnings("unused")
- FtpMessageFilter ftpMessageFilter = ftpListener.getFtpMessageFilter();
+ assertEquals ( true, ftpListener.getIsGateway() );
- System.out.println( "Listener 0 :" + ftpListener );
+ FtpBus ftpBus = (FtpBus) model.getBus( ftpListener.getBusidref() );
+ assertNotNull( "FtpBus element should exist", ftpBus );
+ assertEquals ( "read-only attribute should be true", true, ftpBus.getFtpMessageFilter().getReadOnly() );
- /*
- FtpListenerDocument ftpListenerDocument = FtpListenerDocument.Factory.newInstance();
-// ftpListenerDocument.setFtpListener( model.get );
- //must refer to the same instance!!!!
+ FtpListenerMapper.map( root , ftpListener, model );
- FtpListener ftpListener = ftpListenerDocument.addNewFtpListener();
- ftpListener.setIsGateway( true );
- ftpListener.setName( "FtpMapperListener" );
- ftpListener.setBusidref( "FtpMapperTest" );
- ftpListener.setMaxThreads( 1 );
- FtpMessageFilter filter = ftpListener.addNewFtpMessageFilter();
- filter.setDirectory( "/tmp" );
- filter.setErrorDirectory( "/error" );
- filter.setPostDirectory( "/postdir" );
- filter.setUsername( "user" );
- filter.setPassword( "pass" );
- filter.setInputSuffix( ".txt" );
- filter.setErrorSuffix( ".err" );
- */
+ Node ftpMapperListener = root.getFirstChild();
+ assertNotNull ("ftpMapperListener should not be null", ftpMapperListener );
+ assertEquals( ftpListener.getName(), ftpMapperListener.getNodeName() );
+ NamedNodeMap attributes = ftpMapperListener.getAttributes();
+ Node gatewayClass = attributes.getNamedItem( GATEWAY_CLASS_ATTRIBUTE );
+ assertNotNull( "gatewayClass should have been set", gatewayClass );
+ log.debug( gatewayClass );
+ assertEquals( RemoteGatewayListener.class.getName(), gatewayClass.getNodeValue() );
+ Node remoteStrategyClass = attributes.getNamedItem( RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CLASS );
+ assertNotNull( RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CLASS + " should have been set",
+ remoteStrategyClass );
- FtpListenerMapper.map( root , ftpListener, model );
+
}
+ private XMLBeansModel getXmlBeanModel( String fileName ) throws ConfigurationException, IOException
+ {
+ InputStream inputStream = getClass().getResourceAsStream( ESB_CONFIG_READ_ONLY );
+ GeneratorMock mock = new GeneratorMock( inputStream );
+ XMLBeansModel model = mock.getModel();
+ return model;
+ }
+ private Element createRootElement() throws ConfigurationException
+ {
+ Document doc = YADOMUtil.createDocument();
+ Element root = YADOMUtil.addElement(doc, "jbossesb-gateways");
+ root.setAttribute("parameterReloadSecs", "1000" );
+ return root;
+ }
+
+
+ /**
+ * Just here to get proved access to the XMLBeansModel
+ *
+ */
private class GeneratorMock extends Generator
{
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -5,7 +5,7 @@
<ftp-provider name="FTP" hostname="localhost:21">
<ftp-bus busid="FtpMapperTest">
- <ftp-message-filter directory="/Temp" input-suffix=".txt" username="joe" password="secret"/>
+ <ftp-message-filter directory="/Temp" read-only="true" input-suffix=".txt" username="joe" password="secret"/>
</ftp-bus>
</ftp-provider>
Added: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -0,0 +1,25 @@
+<?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">
+
+ <providers>
+
+ <ftp-provider name="FTP" hostname="localhost:21">
+ <ftp-bus busid="FtpMapperTest">
+ <ftp-message-filter directory="/Temp" read-only="true" input-suffix=".txt" username="joe" password="secret"/>
+ </ftp-bus>
+ </ftp-provider>
+
+ </providers>
+ <services>
+ <service category="Test2" name="FTPTest" description="FTP server Test">
+
+ <listeners>
+ <ftp-listener name="FtpMapperListener"
+ busidref="FtpMapperTest"
+ is-gateway="true"
+ maxThreads="1"/>
+ </listeners>
+ </service>
+ </services>
+
+</jbossesb>
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java 2007-05-08 14:59:26 UTC (rev 11752)
@@ -164,7 +164,7 @@
{
ConfigTree configTree = RemoteGatewayListenerUnitTest.createConfigTree();
configTree.setAttribute( RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CLASS, ReadOnlyRemoteFileSystemStrategy.class.getName());
- configTree.setAttribute( RemoteGatewayListener.STRATEGY_CONFIG_FILE, getCacheConfigFile() );
+ configTree.setAttribute( RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE, getCacheConfigFile() );
return configTree;
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java 2007-05-08 14:59:26 UTC (rev 11752)
@@ -1,8 +1,13 @@
package org.jboss.soa.esb.listeners.gateway.remotestrategies.cache;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
+import java.io.InputStream;
import junit.framework.JUnit4TestAdapter;
@@ -24,18 +29,14 @@
private static FtpFileCache ftpfileCache;
- @Test( expected=IllegalArgumentException.class)
- public void constructorNegativeConfigNull() throws Exception
+ @Test
+ public void getConfigInputStream() throws Exception
{
- new FtpFileCache( null );
+ String configPath = "/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml";
+ InputStream configInputStream = ftpfileCache.getConfigInputStream( configPath );
+ assertNotNull( "InputStream was null", configInputStream );
}
- @Test( expected=IllegalArgumentException.class)
- public void constructorNegativeConfigNotExists() throws Exception
- {
- new FtpFileCache( "/some/file/somewhere" );
- }
-
@Test
public void getPutAndRemove()
{
@@ -107,7 +108,7 @@
private static String getConfigFile()
{
- String configFile = TestEnvironmentUtil.getUserDir() + File.separator +
+ String configFile = TestEnvironmentUtil.getBaseDir() + File.separator +
"core" + File.separator +
"listeners" + File.separator +
"tests" + File.separator +
Added: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file is a copy of the one in core/listeners/test/resources/etc and only here
+ to test the ability to specify a configuration file relative to the classes classpath.
+-->
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+ <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!-- Configure the TransactionManager -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute>
+
+ <!-- Isolation level : SERIALIZABLE REPEATABLE_READ (default) READ_COMMITTED READ_UNCOMMITTED NONE -->
+ <!--attribute name="IsolationLevel">REPEATABLE_READ</attribute-->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC -->
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <!-- Just used for async repl: use a replication queue -->
+ <attribute name="UseReplQueue">false</attribute>
+
+ <!-- Replication interval for replication queue (in ms) -->
+ <attribute name="ReplQueueInterval">0</attribute>
+
+ <!-- Max number of elements which trigger replication -->
+ <attribute name="ReplQueueMaxElements">0</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all clusters, in order to find each other -->
+ <attribute name="ClusterName">FtpFileCache-Cluster</attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+ bind_addr="10.36.17.27"
+ ip_ttl="64" ip_mcast="true"
+ mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+ ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+ loopback="false"/>
+ <PING timeout="2000" num_initial_members="2" up_thread="false" down_thread="false"/>
+ <MERGE2 min_interval="10000" max_interval="20000"/>
+ <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
+ <FD_SOCK/>
+ <VERIFY_SUSPECT timeout="1500" up_thread="false" down_thread="false"/>
+ <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800" max_xmit_size="8192" up_thread="false" down_thread="false"/>
+ <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10" down_thread="false"/>
+ <pbcast.STABLE desired_avg_gossip="20000" up_thread="false" down_thread="false"/>
+ <FRAG frag_size="8192" down_thread="false" up_thread="false"/>
+ <pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="true" print_local_addr="true"/>
+ <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+ </config>
+ </attribute>
+
+ <!-- Whether or not to fetch state on joining a cluster -->
+ <attribute name="FetchStateOnStartup">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="InitialStateRetrievalTimeout">10000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">10000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">30</attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/ftp/cache">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ <attribute name="maxAgeSeconds">86400</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <attribute name="CacheLoaderConfiguration">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>false</passivation>
+
+ <!-- comma delimited FQNs to preload -->
+ <preload>/ftp/cache</preload>
+
+ <!-- are the cache loaders shared in a cluster? -->
+ <shared>false</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <!-- the 'cacheloader' element may be repeated -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.JDBCCacheLoader</class>
+ <properties>
+ cache.jdbc.driver=org.hsqldb.jdbcDriver
+ cache.jdbc.url=jdbc:hsqldb:hsql://localhost:9001/ftpcache
+ cache.jdbc.user=sa
+ cache.jdbc.password=
+ </properties>
+ <!-- whether the cache loader writes are asynchronous -->
+ <async>false</async>
+
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.
+ An exception is thrown if more than one cache loader sets this to true. -->
+ <fetchPersistentState>false</fetchPersistentState>
+
+ <!-- determines whether this cache loader ignores writes - defaults to false. -->
+ <ignoreModifications>false</ignoreModifications>
+
+ <!-- if set to true, purges the contents of this cache loader when the cache starts u Defaults to false. -->
+ <purgeOnStartup>false</purgeOnStartup>
+
+ </cacheloader>
+ </config>
+ </attribute>
+
+ </mbean>
+
+
+ <!-- Uncomment to get a graphical view of the TreeCache MBean above -->
+ <!-- <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
+ <!-- <depends>jboss.cache:service=TreeCache</depends>-->
+ <!-- <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
+ <!-- </mbean>-->
+
+
+</server>
Modified: labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-05-08 14:59:26 UTC (rev 11752)
@@ -487,6 +487,14 @@
<xsd:documentation xml:lang="en">The password used to access the ftp server.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
+ <xsd:attribute name="read-only" use="optional" type="xsd:boolean" default="false">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, the ftp server does not permit write opertations on files.
+ Note that in this case the following properties have no effect: work-suffix, post-delete,
+ post-directory, post-suffix, error-delete, error-directory, and error-suffix.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attribute name="input-suffix" use="required" type="xsd:string">
<xsd:annotation>
<xsd:documentation xml:lang="en">The file suffix used to filter files targeted for comsumption by
Modified: labs/jbossesb/workspace/dbevenius/product/etc/test/resources/log4j/dev/log4j.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/etc/test/resources/log4j/dev/log4j.xml 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/etc/test/resources/log4j/dev/log4j.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -75,6 +75,10 @@
<category name="org.jgroups">
<priority value="WARN"/>
</category>
+
+ <category name="org.jboss.cache">
+ <priority value="WARN"/>
+ </category>
<!-- Limit the jacorb category to WARN as its INFO is verbose -->
<category name="jacorb">
Modified: labs/jbossesb/workspace/dbevenius/product/install/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/install/build.xml 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/install/build.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -31,8 +31,9 @@
<property name="internal.services.deploy.dir" value="${deploy.dir}/jbossesb.esb"/>
<property name="internal.services.metainf.dir" value="${internal.services.deploy.dir}/META-INF"/>
<mkdir dir="${internal.services.metainf.dir}"/>
+ <echo message="dist.lib dir : ${org.jboss.esb.dist.lib}"/>
<copy todir="${internal.services.metainf.dir}"
- file="${org.jboss.esb.dist.lib}/jbossesb.esb/META-INF/jboss-esb.xml"/>
+ file="${org.jboss.esb.dist.lib}/jbossesb/lib/jbossesb.esb/META-INF/jboss-esb.xml"/>
<copy todir="${internal.services.deploy.dir}" file="${messaging.config}"/>
</target>
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/build.xml 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/build.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -8,7 +8,9 @@
<import file="../conf/base-build.xml"/>
<target name="config">
- <antcall target="filter_jboss-esb.xml"/>
+ <antcall target="filter_jboss-esb.xml">
+ <param name="file.name" value="jboss-esb-unfiltered.xml"/>
+ </antcall>
<copy file="log4j.xml" tofile="build/log4j.xml"/>
</target>
@@ -33,8 +35,17 @@
</java>
</target>
+ <target name="run-readonly" description="run the readonly version">
+ <copy file="ftpfile-cache-config.xml" todir="${basedir}/classes"/>
+ <antcall target="filter_jboss-esb.xml">
+ <param name="file.name" value="${basedir}/jboss-esb-readonly-unfiltered.xml"/>
+ </antcall>
+ <antcall target="run"/>
+ </target>
+
+
<target name="filter_jboss-esb.xml">
- <copy file="${basedir}/jboss-esb-unfiltered.xml" tofile="${basedir}/jboss-esb.xml" overwrite="true" filtering="true">
+ <copy file="${file.name}" tofile="${basedir}/jboss-esb.xml" overwrite="true" filtering="true">
<filterset>
<filter token="FTP_HOSTNAME" value="${quickstart.jbossesb.ftp.hostname}"/>
<filter token="FTP_USERNAME" value="${quickstart.jbossesb.ftp.username}"/>
Added: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+ <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!-- Configure the TransactionManager -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute>
+
+ <!-- Isolation level : SERIALIZABLE REPEATABLE_READ (default) READ_COMMITTED READ_UNCOMMITTED NONE -->
+ <!--attribute name="IsolationLevel">REPEATABLE_READ</attribute-->
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC -->
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <!-- Just used for async repl: use a replication queue -->
+ <attribute name="UseReplQueue">false</attribute>
+
+ <!-- Replication interval for replication queue (in ms) -->
+ <attribute name="ReplQueueInterval">0</attribute>
+
+ <!-- Max number of elements which trigger replication -->
+ <attribute name="ReplQueueMaxElements">0</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all clusters, in order to find each other -->
+ <attribute name="ClusterName">FtpFileCache-Cluster</attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+ bind_addr="10.36.17.27"
+ ip_ttl="64" ip_mcast="true"
+ mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+ ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+ loopback="false"/>
+ <PING timeout="2000" num_initial_members="2" up_thread="false" down_thread="false"/>
+ <MERGE2 min_interval="10000" max_interval="20000"/>
+ <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
+ <FD_SOCK/>
+ <VERIFY_SUSPECT timeout="1500" up_thread="false" down_thread="false"/>
+ <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800" max_xmit_size="8192" up_thread="false" down_thread="false"/>
+ <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10" down_thread="false"/>
+ <pbcast.STABLE desired_avg_gossip="20000" up_thread="false" down_thread="false"/>
+ <FRAG frag_size="8192" down_thread="false" up_thread="false"/>
+ <pbcast.GMS join_timeout="5000" join_retry_timeout="2000" shun="true" print_local_addr="true"/>
+ <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+ </config>
+ </attribute>
+
+ <!-- Whether or not to fetch state on joining a cluster -->
+ <attribute name="FetchStateOnStartup">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="InitialStateRetrievalTimeout">10000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">10000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">30</attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/ftp/cache">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ <attribute name="maxAgeSeconds">86400</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <attribute name="CacheLoaderConfiguration">
+ <config>
+ <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
+ <passivation>false</passivation>
+
+ <!-- comma delimited FQNs to preload -->
+ <preload>/ftp/cache</preload>
+
+ <!-- are the cache loaders shared in a cluster? -->
+ <shared>false</shared>
+
+ <!-- we can now have multiple cache loaders, which get chained -->
+ <!-- the 'cacheloader' element may be repeated -->
+ <cacheloader>
+ <class>org.jboss.cache.loader.JDBCCacheLoader</class>
+ <properties>
+ cache.jdbc.driver=org.hsqldb.jdbcDriver
+ cache.jdbc.url=jdbc:hsqldb:hsql://localhost:9001/ftpcache
+ cache.jdbc.user=sa
+ cache.jdbc.password=
+ </properties>
+ <!-- whether the cache loader writes are asynchronous -->
+ <async>false</async>
+
+ <!-- only one cache loader in the chain may set fetchPersistentState to true.
+ An exception is thrown if more than one cache loader sets this to true. -->
+ <fetchPersistentState>false</fetchPersistentState>
+
+ <!-- determines whether this cache loader ignores writes - defaults to false. -->
+ <ignoreModifications>false</ignoreModifications>
+
+ <!-- if set to true, purges the contents of this cache loader when the cache starts u Defaults to false. -->
+ <purgeOnStartup>false</purgeOnStartup>
+
+ </cacheloader>
+ </config>
+ </attribute>
+
+ </mbean>
+
+
+ <!-- Uncomment to get a graphical view of the TreeCache MBean above -->
+ <!-- <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
+ <!-- <depends>jboss.cache:service=TreeCache</depends>-->
+ <!-- <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
+ <!-- </mbean>-->
+
+
+</server>
Added: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -0,0 +1,68 @@
+<?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>
+ <ftp-provider name="FTPprovider" hostname="@FTP_HOSTNAME@" >
+ <ftp-bus busid="helloFTPChannel" >
+ <ftp-message-filter
+ username="@FTP_USERNAME@"
+ password="@FTP_PASSWORD@"
+ read-only="true"
+ passive="false"
+ directory="@FTP_DIRECTORY@"
+ input-suffix=".dat"
+ work-suffix=".esbWorking"
+ post-delete="false"
+ post-suffix=".COMPLETE"
+ error-delete="false"
+ error-suffix=".HAS_ERROR"
+ />
+ </ftp-bus>
+ </ftp-provider>
+
+ <jms-provider name="JBossMQ"
+ connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost" >
+
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_ftp_esb"
+ selector="source='fromHelloworldFTPAction'"
+ />
+ </jms-bus>
+
+ </jms-provider>
+
+ </providers>
+
+ <services>
+ <service
+ category="myCategory"
+ name="myFileListener"
+ description="Hello World File Action (esb listener)" >
+ <listeners>
+ <ftp-listener name="FtpGateway"
+ busidref="helloFTPChannel"
+ maxThreads="1"
+ is-gateway="true"
+ >
+ <property name="pollLatencySeconds" value="5"/>
+ <!--property name="remoteFileSystemStrategy-configFile" value="ftpfile_cache_test_config.xml"/-->
+ </ftp-listener>
+ <jms-listener name="helloWorldFileAction"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action name="action1"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldftpaction.MyAction"
+ process="displayMessage,playWithMessage"
+ />
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-unfiltered.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-unfiltered.xml 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-unfiltered.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -7,6 +7,7 @@
<ftp-message-filter
username="@FTP_USERNAME@"
password="@FTP_PASSWORD@"
+ read-only="true"
passive="false"
directory="@FTP_DIRECTORY@"
input-suffix=".dat"
@@ -48,6 +49,7 @@
is-gateway="true"
>
<property name="pollLatencySeconds" value="5"/>
+ <!--property name="remoteFileSystemStrategy-configFile" value="ftpfile_cache_test_config.xml"/-->
</ftp-listener>
<jms-listener name="helloWorldFileAction"
busidref="quickstartEsbChannel"
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/log4j.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/log4j.xml 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/log4j.xml 2007-05-08 14:59:26 UTC (rev 11752)
@@ -66,6 +66,19 @@
<category name="quickstart">
<priority value="INFO"/>
</category>
+
+ <category name="org.jboss.cache">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.jgroups">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.jboss.cache.transaction.DummyTransactionManager">
+ <priority value="FATAL"/>
+ </category>
+
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt 2007-05-08 14:53:30 UTC (rev 11751)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt 2007-05-08 14:59:26 UTC (rev 11752)
@@ -27,7 +27,7 @@
What to consider in this Quickstart:
===================================
-1) The FTP configuration has been initialised in ../quickstarts.properties
+1) The FTP configuration has been initialised in ../conf/quickstarts.properties
2) The FTP directory is accessable and can be written to as the "in process"
and "completed" files are renamed accordingly.
More information about the jboss-svn-commits
mailing list