diff --git a/org.springframework.integration.samples/build.xml b/org.springframework.integration.samples/build.xml index 7bd5eed299..0d2e82fdf9 100644 --- a/org.springframework.integration.samples/build.xml +++ b/org.springframework.integration.samples/build.xml @@ -18,6 +18,7 @@ + diff --git a/org.springframework.integration.samples/filecopy/.classpath b/org.springframework.integration.samples/filecopy/.classpath new file mode 100644 index 0000000000..f42fb64cfa --- /dev/null +++ b/org.springframework.integration.samples/filecopy/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/org.springframework.integration.samples/filecopy/.project b/org.springframework.integration.samples/filecopy/.project new file mode 100644 index 0000000000..c2900bec4d --- /dev/null +++ b/org.springframework.integration.samples/filecopy/.project @@ -0,0 +1,23 @@ + + + filecopy + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.maven.ide.eclipse.maven2Nature + org.eclipse.jdt.core.javanature + + diff --git a/org.springframework.integration.samples/filecopy/pom.xml b/org.springframework.integration.samples/filecopy/pom.xml new file mode 100644 index 0000000000..59e19f1338 --- /dev/null +++ b/org.springframework.integration.samples/filecopy/pom.xml @@ -0,0 +1,11 @@ + + + spring-integration-samples + org.springframework.integration + 1.0.3 + + 4.0.0 + filecopy + filecopy + 1.0.3 + \ No newline at end of file diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/BinaryFileCopyDemo.java b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/BinaryFileCopyDemo.java new file mode 100644 index 0000000000..47a851927b --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/BinaryFileCopyDemo.java @@ -0,0 +1,33 @@ +/* + * Copyright 2002-2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.integration.samples.filecopy; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * Demonstrating the file copy scenario using binary file source and target. + * + * @author Marius Bogoevici + */ +public class BinaryFileCopyDemo { + + public static void main(String[] args) { + FileCopyDemoCommon.setupDirectories(); + new ClassPathXmlApplicationContext("fileCopyDemo-binary.xml", BinaryFileCopyDemo.class); + } + +} diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/Exclaimer.java b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/Exclaimer.java new file mode 100644 index 0000000000..0e73b95531 --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/Exclaimer.java @@ -0,0 +1,44 @@ +/* + * Copyright 2002-2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.integration.samples.filecopy; + +import java.io.File; + +/** + * A class providing several handling methods for different types of payloads. + * + * @author Mark Fisher + * @author Marius Bogoevici + */ +public class Exclaimer { + + public String exclaim(String input) { + System.out.println("Copying text: " + input); + return input.toUpperCase(); + } + + public File exclaim(File input) { + System.out.println("Copying file: " + input.getAbsolutePath()); + return input; + } + + public byte[] exclaim(byte[] input) { + System.out.println("Copying " + input.length + " bytes ..."); + return new String(input).toUpperCase().getBytes(); + } + +} diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/FileBasedFileCopyDemo.java b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/FileBasedFileCopyDemo.java new file mode 100644 index 0000000000..8004c3e5b4 --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/FileBasedFileCopyDemo.java @@ -0,0 +1,33 @@ +/* + * Copyright 2002-2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.integration.samples.filecopy; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * Demonstrating the file copy scenario using file-based source and target. + * + * @author Marius Bogoevici + */ +public class FileBasedFileCopyDemo { + + public static void main(String[] args) { + FileCopyDemoCommon.setupDirectories(); + new ClassPathXmlApplicationContext("fileCopyDemo-file.xml", FileBasedFileCopyDemo.class); + } + +} diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/FileCopyDemoCommon.java b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/FileCopyDemoCommon.java new file mode 100644 index 0000000000..66a4edc7db --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/FileCopyDemoCommon.java @@ -0,0 +1,43 @@ +/* + * Copyright 2002-2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.integration.samples.filecopy; + +import java.io.File; + +/** + * Common functionality for the file demo. + * + * @author Marius Bogoevici + */ +public class FileCopyDemoCommon { + + public static void setupDirectories() { + String tmpDirPath = System.getProperty("java.io.tmpdir"); + File parentDir = new File(tmpDirPath + File.separator + "spring-integration-samples"); + File inDir = new File(parentDir, "input"); + File outDir = new File(parentDir, "output"); + if ((inDir.exists() || inDir.mkdirs()) && (outDir.exists() || outDir.mkdirs())) { + System.out.println("input directory is: " + inDir.getAbsolutePath()); + System.out.println("output directory is: " + outDir.getAbsolutePath()); + } + else { + System.err.println("failed to create directories within tmp dir: " + tmpDirPath); + System.exit(0); + } + } + +} diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/TextFileCopyDemo.java b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/TextFileCopyDemo.java new file mode 100644 index 0000000000..490fcb2dda --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/TextFileCopyDemo.java @@ -0,0 +1,35 @@ +/* + * Copyright 2002-2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.integration.samples.filecopy; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * Demo of file source and target adapters. + * + * @author Mark Fisher + * @author Marius Bogoevici + */ +public class TextFileCopyDemo { + + public static void main(String[] args) { + FileCopyDemoCommon.setupDirectories(); + new ClassPathXmlApplicationContext("fileCopyDemo-text.xml", TextFileCopyDemo.class); + } + +} + diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-binary.xml b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-binary.xml new file mode 100644 index 0000000000..4ab94b36a2 --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-binary.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-file.xml b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-file.xml new file mode 100644 index 0000000000..69060100c0 --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-file.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + diff --git a/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-text.xml b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-text.xml new file mode 100644 index 0000000000..de4d4df358 --- /dev/null +++ b/org.springframework.integration.samples/filecopy/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-text.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.springframework.integration.samples/pom.xml b/org.springframework.integration.samples/pom.xml index ea2e3cba58..58d8012bbf 100644 --- a/org.springframework.integration.samples/pom.xml +++ b/org.springframework.integration.samples/pom.xml @@ -9,11 +9,12 @@ pom Spring Integration Samples - 1.0.3.BUILD-20090701033844 + 1.0.3.RELEASE cafe errorhandling + filecopy helloworld jms oddeven