[jboss-svn-commits] JBL Code SVN: r12573 - in labs/jbossesb/trunk: product and 16 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jun 14 07:04:19 EDT 2007
Author: beve
Date: 2007-06-14 07:04:18 -0400 (Thu, 14 Jun 2007)
New Revision: 12573
Added:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml
labs/jbossesb/trunk/product/lib/ext/cache.jar
labs/jbossesb/trunk/product/lib/ext/jgroups-all.jar
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml
Removed:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml
Modified:
labs/jbossesb/trunk/IDE/JBossIDE/core_src_plus_tests.classpath
labs/jbossesb/trunk/product/.classpath
labs/jbossesb/trunk/product/build-distr.xml
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/CallHelper.java
labs/jbossesb/trunk/product/docs/MessageActionGuide.odt
labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/readme.txt
Log:
Merge form workspace/dbevenius. JIRA: http://jira.jboss.com/jira/browse/JBESB-533 FTP bus that is read-only
Modified: labs/jbossesb/trunk/IDE/JBossIDE/core_src_plus_tests.classpath
===================================================================
--- labs/jbossesb/trunk/IDE/JBossIDE/core_src_plus_tests.classpath 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/IDE/JBossIDE/core_src_plus_tests.classpath 2007-06-14 11:04:18 UTC (rev 12573)
@@ -7,13 +7,13 @@
<classpathentry kind="lib" path="lib/ext/milyn-smooks-javabean-0.3-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="etc/test/resources/log4j/dev"/>
<classpathentry excluding="**/.svn/" kind="src" path="core/rosetta/src"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="services/jbpm/src/test/java"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="services/jbpm/src/main/java"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/services/tests/src"/>
<classpathentry excluding="**/.svn/" kind="src" path="core/rosetta/tests/src"/>
- <classpathentry excluding="**/.svn/" kind="src" path="core/listeners/src"/>
<classpathentry excluding="**/.svn/" kind="src" path="core/listeners/tests/src"/>
<classpathentry excluding="**/.svn/" kind="src" path="core/services/src"/>
- <classpathentry excluding="**/.svn/" kind="src" path="core/services/tests/src"/>
- <classpathentry excluding="**/.svn/" kind="src" path="services/jbpm/src/main/java"/>
- <classpathentry excluding="**/.svn/" kind="src" path="services/jbpm/src/test/java"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/listeners/src"/>
<classpathentry excluding="**/.svn/" kind="src" path="services/jbrules/src/main/java"/>
<classpathentry excluding="**/.svn/" kind="src" path="services/jbrules/src/test/java"/>
<classpathentry excluding="**/.svn/" kind="src" path="services/soapui-client/src/main/java"/>
Modified: labs/jbossesb/trunk/product/.classpath
===================================================================
--- labs/jbossesb/trunk/product/.classpath 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/.classpath 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,76 +1,78 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry excluding="**/.svn/" kind="src" path="core/rosetta/src"/>
- <classpathentry excluding="**/.svn/" kind="src" path="core/services/src"/>
- <classpathentry excluding="**/.svn/" kind="src" path="core/listeners/src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/ext/activation.jar"/>
- <classpathentry kind="lib" path="lib/ext/antlr-2.7.6.jar"/>
- <classpathentry kind="lib" path="lib/ext/antlr-3.0ea8.jar"/>
- <classpathentry kind="lib" path="lib/ext/c3p0-0.9.1-pre9.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-collections-2.0.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-collections-3.2.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-dbcp-1.2.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-jci-core-1.0-406301.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-jci-janino-2.4.3.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-lang-2.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-logging.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-pool-1.3.jar"/>
- <classpathentry kind="lib" path="lib/ext/drools-compiler-3.0.4.jar"/>
- <classpathentry kind="lib" path="lib/ext/drools-core-3.0.4.jar"/>
- <classpathentry kind="lib" path="lib/ext/emma_ant.jar"/>
- <classpathentry kind="lib" path="lib/ext/emma.jar"/>
- <classpathentry kind="lib" path="lib/ext/groovy-all-1.0.jar"/>
- <classpathentry kind="lib" path="lib/ext/hsqldb.jar"/>
- <classpathentry kind="lib" path="lib/ext/jakarta-oro-2.0.8.jar"/>
- <classpathentry kind="lib" path="lib/ext/janino-2.4.3.jar"/>
- <classpathentry kind="lib" path="lib/ext/jaxr-api-1.0-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/ext/jbossall-client.jar"/>
- <classpathentry kind="lib" path="lib/ext/jboss-jmx.jar"/>
- <classpathentry kind="lib" path="lib/ext/jboss-system.jar"/>
- <classpathentry kind="lib" path="lib/ext/jbossts-common.jar"/>
- <classpathentry kind="lib" path="lib/ext/jsch-0.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/juddi-1.0-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/ext/juddi-client-1.0-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/ext/junit-4.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/log4j.jar"/>
- <classpathentry kind="lib" path="lib/ext/mail.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-commons-0.8.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-edisax-0.1-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-smooks-core-0.8.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-smooks-csv-0.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-smooks-edi-0.1-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-smooks-javabean-0.2.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-smooks-misc-0.2.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-smooks-scripting-0.1-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-smooks-templating-0.2.jar"/>
- <classpathentry kind="lib" path="lib/ext/milyn-tinak-0.7.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/mockejb.jar"/>
- <classpathentry kind="lib" path="lib/ext/ognl-2.6.9.jar"/>
- <classpathentry kind="lib" path="lib/ext/opencsv-1.6.jar"/>
- <classpathentry kind="lib" path="lib/ext/postgresql-8.1-407.jdbc2ee.jar"/>
- <classpathentry kind="lib" path="lib/ext/properties-plugin.jar"/>
- <classpathentry kind="lib" path="lib/ext/scout-1.0-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/ext/stax-api-1.0.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/stringtemplate-2.3b6.jar"/>
- <classpathentry kind="lib" path="lib/ext/tomcat-coyote.jar"/>
- <classpathentry kind="lib" path="lib/ext/tomcat-http.jar"/>
- <classpathentry kind="lib" path="lib/ext/tomcat-util.jar"/>
- <classpathentry kind="lib" path="lib/ext/xalan-2.7.0.jar"/>
- <classpathentry kind="lib" path="lib/ext/xbean.jar"/>
- <classpathentry kind="lib" path="lib/ext/xercesImpl-2.7.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/xml-apis-1.3.02.jar"/>
- <classpathentry kind="lib" path="lib/ext/xmlpublic.jar"/>
- <classpathentry kind="lib" path="lib/ext/xstream-1.1.3.jar"/>
- <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.0.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/jboss.jar"/>
- <classpathentry kind="lib" path="lib/ext/jackrabbit-api-1.2.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/jackrabbit-core-1.2.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/jcr-1.0.jar"/>
- <classpathentry kind="lib" path="lib/ext/commons-io-1.3.jar"/>
- <classpathentry kind="lib" path="lib/ext/jbossws-core.jar"/>
- <classpathentry kind="lib" path="lib/ext/jackrabbit-jcr-commons-1.2.1.jar"/>
- <classpathentry kind="lib" path="lib/ext/lucene-core-2.0.0.jar"/>
- <classpathentry kind="lib" path="lib/ext/edtftpj-1.5.4.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="lib" path="etc/test/resources/log4j/dev"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/rosetta/src"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/rosetta/tests/src"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/listeners/src"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/listeners/tests/src"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/services/src"/>
+ <classpathentry excluding="**/.svn/" kind="src" path="core/services/tests/src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/ext/activation.jar"/>
+ <classpathentry kind="lib" path="lib/ext/antlr-2.7.6.jar"/>
+ <classpathentry kind="lib" path="lib/ext/commons-collections-3.2.jar"/>
+ <classpathentry kind="lib" path="lib/ext/commons-lang-2.1.jar"/>
+ <classpathentry kind="lib" path="lib/ext/emma_ant.jar"/>
+ <classpathentry kind="lib" path="lib/ext/emma.jar"/>
+ <classpathentry kind="lib" path="lib/ext/groovy-all-1.0.jar"/>
+ <classpathentry kind="lib" path="lib/ext/hsqldb.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jaxr-api-1.0-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jbossall-client.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss-system.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jbossts-common.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jsch-0.1.jar"/>
+ <classpathentry kind="lib" path="lib/ext/juddi-1.0-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/ext/juddi-client-1.0-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/ext/junit-4.1.jar"/>
+ <classpathentry kind="lib" path="lib/ext/log4j.jar"/>
+ <classpathentry kind="lib" path="lib/ext/mail.jar"/>
+ <classpathentry kind="lib" path="lib/ext/mockejb.jar"/>
+ <classpathentry kind="lib" path="lib/ext/ognl-2.6.9.jar"/>
+ <classpathentry kind="lib" path="lib/ext/opencsv-1.6.jar"/>
+ <classpathentry kind="lib" path="lib/ext/properties-plugin.jar"/>
+ <classpathentry kind="lib" path="lib/ext/scout-1.0-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/ext/stax-api-1.0.1.jar"/>
+ <classpathentry kind="lib" path="lib/ext/xalan-2.7.0.jar"/>
+ <classpathentry kind="lib" path="lib/ext/xbean.jar"/>
+ <classpathentry kind="lib" path="lib/ext/xercesImpl-2.7.1.jar"/>
+ <classpathentry kind="lib" path="lib/ext/xml-apis-1.3.02.jar"/>
+ <classpathentry kind="lib" path="lib/ext/xmlpublic.jar"/>
+ <classpathentry kind="lib" path="lib/ext/xstream-1.1.3.jar"/>
+ <classpathentry kind="lib" path="build/jbossesb/lib/jbossesb-config-model-1.0.1.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss.jar"/>
+ <classpathentry kind="lib" path="lib/ext/commons-io-1.3.jar"/>
+ <classpathentry kind="lib" path="lib/ext/edtftpj-1.5.4.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/backport-util-concurrent-2.2.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/ftplet-api-1.0-incubator-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/ftpserver-admin-gui-1.0-incubator-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/ftpserver-core-1.0-incubator-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/mina-core-1.0.2.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/mina-filter-ssl-1.0.2.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/slf4j-api-1.3.0.jar"/>
+ <classpathentry kind="lib" path="ftp/lib/slf4j-log4j12-1.3.0.jar"/>
+ <classpathentry kind="lib" path="services/jbpm/lib/ext/asm.jar"/>
+ <classpathentry kind="lib" path="services/jbpm/lib/ext/dom4j.jar"/>
+ <classpathentry kind="lib" path="services/jbpm/lib/ext/hibernate3.jar"/>
+ <classpathentry kind="lib" path="services/jbpm/lib/ext/jbpm-identity.jar"/>
+ <classpathentry kind="lib" path="services/jbpm/lib/ext/jbpm-jpdl.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jgroups-all.jar"/>
+ <classpathentry kind="lib" path="lib/ext/cache.jar"/>
+ <classpathentry kind="lib" path="lib/ext/standalone/c3p0-0.9.1-pre9.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss-jaxws.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jbossws-spi.jar"/>
+ <classpathentry kind="lib" path="lib/ext/antlr-3.0b7.jar"/>
+ <classpathentry kind="lib" path="lib/ext/asm.jar"/>
+ <classpathentry kind="lib" path="lib/ext/cglib-2.1_3.jar"/>
+ <classpathentry kind="lib" path="lib/ext/commons-httpclient.jar"/>
+ <classpathentry kind="lib" path="lib/ext/commons-logging-1.0.4.jar"/>
+ <classpathentry kind="lib" path="lib/ext/hibernate3.jar"/>
+ <classpathentry kind="lib" path="lib/ext/javassist.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss-aop-jdk50.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss-messaging-client.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jboss-remoting.jar"/>
+ <classpathentry kind="lib" path="lib/ext/jbossweb.jar"/>
+ <classpathentry kind="lib" path="lib/ext/stringtemplate-3.0.jar"/>
+ <classpathentry kind="lib" path="lib/ext/trove.jar"/>
+ <classpathentry kind="lib" path="lib/ext/wstx-lgpl-3.2.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/build-distr.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -135,6 +135,8 @@
<fileset dir="${lib.ext.dir}" includes="jcr-*.jar,jackrabbit-*.jar,commons-io-*.jar,lucene-*.jar"/>
<!-- XStream jars - including woodstox for the StaxDriver -->
<fileset dir="${lib.ext.dir}" includes="xstream-*.jar,wstx-lgpl-*.jar"/>
+ <!-- JBossCache jars - including jgroups -->
+ <fileset dir="${lib.ext.dir}" includes="cache.jar,jgroups-all.jar"/>
</copy>
</target>
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapper.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -30,6 +30,7 @@
import org.jboss.soa.esb.listeners.config.FtpMessageFilterDocument.FtpMessageFilter;
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.ReadOnlyRemoteGatewayListener;
import org.jboss.soa.esb.listeners.gateway.RemoteGatewayListener;
import org.w3c.dom.Element;
@@ -78,7 +79,10 @@
// Map the <property> elements targeted at the listener - from the listener itself.
MapperUtil.mapProperties(listener.getPropertyList(), listenerNode);
if(listener.getIsGateway()) {
- listenerNode.setAttribute("gatewayClass", RemoteGatewayListener.class.getName());
+ if ( messageFilter.getReadOnly() )
+ listenerNode.setAttribute("gatewayClass", ReadOnlyRemoteGatewayListener.class.getName());
+ else
+ listenerNode.setAttribute("gatewayClass", RemoteGatewayListener.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);
@@ -98,11 +102,21 @@
return listenerNode;
}
+
+ /**
+ * The separator used by the ftp protocol to separate the
+ * host:port section from the path
+ */
+ private static final String FTP_SEPARATOR = "/";
private static void mapFtpEprProperties(Element toElement, FtpProvider provider, FtpMessageFilter messageFilter)
{
+ String inputDir = messageFilter.getDirectory();
+ if ( ! inputDir.startsWith( FTP_SEPARATOR ) )
+ 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());
toElement.setAttribute(FTPEpr.POST_DEL_TAG, String.valueOf(messageFilter.getPostDelete()));
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -137,7 +137,7 @@
for (File fileIn : fileList)
{
// Try to rename - if unsuccessful, somebody else got it first
- File fileWork = new File(fileIn.toString() + _workingSuffix);
+ File fileWork = getWorkFileName( fileIn, _workingSuffix);
try
{
if (!renameFile(fileIn, fileWork))
@@ -352,7 +352,12 @@
}
} // ________________________________
- /*
+ protected File getWorkFileName( File fileIn, String suffix )
+ {
+ return new File(fileIn.toString() + _workingSuffix);
+ }
+
+ /*
* Extracted to simplify testing
*/
protected Courier getCourier( EPR current ) throws CourierException, MalformedEPRException
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListener.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,231 @@
+/*
+ * 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.listeners.gateway;
+
+import java.io.File;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.ReadOnlyRemoteFileSystemStrategy;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.RemoteFileSystemStrategy;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.RemoteFileSystemStrategyException;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.util.ClassUtil;
+
+/**
+ * This class extends {@link RemoteGatewayListener} and is intended to be used
+ * when the remote file system does not support write operations.
+ * <p>
+ *
+ * <pre>
+ * Sample Listener Configuration:
+ * <ftp-listener name="FtpGateway"
+ * busidref="helloFTPChannel"
+ * maxThreads="1"
+ * is-gateway="true">
+ * <property name="pollLatencySeconds" value="5"/> <!-- Interval to poll the remote file system -->
+ * <property name="remoteFileSystemStrategy-configFile" value="/ftpfile-cache-config.xml"/> <!-- Optional-->
+ * <property name="remoteFileSystemStrategy-cacheListener" value=""org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener"/> <!-- Optional-->
+ * <property name="remoteFileSystemStrategy-class" value="org.my.MyRemoteGatewayStrategy"/> <!-- Optional-->
+ *</ftp-listener>
+ * </pre>
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class ReadOnlyRemoteGatewayListener extends RemoteGatewayListener
+{
+ /**
+ * Property to specify the {@link RemoteFileSystemStrategy} implementation
+ */
+ public static final String REMOTE_FILE_SYSTEM_STRATEGY_CLASS = "remoteFileSystemStrategy-class";
+ /**
+ * Property to specify a configuration file for {@link #REMOTE_FILE_SYSTEM_STRATEGY_CLASS}
+ */
+ public static final String REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE = "remoteFileSystemStrategy-configFile";
+ /**
+ * Property to specify if a the TreeCacheListener should be used. See {@link DeleteOnEvictTreeCacheListener}
+ */
+ public static final String REMOTE_FILE_SYSTEM_STRATEGY_CACHE_LISTENER = "remoteFileSystemStrategy-cacheListener";
+ /**
+ * A strategy for handling call related to write operations.
+ */
+ private RemoteFileSystemStrategy remotefileSystemStrategy;
+ /**
+ * serial version uid for this class
+ */
+ private static final long serialVersionUID = 8505559166811233906L;
+
+ public ReadOnlyRemoteGatewayListener(ConfigTree config) throws ConfigurationException, RegistryException, GatewayException {
+ super(config);
+ createRemoteFileSystemStrategy();
+ }
+
+ /**
+ * Delegates to {@link RemoteFileSystemStrategy#deleteFile(File)}
+ */
+ @Override
+ public boolean deleteFile( File file ) throws GatewayException
+ {
+ try
+ {
+ return remotefileSystemStrategy.deleteFile( file );
+ }
+ catch (RemoteFileSystemStrategyException e)
+ {
+ throw new GatewayException( e );
+ }
+ }
+
+ /**
+ * Delegates to {@link RemoteFileSystemStrategy#filterFileList(File[])}
+ */
+ @Override
+ File[] getFileList() throws GatewayException
+ {
+ try
+ {
+ return remotefileSystemStrategy.filterFileList( super.getFileList() );
+ }
+ catch (RemoteFileSystemStrategyException e)
+ {
+ throw new GatewayException( e );
+ }
+ }
+
+ /**
+ * Delegates to {@link RemoteFileSystemStrategy#renameFile(File, File)}
+ */
+ @Override
+ boolean renameFile(File from, File to) throws GatewayException
+ {
+ try
+ {
+ return remotefileSystemStrategy.renameFile( from, to );
+ }
+ catch (RemoteFileSystemStrategyException e)
+ {
+ throw new GatewayException( e );
+ }
+ }
+
+ /**
+ * Delegates to {@link RemoteFileSystemStrategy#getWorkFileName(File, String)}
+ */
+ @Override
+ protected File getWorkFileName(File file, String suffix )
+ {
+ return remotefileSystemStrategy.getWorkFileName( file, suffix );
+ }
+
+ /**
+ * Set the {@link RemoteFileSystemStrategy } to be used
+ * @param remotefileSystemStrategy
+ */
+ public void setRemotefileSystemStrategy( RemoteFileSystemStrategy remotefileSystemStrategy )
+ {
+ this.remotefileSystemStrategy = remotefileSystemStrategy;
+ }
+
+ protected <T> T getNewInstanceOf( String className ) throws ConfigurationException
+ {
+ if ( className == null )
+ throw new IllegalArgumentException ( "className argument must not be null.");
+
+ T instance = null;
+ try
+ {
+ @SuppressWarnings ("unchecked")
+ Class<T> type = ClassUtil.forName( className , getClass());
+ instance = (T) type.newInstance();
+ }
+ catch (Exception ex)
+ {
+ _logger.error(ex);
+ throw new ConfigurationException(ex);
+ }
+ return instance;
+ }
+
+ /**
+ * Stop the service and also after that stop the
+ * remotefileSystemStrategy in use
+ */
+ protected void doStop() throws ManagedLifecycleException
+ {
+ remotefileSystemStrategy.stop();
+ super.doStop();
+ }
+
+ /**
+ * Destroys the service and also after that stop the
+ * remotefileSystemStrategy in use
+ */
+ protected void doDestroy() throws ManagedLifecycleException
+ {
+ remotefileSystemStrategy.destroy();
+ super.doDestroy();
+ }
+
+ private void createRemoteFileSystemStrategy() throws ConfigurationException
+ {
+ String strategyClassName = _config.getAttribute( REMOTE_FILE_SYSTEM_STRATEGY_CLASS );
+ RemoteFileSystemStrategy strategy = null;
+
+ if ( strategyClassName != null )
+ strategy = getNewInstanceOf( strategyClassName );
+
+ remotefileSystemStrategy = strategy != null ? strategy : new ReadOnlyRemoteFileSystemStrategy();
+
+ String configFile = _config.getAttribute( REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE );
+ try
+ {
+ remotefileSystemStrategy.init( configFile );
+
+ if ( remotefileSystemStrategy instanceof ReadOnlyRemoteFileSystemStrategy )
+ {
+ ReadOnlyRemoteFileSystemStrategy rm = (ReadOnlyRemoteFileSystemStrategy) remotefileSystemStrategy;
+ String cacheListener = _config.getAttribute( REMOTE_FILE_SYSTEM_STRATEGY_CACHE_LISTENER );
+
+ if ( cacheListener != null )
+ {
+ Class cacheListenerClass = ClassUtil.forName( cacheListener , getClass() );
+ rm.setCacheListener( cacheListenerClass );
+ }
+ }
+ }
+ catch( RemoteFileSystemStrategyException e )
+ {
+ _logger.error( "Could not configure the remoteFileSystemStrategy.", e );
+ throw new ConfigurationException(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ _logger.error( "ClassNotFound while trying to create the the remoteFileSystemStrategy.", e );
+ throw new ConfigurationException(e);
+ }
+ }
+
+}
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -37,19 +37,34 @@
import org.jboss.soa.esb.util.RemoteFileSystemException;
import org.jboss.soa.esb.util.RemoteFileSystemFactory;
+/**
+ * Sample Listener Configuration:
+ * <pre>
+ * <ftp-listener name="FtpGateway"
+ * busidref="helloFTPChannel"
+ * maxThreads="1"
+ * is-gateway="true">
+ * <property name="pollLatencySeconds" value="5"/> <!-- Interval to poll the remote file system -->
+ *</ftp-listener>
+ * </pre>
+ *
+ * @author John Doe
+ * @author Daniel Bevenius
+ *
+ */
public class RemoteGatewayListener extends FileGatewayListener
{
- /**
- * serial version uid for this class
- */
- private static final long serialVersionUID = 8505559166811233906L;
+ /**
+ * serial version uid for this class
+ */
+ private static final long serialVersionUID = 8505559166811233906L;
- public RemoteGatewayListener(ConfigTree config) throws ConfigurationException, RegistryException, GatewayException {
+ public RemoteGatewayListener(ConfigTree config) throws ConfigurationException, RegistryException, GatewayException {
super(config);
- checkMyParms() ;
+ checkMyParms() ;
}
- private void checkMyParms() throws ConfigurationException, RegistryException, GatewayException
+ protected void checkMyParms() throws ConfigurationException, RegistryException, GatewayException
{
try
{
@@ -90,7 +105,6 @@
// p_oDir exists
// p_oDir writable
// p_oDir readable
-
}
@Override
@@ -154,6 +168,7 @@
File[] getFileList() throws GatewayException
{
RemoteFileSystem rfs = null;
+ File[] oaRet = null;
try
{
EPR epr = ListenerUtil.assembleEpr(_config);
@@ -162,12 +177,11 @@
rfs = RemoteFileSystemFactory.getRemoteFileSystem(ftpEpr, true);
rfs.setRemoteDir(FtpClientUtil.fileToFtpString(_inputDirectory));
String[] sa = rfs.getFileListFromRemoteDir(_inputSuffix);
- File[] oaRet = new File[(null == sa) ? 0 : sa.length];
+ oaRet = new File[(null == sa) ? 0 : sa.length];
int i1 = 0;
if (null != sa)
for (String sCurr : sa)
oaRet[i1++] = new File(sCurr);
- return oaRet;
} else {
throw new GatewayException("This Gateway only accepts FTP and SFTP.");
}
@@ -177,6 +191,7 @@
if (null != rfs)
rfs.quit();
}
+ return oaRet;
}
@Override
@@ -190,7 +205,6 @@
FTPEpr ftpEpr = (FTPEpr) epr;
rfs = RemoteFileSystemFactory.getRemoteFileSystem(ftpEpr, true);
rfs.setRemoteDir(FtpClientUtil.fileToFtpString(_inputDirectory));
-// rfs.renameInRemoteDir(from.toString(), to.toString());
rfs.remoteRename( from, to );
return true;
} else {
@@ -203,7 +217,14 @@
rfs.quit();
}
}
+
@Override
+ protected File getWorkFileName(File file, String suffix )
+ {
+ return new File( file.toString() + suffix);
+ }
+
+ @Override
void bytesToFile(byte[] bytes, File file) throws GatewayException
{
RemoteFileSystem rfs = null;
@@ -229,5 +250,5 @@
rfs.quit();
}
}
-
+
}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,170 +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.listeners.gateway.remotestrategies;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCache;
-import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheException;
-
-/**
- * Read-only implementation of {@link RemoteFileSystemStrategy}.
- * <p>
- * An instance of this class can be used when a remote file system does
- * not support write operations.
- * </p>
- *
- * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
- *
- */
-public class ReadOnlyRemoteFileSystemStrategy implements RemoteFileSystemStrategy
-{
- private Logger log = Logger .getLogger( ReadOnlyRemoteFileSystemStrategy.class );
-
- private FtpFileCache ftpFileCache;
-
- /**
- * Configures and starts the underlying FtpFileCache
- */
- public void init( String configFile ) throws RemoteFileSystemStrategyException
- {
- try
- {
- ftpFileCache = new FtpFileCache( configFile );
-
- ftpFileCache.start();
- }
- catch ( FtpFileCacheException e )
- {
- throw new RemoteFileSystemStrategyException ( e );
- }
- }
-
- /**
- * Do nothing
- *
- * @param file the file to delete. Ignored
- * @return true always returns true without deleting the filee
- */
- public boolean deleteFile( final File file ) throws RemoteFileSystemStrategyException
- {
- return true;
- }
-
- /**
- * Do nothing
- *
- * @param from the file to be renamed. Ignored
- * @param to the new file. Ignored
- * @return true always returns true without deleting the filee
- */
- public boolean renameFile( final File from, final File to ) throws RemoteFileSystemStrategyException
- {
- return true;
- }
-
- /**
- * This method simply returns the file without a worksuffix.
- * This is useful when the remote system does not allow one to rename the file.
- *
- * @param file the file to work with
- * @param suffix the suffix. This will be ignored
- * @return File the file untouched
- */
- public File getWorkFileName( final File file, final String suffix )
- {
- return file;
- }
-
- /**
- * Returns a File[] that only contains files that have not previously
- * been through this method.
- */
- public File[] filterFileList( File[] files ) throws RemoteFileSystemStrategyException
- {
- if ( files == null )
- return files;
-
- List<File> newFileList = new ArrayList<File>();
- for ( File file : files )
- {
- String fileName = file.getName();
- if ( !ftpFileCache.containsFile( fileName ) )
- {
- try
- {
- ftpFileCache.putFileName( fileName );
- newFileList.add( file );
- }
- catch (CacheException e)
- {
- log.error( "Exception while trying to put file : " + fileName + " into the cache", e);
- }
- }
- }
-
- return newFileList.toArray( new File[]{} );
- }
-
- public void removeAllData() throws CacheException
- {
- ftpFileCache.removeAll();
- }
-
- public void stop()
- {
- ftpFileCache.stop();
- }
-
- public void destroy()
- {
- ftpFileCache.destroy();
- }
-
- public void setDeleteOnEviction()
- {
- ftpFileCache.setDeleteOnEviction();
- }
-
- public Map getCacheListeners()
- {
- return ftpFileCache.getCacheListeners();
- }
-
- public void setCacheListener( Class cacheListenerClass ) throws RemoteFileSystemStrategyException
- {
- try
- {
- ftpFileCache.setCacheListener( cacheListenerClass );
- }
- catch (FtpFileCacheException e)
- {
- throw new RemoteFileSystemStrategyException( e );
- }
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,170 @@
+/*
+ * 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.listeners.gateway.remotestrategies;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCache;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheException;
+
+/**
+ * Read-only implementation of {@link RemoteFileSystemStrategy}.
+ * <p>
+ * An instance of this class can be used when a remote file system does
+ * not support write operations.
+ * </p>
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class ReadOnlyRemoteFileSystemStrategy implements RemoteFileSystemStrategy
+{
+ private Logger log = Logger .getLogger( ReadOnlyRemoteFileSystemStrategy.class );
+
+ private FtpFileCache ftpFileCache;
+
+ /**
+ * Configures and starts the underlying FtpFileCache
+ */
+ public void init( String configFile ) throws RemoteFileSystemStrategyException
+ {
+ try
+ {
+ ftpFileCache = new FtpFileCache( configFile );
+
+ ftpFileCache.start();
+ }
+ catch ( FtpFileCacheException e )
+ {
+ throw new RemoteFileSystemStrategyException ( e );
+ }
+ }
+
+ /**
+ * Do nothing
+ *
+ * @param file the file to delete. Ignored
+ * @return true always returns true without deleting the filee
+ */
+ public boolean deleteFile( final File file ) throws RemoteFileSystemStrategyException
+ {
+ return true;
+ }
+
+ /**
+ * Do nothing
+ *
+ * @param from the file to be renamed. Ignored
+ * @param to the new file. Ignored
+ * @return true always returns true without deleting the filee
+ */
+ public boolean renameFile( final File from, final File to ) throws RemoteFileSystemStrategyException
+ {
+ return true;
+ }
+
+ /**
+ * This method simply returns the file without a worksuffix.
+ * This is useful when the remote system does not allow one to rename the file.
+ *
+ * @param file the file to work with
+ * @param suffix the suffix. This will be ignored
+ * @return File the file untouched
+ */
+ public File getWorkFileName( final File file, final String suffix )
+ {
+ return file;
+ }
+
+ /**
+ * Returns a File[] that only contains files that have not previously
+ * been through this method.
+ */
+ public File[] filterFileList( File[] files ) throws RemoteFileSystemStrategyException
+ {
+ if ( files == null )
+ return files;
+
+ List<File> newFileList = new ArrayList<File>();
+ for ( File file : files )
+ {
+ String fileName = file.getName();
+ if ( !ftpFileCache.containsFile( fileName ) )
+ {
+ try
+ {
+ ftpFileCache.putFileName( fileName );
+ newFileList.add( file );
+ }
+ catch (CacheException e)
+ {
+ log.error( "Exception while trying to put file : " + fileName + " into the cache", e);
+ }
+ }
+ }
+
+ return newFileList.toArray( new File[]{} );
+ }
+
+ public void removeAllData() throws CacheException
+ {
+ ftpFileCache.removeAll();
+ }
+
+ public void stop()
+ {
+ ftpFileCache.stop();
+ }
+
+ public void destroy()
+ {
+ ftpFileCache.destroy();
+ }
+
+ public void setDeleteOnEviction()
+ {
+ ftpFileCache.setDeleteOnEviction();
+ }
+
+ public Map getCacheListeners()
+ {
+ return ftpFileCache.getCacheListeners();
+ }
+
+ public void setCacheListener( Class cacheListenerClass ) throws RemoteFileSystemStrategyException
+ {
+ try
+ {
+ ftpFileCache.setCacheListener( cacheListenerClass );
+ }
+ catch (FtpFileCacheException e)
+ {
+ throw new RemoteFileSystemStrategyException( e );
+ }
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,68 +0,0 @@
-package org.jboss.soa.esb.listeners.gateway.remotestrategies;
-
-import java.io.File;
-import org.jboss.soa.esb.listeners.gateway.GatewayException;
-
-/**
- * A strategy for handling remote write operations.
- *
- * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
- *
- */
-public interface RemoteFileSystemStrategy
-{
- /**
- * Initialize this RemoteFileSystemStrategy
- *
- * @param configFile
- * @throws Exception
- */
- void init( String configFile ) throws RemoteFileSystemStrategyException;
-
- /**
- * filters the file array passed in.
- *
- * @return File[] list of files that should worked on
- * @throws GatewayException
- */
- File[] filterFileList( File[] files ) throws RemoteFileSystemStrategyException;
-
- /**
- *
- * @param file the file to delete
- * @return true if the file was sucessfully deleted
- * @throws GatewayException
- */
- boolean deleteFile( File file ) throws RemoteFileSystemStrategyException;
-
- /**
- *
- * @param from the file to rename
- * @param to the target file
- * @return true if the file was sucessfully renamed
- * @throws GatewayException
- */
- boolean renameFile( File from, File to ) throws RemoteFileSystemStrategyException;
-
- /**
- *
- * @param file the current file the system is working on
- * @param suffix a suffix to append to the file.
- * @return File either the file with the appended suffix or
- * without.This depends on the implementation.
- */
- File getWorkFileName( File file, String suffix );
-
- /**
- * Stop of clean upp anything that needs to be perforemed
- * upon shutdown.
- */
- void stop();
-
- /**
- * Clean upp anything that needs to be perforemed
- * upon destruction.
- */
- void destroy();
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategy.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,68 @@
+package org.jboss.soa.esb.listeners.gateway.remotestrategies;
+
+import java.io.File;
+import org.jboss.soa.esb.listeners.gateway.GatewayException;
+
+/**
+ * A strategy for handling remote write operations.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public interface RemoteFileSystemStrategy
+{
+ /**
+ * Initialize this RemoteFileSystemStrategy
+ *
+ * @param configFile
+ * @throws Exception
+ */
+ void init( String configFile ) throws RemoteFileSystemStrategyException;
+
+ /**
+ * filters the file array passed in.
+ *
+ * @return File[] list of files that should worked on
+ * @throws GatewayException
+ */
+ File[] filterFileList( File[] files ) throws RemoteFileSystemStrategyException;
+
+ /**
+ *
+ * @param file the file to delete
+ * @return true if the file was sucessfully deleted
+ * @throws GatewayException
+ */
+ boolean deleteFile( File file ) throws RemoteFileSystemStrategyException;
+
+ /**
+ *
+ * @param from the file to rename
+ * @param to the target file
+ * @return true if the file was sucessfully renamed
+ * @throws GatewayException
+ */
+ boolean renameFile( File from, File to ) throws RemoteFileSystemStrategyException;
+
+ /**
+ *
+ * @param file the current file the system is working on
+ * @param suffix a suffix to append to the file.
+ * @return File either the file with the appended suffix or
+ * without.This depends on the implementation.
+ */
+ File getWorkFileName( File file, String suffix );
+
+ /**
+ * Stop of clean upp anything that needs to be perforemed
+ * upon shutdown.
+ */
+ void stop();
+
+ /**
+ * Clean upp anything that needs to be perforemed
+ * upon destruction.
+ */
+ void destroy();
+
+}
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,57 +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.listeners.gateway.remotestrategies;
-
-/**
- *
- * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
- *
- */
-public class RemoteFileSystemStrategyException extends Exception
-{
-
- public RemoteFileSystemStrategyException()
- {
- super();
- }
-
- public RemoteFileSystemStrategyException(String message, Throwable cause)
- {
- super( message, cause );
- }
-
- public RemoteFileSystemStrategyException(String message)
- {
- super( message );
- }
-
- public RemoteFileSystemStrategyException(Throwable cause)
- {
- super( cause );
- }
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/RemoteFileSystemStrategyException.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,57 @@
+/*
+ * 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.listeners.gateway.remotestrategies;
+
+/**
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class RemoteFileSystemStrategyException extends Exception
+{
+
+ public RemoteFileSystemStrategyException()
+ {
+ super();
+ }
+
+ public RemoteFileSystemStrategyException(String message, Throwable cause)
+ {
+ super( message, cause );
+ }
+
+ public RemoteFileSystemStrategyException(String message)
+ {
+ super( message );
+ }
+
+ public RemoteFileSystemStrategyException(Throwable cause)
+ {
+ super( cause );
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache)
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,84 +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.listeners.gateway.remotestrategies.cache;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeCacheListener;
-import org.jgroups.View;
-
-/**
- * This listener will upon node eviction events delete the
- * node from the cache.
- * <p>
- * This listener should be used in combination with a cache loader <br>
- * so that it is possible to set an eviction policy and when nodes <br>
- * are evicted they are also deleted from the cache loaders store
- * </p>
- *
- * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
- *
- */
-public class DeleteOnEvictTreeCacheListener implements TreeCacheListener
-{
- private Logger log = Logger .getLogger( DeleteOnEvictTreeCacheListener.class );
-
- private TreeCache treeCache;
-
- public DeleteOnEvictTreeCacheListener( final TreeCache treeCache )
- {
- if ( treeCache == null )
- throw new IllegalArgumentException( "treeCache must not be null" );
-
- this.treeCache = treeCache;
- }
-
-
- /**
- * Will remove from the passed in fqn upon being
- * evicted from the cache.
- */
- public void nodeEvicted( Fqn fqn )
- {
- try
- {
- treeCache.remove( fqn );
- log.debug( "removed fqn : " + fqn );
- }
- catch (CacheException e)
- {
- log.error( "Exception while trying to remove data for fqn : " + fqn , e );
- }
- }
-
- public void cacheStarted(TreeCache arg0) {}
- public void cacheStopped(TreeCache arg0) {}
- public void nodeCreated(Fqn arg0) {}
- public void nodeLoaded(Fqn arg0) {}
- public void nodeModified(Fqn arg0) {}
- public void nodeRemoved(Fqn arg0) {}
- public void nodeVisited(Fqn arg0) {}
- public void viewChange(View arg0) {}
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,84 @@
+/*
+ * 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.listeners.gateway.remotestrategies.cache;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.TreeCacheListener;
+import org.jgroups.View;
+
+/**
+ * This listener will upon node eviction events delete the
+ * node from the cache.
+ * <p>
+ * This listener should be used in combination with a cache loader <br>
+ * so that it is possible to set an eviction policy and when nodes <br>
+ * are evicted they are also deleted from the cache loaders store
+ * </p>
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class DeleteOnEvictTreeCacheListener implements TreeCacheListener
+{
+ private Logger log = Logger .getLogger( DeleteOnEvictTreeCacheListener.class );
+
+ private TreeCache treeCache;
+
+ public DeleteOnEvictTreeCacheListener( final TreeCache treeCache )
+ {
+ if ( treeCache == null )
+ throw new IllegalArgumentException( "treeCache must not be null" );
+
+ this.treeCache = treeCache;
+ }
+
+
+ /**
+ * Will remove from the passed in fqn upon being
+ * evicted from the cache.
+ */
+ public void nodeEvicted( Fqn fqn )
+ {
+ try
+ {
+ treeCache.remove( fqn );
+ log.debug( "removed fqn : " + fqn );
+ }
+ catch (CacheException e)
+ {
+ log.error( "Exception while trying to remove data for fqn : " + fqn , e );
+ }
+ }
+
+ public void cacheStarted(TreeCache arg0) {}
+ public void cacheStopped(TreeCache arg0) {}
+ public void nodeCreated(Fqn arg0) {}
+ public void nodeLoaded(Fqn arg0) {}
+ public void nodeModified(Fqn arg0) {}
+ public void nodeRemoved(Fqn arg0) {}
+ public void nodeVisited(Fqn arg0) {}
+ public void viewChange(View arg0) {}
+
+}
Deleted: labs/jbossesb/trunk/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-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,311 +0,0 @@
-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 java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.PropertyConfigurator;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeCacheListener;
-import org.jboss.soa.esb.util.ClassUtil;
-
-/**
- * Implements a cache of file names which can be replicated in a cluster.
- *
- * See the <a href="http://labs.jboss.com/jbosscache">JBoss Cache</a> docs
- * for details on configuring the cache.
- *
- * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
- *
- */
-public class FtpFileCache
-{
- @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 FtpFileCacheException
- {
- if ( config == null )
- config = DEFAULT_CONFIG_FILE;
-
- this.config = config;
-
- InputStream in = null;
- try
- {
- treeCache = new TreeCache();
- in = getConfigInputStream( this.config );
- PropertyConfigurator configurator = new PropertyConfigurator();
- configurator.configure( treeCache, in );
- }
- catch ( Exception e )
- {
- log.error( e );
- throw new FtpFileCacheException ( e );
- }
- finally
- {
- close( in );
- }
-
-
- }
-
- /**
- * Gets an input stream from the specified path.
- *
- * If the path denotes a file on the filesystem, that file
- * will be used.
- * If a file is not found in the filesystem, this method will look
- * for the file on the classpath.
- *
- * @param path the path to the JBossCache configuration file
- * @return InputStream the inputstream for the passed-in path
- */
- protected InputStream getConfigInputStream( final 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 = ClassUtil.getResourceAsStream( path, getClass() );
- }
- return in;
- }
-
- /**
- * Start the cache
- * @throws Exception
- */
- public void start() throws FtpFileCacheException
- {
- try
- {
- treeCache.startService();
- }
- catch (Exception e)
- {
- log.error( e );
- throw new FtpFileCacheException( e );
- }
- }
-
- /**
- * Stops the cache
- *
- */
- public void stop()
- {
- treeCache.stopService();
- }
-
- /**
- * Will add the filename to the cache.
- *
- * @param fileName
- * @throws CacheException
- */
- public void putFileName( final String fileName) throws CacheException
- {
- treeCache.put ( fqn, fileName, fileName );
- }
-
- /**
- * Will get the filename if it exists in the cache.
- *
- * @param fileName
- * @throws CacheException
- */
- public Object getFileName( final String fileName) throws CacheException
- {
- return treeCache.get ( fqn, fileName );
- }
-
- /**
- * Removed the fileName from the cache if it exist there
- *
- * @param fileName
- * @return Object the value of the removed object
- * @throws CacheException
- */
- public Object deleteFile( final String fileName ) throws CacheException
- {
- return treeCache.remove( fqn, fileName );
- }
-
- /**
- * Checks to see if the filename exists in the cache
- *
- * @param fileName the filename to look for
- * @return true if the file exists in the cache
- */
- public boolean containsFile( final String fileName )
- {
- return treeCache.exists( fqn, fileName );
- }
-
- /**
- * Gets the a string of all files in the cache
- * @return String
- */
- public String getCache()
- {
- return treeCache.print( fqn );
- }
-
- public String getFqn()
- {
- return fqn;
- }
-
- public void setFqn(String fqn)
- {
- this.fqn = fqn;
- }
-
- public String getConfigFile( )
- {
- return config;
- }
-
- /**
- * Removes all data under the fqn, but not the fqn
- * itself
- *
- * @throws CacheException
- */
- public void removeAll() throws CacheException
- {
- treeCache.removeData( fqn );
- }
-
- public void setDeleteOnEviction()
- {
- treeCache.addTreeCacheListener( new DeleteOnEvictTreeCacheListener( treeCache) );
- }
-
- public void addCacheListener( final TreeCacheListener listener )
- {
- if ( listener != null )
- treeCache.addTreeCacheListener( listener );
- }
-
- public Map getCacheListeners()
- {
- return treeCache.getTreeCacheListeners();
- }
-
- public void setCacheListener( final Class cacheListenerClass ) throws FtpFileCacheException
- {
- if ( cacheListenerClass == null )
- return;
- try
- {
- Constructor constructor = cacheListenerClass.getConstructor( TreeCache.class );
- Object object = constructor.newInstance( treeCache );
- if ( object instanceof TreeCacheListener )
- {
- TreeCacheListener listener = ( TreeCacheListener ) object;
- treeCache.addTreeCacheListener( listener );
- }
- }
- catch (SecurityException e)
- {
- throw createFtpFileCacheException( "SecurityException while trying set the CacheListener:", e );
- }
- catch (NoSuchMethodException e)
- {
- throw createFtpFileCacheException( "NoSuchMethodException while trying set the CacheListener:", e );
- }
- catch (IllegalArgumentException e)
- {
- throw createFtpFileCacheException( "IllegalArgumentException while trying set the CacheListener:", e );
- }
- catch (InstantiationException e)
- {
- throw createFtpFileCacheException( "InstantiationException while trying set the CacheListener:", e );
- }
- catch (IllegalAccessException e)
- {
- throw createFtpFileCacheException( "IllegalAccessException while trying set the CacheListener:", e );
- }
- catch (InvocationTargetException e)
- {
- throw createFtpFileCacheException( "InvocationTargetException while trying set the CacheListener:", e );
- }
- }
-
- private FtpFileCacheException createFtpFileCacheException( final String msg, Exception e )
- {
- log.error( msg, e );
- return new FtpFileCacheException( e );
- }
-
- private void close( Closeable c )
- {
- if ( c == null )
- return;
-
- try
- {
- c.close();
- }
- catch ( IOException e )
- {
- log.warn( "Error while trying to close Closable", e);
- }
- }
-
- public void destroy()
- {
- log.info( "destroy method of FtpFileCache called" );
- treeCache.destroy();
- }
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,311 @@
+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 java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.PropertyConfigurator;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.TreeCacheListener;
+import org.jboss.soa.esb.util.ClassUtil;
+
+/**
+ * Implements a cache of file names which can be replicated in a cluster.
+ *
+ * See the <a href="http://labs.jboss.com/jbosscache">JBoss Cache</a> docs
+ * for details on configuring the cache.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class FtpFileCache
+{
+ @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 FtpFileCacheException
+ {
+ if ( config == null )
+ config = DEFAULT_CONFIG_FILE;
+
+ this.config = config;
+
+ InputStream in = null;
+ try
+ {
+ treeCache = new TreeCache();
+ in = getConfigInputStream( this.config );
+ PropertyConfigurator configurator = new PropertyConfigurator();
+ configurator.configure( treeCache, in );
+ }
+ catch ( Exception e )
+ {
+ log.error( e );
+ throw new FtpFileCacheException ( e );
+ }
+ finally
+ {
+ close( in );
+ }
+
+
+ }
+
+ /**
+ * Gets an input stream from the specified path.
+ *
+ * If the path denotes a file on the filesystem, that file
+ * will be used.
+ * If a file is not found in the filesystem, this method will look
+ * for the file on the classpath.
+ *
+ * @param path the path to the JBossCache configuration file
+ * @return InputStream the inputstream for the passed-in path
+ */
+ protected InputStream getConfigInputStream( final 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 = ClassUtil.getResourceAsStream( path, getClass() );
+ }
+ return in;
+ }
+
+ /**
+ * Start the cache
+ * @throws Exception
+ */
+ public void start() throws FtpFileCacheException
+ {
+ try
+ {
+ treeCache.startService();
+ }
+ catch (Exception e)
+ {
+ log.error( e );
+ throw new FtpFileCacheException( e );
+ }
+ }
+
+ /**
+ * Stops the cache
+ *
+ */
+ public void stop()
+ {
+ treeCache.stopService();
+ }
+
+ /**
+ * Will add the filename to the cache.
+ *
+ * @param fileName
+ * @throws CacheException
+ */
+ public void putFileName( final String fileName) throws CacheException
+ {
+ treeCache.put ( fqn, fileName, fileName );
+ }
+
+ /**
+ * Will get the filename if it exists in the cache.
+ *
+ * @param fileName
+ * @throws CacheException
+ */
+ public Object getFileName( final String fileName) throws CacheException
+ {
+ return treeCache.get ( fqn, fileName );
+ }
+
+ /**
+ * Removed the fileName from the cache if it exist there
+ *
+ * @param fileName
+ * @return Object the value of the removed object
+ * @throws CacheException
+ */
+ public Object deleteFile( final String fileName ) throws CacheException
+ {
+ return treeCache.remove( fqn, fileName );
+ }
+
+ /**
+ * Checks to see if the filename exists in the cache
+ *
+ * @param fileName the filename to look for
+ * @return true if the file exists in the cache
+ */
+ public boolean containsFile( final String fileName )
+ {
+ return treeCache.exists( fqn, fileName );
+ }
+
+ /**
+ * Gets the a string of all files in the cache
+ * @return String
+ */
+ public String getCache()
+ {
+ return treeCache.print( fqn );
+ }
+
+ public String getFqn()
+ {
+ return fqn;
+ }
+
+ public void setFqn(String fqn)
+ {
+ this.fqn = fqn;
+ }
+
+ public String getConfigFile( )
+ {
+ return config;
+ }
+
+ /**
+ * Removes all data under the fqn, but not the fqn
+ * itself
+ *
+ * @throws CacheException
+ */
+ public void removeAll() throws CacheException
+ {
+ treeCache.removeData( fqn );
+ }
+
+ public void setDeleteOnEviction()
+ {
+ treeCache.addTreeCacheListener( new DeleteOnEvictTreeCacheListener( treeCache) );
+ }
+
+ public void addCacheListener( final TreeCacheListener listener )
+ {
+ if ( listener != null )
+ treeCache.addTreeCacheListener( listener );
+ }
+
+ public Map getCacheListeners()
+ {
+ return treeCache.getTreeCacheListeners();
+ }
+
+ public void setCacheListener( final Class cacheListenerClass ) throws FtpFileCacheException
+ {
+ if ( cacheListenerClass == null )
+ return;
+ try
+ {
+ Constructor constructor = cacheListenerClass.getConstructor( TreeCache.class );
+ Object object = constructor.newInstance( treeCache );
+ if ( object instanceof TreeCacheListener )
+ {
+ TreeCacheListener listener = ( TreeCacheListener ) object;
+ treeCache.addTreeCacheListener( listener );
+ }
+ }
+ catch (SecurityException e)
+ {
+ throw createFtpFileCacheException( "SecurityException while trying set the CacheListener:", e );
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw createFtpFileCacheException( "NoSuchMethodException while trying set the CacheListener:", e );
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw createFtpFileCacheException( "IllegalArgumentException while trying set the CacheListener:", e );
+ }
+ catch (InstantiationException e)
+ {
+ throw createFtpFileCacheException( "InstantiationException while trying set the CacheListener:", e );
+ }
+ catch (IllegalAccessException e)
+ {
+ throw createFtpFileCacheException( "IllegalAccessException while trying set the CacheListener:", e );
+ }
+ catch (InvocationTargetException e)
+ {
+ throw createFtpFileCacheException( "InvocationTargetException while trying set the CacheListener:", e );
+ }
+ }
+
+ private FtpFileCacheException createFtpFileCacheException( final String msg, Exception e )
+ {
+ log.error( msg, e );
+ return new FtpFileCacheException( e );
+ }
+
+ private void close( Closeable c )
+ {
+ if ( c == null )
+ return;
+
+ try
+ {
+ c.close();
+ }
+ catch ( IOException e )
+ {
+ log.warn( "Error while trying to close Closable", e);
+ }
+ }
+
+ public void destroy()
+ {
+ log.info( "destroy method of FtpFileCache called" );
+ treeCache.destroy();
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,57 +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.listeners.gateway.remotestrategies.cache;
-
-/**
- *
- * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
- *
- */
-public class FtpFileCacheException extends Exception
-{
-
- public FtpFileCacheException()
- {
- super();
- }
-
- public FtpFileCacheException(String message, Throwable cause)
- {
- super( message, cause );
- }
-
- public FtpFileCacheException(String message)
- {
- super( message );
- }
-
- public FtpFileCacheException(Throwable cause)
- {
- super( cause );
- }
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheException.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,57 @@
+/*
+ * 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.listeners.gateway.remotestrategies.cache;
+
+/**
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class FtpFileCacheException extends Exception
+{
+
+ public FtpFileCacheException()
+ {
+ super();
+ }
+
+ public FtpFileCacheException(String message, Throwable cause)
+ {
+ super( message, cause );
+ }
+
+ public FtpFileCacheException(String message)
+ {
+ super( message );
+ }
+
+ public FtpFileCacheException(Throwable cause)
+ {
+ super( cause );
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -15,7 +15,7 @@
</jms-bus>
</jms-provider>
- <ftp-provider name="FTP" hostname="localhost">
+ <ftp-provider name="FTP" hostname="localhost:21">
<ftp-bus busid="Ftp-ServerTest">
<ftp-message-filter directory="/Temp" input-suffix=".txt" username="joe" password="secret"/>
</ftp-bus>
@@ -108,4 +108,4 @@
</service>
</services>
-</jbossesb>
\ No newline at end of file
+</jbossesb>
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_01_esbaware.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><Bank-Listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" protocol="jms"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></Bank-Listener><Bank-Listener-Generic listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" my-generic-listener="my-generic-listener#someattribvalue" !
service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></Bank-Listener-Generic><test-ftp-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" pollLatencySeconds="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/><action action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-ftp-listener><test-sql-!
listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwa
reListener" maxThreads="1" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-sql-listener></jbossesb-listeners>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!-- NOTE: DO NOT MODIFY This file was auto-generated.--><jbossesb-listeners parameterReloadSecs="180"><Bank-Listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR connection-factory="ConnectionFactory" destination-name="queue/B" destination-type="topic" jndi-URL="jnp://localhost:1099" message-selector="service='Reconciliation'" protocol="jms"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></Bank-Listener><Bank-Listener-Generic listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="2" my-generic-listener="my-generic-listener#someattribvalue" !
service-category="Bank" service-description="Bank Reconciliation Service" service-name="Reconciliation"><EPR my-generic-bus="my-generic-bus#someattribvalue" my-generic-provider="my-generic-provider#someattribvalue"/><action action="TestDefaultRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter" propName="propValue"> This is some complex.. <!-- property --> value. <xxxx> boooo <yyyy/> </xxxx> Some CDATA data... </action></Bank-Listener-Generic><test-ftp-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageAwareListener" maxThreads="1" pollLatencySeconds="10" service-category="Test2" service-description="FTP server Test" service-name="FTPTest"><EPR URL="ftp://joe:secret@localhost:21/Temp" errorDelete="true" inputSuffix=".txt" passive="false" postDelete="true" workSuffix=".esbInProcess"/><action action="TestFtpRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-ftp-listener><test-sq!
l-listener listenerClass="org.jboss.soa.esb.listeners.message.MessageA
wareListener" maxThreads="1" pollLatencySeconds="10" service-category="Test3" service-description="SQL server Test" service-name="SQLTest"><EPR URL="jdbc:postgresql://myhost:5432/testDB" driver="org.postgresql.Driver" errorDelete="true" insert_timestamp_column="insert_timestamp" message_column="message" message_id_column="message_id" password="secret" postDelete="true" status_column="status" tablename="testtable" username="joe"/><action action="TestSqlRouteAction" class="org.jboss.soa.esb.actions.ContentBasedRouter"/></test-sql-listener></jbossesb-listeners>
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_02.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -28,7 +28,7 @@
</provider>
<provider name="FTP">
- <property name="URL" value="ftp://joe:secret@localhost:/Temp" />
+ <property name="URL" value="ftp://joe:secret@localhost:21/Temp" />
<bus busid="Ftp-ServerTest">
<property name="inputSuffix" value=".txt" />
@@ -153,4 +153,4 @@
</service>
</services>
-</jbossesb>
\ No newline at end of file
+</jbossesb>
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers)
Deleted: labs/jbossesb/trunk/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-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,125 +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.listeners.config.mappers;
-
-import static org.junit.Assert.assertEquals;
-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.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.Generator.XMLBeansModel;
-import org.jboss.soa.esb.listeners.gateway.ReadOnlyRemoteGatewayListener;
-import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Tests the class FtpListenerMapper
- *
- * @author Daniel Bevenius
- *
- */
-public class FtpListenerMapperTest
-{
- @SuppressWarnings("unused")
- 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 testReadOnlyConfiguration() throws ConfigurationException, IOException
- {
- Element root = createRootElement();
- XMLBeansModel model = getXmlBeanModel( ESB_CONFIG_READ_ONLY );
-
- List<Listener> gateways = model.getGatewayListeners();
- FtpListener ftpListener = (FtpListener) gateways.get(0);
- assertEquals ( true, ftpListener.getIsGateway() );
-
- FtpBus ftpBus = (FtpBus) model.getBus( ftpListener.getBusidref() );
- assertNotNull( "FtpBus element should exist", ftpBus );
- assertEquals ( "read-only attribute should be true", true, ftpBus.getFtpMessageFilter().getReadOnly() );
-
- FtpListenerMapper.map( root , ftpListener, model );
-
- 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 );
- assertEquals( ReadOnlyRemoteGatewayListener.class.getName(), gatewayClass.getNodeValue() );
- }
-
- 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
- {
-
- public GeneratorMock(InputStream config) throws ConfigurationException, IOException
- {
- super( config );
- }
-
- @Override
- protected XMLBeansModel getModel()
- {
- return super.getModel();
- }
-
-
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/FtpListenerMapperTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,125 @@
+/*
+ * 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.listeners.config.mappers;
+
+import static org.junit.Assert.assertEquals;
+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.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.Generator.XMLBeansModel;
+import org.jboss.soa.esb.listeners.gateway.ReadOnlyRemoteGatewayListener;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * Tests the class FtpListenerMapper
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class FtpListenerMapperTest
+{
+ @SuppressWarnings("unused")
+ 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 testReadOnlyConfiguration() throws ConfigurationException, IOException
+ {
+ Element root = createRootElement();
+ XMLBeansModel model = getXmlBeanModel( ESB_CONFIG_READ_ONLY );
+
+ List<Listener> gateways = model.getGatewayListeners();
+ FtpListener ftpListener = (FtpListener) gateways.get(0);
+ assertEquals ( true, ftpListener.getIsGateway() );
+
+ FtpBus ftpBus = (FtpBus) model.getBus( ftpListener.getBusidref() );
+ assertNotNull( "FtpBus element should exist", ftpBus );
+ assertEquals ( "read-only attribute should be true", true, ftpBus.getFtpMessageFilter().getReadOnly() );
+
+ FtpListenerMapper.map( root , ftpListener, model );
+
+ 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 );
+ assertEquals( ReadOnlyRemoteGatewayListener.class.getName(), gatewayClass.getNodeValue() );
+ }
+
+ 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
+ {
+
+ public GeneratorMock(InputStream config) throws ConfigurationException, IOException
+ {
+ super( config );
+ }
+
+ @Override
+ protected XMLBeansModel getModel()
+ {
+ return super.getModel();
+ }
+
+
+ }
+
+}
Deleted: labs/jbossesb/trunk/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-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,25 +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">
-
- <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>
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -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>
Deleted: labs/jbossesb/trunk/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 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,25 +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">
-
- <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>
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -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>
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerUnitTest.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/ReadOnlyRemoteGatewayListenerUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,323 @@
+/*
+ * 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,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.gateway;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.embedded.EmbeddableException;
+import org.jboss.internal.soa.esb.util.embedded.ftp.FtpTestUtil;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.MalformedEPRException;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
+import org.jboss.soa.esb.couriers.Courier;
+import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.ReadOnlyRemoteFileSystemStrategy;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheTestUtil;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleThreadState;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Unit test for ReadOnlyRemoteGatewayListener that uses an embedded ftp server.
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class ReadOnlyRemoteGatewayListenerUnitTest extends RemoteGatewayListenerUnitTest
+{
+
+ @SuppressWarnings("unused")
+ private Logger log = Logger .getLogger( ReadOnlyRemoteGatewayListenerUnitTest.class );
+
+ @BeforeClass
+ public static void classSetup() throws EmbeddableException, ConfigurationException, GatewayException, RegistryException, MalformedURLException
+ {
+ ftpServer = createFtpServer();
+ ftpServer.start();
+
+ createWorkDirectories();
+ configTree = createConfigTree();
+ createRemoteGatewayListener( configTree );
+ }
+
+ @Test
+ public void deleteFile() throws GatewayException
+ {
+ File remoteFile = createAbsoluteFromFile();
+
+ gatewayListener.deleteFile( remoteFile );
+ assertTrue( "Remote file was deleted which should not be possible!", testFile.exists() );
+ }
+
+ @Test
+ public void getFileListFromRemoteDir() throws GatewayException
+ {
+ File[] fileListFromRemoteDir = gatewayListener.getFileList();
+
+ assertNotNull ( fileListFromRemoteDir );
+ assertTrue ( fileListFromRemoteDir.length > 0 );
+
+ List<File> fileList = Arrays.asList( fileListFromRemoteDir );
+ assertTrue( "The test file was not included in the List! " , fileList.contains( new File ( testFile.getName() ) ));
+ }
+
+ @Test ( timeout=3000 )
+ public void doRun_PostDir_Same_As_InputDir() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException
+ {
+ setAbsoluteInputDir();
+ setAbsolutePostDirToInputDir();
+ boolean getCourierReturnValue = true;
+
+ RemoteGatewayListenerMock mock = createAndStartListener ( configTree, getCourierReturnValue );
+
+ File inputDir = ftpServer.getLocalInputDir();
+ String doneFileName = testFile.getName();
+
+ waitForFile( inputDir, doneFileName );
+ stopdoRun( mock );
+
+ File processedFile = new File ( inputDir, doneFileName );
+ try
+ {
+ assertTrue ( processedFile.exists() );
+ }
+ finally
+ {
+ FtpTestUtil.deleteFile( processedFile );
+ }
+ }
+
+ /**
+ * This is a "negtive" test. It verifies that the file was not
+ * renamed. The name of the method is kept so that it overrides
+ * the super classes method.
+ */
+ @Test
+ public void renameFile_In_Same_Directory() throws GatewayException
+ {
+ File from = createAbsoluteFromFile();
+ File to = createAbsoluteToFile();
+
+ gatewayListener.renameFile( from, to );
+
+ renamedFile = new File ( ftpServer.getLocalInputDir(), to.getName() );
+ assertFileExists( testFile );
+ assertFalse( renamedFile.exists() );
+ }
+
+ @Test
+ public void getNewInstanceNegative()
+ {
+ ReadOnlyRemoteGatewayListener listener = (ReadOnlyRemoteGatewayListener) gatewayListener;
+ try
+ {
+ listener.getNewInstanceOf( null );
+ fail ( "an IllegalArgumentException should have been thrown" );
+ }
+ catch ( Exception e)
+ {
+ assertTrue ( e instanceof IllegalArgumentException );
+ }
+
+ try
+ {
+ listener.getNewInstanceOf( "some.package.class" );
+ fail ( "a ConfigurationException should have been thrown" );
+ }
+ catch ( Exception e)
+ {
+ assertTrue ( e instanceof ConfigurationException );
+ }
+ }
+
+ @Test
+ public void getNewInstance() throws ConfigurationException
+ {
+ ReadOnlyRemoteGatewayListener listener = (ReadOnlyRemoteGatewayListener) gatewayListener;
+ ReadOnlyRemoteFileSystemStrategy instance = listener.getNewInstanceOf( ReadOnlyRemoteFileSystemStrategy.class.getName() );
+ assertNotNull( "The instance should not be null!", instance );
+ }
+
+ /**
+ * Not a valid test for this impl
+ */
+ @Override
+ public void renameFile_In_Different_Directory() throws GatewayException { }
+
+ /**
+ * Not a valid test for this impl
+ */
+ @Override
+ public void doRun_PostDir_Different_From_InputDir() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException { }
+
+ /**
+ * Not a valid test for this impl
+ */
+ @Override
+ public void doRun_Negative() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException {}
+
+ /**
+ * Override createConfigTree and add the ReadOnlyFileSystem strategy.
+ *
+ * @return
+ */
+ public static ConfigTree createConfigTree()
+ {
+ ConfigTree configTree = RemoteGatewayListenerUnitTest.createConfigTree();
+ configTree.setAttribute( ReadOnlyRemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CLASS, ReadOnlyRemoteFileSystemStrategy.class.getName() );
+ configTree.setAttribute( ReadOnlyRemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE, FtpFileCacheTestUtil.getCacheConfigFile() );
+ configTree.setAttribute( ReadOnlyRemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CACHE_LISTENER, DeleteOnEvictTreeCacheListener.class.getName() );
+ return configTree;
+ }
+
+ protected static void createRemoteGatewayListener( ConfigTree configTree )
+ throws ConfigurationException, RegistryException, GatewayException
+ {
+ gatewayListener = new ReadOnlyRemoteGatewayListener( configTree );
+ }
+
+ /**
+ * Creates a RemoteGatewayListenerMock instance with the passed in arguments, and then starts
+ * the ReadOnlyRemoteGatewayListener's doRun() method in a new Thread.
+ *
+ * @param configTree The configTree to use to configure the RemoteGatewayListenerMock object
+ * @param returnValueForCourier the return value for the getCourier method of the RemoteGatewayListenerMock object
+ * @return RemoteGatewayListenerMock Mock impl of a RemoteGatewayListener.
+ */
+ protected RemoteGatewayListenerMock createAndStartListener ( ConfigTree configTree, boolean returnValueForCourier ) throws ConfigurationException, GatewayException, RegistryException
+ {
+ final RemoteGatewayListenerMock mock = new RemoteGatewayListenerMock( configTree , returnValueForCourier );
+ mock.doInitialise();
+
+ Thread thread = new Thread ( new Runnable () {
+ public void run()
+ {
+ mock.doRun();
+ }
+ });
+ thread.start();
+
+ return mock;
+
+ }
+
+ protected void stopdoRun ( RemoteGatewayListenerMock mock )
+ {
+ if ( mock == null ) return;
+ try
+ {
+ mock.stop();
+ }
+ catch ( Exception e )
+ {
+ if ( ! (e instanceof ManagedLifecycleException ) )
+ fail ( e.getMessage() );
+ }
+ }
+
+ /**
+ * Mock impl of RemoteGatewayListener.
+ */
+ class RemoteGatewayListenerMock extends ReadOnlyRemoteGatewayListener
+ {
+ private static final long serialVersionUID = 1L;
+
+ /* value that will be returned from the getCourier( EPR ) method */
+ private boolean returnValueForCourier;
+
+ private boolean finishedOneRun;
+
+ /**
+ * Sole constructor
+ *
+ * @param configTree configTree used to configure this RemoteGatewayListener
+ * @param returnValueForCourier value to be returned from this objects getCourier( EPR ) method
+ *
+ */
+ public RemoteGatewayListenerMock ( ConfigTree configTree, boolean returnValueForCourier) throws ConfigurationException, GatewayException, RegistryException
+ {
+ super ( configTree );
+ this.returnValueForCourier = returnValueForCourier;
+ }
+
+ /**
+ * Will return a Courier instance that returns the value of the
+ * field returnValueForCourier.
+ */
+ @Override
+ protected Courier getCourier( EPR current ) throws CourierException, MalformedEPRException
+ {
+ return new Courier() {
+ public boolean deliver( Message message ) throws CourierException, MalformedEPRException
+ {
+ return returnValueForCourier;
+ }
+ public void cleanup() { }
+ };
+ }
+
+ @Override
+ protected void doInitialise()
+ {
+ _targetEprs = new ArrayList<EPR>();
+ _targetEprs.add( new JMSEpr( new EPR() ) );
+ };
+
+ @Override
+ protected boolean waitForRunningStateChange(final ManagedLifecycleThreadState state, final long terminationPeriod)
+ {
+ finishedOneRun = true;
+ return super.waitForRunningStateChange( state, terminationPeriod );
+ }
+
+ public boolean hasFinishedOneRun()
+ {
+ return finishedOneRun;
+ }
+ }
+
+ /*
+ * Just here to help Ant to find annotated test.
+ */
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter( ReadOnlyRemoteGatewayListenerUnitTest.class);
+ }
+
+}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -47,6 +47,7 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleThreadState;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.junit.After;
@@ -57,6 +58,7 @@
/**
* Unit test for RemoteGatewayListener that uses an embedded ftp server
+ * Tests the RemoteGatewayListener with the default RemoteFileSystemStrategy.
*
* @author Daniel Bevenius
*
@@ -66,57 +68,76 @@
private static Logger log = Logger.getLogger( RemoteGatewayListenerUnitTest.class );
/* EmbeddedFtp Server */
- private static NoConfigFileFtpServer ftpServer;
+ protected static NoConfigFileFtpServer ftpServer;
/* Instance of class under test */
- private static RemoteGatewayListener gatewayListener;
+ protected static RemoteGatewayListener gatewayListener;
/*
* ConfigTree configuration. This is a field so that test methods
* can override the default settings created by createConfigTree()
*/
- private static ConfigTree configTree;
+ protected static ConfigTree configTree;
/* name of the remote ftp input directory */
- private static String remoteInputDirName;
+ protected static String remoteInputDirName;
/* name of the remote ftp upload directory */
- private static String remoteUploadDirName;
+ protected static String remoteUploadDirName;
/* name of the remote ftp error directory */
- private static String remoteErrorDirName;
+ protected static String remoteErrorDirName;
private static final String SERVICE_CATEGORY = "RemoteGWListenerTest";
private static final String SERVICE_NAME = SERVICE_CATEGORY;
private static final String INPUT_SUFFIX = ".txt";
private static final String WORK_SUFFIX = ".esbwork";
- private static final String POST_SUFFIX = ".done";
+ protected static final String POST_SUFFIX = ".done";
private static final String POST_ERROR_SUFFIX = ".error";
private static final String POST_DEL = "false";
private static final String RENAMED_SUFFIX = ".renamed";
- private static final String TEST_FILE_CONTENT = RemoteGatewayListenerUnitTest.class.getName() + " junit ftp test";
+ protected static final String TEST_FILE_CONTENT = RemoteGatewayListenerUnitTest.class.getName() + " junit ftp test";
- private File testFile;
+ protected File testFile;
- private File renamedFile;
+ protected File renamedFile;
@BeforeClass
public static void classSetup() throws EmbeddableException, ConfigurationException, GatewayException, RegistryException, MalformedURLException
{
- ftpServer = new NoConfigFileFtpServer();
- ftpServer.setPort( 2221 );
+ ftpServer = createFtpServer();
ftpServer.start();
+ createWorkDirectories();
+
+ configTree = createConfigTree();
+ createRemoteGatewayListener( configTree );
+
+ }
+
+ protected static void createWorkDirectories()
+ {
remoteInputDirName = "/" + ftpServer.getLocalInputDir().getName();
remoteUploadDirName = "/" + ftpServer.getLocalUploadDir().getName();
remoteErrorDirName = "/" + ftpServer.getLocalErrorDir().getName();
-
- configTree = createConfigTree();
+ }
+
+
+ protected static void createRemoteGatewayListener( ConfigTree configTree )
+ throws ConfigurationException, RegistryException, GatewayException
+ {
gatewayListener = new RemoteGatewayListener( configTree );
-
}
+
+ public static NoConfigFileFtpServer createFtpServer()
+ {
+ ftpServer = new NoConfigFileFtpServer();
+ ftpServer.setPort( 2221 );
+ return ftpServer;
+ }
+
@AfterClass
public static void classTearDown()
{
@@ -212,7 +233,7 @@
/**
* This test will assert that the work file is renamed into the error directory.
- * Test with the following configuration:
+ * Test with the following configuration:
* postDir="/input"
* errorDir="/error"
*
@@ -224,6 +245,7 @@
setAbsoluteInputDir();
setAbsoluteErrorDir();
boolean getCourierReturnValue = false;
+ log.error( "The following exceptions are expected: " );
RemoteGatewayListenerMock mock = createAndStartListener ( configTree, getCourierReturnValue );
File errorDir = ftpServer.getLocalErrorDir();
@@ -296,7 +318,6 @@
byte[] fileContents = gatewayListener.getFileContents( remoteFileName );
assertEquals( TEST_FILE_CONTENT, new String ( fileContents ) );
- assertTrue( "The remote file should not have been removed.", testFile.exists() );
}
/*
@@ -312,15 +333,15 @@
* passive="false"
* pollLatencySeconds="5"
* postDelete="false"
- * postDir="/upload"
- * postSuffix=".done"
- * service-description="Gateway for SIFO"
- * target-service-category="RemoteGWListenerTest"
- * target-service-name="RemoteGWListenerTest"
- * workSuffix=".esbwork"
+ * postDir="/upload"
+ * postSuffix=".done"
+ * service-description="Gateway for SIFO"
+ * target-service-category="RemoteGWListenerTest"
+ * target-service-name="RemoteGWListenerTest"
+ * workSuffix=".esbwork"
* />
*/
- private static ConfigTree createConfigTree()
+ public static ConfigTree createConfigTree()
{
ConfigTree configTree = new ConfigTree( "junitRemoteGatewayListenerTest" );
@@ -351,14 +372,14 @@
return configTree;
}
- private void waitForFile( File inDir, String fileNameToWaitfor ) throws InterruptedException
+ protected void waitForFile( File inDir, String fileNameToWaitfor ) throws InterruptedException
{
boolean done = false;
while( !done )
{
for( String fileName : inDir.list() )
{
- System.out.println( fileName );
+ log.debug( fileName );
if ( fileName.equals( fileNameToWaitfor ) )
{
done = true;
@@ -397,6 +418,7 @@
private void stopdoRun ( RemoteGatewayListenerMock mock )
{
+ if ( mock == null ) return;
try
{
mock.stop();
@@ -408,27 +430,27 @@
}
}
- private static void assertFileRemoved( File file)
+ protected static void assertFileRemoved( File file)
{
- assertFalse( "The file was not removed from the filesystem", file.exists() );
+ assertFalse( "The file was not removed from the filesystem", file.exists() );
}
- private static void assertFileExists( File file )
+ protected static void assertFileExists( File file )
{
assertTrue( "The file was not renamed to the upload directory.", file.exists() );
}
- private void setAbsoluteInputDir()
+ protected void setAbsoluteInputDir()
{
configTree.setAttribute( ListenerTagNames.FILE_INPUT_DIR_TAG, remoteInputDirName );
}
- private void setAbsolutePostDirToInputDir()
+ protected void setAbsolutePostDirToInputDir()
{
configTree.setAttribute( ListenerTagNames.FILE_POST_DIR_TAG, remoteInputDirName );
}
-
- private void setAbsolutePostDirToUploadDir()
+
+ protected void setAbsolutePostDirToUploadDir()
{
configTree.setAttribute( ListenerTagNames.FILE_POST_DIR_TAG, remoteUploadDirName );
}
@@ -438,12 +460,12 @@
configTree.setAttribute( ListenerTagNames.FILE_ERROR_DIR_TAG, remoteErrorDirName );
}
- private File createAbsoluteFromFile()
+ protected File createAbsoluteFromFile()
{
return new File ( remoteInputDirName + "/" + testFile.getName() );
}
- private File createAbsoluteToFile()
+ protected File createAbsoluteToFile()
{
return new File ( remoteInputDirName + "/" + testFile.getName() + RENAMED_SUFFIX );
}
@@ -464,13 +486,15 @@
/**
* Mock impl of RemoteGatewayListener.
*/
- private class RemoteGatewayListenerMock extends RemoteGatewayListener
+ class RemoteGatewayListenerMock extends RemoteGatewayListener
{
private static final long serialVersionUID = 1L;
/* value that will be returned from the getCourier( EPR ) method */
private boolean returnValueForCourier;
-
+
+ private boolean finishedOneRun;
+
/**
* Sole constructor
*
@@ -506,6 +530,18 @@
_targetEprs = new ArrayList<EPR>();
_targetEprs.add( new JMSEpr( new EPR() ) );
};
+
+ @Override
+ protected boolean waitForRunningStateChange(final ManagedLifecycleThreadState state, final long terminationPeriod)
+ {
+ finishedOneRun = true;
+ return super.waitForRunningStateChange( state, terminationPeriod );
+ }
+
+ public boolean hasFinishedOneRun()
+ {
+ return finishedOneRun;
+ }
}
}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies)
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,135 +0,0 @@
-package org.jboss.soa.esb.listeners.gateway.remotestrategies;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheTestUtil;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
- *
- */
-public class ReadOnlyRemoteFileSystemStrategyUnitTest
-{
- private static Logger log = Logger .getLogger( ReadOnlyRemoteFileSystemStrategyUnitTest.class );
-
- private static ReadOnlyRemoteFileSystemStrategy strategy;
-
- private static ReadOnlyRemoteFileSystemStrategy strategy2;
-
- private String testFile1 = "testFile1";
- private String testFile2 = "testFile2";
- private String testFile3 = "testFile3";
-
- private File[] expectedFileList = new File[] { new File( testFile1 ) , new File( testFile2 ) };
- private File[] newFileList = new File[] { new File( testFile3 ) };
- private File[] emptyFileList = new File[] {};
-
- @Test
- public void listFilesNegative()
- {
- try
- {
- strategy.filterFileList( null );
- }
- catch (RemoteFileSystemStrategyException e)
- {
- fail("Should be ok to pass null as the file array!");
- }
- }
-
- @Test
- public void listFiles() throws RemoteFileSystemStrategyException
- {
- File[] filteredFileList = strategy.filterFileList( expectedFileList );
- assertEquals( expectedFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( expectedFileList );
- assertEquals( "No files should have been returned. They should have been cached.", emptyFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( newFileList );
- assertEquals( newFileList, filteredFileList );
- assertTrue ( filteredFileList instanceof File[] );
- }
-
- @Test
- public void listFiles_With_Two_Strategy_Instances() throws Exception
- {
-
- try
- {
- File[] filteredFileList = strategy2.filterFileList( expectedFileList );
- assertEquals( expectedFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( expectedFileList );
- assertEquals( emptyFileList, filteredFileList );
-
- filteredFileList = strategy2.filterFileList( newFileList );
- assertEquals( newFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( newFileList );
- assertEquals( emptyFileList, filteredFileList );
-
- }
- catch ( Exception e )
- {
- log.error(e);
- }
- finally
- {
- strategy2.stop();
- }
-
- }
-
- @Before
- public void setup() throws CacheException
- {
- strategy.removeAllData();
- }
-
- @BeforeClass
- public static void classSetup() throws Exception
- {
- registerHsqlDriver();
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir() + "build" + File.separator + "hsqltestdb", "ftpcache");
-
- strategy = new ReadOnlyRemoteFileSystemStrategy();
- strategy.init( FtpFileCacheTestUtil.getCacheConfigFile() );
-
- strategy2 = new ReadOnlyRemoteFileSystemStrategy();
- strategy2.init( FtpFileCacheTestUtil.getCacheConfigFile() );
- }
-
- private static void registerHsqlDriver()
- {
- try
- {
- Class.forName( "org.hsqldb.jdbcDriver" );
- }
- catch (Exception e)
- {
- fail( "ERROR: failed to load JDBC driver." + e.getMessage() );
- }
- }
-
- @AfterClass
- public static void classTearDown()
- {
- strategy.stop();
- strategy2.stop();
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,135 @@
+package org.jboss.soa.esb.listeners.gateway.remotestrategies;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheTestUtil;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author <a href="daniel.bevenius at redpill.se">Daniel Bevenius</a>
+ *
+ */
+public class ReadOnlyRemoteFileSystemStrategyUnitTest
+{
+ private static Logger log = Logger .getLogger( ReadOnlyRemoteFileSystemStrategyUnitTest.class );
+
+ private static ReadOnlyRemoteFileSystemStrategy strategy;
+
+ private static ReadOnlyRemoteFileSystemStrategy strategy2;
+
+ private String testFile1 = "testFile1";
+ private String testFile2 = "testFile2";
+ private String testFile3 = "testFile3";
+
+ private File[] expectedFileList = new File[] { new File( testFile1 ) , new File( testFile2 ) };
+ private File[] newFileList = new File[] { new File( testFile3 ) };
+ private File[] emptyFileList = new File[] {};
+
+ @Test
+ public void listFilesNegative()
+ {
+ try
+ {
+ strategy.filterFileList( null );
+ }
+ catch (RemoteFileSystemStrategyException e)
+ {
+ fail("Should be ok to pass null as the file array!");
+ }
+ }
+
+ @Test
+ public void listFiles() throws RemoteFileSystemStrategyException
+ {
+ File[] filteredFileList = strategy.filterFileList( expectedFileList );
+ assertEquals( expectedFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( expectedFileList );
+ assertEquals( "No files should have been returned. They should have been cached.", emptyFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( newFileList );
+ assertEquals( newFileList, filteredFileList );
+ assertTrue ( filteredFileList instanceof File[] );
+ }
+
+ @Test
+ public void listFiles_With_Two_Strategy_Instances() throws Exception
+ {
+
+ try
+ {
+ File[] filteredFileList = strategy2.filterFileList( expectedFileList );
+ assertEquals( expectedFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( expectedFileList );
+ assertEquals( emptyFileList, filteredFileList );
+
+ filteredFileList = strategy2.filterFileList( newFileList );
+ assertEquals( newFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( newFileList );
+ assertEquals( emptyFileList, filteredFileList );
+
+ }
+ catch ( Exception e )
+ {
+ log.error(e);
+ }
+ finally
+ {
+ strategy2.stop();
+ }
+
+ }
+
+ @Before
+ public void setup() throws CacheException
+ {
+ strategy.removeAllData();
+ }
+
+ @BeforeClass
+ public static void classSetup() throws Exception
+ {
+ registerHsqlDriver();
+ HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir() + "build" + File.separator + "hsqltestdb", "ftpcache");
+
+ strategy = new ReadOnlyRemoteFileSystemStrategy();
+ strategy.init( FtpFileCacheTestUtil.getCacheConfigFile() );
+
+ strategy2 = new ReadOnlyRemoteFileSystemStrategy();
+ strategy2.init( FtpFileCacheTestUtil.getCacheConfigFile() );
+ }
+
+ private static void registerHsqlDriver()
+ {
+ try
+ {
+ Class.forName( "org.hsqldb.jdbcDriver" );
+ }
+ catch (Exception e)
+ {
+ fail( "ERROR: failed to load JDBC driver." + e.getMessage() );
+ }
+ }
+
+ @AfterClass
+ public static void classTearDown()
+ {
+ strategy.stop();
+ strategy2.stop();
+ }
+
+}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache)
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,156 +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.listeners.gateway.remotestrategies.cache;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.TreeCache;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * @author Daniel Bevenius
- *
- */
-public class DeleteOnEvictTreeCacheListenerUnitTest
-{
- @SuppressWarnings("unused")
- private Logger log = Logger .getLogger( DeleteOnEvictTreeCacheListenerUnitTest.class );
-
- private static DeleteOnEvictTreeCacheListener listener;
- private static TreeCache treeCache;
-
- private static final String FQN = "test/junit";
- private String key = "testKey";
- private String value = "testValue";
- private Fqn fqnTest = new Fqn ( new String[] { FQN, key, value} );
-
- @Test( expected=IllegalArgumentException.class )
- public void constructor()
- {
- new DeleteOnEvictTreeCacheListener( null );
- }
-
- @Test
- public void nodeEvict() throws CacheException
- {
- treeCache.put( FQN, key, value );
- Node node = treeCache.get( fqnTest );
- assertTrue( "The value should have been added!", treeCache.exists( FQN, key ) );
-
- listener.nodeEvicted( fqnTest );
- node = treeCache.get( fqnTest );
- assertFalse( "The value should have been removed upon eviction!", treeCache.exists( fqnTest ) );
-
- node = treeCache.get( fqnTest );
- assertNull ( "The node should have been removed from the cache store", node );
- }
-
- @Test
- public void testCacheRestart() throws Exception
- {
- treeCache.put( FQN, key, value );
- Object valueBeforeCacheShutdown = treeCache.get( FQN, key );
- treeCache.stop();
- treeCache.start();
- Object valueAfterCacheShutdown = treeCache.get( FQN, key );
- assertEquals( "Objects should be equal even after a treeCache restart", valueBeforeCacheShutdown, valueAfterCacheShutdown );
- }
-
- @BeforeClass
- public static void classSetup() throws Exception
- {
- FtpFileCacheTestUtil.startDB();
- startCache();
- }
-
- private static void startCache() throws Exception
- {
- treeCache = new TreeCache();
- listener = new DeleteOnEvictTreeCacheListener( treeCache );
- treeCache.addTreeCacheListener( listener );
- FtpFileCacheTestUtil.createTreeCache( treeCache, FtpFileCacheTestUtil.getCacheConfigFile() );
- treeCache.start();
- }
-
- private static void stopCache()
- {
- treeCache.stop();
- }
-
- @AfterClass
- public static void classTearDown() throws Exception
- {
- FtpFileCacheTestUtil.stopDB();
- stopCache();
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter( FtpFileCacheUnitTest.class );
- }
-
- @SuppressWarnings("unused")
- private int getMaxAgeSeconds()
- {
- int maxAgeSeconds = 0;
- NodeList elementsByTagName = treeCache.getEvictionPolicyConfig().getElementsByTagName( "region" );
- for ( int i = elementsByTagName.getLength() ; i-->0 ; )
- {
- org.w3c.dom.Node region = elementsByTagName.item( i );
- NamedNodeMap attributes = region.getAttributes();
- org.w3c.dom.Node fqnNameNode = attributes.getNamedItem( "name" );
- if ( fqnNameNode.getNodeValue().equals( "/ftp/cache" ))
- {
- NodeList childNodes = region.getChildNodes();
- for ( int y = 0 ; y < childNodes.getLength() ; y ++ )
- {
- org.w3c.dom.Node node = childNodes.item( y );
- if ( node.getNodeName().equals( "attribute" ))
- {
- NamedNodeMap attributes2 = node.getAttributes();
- org.w3c.dom.Node namedItem = attributes2.getNamedItem( "name" );
- if ( namedItem.getNodeValue().equals("maxAgeSeconds") )
- {
- maxAgeSeconds = Integer.valueOf( node.getTextContent() );
- break;
- }
- }
- }
- }
- }
- return maxAgeSeconds;
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,156 @@
+/*
+ * 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.listeners.gateway.remotestrategies.cache;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.TreeCache;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class DeleteOnEvictTreeCacheListenerUnitTest
+{
+ @SuppressWarnings("unused")
+ private Logger log = Logger .getLogger( DeleteOnEvictTreeCacheListenerUnitTest.class );
+
+ private static DeleteOnEvictTreeCacheListener listener;
+ private static TreeCache treeCache;
+
+ private static final String FQN = "test/junit";
+ private String key = "testKey";
+ private String value = "testValue";
+ private Fqn fqnTest = new Fqn ( new String[] { FQN, key, value} );
+
+ @Test( expected=IllegalArgumentException.class )
+ public void constructor()
+ {
+ new DeleteOnEvictTreeCacheListener( null );
+ }
+
+ @Test
+ public void nodeEvict() throws CacheException
+ {
+ treeCache.put( FQN, key, value );
+ Node node = treeCache.get( fqnTest );
+ assertTrue( "The value should have been added!", treeCache.exists( FQN, key ) );
+
+ listener.nodeEvicted( fqnTest );
+ node = treeCache.get( fqnTest );
+ assertFalse( "The value should have been removed upon eviction!", treeCache.exists( fqnTest ) );
+
+ node = treeCache.get( fqnTest );
+ assertNull ( "The node should have been removed from the cache store", node );
+ }
+
+ @Test
+ public void testCacheRestart() throws Exception
+ {
+ treeCache.put( FQN, key, value );
+ Object valueBeforeCacheShutdown = treeCache.get( FQN, key );
+ treeCache.stop();
+ treeCache.start();
+ Object valueAfterCacheShutdown = treeCache.get( FQN, key );
+ assertEquals( "Objects should be equal even after a treeCache restart", valueBeforeCacheShutdown, valueAfterCacheShutdown );
+ }
+
+ @BeforeClass
+ public static void classSetup() throws Exception
+ {
+ FtpFileCacheTestUtil.startDB();
+ startCache();
+ }
+
+ private static void startCache() throws Exception
+ {
+ treeCache = new TreeCache();
+ listener = new DeleteOnEvictTreeCacheListener( treeCache );
+ treeCache.addTreeCacheListener( listener );
+ FtpFileCacheTestUtil.createTreeCache( treeCache, FtpFileCacheTestUtil.getCacheConfigFile() );
+ treeCache.start();
+ }
+
+ private static void stopCache()
+ {
+ treeCache.stop();
+ }
+
+ @AfterClass
+ public static void classTearDown() throws Exception
+ {
+ FtpFileCacheTestUtil.stopDB();
+ stopCache();
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter( FtpFileCacheUnitTest.class );
+ }
+
+ @SuppressWarnings("unused")
+ private int getMaxAgeSeconds()
+ {
+ int maxAgeSeconds = 0;
+ NodeList elementsByTagName = treeCache.getEvictionPolicyConfig().getElementsByTagName( "region" );
+ for ( int i = elementsByTagName.getLength() ; i-->0 ; )
+ {
+ org.w3c.dom.Node region = elementsByTagName.item( i );
+ NamedNodeMap attributes = region.getAttributes();
+ org.w3c.dom.Node fqnNameNode = attributes.getNamedItem( "name" );
+ if ( fqnNameNode.getNodeValue().equals( "/ftp/cache" ))
+ {
+ NodeList childNodes = region.getChildNodes();
+ for ( int y = 0 ; y < childNodes.getLength() ; y ++ )
+ {
+ org.w3c.dom.Node node = childNodes.item( y );
+ if ( node.getNodeName().equals( "attribute" ))
+ {
+ NamedNodeMap attributes2 = node.getAttributes();
+ org.w3c.dom.Node namedItem = attributes2.getNamedItem( "name" );
+ if ( namedItem.getNodeValue().equals("maxAgeSeconds") )
+ {
+ maxAgeSeconds = Integer.valueOf( node.getTextContent() );
+ break;
+ }
+ }
+ }
+ }
+ }
+ return maxAgeSeconds;
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,96 +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.listeners.gateway.remotestrategies.cache;
-
-import static org.junit.Assert.fail;
-
-import java.io.File;
-
-import org.jboss.cache.ConfigureException;
-import org.jboss.cache.PropertyConfigurator;
-import org.jboss.cache.TreeCache;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-
-/**
- * Simple helper class with util method for getting a cache config
- * file.
- *
- * @author Daniel Bevenius
- *
- */
-public class FtpFileCacheTestUtil
-{
- public static String getCacheConfigFile()
- {
- String configFile = TestEnvironmentUtil.getBaseDir() + File.separator +
- "core" + File.separator +
- "listeners" + File.separator +
- "tests" + File.separator +
- "src" + File.separator +
- "org" + File.separator +
- "jboss" + File.separator +
- "soa" + File.separator +
- "esb" + File.separator +
- "listeners" + File.separator +
- "gateway" + File.separator +
- "remotestrategies" + File.separator +
- "cache" + File.separator +
- "ftpfile_cache_test.xml";
-
- if ( ! new File ( configFile ).exists() )
- fail( "Could not locate the jboss cache config file: " + configFile );
-
- return configFile;
- }
-
- public static void createTreeCache( TreeCache treeCache, String pathToConfigFile ) throws ConfigureException
- {
- PropertyConfigurator configurator = new PropertyConfigurator();
- configurator.configure( treeCache, pathToConfigFile );
- }
-
- public static void startDB() throws Exception
- {
-
- registerHsqlDriver();
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir() + "build" + File.separator + "hsqltestdb", "ftpcache");
- }
-
- private static void registerHsqlDriver()
- {
- try
- {
- Class.forName( "org.hsqldb.jdbcDriver" );
- }
- catch (Exception e)
- {
- fail( "ERROR: failed to load JDBC driver." + e.getMessage() );
- }
- }
-
- public static void stopDB() throws Exception
- {
- HsqldbUtil.stopHsqldb( "jdbc:hsqldb:hsql://localhost:9001/ftpcache", "sa", "" );
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTestUtil.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,96 @@
+/*
+ * 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.listeners.gateway.remotestrategies.cache;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import org.jboss.cache.ConfigureException;
+import org.jboss.cache.PropertyConfigurator;
+import org.jboss.cache.TreeCache;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+
+/**
+ * Simple helper class with util method for getting a cache config
+ * file.
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class FtpFileCacheTestUtil
+{
+ public static String getCacheConfigFile()
+ {
+ String configFile = TestEnvironmentUtil.getBaseDir() + File.separator +
+ "core" + File.separator +
+ "listeners" + File.separator +
+ "tests" + File.separator +
+ "src" + File.separator +
+ "org" + File.separator +
+ "jboss" + File.separator +
+ "soa" + File.separator +
+ "esb" + File.separator +
+ "listeners" + File.separator +
+ "gateway" + File.separator +
+ "remotestrategies" + File.separator +
+ "cache" + File.separator +
+ "ftpfile_cache_test.xml";
+
+ if ( ! new File ( configFile ).exists() )
+ fail( "Could not locate the jboss cache config file: " + configFile );
+
+ return configFile;
+ }
+
+ public static void createTreeCache( TreeCache treeCache, String pathToConfigFile ) throws ConfigureException
+ {
+ PropertyConfigurator configurator = new PropertyConfigurator();
+ configurator.configure( treeCache, pathToConfigFile );
+ }
+
+ public static void startDB() throws Exception
+ {
+
+ registerHsqlDriver();
+ HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir() + "build" + File.separator + "hsqltestdb", "ftpcache");
+ }
+
+ private static void registerHsqlDriver()
+ {
+ try
+ {
+ Class.forName( "org.hsqldb.jdbcDriver" );
+ }
+ catch (Exception e)
+ {
+ fail( "ERROR: failed to load JDBC driver." + e.getMessage() );
+ }
+ }
+
+ public static void stopDB() throws Exception
+ {
+ HsqldbUtil.stopHsqldb( "jdbc:hsqldb:hsql://localhost:9001/ftpcache", "sa", "" );
+ }
+
+}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,120 +0,0 @@
-package org.jboss.soa.esb.listeners.gateway.remotestrategies.cache;
-
-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.InputStream;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test class FtpFileCache
- *
- * @author Daniel Bevenius
- *
- */
-public class FtpFileCacheUnitTest
-{
- private static Logger log = Logger.getLogger(FtpFileCacheUnitTest.class);
-
- private static FtpFileCache ftpfileCache;
-
- @Test
- public void getConfigInputStream_From_Classpath() throws Exception
- {
- String configPath_CP = "/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml";
- InputStream configInputStream = ftpfileCache.getConfigInputStream( configPath_CP );
- assertNotNull( "InputStream was null", configInputStream );
- }
-
- @Test
- public void getPutAndRemove()
- {
- String fileName = "testfile1";
- try
- {
- ftpfileCache.putFileName( fileName );
-
- Object obj = ftpfileCache.getFileName( fileName );
- assertTrue( obj instanceof String );
-
- String actualFileName = (String) obj;
- assertEquals( fileName, actualFileName );
- }
- catch (CacheException e)
- {
- fail ( e.getMessage() );
- }
- finally
- {
- try { ftpfileCache.deleteFile( fileName ); } catch (CacheException e) { log.error( e.getMessage() ); }
- }
- }
-
- @Test
- public void addCacheListenerNegative()
- {
- try
- {
- ftpfileCache.addCacheListener( null );
- }
- catch ( Exception e )
- {
- fail("Should be ok to pass a null listener! Exception was : "+ e.getMessage() );
- }
- }
-
- @Test
- public void fileExists() throws CacheException
- {
- String fileName = "testfile1";
-
- ftpfileCache.putFileName( fileName );
-
- boolean fileExistsInCache = ftpfileCache.containsFile( fileName );
- assertTrue ( fileExistsInCache );
- }
-
- @Test
- public void removeAll() throws CacheException
- {
- String fileName = "testfile3";
- ftpfileCache.putFileName( fileName );
- ftpfileCache.removeAll();
- assertNull ( ftpfileCache.getFileName( fileName ));
-
- }
-
- @BeforeClass
- public static void classSetup() throws Exception
- {
- FtpFileCacheTestUtil.startDB();
-
- ftpfileCache = new FtpFileCache ( FtpFileCacheTestUtil.getCacheConfigFile() );
- ftpfileCache.start();
- }
-
-
- @AfterClass
- public static void classTearDown() throws Exception
- {
- ftpfileCache.stop();
- FtpFileCacheTestUtil.stopDB();
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter( FtpFileCacheUnitTest.class );
- }
-
-}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,120 @@
+package org.jboss.soa.esb.listeners.gateway.remotestrategies.cache;
+
+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.InputStream;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class FtpFileCache
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class FtpFileCacheUnitTest
+{
+ private static Logger log = Logger.getLogger(FtpFileCacheUnitTest.class);
+
+ private static FtpFileCache ftpfileCache;
+
+ @Test
+ public void getConfigInputStream_From_Classpath() throws Exception
+ {
+ String configPath_CP = "/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml";
+ InputStream configInputStream = ftpfileCache.getConfigInputStream( configPath_CP );
+ assertNotNull( "InputStream was null", configInputStream );
+ }
+
+ @Test
+ public void getPutAndRemove()
+ {
+ String fileName = "testfile1";
+ try
+ {
+ ftpfileCache.putFileName( fileName );
+
+ Object obj = ftpfileCache.getFileName( fileName );
+ assertTrue( obj instanceof String );
+
+ String actualFileName = (String) obj;
+ assertEquals( fileName, actualFileName );
+ }
+ catch (CacheException e)
+ {
+ fail ( e.getMessage() );
+ }
+ finally
+ {
+ try { ftpfileCache.deleteFile( fileName ); } catch (CacheException e) { log.error( e.getMessage() ); }
+ }
+ }
+
+ @Test
+ public void addCacheListenerNegative()
+ {
+ try
+ {
+ ftpfileCache.addCacheListener( null );
+ }
+ catch ( Exception e )
+ {
+ fail("Should be ok to pass a null listener! Exception was : "+ e.getMessage() );
+ }
+ }
+
+ @Test
+ public void fileExists() throws CacheException
+ {
+ String fileName = "testfile1";
+
+ ftpfileCache.putFileName( fileName );
+
+ boolean fileExistsInCache = ftpfileCache.containsFile( fileName );
+ assertTrue ( fileExistsInCache );
+ }
+
+ @Test
+ public void removeAll() throws CacheException
+ {
+ String fileName = "testfile3";
+ ftpfileCache.putFileName( fileName );
+ ftpfileCache.removeAll();
+ assertNull ( ftpfileCache.getFileName( fileName ));
+
+ }
+
+ @BeforeClass
+ public static void classSetup() throws Exception
+ {
+ FtpFileCacheTestUtil.startDB();
+
+ ftpfileCache = new FtpFileCache ( FtpFileCacheTestUtil.getCacheConfigFile() );
+ ftpfileCache.start();
+ }
+
+
+ @AfterClass
+ public static void classTearDown() throws Exception
+ {
+ ftpfileCache.stop();
+ FtpFileCacheTestUtil.stopDB();
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter( FtpFileCacheUnitTest.class );
+ }
+
+}
Deleted: labs/jbossesb/trunk/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 2007-06-14 07:26:37 UTC (rev 12571)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,146 +0,0 @@
-<?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="localhost"
- receive_on_all_interfaces="true"
- send_on_all_interfaces="true"
- 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" 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>true</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>
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml (from rev 12571, labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,146 @@
+<?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="localhost"
+ receive_on_all_interfaces="true"
+ send_on_all_interfaces="true"
+ 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" 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>true</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/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/CallHelper.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/CallHelper.java 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/CallHelper.java 2007-06-14 11:04:18 UTC (rev 12573)
@@ -154,11 +154,6 @@
throw new UnmarshalException("'" + XMLUtil.RELATES_TO_TAG
+ "' must be a valid URI", e);
}
- catch (Exception ex)
- {
- throw new UnmarshalException("'" + XMLUtil.RELATES_TO_TAG
- + "' has invalid content", ex);
- }
}
if (n.getPrefix().equals(XMLUtil.WSA_PREFIX) && (n.getLocalName().equals(XMLUtil.FAULT_TO_TAG)))
@@ -177,11 +172,6 @@
throw new UnmarshalException("'" + XMLUtil.ACTION_TAG
+ "' must be a valid URI", e);
}
- catch (Exception ex)
- {
- throw new UnmarshalException("'" + XMLUtil.ACTION_TAG
- + "' has invalid content", ex);
- }
}
if (n.getPrefix().equals(XMLUtil.WSA_PREFIX) && (n.getLocalName().equals(XMLUtil.MESSAGE_IDENTIFIER_TAG)))
@@ -196,12 +186,6 @@
+ XMLUtil.MESSAGE_IDENTIFIER_TAG
+ "' must be a valid URI", e);
}
- catch (Exception ex)
- {
- throw new UnmarshalException("'"
- + XMLUtil.MESSAGE_IDENTIFIER_TAG
- + "' has invalid content", ex);
- }
}
}
}
Modified: labs/jbossesb/trunk/product/docs/MessageActionGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-06-14 11:04:18 UTC (rev 12573)
@@ -229,7 +229,6 @@
</xsd:attribute>
</xsd:complexType>
<xsd:element name="listener" type="jesb:listener"/>
-
<!-- JCA Types -->
<xsd:element name="activation-config">
<xsd:annotation>
@@ -493,116 +492,123 @@
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
-
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- FTP Type Implementations.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="ftp-message-filter">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A FTP filter.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:attribute name="directory" use="required" type="xsd:string">
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ FTP Type Implementations.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <xsd:element name="ftp-message-filter">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A FTP filter.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:attribute name="directory" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The ftp directory that is monitored for incoming new files.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="username" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The username used to access the ftp server</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="password" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The password used to access the ftp server.</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
+ the ESB (note: add the dot, so something like '.esbIn').
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="work-suffix" use="optional" type="xsd:string" default=".esbInProcess">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix used while the file is being process, so that
+ another thread or process won't pick it up too.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, the file will be deleted after it is processed. Note that
+ in that case post-directory and post-suffix have no effect.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-directory" use="optional" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after it is
+ processed by the ESB
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-suffix" use="optional" type="xsd:string" default=".esbDone">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after it is
+ processed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, the file will be deleted if an error occurs during
+ processing. Note that in that case error-directory and error-suffix have no effect.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-directory" use="optional" type="xsd:string" default="processed">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after when an
+ error occurs during processing.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-suffix" use="optional" type="xsd:string" default=".esbERROR">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after an error
+ occurs during processing.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="passive" use="optional" type="xsd:boolean">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">This is an ftp server setting which may vary per session.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="protocol" use="optional" default="ftp">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The protocol, can be sftp (SSH File Transfer Protocol), ftps (FTP
+ over SLL) and ftp (to which it defaults).
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="ftp"/>
+ <xsd:enumeration value="ftps"/>
+ <xsd:enumeration value="sftp"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="certificate-url" use="optional" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The url to a certificate, which can be needed for secure protocols
+ (sftp and ftps).
+ </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">The ftp directory that is monitored for incoming new files.
+ <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="username" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The username used to access the ftp server</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="password" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The password used to access the ftp server.</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
- the ESB (note: add the dot, so something like '.esbIn').
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="work-suffix" use="optional" type="xsd:string" default=".esbInProcess">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix used while the file is being process, so that
- another thread or process won't pick it up too.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, the file will be deleted after it is processed. Note that
- in that case post-directory and post-suffix have no effect.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-directory" use="optional" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after it is
- processed by the ESB
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-suffix" use="optional" type="xsd:string" default=".esbDone">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after it is
- processed.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, the file will be deleted if an error occurs during
- processing. Note that in that case error-directory and error-suffix have no effect.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-directory" use="optional" type="xsd:string" default="processed">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after when an
- error occurs during processing.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-suffix" use="optional" type="xsd:string" default=".esbERROR">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after an error
- occurs during processing.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="passive" use="optional" type="xsd:boolean">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">This is an ftp server setting which may vary per session.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="protocol" use="optional" default="ftp">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The protocol, can be sftp (SSH File Transfer Protocol), ftps (FTP
- over SLL) and ftp (to which it defaults).
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:NMTOKEN">
- <xsd:enumeration value="ftp"/>
- <xsd:enumeration value="ftps"/>
- <xsd:enumeration value="sftp"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="certificate-url" use="optional" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The url to a certificate, which can be needed for secure protocols
- (sftp and ftps).
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
<xsd:element name="ftp-bus" substitutionGroup="jesb:bus">
<xsd:annotation>
<xsd:documentation xml:lang="en">A FTP-Bus is a specific instance of a bus using the FTP protocol.
Copied: labs/jbossesb/trunk/product/lib/ext/cache.jar (from rev 12571, labs/jbossesb/workspace/dbevenius/product/lib/ext/cache.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossesb/trunk/product/lib/ext/jgroups-all.jar (from rev 12571, labs/jbossesb/workspace/dbevenius/product/lib/ext/jgroups-all.jar)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -243,9 +243,14 @@
<target name="run" depends="compile,config">
<description> run will run the quickstart in standalone mode
</description>
+
+ <condition property="esb.config.file"
+ value="${esb.config.file}" else="${basedir}/jboss-esb.xml">
+ <isset property="esb.config.file"/>
+ </condition>
<echo>Launching Quickstart in standalone mode...</echo>
<java fork="yes" classname="org.jboss.soa.esb.listeners.StandAloneBootStrapper" failonerror="true">
- <arg value="${basedir}/jboss-esb.xml" />
+ <arg value="${esb.config.file}" />
<classpath refid="exec-classpath" />
</java>
</target>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/build.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/build.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -4,11 +4,16 @@
${ant.project.name}
${line.separator}
</description>
+
+ <property name="additional.deploys" value="ftpfile-cache-config.xml,lib/cache.jar,lib/jgroups.jar"/>
<import file="../conf/base-build.xml"/>
- <target name="config">
- <antcall target="filter_jboss-esb.xml"/>
+ <target name="config" unless="readonly.mode">
+ <antcall target="filter_jboss-esb.xml">
+ <param name="file.name" value="jboss-esb-unfiltered.xml"/>
+ <param name="to.file.name" value="${basedir}/jboss-esb.xml"/>
+ </antcall>
<copy file="log4j.xml" tofile="build/log4j.xml"/>
</target>
@@ -33,8 +38,44 @@
</java>
</target>
+ <target name="run-readonly" description="run the readonly version">
+ <copy file="ftpfile-cache-config.xml" todir="${basedir}/build/classes"/>
+ <property name="readonly.mode" value="true"/>
+
+ <tstamp>
+ <format property="timestamp" pattern="ss" />
+ </tstamp>
+
+ <property name="readonly.esb.config.file" value="${basedir}/readonly-esb-${timestamp}.xml"/>
+
+ <antcall target="filter_jboss-esb.xml">
+ <param name="file.name" value="${basedir}/jboss-esb-readonly-unfiltered.xml"/>
+ <param name="to.file.name" value="${readonly.esb.config.file}"/>
+ </antcall>
+
+ <antcall target="run">
+ <param name="esb.config.file" value="${readonly.esb.config.file}"/>
+ </antcall>
+ </target>
+
+ <target name="deploy-readonly" description="deploy the readonly version">
+ <copy file="ftpfile-cache-config.xml" todir="${basedir}/classes"/>
+ <property name="readonly.mode" value="true"/>
+
+ <antcall target="filter_jboss-esb.xml">
+ <param name="file.name" value="${basedir}/jboss-esb-readonly-unfiltered.xml"/>
+ <param name="to.file.name" value="${basedir}/jboss-esb.xml"/>
+ </antcall>
+
+ <antcall target="deploy"/>
+
+ </target>
+
+
+
<target name="filter_jboss-esb.xml">
- <copy file="${basedir}/jboss-esb-unfiltered.xml" tofile="${basedir}/jboss-esb.xml" overwrite="true" filtering="true">
+ <echo message="${file.name}"/>
+ <copy file="${file.name}" tofile="${to.file.name}" overwrite="true" filtering="true">
<filterset>
<filter token="FTP_HOSTNAME" value="${quickstart.jbossesb.ftp.hostname}"/>
<filter token="FTP_USERNAME" value="${quickstart.jbossesb.ftp.username}"/>
@@ -44,4 +85,14 @@
</copy>
</target>
+ <target name="quickstart-specific-clean">
+ <delete >
+ <fileset dir="${basedir}">
+ <include name="readonly-esb*"/>
+ <include name="jbossesb-gateway.xml"/>
+ <include name="jbossesb-listener.xml"/>
+ </fileset>
+ </delete>
+ </target>
+
</project>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml (from rev 12571, labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+
+ <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>
+
+ <!-- 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="localhost"
+ receive_on_all_interfaces="true"
+ send_on_all_interfaces="true"
+ 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_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" 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">60</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">60</attribute>
+ <attribute name="maxAgeSeconds">60</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>
+
+</server>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml (from rev 12571, labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -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-config.xml"/>
+ <property name="remoteFileSystemStrategy-cacheListener" value="org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener"/>
+ </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/trunk/product/samples/quickstarts/helloworld_ftp_action/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/log4j.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/log4j.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -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/trunk/product/samples/quickstarts/helloworld_ftp_action/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/readme.txt 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld_ftp_action/readme.txt 2007-06-14 11:04:18 UTC (rev 12573)
@@ -2,7 +2,7 @@
=========
This is a very basic example that demonstrates how to configure the FTP gateway
so that it picks up messages from an ftp server, routes them through a JMS queue
- and finally to your action class for processing.
+ and finally to your action class for processing.
Running this quickstart:
========================
@@ -12,27 +12,99 @@
Before Running:
===============
1. Make sure the you have set the jboss.ftp properties in either install/deployment.properties
- or in sample/quickstarts/conf/quickstarts.properties.
+ or in samples/quickstarts/conf/quickstarts.properties.
2. Make sure you have read/write access to an FTP server. Write access is required
so that a file can be marked as "completed" (or just deleted) and not reprocessed
- again and again.
- 3. In a command terminal window in the quickstart folder type 'ant deploy-jms-queues'.
+ again and again. Write access is not needed for the read-only version.
To Run standalone mode:
=======================
- 1. In a command terminal window in this folder ("Window1"), type 'ant run'.
- 2. Open another command terminal window in this folder ("Window2"), type 'ant runtest'.
- 3. Switch back to "Window1" to see the output from the ESB. You should see the file contents
+ 1. In a command terminal window in the quickstart folder type 'ant deploy-jms-dests'.
+ 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
+ 3. Open another command terminal window in this folder ("Window2"), type 'ant runtest'.
+ 4. Switch back to "Window1" to see the output from the ESB. You should see the file contents
displayed in the listener window
+To Run standalone mode readonly configuration:
+==============================================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant run-readonly'.
+ 1. In another command terminal window in this folder ("Window2"), type 'ant run-readonly'.
+ 2. Open another command terminal window in this folder ("Window3"), type 'ant runtest'.
+ 3. You should see the file contents displayed in the one of the listener windows.
+ Log onto the ftpserver and see that the file has not been renamed.
+ 4. Examine the jboss-esb-readonly-unfiltered.xml file and specifically this ftp-listener
+ section:
+ <property name="remoteFileSystemStrategy-configFile" value="./ftpfile-cache-config.xml"/>
+ <property name="remoteFileSystemStrategy-cacheListener" value="org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener"/>
+ Setting the deleteOnEviction to true will cause the file name to be deleted from the
+ cacheloader. You can set the eviction time in ftpfile-cache-config.xml:
+ <region name="/ftp/cache">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">20</attribute>
+ <attribute name="maxAgeSeconds">20</attribute>
+ </region>
+ This will cause the filename to be deleted every 20 seconds. Such as short period is only
+ for testing and a more realistic interval could perhaps be every day or so.
+
+To Run as a .esb archive:
+=========================
+ 1. In a command terminal window in the quickstart folder type 'ant undeploy-jms-dests'.
+ 2. In a command terminal window in the quickstart folder type 'ant deploy'.
+ 3. In a command terminal window in the quickstart folder type 'ant runtest'.
+
+To Run as a .esb archive readonly version:
+==========================================
+ 1. In a command terminal window in the quickstart folder type 'ant undeploy-jms-dests'.
+ 2. In a command terminal window in the quickstart folder type 'ant deploy-readonly'.
+ 3. In a command terminal window in the quickstart folder type 'ant runtest'.
+
+
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.
+ 2) The FTP directory is accessable and can be written to as the "in process"
+ and "completed" files are renamed accordingly.
-If you do not have write access you will receive an error that looks something like the
-following:
- [java] 20:41:36,625 ERROR [Thread-5][AbstractFileGateway] Problems renaming
- file new_file.dat to new_file.dat.esbWorking
+ If you do not have write access you will receive an error that looks something like the
+ following:
+ [java] 20:41:36,625 ERROR [Thread-5][AbstractFileGateway] Problems renaming
+ file new_file.dat to new_file.dat.esbWorking
+
+ 3) Running the read-only version:
+ Note that the database used by the cacheloader is hypersonic and it is an inmemory database. This means that if
+ you close all the ESBs running('ant run-readonly') windows all files will be retrieved once
+ more. This would not be the case with a persistent database.
+
+Project file descriptions:
+==========================
+
+ * jboss-esb-unfiltered.xml - the jboss-esb configuration file before it is filtered by Ant
+ to add the proper values for the remote ftp server. Ant will generate a file name jboss-esb.xml.
+
+ * jboss-esb-readonly-unfiltered.xml - same as the file above but configured for a readonly ftp server.
+ Ant will generate an file named jboss-esb-XX.xml. The reason for this is that if two standalone
+ instances of the ESB are started in the same directory and use the same config file they will
+ interfere with each other on startup. The one already started will think that it file as changed.
+ Just run 'ant clean' to get rid of all the generated files.
+
+ * ftpfile-cache-config.xml - JBossTreeCache configuration file used with the readonly version.
+
+ * jbossesb-properties.xml - also needed by jUDDI and needs to be at the head of the classpath.
+ Both juddi.properties and jbossesb-properties.xml are used when the service first
+ boots up for self-registration based upon the service-category and
+ service-name found in the esb-config.xml file.
+
+ * jndi.properties - needed primarily for
+ quickstart.test.SendJMSMessage that is fired by ant runtest.
+
+ * log4j.xml - needed to configure log4J used by both the
+ quickstart and the ESB itself. A listener needs a place to
+ log.
+
+ * src/org/jboss/soa/esb/samples/quickstarts/helloworldftpaction/MyAction.java -
+ Action that prints the message received to sysout
+
+ * src/org/jboss/soa/esb/samples/quickstarts/helloworldftpaction/test/CreateTestFile.java -
+ Creates a test file on the ftpserver. This is what triggers the ftplistener
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml 2007-06-14 09:34:41 UTC (rev 12572)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml 2007-06-14 11:04:18 UTC (rev 12573)
@@ -1,56 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
- <resource-config target-profile="from-type:text/csv:order-list AND to-type:text/xml:smooks-order-xml" selector="org.xml.sax.driver">
- <resource>org.milyn.csv.CSVParser</resource>
- <param name="fields" type="string-list">
- orderId,
- orderDate,
- statusCode,
- netAmount,
- totalAmount,
- tax,
- userName,
- firstName,
- lastName,
- state,
- orderLine1Position,
- orderLine1Quantity,
- orderLine1ProductId,
- orderLine1ProductTitle,
- orderLine1ProductPrice,
- orderLine2Position,
- orderLine2Quantity,
- orderLine2ProductId,
- orderLine2ProductTitle,
- orderLine2ProductPrice
- </param>
- </resource-config>
-
- <resource-config target-profile="from-type:text/xml:smooks-order-xml AND to-type:text/xml:canonical-order-xml" selector="csv-set">
- <resource type="xsl">
- <![CDATA[
- <xsl:for-each select="csv-record">
- <Order orderId="{orderId}"
- orderDate="{orderDate}"
- statusCode="{statusCode}"
- netAmount="{netAmount}"
- totalAmount="{totalAmount}"
- tax="{tax}" >
- <Customer userName="{userName}" firstName="{firstName}" lastName="{lastName}" state="{state}" />
- <OrderLines>
- <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
- <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
- </OrderLine>
- <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
- <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
- </OrderLine>
- </OrderLines>
- </Order>
- </xsl:for-each>
- ]]>
- </resource>
- <param name="is-xslt-templatelet">true</param>
- </resource-config>
-
-</smooks-resource-list>
More information about the jboss-svn-commits
mailing list