You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/02/05 11:04:30 UTC
svn commit: r1240692 - in /camel/trunk/components: ./ camel-beanio/
camel-beanio/src/ camel-beanio/src/main/ camel-beanio/src/main/java/
camel-beanio/src/main/java/org/ camel-beanio/src/main/java/org/apache/
camel-beanio/src/main/java/org/apache/camel/...
Author: davsclaus
Date: Sun Feb 5 10:04:28 2012
New Revision: 1240692
URL: http://svn.apache.org/viewvc?rev=1240692&view=rev
Log:
CAMEL-4964: New camel-beanio component. Thanks to James Lucas for the contribution.
Added:
camel/trunk/components/camel-beanio/ (with props)
camel/trunk/components/camel-beanio/pom.xml (with props)
camel/trunk/components/camel-beanio/src/
camel/trunk/components/camel-beanio/src/main/
camel/trunk/components/camel-beanio/src/main/java/
camel/trunk/components/camel-beanio/src/main/java/org/
camel/trunk/components/camel-beanio/src/main/java/org/apache/
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java (with props)
camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java (with props)
camel/trunk/components/camel-beanio/src/main/resources/
camel/trunk/components/camel-beanio/src/main/resources/META-INF/
camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt (with props)
camel/trunk/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt (with props)
camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/
camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/
camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/
camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/
camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/
camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio
camel/trunk/components/camel-beanio/src/test/
camel/trunk/components/camel-beanio/src/test/java/
camel/trunk/components/camel-beanio/src/test/java/org/
camel/trunk/components/camel-beanio/src/test/java/org/apache/
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java (with props)
camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java (with props)
camel/trunk/components/camel-beanio/src/test/resources/
camel/trunk/components/camel-beanio/src/test/resources/log4j.properties (with props)
camel/trunk/components/camel-beanio/src/test/resources/org/
camel/trunk/components/camel-beanio/src/test/resources/org/apache/
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/
camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml (with props)
Modified:
camel/trunk/components/pom.xml
Propchange: camel/trunk/components/camel-beanio/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Feb 5 10:04:28 2012
@@ -0,0 +1,17 @@
+.pmd
+.checkstyle
+.ruleset
+target
+.settings
+.classpath
+.project
+.wtpmodules
+prj.el
+.jdee_classpath
+.jdee_sources
+velocity.log
+eclipse-classes
+*.ipr
+*.iml
+*.iws
+*.idea
Added: camel/trunk/components/camel-beanio/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/pom.xml?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/pom.xml (added)
+++ camel/trunk/components/camel-beanio/pom.xml Sun Feb 5 10:04:28 2012
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-parent</artifactId>
+ <version>2.10-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-beanio</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Camel :: BeanIO</name>
+ <description>Camel BeanIO support</description>
+ <url>http://www.beanio.org</url>
+
+ <properties>
+ <camel.osgi.export.pkg>
+ org.apache.camel.dataformat.beanio.*;
+ </camel.osgi.export.pkg>
+ <beanio-version>1.2.2</beanio-version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.beanio</groupId>
+ <artifactId>beanio</artifactId>
+ <version>${beanio-version}</version>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Propchange: camel/trunk/components/camel-beanio/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-beanio/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java (added)
+++ camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,206 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.util.ObjectHelper;
+import org.beanio.BeanReader;
+import org.beanio.BeanReaderErrorHandlerSupport;
+import org.beanio.BeanWriter;
+import org.beanio.InvalidRecordException;
+import org.beanio.StreamFactory;
+import org.beanio.UnexpectedRecordException;
+import org.beanio.UnidentifiedRecordException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A <a href="http://camel.apache.org/data-format.html">data format</a> (
+ * {@link DataFormat}) for beanio data.
+ */
+public class BeanIODataFormat implements DataFormat {
+
+ private static final String LOG_PREFIX = "BeanIO: ";
+ private static final transient Logger LOG = LoggerFactory.getLogger(BeanIODataFormat.class);
+
+ private StreamFactory factory;
+ private String streamName;
+ private boolean ignoreUnidentifiedRecords;
+ private boolean ignoreUnexpectedRecords;
+ private boolean ignoreInvalidRecords;
+ private Charset characterSet = Charset.defaultCharset();
+
+ public BeanIODataFormat(String mapping, String streamName) {
+ // Create the stream factory that will be used to read/write objects.
+ factory = StreamFactory.newInstance();
+
+ // Load the mapping file
+ factory.loadResource(mapping);
+
+ // Save the stream name that we want to read
+ this.streamName = streamName;
+ }
+
+ public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
+
+ validateRequiredProperties();
+
+ List<Object> models = getModels(exchange, body);
+
+ writeModels(stream, models);
+ }
+
+ private void validateRequiredProperties() {
+ ObjectHelper.notNull(factory, "StreamFactory not configured.");
+ ObjectHelper.notNull(streamName, "Stream name not configured.");
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<Object> getModels(Exchange exchange, Object body) {
+ List<Object> models;
+ if ((models = exchange.getContext().getTypeConverter().convertTo(List.class, body)) == null) {
+ models = new ArrayList<Object>();
+ Iterator<Object> it = ObjectHelper.createIterator(body);
+ while (it.hasNext()) {
+ models.add(it.next());
+ }
+ }
+ return models;
+ }
+
+ private void writeModels(OutputStream stream, List<Object> models) {
+ BufferedWriter streamWriter = new BufferedWriter(new OutputStreamWriter(stream, characterSet));
+ BeanWriter out = factory.createWriter(streamName, streamWriter);
+
+ for (Object obj : models) {
+ out.write(obj);
+ }
+
+ out.flush();
+ out.close();
+ }
+
+ public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+ validateRequiredProperties();
+ return readModels(exchange, stream);
+ }
+
+ private List<Object> readModels(Exchange exchange, InputStream stream) {
+ List<Object> results = new ArrayList<Object>();
+ BufferedReader streamReader = new BufferedReader(new InputStreamReader(stream, characterSet));
+
+ BeanReader in = factory.createReader(streamName, streamReader);
+
+ try {
+ registerErrorHandler(in);
+
+ Object readObject;
+ while ((readObject = in.read()) != null) {
+ if (readObject instanceof BeanIOHeader) {
+ exchange.getOut().getHeaders().putAll(((BeanIOHeader) readObject).getHeaders());
+ }
+ results.add(readObject);
+ }
+ } finally {
+ in.close();
+ }
+
+ return results;
+ }
+
+ private void registerErrorHandler(BeanReader in) {
+ in.setErrorHandler(new BeanReaderErrorHandlerSupport() {
+
+ @Override
+ public void invalidRecord(InvalidRecordException ex) throws Exception {
+ LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getContext().getRecordText());
+
+ if (!ignoreInvalidRecords) {
+ throw ex;
+ }
+ }
+
+ @Override
+ public void unexpectedRecord(UnexpectedRecordException ex) throws Exception {
+ LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getContext().getRecordText());
+
+ if (!ignoreUnexpectedRecords) {
+ throw ex;
+ }
+ }
+
+ @Override
+ public void unidentifiedRecord(UnidentifiedRecordException ex) throws Exception {
+ LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getContext().getRecordText());
+
+ if (!ignoreUnidentifiedRecords) {
+ throw ex;
+ }
+ }
+ });
+ }
+
+ /**
+ * @param streamName The beanio stream that will be marshaled/unmarshaled.
+ */
+ public void setStreamName(String streamName) {
+ this.streamName = streamName;
+ }
+
+ /**
+ * @param ignoreUnidentifiedRecords When true any unidentified records will be ignored when
+ * unmarshaling.
+ */
+ public void setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords) {
+ this.ignoreUnidentifiedRecords = ignoreUnidentifiedRecords;
+ }
+
+ /**
+ * @param ignoreUnexpectedRecords When true any unexpected records will be ignored when
+ * unmarshaling.
+ */
+ public void setIgnoreUnexpectedRecords(boolean ignoreUnexpectedRecords) {
+ this.ignoreUnexpectedRecords = ignoreUnexpectedRecords;
+ }
+
+ /**
+ * @param ignoreInvalidRecords When true any invalid records will be ignored when
+ * unmarshaling.
+ */
+ public void setIgnoreInvalidRecords(boolean ignoreInvalidRecords) {
+ this.ignoreInvalidRecords = ignoreInvalidRecords;
+ }
+
+ /**
+ * @param characterSet the characterSet to set
+ */
+ public void setCharacterSet(String characterSet) {
+ this.characterSet = Charset.forName(characterSet);
+ }
+}
Propchange: camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java (added)
+++ camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+import java.util.Map;
+
+public interface BeanIOHeader {
+
+ Map<String, Object> getHeaders();
+
+}
Propchange: camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt (added)
+++ camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt Sun Feb 5 10:04:28 2012
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
Propchange: camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:executable = *
Propchange: camel/trunk/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: camel/trunk/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt (added)
+++ camel/trunk/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt Sun Feb 5 10:04:28 2012
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
Propchange: camel/trunk/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio (added)
+++ camel/trunk/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio Sun Feb 5 10:04:28 2012
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+class=org.apache.camel.dataformat.beanio.BeanIODataFormat
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+public class A1Record extends Record {
+ Double currentPrice;
+
+ public A1Record() {
+ }
+
+ public A1Record(String sedol, String source, Double currentPrice) {
+ super(sedol, source);
+ this.currentPrice = currentPrice;
+ }
+
+ public Double getCurrentPrice() {
+ return currentPrice;
+ }
+
+ public void setCurrentPrice(Double currentPrice) {
+ this.currentPrice = currentPrice;
+ }
+
+ @Override
+ public int hashCode() {
+ return currentPrice != null ? currentPrice.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (obj == this) {
+ return true;
+ } else {
+ A1Record record = (A1Record) obj;
+ return super.equals(record) && this.currentPrice.doubleValue() == record.getCurrentPrice().doubleValue();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "SEDOL[" + this.sedol + "], SOURCE[" + this.source + "], PRICE[" + this.currentPrice + "]";
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+public class B1Record extends Record {
+ String securityName;
+
+ public B1Record() {
+ }
+
+ public B1Record(String sedol, String source, String securityName) {
+ super(sedol, source);
+ this.securityName = securityName;
+ }
+
+ public String getSecurityName() {
+ return securityName;
+ }
+
+ public void setSecurityName(String securityName) {
+ this.securityName = securityName;
+ }
+
+ @Override
+ public int hashCode() {
+ return securityName != null ? securityName.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (obj == this) {
+ return true;
+ } else {
+ B1Record record = (B1Record) obj;
+ return super.equals(record) && this.securityName.equals(record.getSecurityName());
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "SEDOL[" + this.sedol + "], SOURCE[" + this.source + "], NAME[" + this.securityName + "]";
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,211 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.beanio.InvalidRecordException;
+import org.beanio.UnexpectedRecordException;
+import org.beanio.UnidentifiedRecordException;
+import org.junit.Test;
+
+public class BeanIODataFormatComplexTest extends CamelTestSupport {
+
+ private final String recordData = "0001917A112345.678900 " + LS
+ + "0002374A159303290.020 " + LS
+ + "0015219B1SECURITY ONE " + LS
+ + "END OF SECTION 1 " + LS
+ + "0076647A10.0000000001 " + LS
+ + "0135515A1999999999999 " + LS
+ + "2000815B1SECURITY TWO " + LS
+ + "2207122B1SECURITY THR " + LS
+ + "END OF FILE 000007 " + LS;
+
+ private final String data = "0000000A1030808PRICE " + LS
+ + "0000000B1030808SECURITY " + LS
+ + "HEADER END " + LS
+ + recordData;
+
+ private final String unExpectedData = "0000000A1030808PRICE " + LS
+ + "0000000B1030808SECURITY " + LS
+ + "0000000B1030808SECURITY " + LS
+ + "HEADER END " + LS
+ + recordData;
+
+ private final String invalidData = "0000000A1030808PRICE " + LS
+ + "0000000B1030808SECURITY EXTRA DATA" + LS
+ + "0000000B1030808SECURITY " + LS
+ + "HEADER END " + LS
+ + recordData;
+
+ private final String unidentifiedData = "0000000A1030808PRICE " + LS
+ + "0000000C1030808SECURITY " + LS
+ + "0000000B1030808SECURITY " + LS
+ + "HEADER END " + LS
+ + recordData;
+
+ @Test
+ public void testMarshal() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:beanio-marshal");
+ mock.expectedBodiesReceived(data);
+
+ template.sendBody("direct:marshal", createTestData(false));
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testUnmarshal() throws Exception {
+ context.setTracing(true);
+ MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
+ mock.expectedBodiesReceived(createTestData(false));
+
+ template.sendBody("direct:unmarshal", data);
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testUnmarshalUnexpected() throws Exception {
+ Throwable ex = null;
+
+ try {
+ template.sendBody("direct:unmarshal", unExpectedData);
+ } catch (Exception e) {
+ ex = e.getCause();
+ }
+
+ assertIsInstanceOf(UnexpectedRecordException.class, ex);
+ }
+
+ @Test
+ public void testUnmarshalInvalid() throws Exception {
+ Throwable ex = null;
+
+ try {
+ template.sendBody("direct:unmarshal", invalidData);
+ } catch (Exception e) {
+ ex = e.getCause();
+ }
+
+ assertIsInstanceOf(InvalidRecordException.class, ex);
+ }
+
+ @Test
+ public void testUnmarshalUnidentifiedIgnore() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
+ mock.expectedBodiesReceived(createTestData(false));
+ template.sendBody("direct:unmarshal-forgiving", unidentifiedData);
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testUnmarshalUnexpectedIgnore() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
+ mock.expectedBodiesReceived(createTestData(false));
+ template.sendBody("direct:unmarshal-forgiving", unExpectedData);
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testUnmarshalInvalidIgnore() throws Exception {
+ context.setTracing(true);
+ MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
+ mock.expectedBodiesReceived(createTestData(true));
+ template.sendBody("direct:unmarshal-forgiving", invalidData);
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testUnmarshalUnidentified() throws Exception {
+ Throwable ex = null;
+
+ try {
+ template.sendBody("direct:unmarshal", unidentifiedData);
+ } catch (Exception e) {
+ ex = e.getCause();
+ }
+
+ assertIsInstanceOf(UnidentifiedRecordException.class, ex);
+ }
+
+ private List<Object> createTestData(boolean skipB1header) throws ParseException {
+ String source = "camel-beanio";
+ List<Object> body = new ArrayList<Object>();
+
+ Date date = new SimpleDateFormat("ddMMyy").parse("030808");
+ Header hFirst = new Header("A1", date, "PRICE");
+ Header hSecond = new Header("B1", date, "SECURITY");
+ Separator headerEnd = new Separator("HEADER END");
+
+ A1Record first = new A1Record("0001917", source, 12345.678900);
+ A1Record second = new A1Record("0002374", source, 59303290.020);
+ B1Record third = new B1Record("0015219", source, "SECURITY ONE");
+ Separator sectionEnd = new Separator("END OF SECTION 1");
+ A1Record fourth = new A1Record("0076647", source, 0.0000000001);
+ A1Record fifth = new A1Record("0135515", source, 999999999999d);
+ B1Record sixth = new B1Record("2000815", source, "SECURITY TWO");
+ B1Record seventh = new B1Record("2207122", source, "SECURITY THR");
+
+ body.add(hFirst);
+ if (!skipB1header) {
+ body.add(hSecond);
+ }
+ body.add(headerEnd);
+ body.add(first);
+ body.add(second);
+ body.add(third);
+ body.add(sectionEnd);
+ body.add(fourth);
+ body.add(fifth);
+ body.add(sixth);
+ body.add(seventh);
+
+ Trailer trailer = new Trailer(7);
+ body.add(trailer);
+
+ return body;
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ BeanIODataFormat format = new BeanIODataFormat("org/apache/camel/dataformat/beanio/mappings.xml", "securityData");
+
+ BeanIODataFormat forgivingFormat = new BeanIODataFormat("org/apache/camel/dataformat/beanio/mappings.xml", "securityData");
+ forgivingFormat.setIgnoreInvalidRecords(true);
+ forgivingFormat.setIgnoreUnexpectedRecords(true);
+ forgivingFormat.setIgnoreUnidentifiedRecords(true);
+
+ from("direct:unmarshal").unmarshal(format).split(simple("body")).to("mock:beanio-unmarshal");
+
+ from("direct:unmarshal-forgiving").unmarshal(forgivingFormat).split(simple("body")).to("mock:beanio-unmarshal");
+
+ from("direct:marshal").marshal(format).to("mock:beanio-marshal");
+ }
+ };
+ }
+}
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class BeanIODataFormatSimpleTest extends CamelTestSupport {
+
+ private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + LS
+ + "Jane,Doe,Architect,80000,01152008" + LS
+ + "Jon,Anderson,Manager,85000,03182007" + LS;
+
+ @Test
+ public void testMarshal() throws Exception {
+ List<Employee> employees = getEmployees();
+
+ MockEndpoint mock = getMockEndpoint("mock:beanio-marshal");
+ mock.expectedBodiesReceived(FIXED_DATA);
+
+ template.sendBody("direct:marshal", employees);
+
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testUnmarshal() throws Exception {
+ List<Employee> employees = getEmployees();
+
+ MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
+ mock.expectedBodiesReceived(employees);
+
+ template.sendBody("direct:unmarshal", FIXED_DATA);
+
+ mock.assertIsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ DataFormat format = new BeanIODataFormat(
+ "org/apache/camel/dataformat/beanio/mappings.xml",
+ "employeeFile");
+
+ from("direct:unmarshal").unmarshal(format)
+ .split(simple("body")).to("mock:beanio-unmarshal");
+
+ from("direct:marshal").marshal(format)
+ .to("mock:beanio-marshal");
+ }
+ };
+ }
+
+ private List<Employee> getEmployees() throws ParseException {
+ List<Employee> employees = new ArrayList<Employee>();
+ Employee one = new Employee();
+ one.setFirstName("Joe");
+ one.setLastName("Smith");
+ one.setTitle("Developer");
+ one.setSalary(75000);
+ one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009"));
+ employees.add(one);
+
+ Employee two = new Employee();
+ two.setFirstName("Jane");
+ two.setLastName("Doe");
+ two.setTitle("Architect");
+ two.setSalary(80000);
+ two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008"));
+ employees.add(two);
+
+ Employee three = new Employee();
+ three.setFirstName("Jon");
+ three.setLastName("Anderson");
+ three.setTitle("Manager");
+ three.setSalary(85000);
+ three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007"));
+ employees.add(three);
+ return employees;
+ }
+}
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,100 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+import java.util.Date;
+
+public class Employee {
+
+ private String firstName;
+ private String lastName;
+ private String title;
+ private int salary;
+ private Date hireDate;
+
+ public Employee() {
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getSalary() {
+ return salary;
+ }
+
+ public void setSalary(int salary) {
+ this.salary = salary;
+ }
+
+ public Date getHireDate() {
+ return hireDate;
+ }
+
+ public void setHireDate(Date hireDate) {
+ this.hireDate = hireDate;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = firstName != null ? firstName.hashCode() : 0;
+ result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
+ result = 31 * result + (title != null ? title.hashCode() : 0);
+ result = 31 * result + salary;
+ result = 31 * result + (hireDate != null ? hireDate.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (object == null) {
+ return false;
+ } else if (object == this) {
+ return true;
+ } else if (!(object instanceof Employee)) {
+ return false;
+ }
+
+ Employee e = (Employee) object;
+
+ return this.getFirstName().equals(e.getFirstName())
+ && this.getLastName().equals(e.getLastName())
+ && this.getTitle().equals(e.getTitle())
+ && this.getSalary() == e.getSalary()
+ && this.getHireDate().equals(e.getHireDate());
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+public class Header implements BeanIOHeader {
+
+ String identifier;
+ String recordType;
+ Date headerDate;
+
+ public Header() {
+ }
+
+ public Header(String identifier, Date headerDate, String recordType) {
+ this.identifier = identifier;
+ this.headerDate = headerDate;
+ this.recordType = recordType;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = identifier != null ? identifier.hashCode() : 0;
+ result = 31 * result + (recordType != null ? recordType.hashCode() : 0);
+ result = 31 * result + (headerDate != null ? headerDate.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (obj == this) {
+ return true;
+ } else {
+ Header record = (Header) obj;
+ return identifier.equals(record.getIdentifier()) && recordType.equals(record.getRecordType());
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "TYPE[" + this.recordType + "], IDENTIFIER[" + this.identifier + "]";
+ }
+
+ /**
+ * @return the identifier
+ */
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ /**
+ * @param identifier the identifier to set
+ */
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * @return the headerDate
+ */
+ public Date getHeaderDate() {
+ return headerDate;
+ }
+
+ /**
+ * @param headerDate the headerDate to set
+ */
+ public void setHeaderDate(Date headerDate) {
+ this.headerDate = headerDate;
+ }
+
+ /**
+ * @return the recordType
+ */
+ public String getRecordType() {
+ return recordType;
+ }
+
+ /**
+ * @param recordType the recordType to set
+ */
+ public void setRecordType(String recordType) {
+ this.recordType = recordType;
+ }
+
+ @Override
+ public Map<String, Object> getHeaders() {
+ Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put(recordType + "Date", headerDate);
+ return headers;
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+public abstract class Record {
+ String sedol;
+ String source;
+
+ public Record() {
+ }
+
+ public Record(String sedol, String source) {
+ this.sedol = sedol;
+ this.source = source;
+ }
+
+ public String getSedol() {
+ return sedol;
+ }
+
+ public void setSedol(String sedol) {
+ this.sedol = sedol;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = sedol != null ? sedol.hashCode() : 0;
+ result = 31 * result + (source != null ? source.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (obj == this) {
+ return true;
+ } else {
+ Record record = (Record) obj;
+ return sedol.equals(record.getSedol()) && source.equals(record.getSource());
+ }
+ }
+}
+
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+public class Separator {
+ String value;
+
+ public Separator() {
+ }
+
+ public Separator(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public int hashCode() {
+ return value != null ? value.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (obj == this) {
+ return true;
+ } else {
+ Separator record = (Separator) obj;
+ return this.value.equals(record.getValue());
+ }
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
+
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java (added)
+++ camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java Sun Feb 5 10:04:28 2012
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.dataformat.beanio;
+
+public class Trailer {
+ int numberOfRecords;
+
+ public Trailer() {
+ }
+
+ public Trailer(int numberOfRecords) {
+ this.numberOfRecords = numberOfRecords;
+ }
+
+ @Override
+ public int hashCode() {
+ return numberOfRecords;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (obj == this) {
+ return true;
+ } else {
+ Trailer record = (Trailer) obj;
+ return this.numberOfRecords == record.getNumberOfRecords();
+ }
+ }
+
+ /**
+ * @return the numberOfRecords
+ */
+ public int getNumberOfRecords() {
+ return numberOfRecords;
+ }
+
+ /**
+ * @param numberOfRecords the numberOfRecords to set
+ */
+ public void setNumberOfRecords(int numberOfRecords) {
+ this.numberOfRecords = numberOfRecords;
+ }
+}
+
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-beanio/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/resources/log4j.properties?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/resources/log4j.properties (added)
+++ camel/trunk/components/camel-beanio/src/test/resources/log4j.properties Sun Feb 5 10:04:28 2012
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, file
+
+#log4j.logger.org.apache.camel.dataformat.beanio=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d %-5p %c{1} - %m %n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
+log4j.appender.file.file=target/camel-beanio-test.log
+
Propchange: camel/trunk/components/camel-beanio/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-beanio/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml?rev=1240692&view=auto
==============================================================================
--- camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml (added)
+++ camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml Sun Feb 5 10:04:28 2012
@@ -0,0 +1,113 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<beanio xmlns="http://www.beanio.org/2011/01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.beanio.org/2011/01 http://www.beanio.org/2011/01/mapping.xsd">
+
+ <template name="A1Record">
+ <field name="sedol" type="string" length="7"/>
+ <field name="identifier" rid="true" literal="A1" ignore="true"/>
+ <field name="currentPrice" type="double" length="12" format="0.000000####"/>
+ <field name="padding" type="string" length="11" ignore="true"/>
+ <property name="source" value="camel-beanio"/>
+ </template>
+
+ <template name="B1Record">
+ <field name="sedol" type="string" length="7"/>
+ <field name="identifier" rid="true" literal="B1" ignore="true"/>
+ <field name="securityName" type="string" length="12"/>
+ <field name="padding" type="string" length="11" ignore="true"/>
+ <property name="source" value="camel-beanio"/>
+ </template>
+
+ <stream name="employeeFile" format="csv">
+ <record name="employee" class="org.apache.camel.dataformat.beanio.Employee">
+ <field name="firstName"/>
+ <field name="lastName"/>
+ <field name="title"/>
+ <field name="salary"/>
+ <field name="hireDate" format="MMddyyyy"/>
+ </record>
+ </stream>
+
+ <stream name="securityData" format="fixedlength" ordered="true">
+
+ <group name="headerGroup" minOccurs="1" maxOccurs="1" order="1">
+
+ <record name="headerA1" class="org.apache.camel.dataformat.beanio.Header" order="1" minLength="32" maxLength="32"
+ minOccurs="1" maxOccurs="1">
+ <field name="zeros" type="string" length="7" literal="0000000" ignore="true"/>
+ <field name="identifier" type="string" length="2" rid="true" literal="A1"/>
+ <field name="headerDate" type="date" length="6" format="ddMMyy"/>
+ <field name="recordType" type="string" length="17"/>
+ </record>
+
+ <record name="headerB1" class="org.apache.camel.dataformat.beanio.Header" order="2" minLength="32" maxLength="32"
+ minOccurs="1" maxOccurs="1">
+ <field name="zeros" type="string" length="7" literal="0000000" ignore="true"/>
+ <field name="identifier" type="string" length="2" rid="true" literal="B1"/>
+ <field name="headerDate" type="date" length="6" format="ddMMyy"/>
+ <field name="recordType" type="string" length="17"/>
+ </record>
+
+ <!-- Ignore the HEADER END by not setting a class -->
+ <record name="headerEnd" class="org.apache.camel.dataformat.beanio.Separator" order="3" minLength="32"
+ maxLength="32" minOccurs="1" maxOccurs="1">
+ <field name="value" rid="true" literal="HEADER END" default="HEADER END" required="true"/>
+ <field name="padding" length="22" ignore="true"/>
+ </record>
+
+ </group>
+
+ <group name="section1" minOccurs="1" maxOccurs="1" order="2">
+
+ <record name="A1" template="A1Record"
+ class="org.apache.camel.dataformat.beanio.A1Record" minOccurs="0"
+ maxOccurs="unbounded" minLength="32" maxLength="32"/>
+ <record name="B1" template="B1Record"
+ class="org.apache.camel.dataformat.beanio.B1Record" minOccurs="0"
+ maxOccurs="unbounded" minLength="32" maxLength="32"/>
+
+ <record name="endOfUk" class="org.apache.camel.dataformat.beanio.Separator" minOccurs="1" maxOccurs="1"
+ minLength="32" maxLength="32">
+ <field name="value" rid="true" literal="END OF SECTION 1"/>
+ <field name="padding" length="16" ignore="true"/>
+ </record>
+
+ </group>
+
+ <group name="section2" minOccurs="1" maxOccurs="1" order="3">
+
+ <record name="A1" template="A1Record"
+ class="org.apache.camel.dataformat.beanio.A1Record" minOccurs="0"
+ maxOccurs="unbounded" minLength="32" maxLength="32"/>
+ <record name="B1" template="B1Record"
+ class="org.apache.camel.dataformat.beanio.B1Record" minOccurs="0"
+ maxOccurs="unbounded" minLength="32" maxLength="32"/>
+
+ <record name="endOfFile" class="org.apache.camel.dataformat.beanio.Trailer" minOccurs="1" maxOccurs="1"
+ minLength="32" maxLength="32">
+ <field name="endOfFile" rid="true" literal="END OF FILE" ignore="true"/>
+ <field name="spacer" literal=" " length="1" ignore="true"/>
+ <field name="numberOfRecords" type="integer" length="6" format="000000"/>
+ <field name="padding" length="14" ignore="true"/>
+ </record>
+
+ </group>
+
+ </stream>
+
+</beanio>
\ No newline at end of file
Propchange: camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1240692&r1=1240691&r2=1240692&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Sun Feb 5 10:04:28 2012
@@ -59,6 +59,7 @@
<module>camel-atom</module>
<module>camel-avro</module>
<module>camel-aws</module>
+ <module>camel-beanio</module>
<module>camel-bean-validator</module>
<module>camel-bindy</module>
<module>camel-cache</module>