You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ha...@apache.org on 2009/06/26 21:42:35 UTC

svn commit: r788832 - in /camel/trunk/components/camel-bindy/src: main/java/org/apache/camel/dataformat/bindy/ main/java/org/apache/camel/dataformat/bindy/annotation/ test/java/org/apache/camel/dataformat/bindy/fix/ test/java/org/apache/camel/dataforma...

Author: hadrian
Date: Fri Jun 26 19:42:35 2009
New Revision: 788832

URL: http://svn.apache.org/viewvc?rev=788832&view=rev
Log:
Checkstyle and typo fixes.

Modified:
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Section.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/body/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/header/Header.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/trailer/Trailer.java

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java Fri Jun 26 19:42:35 2009
@@ -35,138 +35,127 @@
  * supported by camel bindy
  */
 public abstract class BindyAbstractFactory implements BindyFactory {
-	private static final transient Log LOG = LogFactory.getLog(BindyAbstractFactory.class);
-	protected Set<Class> models;
-	protected Map<String, Field> mapAnnotedLinkField = new LinkedHashMap<String, Field>();
-	protected String crlf;
-
-	private AnnotationModelLoader modelsLoader;
-	private String[] packageNames;
-
-	public BindyAbstractFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
-		this.modelsLoader = new AnnotationModelLoader(resolver);
-		this.packageNames = packageNames;
-
-		if (LOG.isDebugEnabled()) {
-			LOG.debug("Package(s) name : " + packageNames.toString());
-		}
-
-		initModel();
-	}
-
-	/**
-	 * method uses to initialize the model representing the classes who will
-	 * bind the data. This process will scan for classes according to the
-	 * package name provided, check the classes and fields annoted.
-	 * 
-	 * @throws Exception
-	 */
-	public void initModel() throws Exception {
-
-		// Find classes defined as Model
-		initModelClasses(this.packageNames);
-
-	}
-
-	/**
-	 * Find all the classes defined as model
-	 */
-	private void initModelClasses(String... packageNames) throws Exception {
-		models = modelsLoader.loadModels(packageNames);
-	}
-
-	/**
-	 * Find fields annoted in each class of the model
-	 */
-	public abstract void initAnnotedFields() throws Exception;
-
-	public abstract void bind(List<String> data, Map<String, Object> model) throws Exception;
-
-	public abstract String unbind(Map<String, Object> model) throws Exception;
-
-	/**
-	 * Link objects together (Only 1to1 relation is allowed)
-	 */
-	public void link(Map<String, Object> model) throws Exception {
-
-		for (String link : mapAnnotedLinkField.keySet()) {
-
-			Field field = mapAnnotedLinkField.get(link);
-			field.setAccessible(true);
-
-			// Retrieve linked object
-			String toClassName = field.getType().getName();
-			Object to = model.get(toClassName);
-
-			ObjectHelper.notNull(to, "No @link annotation has been defined for the oject to link");
-			field.set(model.get(field.getDeclaringClass().getName()), to);
-
-		}
-	}
-
-	/**
-	 * Factory method generating new instances of the model and adding them to a
-	 * HashMap
-	 * 
-	 * @return Map is a collection of the objects used to bind data from
-	 *         records, messages
-	 * @throws Exception
-	 *             can be thrown
-	 */
-	public Map<String, Object> factory() throws Exception {
-
-		Map<String, Object> mapModel = new HashMap<String, Object>();
-
-		for (Class<?> cl : models) {
-
-			Object obj = ObjectHelper.newInstance(cl);
-
-			// Add instance of the class to the Map Model
-			mapModel.put(obj.getClass().getName(), obj);
-
-		}
-
-		return mapModel;
-	}
-
-	/**
-	 * Generate a unique key
-	 * 
-	 * @param key1
-	 *            The key of the section number
-	 * @param key2
-	 *            The key of the position of the field
-	 * @return the key generated
-	 */
-	protected static Integer generateKey(Integer key1, Integer key2) {
-		
-		String key2Formated = getNumberFormat().format((long)key2);
-		String keyGenerated = String.valueOf(key1) + key2Formated;
-		
-		return Integer.valueOf(keyGenerated);
-
-	}
-
-	/**
-	 * 
-	 * @return NumberFormat
-	 */
-	private static NumberFormat getNumberFormat() {
-		
-		// Get instance of NumberFormat
-		NumberFormat nf = NumberFormat.getInstance();
-	
-		// set max number of digits to 3 (thousands) 
-		nf.setMaximumIntegerDigits(3);
-		nf.setMinimumIntegerDigits(3);
-		
-		return nf;
-	}
-
-	/**
-	 * Find the carriage return set
-	 */
-	public String getCarriageReturn() {
-		return crlf;
-	}
+    private static final transient Log LOG = LogFactory.getLog(BindyAbstractFactory.class);
+    protected Set<Class> models;
+    protected Map<String, Field> mapAnnotatedLinkField = new LinkedHashMap<String, Field>();
+    protected String crlf;
+
+    private AnnotationModelLoader modelsLoader;
+    private String[] packageNames;
+
+    public BindyAbstractFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
+        this.modelsLoader = new AnnotationModelLoader(resolver);
+        this.packageNames = packageNames;
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Package(s) name : " + packageNames.toString());
+        }
+
+        initModel();
+    }
+
+    /**
+     * method uses to initialize the model representing the classes who will
+     * bind the data. This process will scan for classes according to the
+     * package name provided, check the annotated classes and fields.
+     * 
+     * @throws Exception
+     */
+    public void initModel() throws Exception {
+        // Find classes defined as Model
+        initModelClasses(this.packageNames);
+    }
+
+    /**
+     * Find all the classes defined as model
+     */
+    private void initModelClasses(String... packageNames) throws Exception {
+        models = modelsLoader.loadModels(packageNames);
+    }
+
+    /**
+     * Find fields annoted in each class of the model
+     */
+    public abstract void initAnnotedFields() throws Exception;
+
+    public abstract void bind(List<String> data, Map<String, Object> model) throws Exception;
+
+    public abstract String unbind(Map<String, Object> model) throws Exception;
+
+    /**
+     * Link objects together (Only 1to1 relation is allowed)
+     */
+    public void link(Map<String, Object> model) throws Exception {
+        for (String link : mapAnnotatedLinkField.keySet()) {
+            Field field = mapAnnotatedLinkField.get(link);
+            field.setAccessible(true);
+
+            // Retrieve linked object
+            String toClassName = field.getType().getName();
+            Object to = model.get(toClassName);
+
+            ObjectHelper.notNull(to, "No @link annotation has been defined for the oject to link");
+            field.set(model.get(field.getDeclaringClass().getName()), to);
+        }
+    }
+
+    /**
+     * Factory method generating new instances of the model and adding them to a
+     * HashMap
+     * 
+     * @return Map is a collection of the objects used to bind data from
+     *         records, messages
+     * @throws Exception
+     *         can be thrown
+     */
+    public Map<String, Object> factory() throws Exception {
+        Map<String, Object> mapModel = new HashMap<String, Object>();
+
+        for (Class<?> cl : models) {
+            Object obj = ObjectHelper.newInstance(cl);
+
+            // Add instance of the class to the Map Model
+            mapModel.put(obj.getClass().getName(), obj);
+        }
+
+        return mapModel;
+    }
+
+    /**
+     * Generate a unique key
+     * 
+     * @param key1
+     *            The key of the section number
+     * @param key2
+     *            The key of the position of the field
+     * @return the key generated
+     */
+    protected static Integer generateKey(Integer key1, Integer key2) {
+        String key2Formated = getNumberFormat().format((long)key2);
+        String keyGenerated = String.valueOf(key1) + key2Formated;
+        
+        return Integer.valueOf(keyGenerated);
+    }
+
+    /**
+     * 
+     * @return NumberFormat
+     */
+    private static NumberFormat getNumberFormat() {
+        // Get instance of NumberFormat
+        NumberFormat nf = NumberFormat.getInstance();
+    
+        // set max number of digits to 3 (thousands) 
+        nf.setMaximumIntegerDigits(3);
+        nf.setMinimumIntegerDigits(3);
+        
+        return nf;
+    }
+
+    /**
+     * Find the carriage return set
+     */
+    public String getCarriageReturn() {
+        return crlf;
+    }
 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java Fri Jun 26 19:42:35 2009
@@ -42,125 +42,124 @@
  */
 public class BindyCsvFactory extends BindyAbstractFactory implements BindyFactory {
 
-	private static final transient Log LOG = LogFactory.getLog(BindyCsvFactory.class);
+    private static final transient Log LOG = LogFactory.getLog(BindyCsvFactory.class);
 
-	private Map<Integer, DataField> mapDataField = new LinkedHashMap<Integer, DataField>();
-	private Map<Integer, Field> mapAnnotedField = new LinkedHashMap<Integer, Field>();
-	private Map<String, Integer> sections = new HashMap<String, Integer>();
-
-	private String separator;
-	private boolean skipFirstLine;
-	private boolean messageOrdered;
-
-	public BindyCsvFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
-
-		super(resolver, packageNames);
-
-		// initialize specific parameters of the csv model
-		initCsvModel();
-	}
-
-	/**
-	 * method uses to initialize the model representing the classes who will
-	 * bind the data This process will scan for classes according to the package
-	 * name provided, check the classes and fields annoted and retrieve the
-	 * separator of the CSV record
-	 * 
-	 * @throws Exception
-	 */
-	public void initCsvModel() throws Exception {
-
-		// Find annotated Datafields declared in the Model classes
-		initAnnotedFields();
-
-		// initialize Csv parameter(s)
-		// separator and skip first line from @CSVrecord annotation
-		initCsvRecordParameters();
-	}
-
-	public void initAnnotedFields() {
-
-		for (Class<?> cl : models) {
-
-			if (LOG.isDebugEnabled()) {
-				LOG.debug("Class retrieved : " + cl.getName());
-			}
-
-			for (Field field : cl.getDeclaredFields()) {
-				DataField dataField = field.getAnnotation(DataField.class);
-				if (dataField != null) {
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Position defined in the class : " + cl.getName() + ", position : " + dataField.pos()
-								+ ", Field : " + dataField.toString());
-					}
-					mapDataField.put(dataField.pos(), dataField);
-					mapAnnotedField.put(dataField.pos(), field);
-				}
-
-				Link linkField = field.getAnnotation(Link.class);
-
-				if (linkField != null) {
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Class linked  : " + cl.getName() + ", Field" + field.toString());
-					}
-					mapAnnotedLinkField.put(cl.getName(), field);
-				}
-			}
-		}
-	}
-
-	public void bind(List<String> data, Map<String, Object> model) throws Exception {
-
-		int pos = 0;
-		while (pos < data.size()) {
-
-			// Set the field with the data received
-			// Only when no empty line is provided
-			// Data is transformed according to the pattern defined or by
-			// default the type of the field (int, double, String, ...)
-
-			if (!data.get(pos).equals("")) {
-
-				DataField dataField = mapDataField.get(pos);
-				ObjectHelper.notNull(dataField, "No position defined for the field positoned : " + pos);
-				Field field = mapAnnotedField.get(pos);
-				field.setAccessible(true);
-
-				if (LOG.isDebugEnabled()) {
-					LOG.debug("Pos : " + pos + ", Data : " + data.get(pos) + ", Field type : " + field.getType());
-				}
-
-				Format<?> format;
-				String pattern = dataField.pattern();
-
-				format = FormatFactory.getFormat(field.getType(), pattern, dataField.precision());
-				field.set(model.get(field.getDeclaringClass().getName()), format.parse(data.get(pos)));
-			}
-			pos++;
-		}
-	}
+    private Map<Integer, DataField> mapDataField = new LinkedHashMap<Integer, DataField>();
+    private Map<Integer, Field> mapAnnotedField = new LinkedHashMap<Integer, Field>();
+    private Map<String, Integer> sections = new HashMap<String, Integer>();
 
-	public String unbind(Map<String, Object> model) throws Exception {
+    private String separator;
+    private boolean skipFirstLine;
+    private boolean messageOrdered;
+
+    public BindyCsvFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
+        super(resolver, packageNames);
+
+        // initialize specific parameters of the csv model
+        initCsvModel();
+    }
+
+    /**
+     * method uses to initialize the model representing the classes who will
+     * bind the data. This process will scan for classes according to the package
+     * name provided, check the annotated classes and fields and retrieve the
+     * separator of the CSV record
+     * 
+     * @throws Exception
+     */
+    public void initCsvModel() throws Exception {
+
+        // Find annotated Datafields declared in the Model classes
+        initAnnotedFields();
+
+        // initialize Csv parameter(s)
+        // separator and skip first line from @CSVrecord annotation
+        initCsvRecordParameters();
+    }
+
+    public void initAnnotedFields() {
+
+        for (Class<?> cl : models) {
+
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Class retrieved : " + cl.getName());
+            }
+
+            for (Field field : cl.getDeclaredFields()) {
+                DataField dataField = field.getAnnotation(DataField.class);
+                if (dataField != null) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Position defined in the class : " + cl.getName() + ", position : " + dataField.pos()
+                                + ", Field : " + dataField.toString());
+                    }
+                    mapDataField.put(dataField.pos(), dataField);
+                    mapAnnotedField.put(dataField.pos(), field);
+                }
+
+                Link linkField = field.getAnnotation(Link.class);
+
+                if (linkField != null) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Class linked  : " + cl.getName() + ", Field" + field.toString());
+                    }
+                    mapAnnotatedLinkField.put(cl.getName(), field);
+                }
+            }
+        }
+    }
+
+    public void bind(List<String> data, Map<String, Object> model) throws Exception {
+
+        int pos = 0;
+        while (pos < data.size()) {
+
+            // Set the field with the data received
+            // Only when no empty line is provided
+            // Data is transformed according to the pattern defined or by
+            // default the type of the field (int, double, String, ...)
+
+            if (!data.get(pos).equals("")) {
+
+                DataField dataField = mapDataField.get(pos);
+                ObjectHelper.notNull(dataField, "No position defined for the field positoned : " + pos);
+                Field field = mapAnnotedField.get(pos);
+                field.setAccessible(true);
+
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Pos : " + pos + ", Data : " + data.get(pos) + ", Field type : " + field.getType());
+                }
+
+                Format<?> format;
+                String pattern = dataField.pattern();
+
+                format = FormatFactory.getFormat(field.getType(), pattern, dataField.precision());
+                field.set(model.get(field.getDeclaringClass().getName()), format.parse(data.get(pos)));
+            }
+            pos++;
+        }
+    }
+
+    public String unbind(Map<String, Object> model) throws Exception {
 
         StringBuilder builder = new StringBuilder();
 
         Map<Integer, DataField> dataFields = new TreeMap<Integer, DataField>(mapDataField);
         Iterator<Integer> it = dataFields.keySet().iterator();
         
-		// Map containing the OUT position of the field
-		// The key is double and is created using the position of the field and 
-		// location of the class in the message (using section)
-		Map<Integer, String> positions = new TreeMap<Integer, String>();
+        // Map containing the OUT position of the field
+        // The key is double and is created using the position of the field and 
+        // location of the class in the message (using section)
+        Map<Integer, String> positions = new TreeMap<Integer, String>();
 
         // Check if separator exists
         ObjectHelper.notNull(this.separator, "The separator has not been instantiated or property not defined in the @CsvRecord annotation");
         
-		char separator = Converter.getCharDelimitor(this.getSeparator());
+        char separator = Converter.getCharDelimitor(this.getSeparator());
 
-		if (LOG.isDebugEnabled()) {
-			LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : "
-					+ this.getSeparator());
-		}
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : "
+                    + this.getSeparator());
+        }
 
         while (it.hasNext()) {
 
@@ -174,142 +173,134 @@
             // Retrieve the format associated to the type
             Format format = FormatFactory.getFormat(field.getType(), dataField.pattern(), dataField.precision());
             
-			// Get object to be formatted
-			Object obj = model.get(field.getDeclaringClass().getName());
-			
-			if (obj != null) {
-
-				if ( this.isMessageOrdered() ) {
-
-					// Generate a key using the number of the section
-					// and the position of the field
-					Integer key1 = sections.get(obj.getClass().getName());
-					Integer key2 = dataField.position();
-					Integer keyGenerated = generateKey(key1, key2);
-					
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : " + key1);
-					}					
-
-					// Add the content to the TreeMap according to the position
-					// defined
-					
-					String value = format.format(field.get(obj));
-					positions.put( keyGenerated , value );
-			
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Positions size : " + positions.size());
-					}
-					
-				} else {
-
-					// Convert the content to a String and append it to the builder
-					builder.append(format.format(field.get(obj)));
-					if (it.hasNext()) {
-						builder.append(separator);
-					}
-				}
-			}
+            // Get object to be formatted
+            Object obj = model.get(field.getDeclaringClass().getName());
+            
+            if (obj != null) {
+
+                if (this.isMessageOrdered()) {
+
+                    // Generate a key using the number of the section
+                    // and the position of the field
+                    Integer key1 = sections.get(obj.getClass().getName());
+                    Integer key2 = dataField.position();
+                    Integer keyGenerated = generateKey(key1, key2);
+                    
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : " + key1);
+                    }                    
+
+                    // Add the content to the TreeMap according to the position defined
+                    String value = format.format(field.get(obj));
+                    positions.put(keyGenerated, value);
+            
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Positions size : " + positions.size());
+                    }
+                } else {
+                    // Convert the content to a String and append it to the builder
+                    builder.append(format.format(field.get(obj)));
+                    if (it.hasNext()) {
+                        builder.append(separator);
+                    }
+                }
+            }
         }
         
-		// Iterate through the list to generate
-		// the message according to the order/position
-		if ( this.isMessageOrdered() ) {
-
-			Iterator<Integer> posit = positions.keySet().iterator();
-			
-			while (posit.hasNext()) {
-				String value = positions.get(posit.next());
-				
-				if (LOG.isDebugEnabled()) {
-					LOG.debug("Value added at the position (" + posit + ") : " + value + separator);
-				}
-				
-				builder.append(value);
-				if (it.hasNext()) {
-					builder.append(separator);
-				}
-			}
-		}
+        // Iterate through the list to generate
+        // the message according to the order/position
+        if (this.isMessageOrdered()) {
+
+            Iterator<Integer> posit = positions.keySet().iterator();
+            
+            while (posit.hasNext()) {
+                String value = positions.get(posit.next());
+                
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Value added at the position (" + posit + ") : " + value + separator);
+                }
+                
+                builder.append(value);
+                if (it.hasNext()) {
+                    builder.append(separator);
+                }
+            }
+        }
         
         return builder.toString();
     }
 
-	/**
-	 * Find the separator used to delimit the CSV fields
-	 */
-	public String getSeparator() {
-		return separator;
-	}
-
-	/**
-	 * Find the separator used to delimit the CSV fields
-	 */
-	public boolean getSkipFirstLine() {
-		return skipFirstLine;
-	}
-
-	/**
-	 * Flag indicating if the message must be ordered
-	 * 
-	 * @return boolean
-	 */
-	public boolean isMessageOrdered() {
-		return messageOrdered;
-	}
-
-	/**
-	 * 
-	 * Get paramaters defined in @Csvrecord annotation
-	 * 
-	 */
-	private void initCsvRecordParameters() {
-		if (separator == null) {
-			for (Class<?> cl : models) {
-
-				// Get annotation @CsvRecord from the class
-				CsvRecord record = cl.getAnnotation(CsvRecord.class);
-
-				// Get annotation @Section from the class
-				Section section = cl.getAnnotation(Section.class);
-
-				if (record != null) {
-
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Csv record : " + record.toString());
-					}
-
-					// Get skipFirstLine parameter
-					skipFirstLine = record.skipFirstLine();
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Skip First Line parameter of the CSV : " + skipFirstLine);
-					}
-
-					// Get Separator parameter
-					ObjectHelper.notNull(record.separator(),
-							"No separator has been defined in the @Record annotation !");
-					separator = record.separator();
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Separator defined for the CSV : " + separator);
-					}
-
-					// Get carriage return parameter
-					crlf = record.crlf();
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Carriage return defined for the CSV : " + crlf);
-					}
-				}
-
-				if (section != null) {
-
-					// Test if section number is not null
-					ObjectHelper.notNull(section.nber(), "No number has been defined for the section !");
-
-					// Get section number and add it to the sections
-					sections.put(cl.getName(), section.nber());
-
-				}
-			}
-		}
-	}
+    /**
+     * Find the separator used to delimit the CSV fields
+     */
+    public String getSeparator() {
+        return separator;
+    }
+
+    /**
+     * Find the separator used to delimit the CSV fields
+     */
+    public boolean getSkipFirstLine() {
+        return skipFirstLine;
+    }
+
+    /**
+     * Flag indicating if the message must be ordered
+     * 
+     * @return boolean
+     */
+    public boolean isMessageOrdered() {
+        return messageOrdered;
+    }
+
+    /**
+     * 
+     * Get paramaters defined in @Csvrecord annotation
+     * 
+     */
+    private void initCsvRecordParameters() {
+        if (separator == null) {
+            for (Class<?> cl : models) {
+                // Get annotation @CsvRecord from the class
+                CsvRecord record = cl.getAnnotation(CsvRecord.class);
+
+                // Get annotation @Section from the class
+                Section section = cl.getAnnotation(Section.class);
+
+                if (record != null) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Csv record : " + record.toString());
+                    }
+
+                    // Get skipFirstLine parameter
+                    skipFirstLine = record.skipFirstLine();
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Skip First Line parameter of the CSV : " + skipFirstLine);
+                    }
+
+                    // Get Separator parameter
+                    ObjectHelper.notNull(record.separator(),
+                            "No separator has been defined in the @Record annotation !");
+                    separator = record.separator();
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Separator defined for the CSV : " + separator);
+                    }
+
+                    // Get carriage return parameter
+                    crlf = record.crlf();
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Carriage return defined for the CSV : " + crlf);
+                    }
+                }
+
+                if (section != null) {
+                    // Test if section number is not null
+                    ObjectHelper.notNull(section.number(), "No number has been defined for the section !");
+
+                    // Get section number and add it to the sections
+                    sections.put(cl.getName(), section.number());
+                }
+            }
+        }
+    }
 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java Fri Jun 26 19:42:35 2009
@@ -43,308 +43,292 @@
  */
 public class BindyKeyValuePairFactory extends BindyAbstractFactory implements BindyFactory {
 
-	private static final transient Log LOG = LogFactory.getLog(BindyKeyValuePairFactory.class);
-
-	private Map<Integer, KeyValuePairField> mapKeyValuePairField = new LinkedHashMap<Integer, KeyValuePairField>();
-	private Map<Integer, Field> mapAnnotedField = new LinkedHashMap<Integer, Field>();
-	private Map<String, Integer> sections = new HashMap<String, Integer>();
-
-	private String keyValuePairSeparator;
-	private String pairSeparator;
-	private boolean messageOrdered;
-
-	public BindyKeyValuePairFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
-
-		super(resolver, packageNames);
-
-		// Initialize what is specific to Key Value Pair model
-		initKeyValuePairModel();
-	}
-
-	/**
-	 * method uses to initialize the model representing the classes who will
-	 * bind the data This process will scan for classes according to the package
-	 * name provided, check the classes and fields annoted. Next, we retrieve
-	 * the parameters required like : Pair Separator & key value pair separator
-	 * 
-	 * @throws Exception
-	 */
-	public void initKeyValuePairModel() throws Exception {
-
-		// Find annotated KeyValuePairfields declared in the Model classes
-		initAnnotedFields();
-
-		// Initialize key value pair parameter(s)
-		initMessageParameters();
-
-	}
-
-	public void initAnnotedFields() {
-
-		for (Class<?> cl : models) {
-
-			for (Field field : cl.getDeclaredFields()) {
-				KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
-				if (keyValuePairField != null) {
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Key declared in the class : " + cl.getName() + ", key : " + keyValuePairField.tag()
-								+ ", Field : " + keyValuePairField.toString());
-					}
-					mapKeyValuePairField.put(keyValuePairField.tag(), keyValuePairField);
-					mapAnnotedField.put(keyValuePairField.tag(), field);
-				}
-
-				Link linkField = field.getAnnotation(Link.class);
-
-				if (linkField != null) {
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Class linked  : " + cl.getName() + ", Field" + field.toString());
-					}
-					mapAnnotedLinkField.put(cl.getName(), field);
-				}
-			}
-
-		}
-	}
-
-	public void bind(List<String> data, Map<String, Object> model) throws Exception {
-
-		int pos = 0;
-
-		if (LOG.isDebugEnabled()) {
-			LOG.debug("Data : " + data);
-		}
-
-		while (pos < data.size()) {
-
-			if (!data.get(pos).equals("")) {
-
-				// Separate the key from its value
-				// e.g 8=FIX 4.1 --> key = 8 and Value = FIX 4.1
-				ObjectHelper.notNull(this.keyValuePairSeparator,
-						"Key Value Pair not defined in the @Message annotation");
-				String[] keyValuePair = data.get(pos).split(this.getKeyValuePairSeparator());
-
-				int tag = Integer.parseInt(keyValuePair[0]);
-				String value = keyValuePair[1];
-
-				if (LOG.isDebugEnabled()) {
-					LOG.debug("Key : " + tag + ", value : " + value);
-				}
-
-				KeyValuePairField keyValuePairField = mapKeyValuePairField.get(tag);
-				ObjectHelper.notNull(keyValuePairField, "No tag defined for the field : " + tag);
-
-				Field field = mapAnnotedField.get(tag);
-				field.setAccessible(true);
-
-				if (LOG.isDebugEnabled()) {
-					LOG.debug("Tag : " + tag + ", Data : " + value + ", Field type : " + field.getType());
-				}
-
-				Format<?> format;
-				String pattern = keyValuePairField.pattern();
-
-				format = FormatFactory.getFormat(field.getType(), pattern, keyValuePairField.precision());
-				field.set(model.get(field.getDeclaringClass().getName()), format.parse(value));
-
-			}
-
-			pos++;
-		}
-
-	}
-
-	public String unbind(Map<String, Object> model) throws Exception {
-
-		StringBuilder builder = new StringBuilder();
-
-		Map<Integer, KeyValuePairField> keyValuePairFields = new TreeMap<Integer, KeyValuePairField>(mapKeyValuePairField);
-		Iterator<Integer> it = keyValuePairFields.keySet().iterator();
-		
-		// Map containing the OUT position of the field
-		// The key is double and is created using the position of the field and 
-		// location of the class in the message (using section)
-		Map<Integer, String> positions = new TreeMap<Integer, String>();
-
-		// Check if separator exists
-		ObjectHelper.notNull(this.pairSeparator,
-				"The pair separator has not been instantiated or property not defined in the @Message annotation");
-
-		char separator = Converter.getCharDelimitor(this.getPairSeparator());
-
-		if (LOG.isDebugEnabled()) {
-			LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : "
-					+ this.getPairSeparator());
-		}
-
-		while (it.hasNext()) {
-
-			KeyValuePairField keyValuePairField = mapKeyValuePairField.get(it.next());
-			ObjectHelper.notNull(keyValuePairField, "KeyValuePair is null !");
-
-			// Retrieve the field
-			Field field = mapAnnotedField.get(keyValuePairField.tag());
-			// Change accessibility to allow to read protected/private fields
-			field.setAccessible(true);
-
-			if (LOG.isDebugEnabled()) {
-				LOG.debug("Tag : " + keyValuePairField.tag() + ", Field type : " + field.getType() + ", class : " + field.getDeclaringClass().getName());
-			}
-
-			// Retrieve the format associated to the type
-			Format format;
-			String pattern = keyValuePairField.pattern();
-			format = FormatFactory.getFormat(field.getType(), pattern, keyValuePairField.precision());
-
-			// Get object to be formatted
-			Object obj = model.get(field.getDeclaringClass().getName());
-			
-			if (obj != null) {
-
-				if ( this.isMessageOrdered() ) {
-
-					
-					// Generate a key using the number of the section
-					// and the position of the field
-					Integer key1 = sections.get(obj.getClass().getName());
-					Integer key2 = keyValuePairField.position();
-					Integer keyGenerated = generateKey(key1, key2);
-					
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : " + key1);
-					}					
-
-					// Add the content to the TreeMap according to the position
-					// defined
-					
-					String value = keyValuePairField.tag() + this.getKeyValuePairSeparator() + format.format(field.get(obj));
-					positions.put( keyGenerated , value );
-
-			
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Positions size : " + positions.size());
-					}
-					
-				} else {
-					// Convert the content to a String and append it to the
-					// builder
-					// Add the tag followed by its key value pair separator
-					// the data and finish by the pair separator
-					String value = keyValuePairField.tag() + this.getKeyValuePairSeparator() + format.format(field.get(obj)) + separator;
-					builder.append(value);
-					
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Value added : " + keyValuePairField.tag() + this.getKeyValuePairSeparator()
-								+ format.format(field.get(obj)) + separator);
-					}
-				}
-			}
-
-		}
-
-		// Iterate through the list to generate
-		// the message according to the order/position
-		if ( this.isMessageOrdered() ) {
-
-			Iterator<Integer> posit = positions.keySet().iterator();
-			
-			while (posit.hasNext()) {
-				String value = positions.get(posit.next());
-				
-				if (LOG.isDebugEnabled()) {
-					LOG.debug("Value added at the position (" + posit + ") : " + value + separator);
-				}
-				
-				builder.append(value + separator);
-			}
-		}
-
-
-		return builder.toString();
-	}
-
-	/**
-	 * Find the pair separator used to delimit the key value pair fields
-	 */
-	public String getPairSeparator() {
-		return pairSeparator;
-	}
-
-	/**
-	 * Find the key value pair separator used to link the key with its value
-	 */
-	public String getKeyValuePairSeparator() {
-		return keyValuePairSeparator;
-	}
-	
-	/**
-	 * Flag indicating if the message must be ordered
-	 * 
-	 * @return boolean
-	 */
-	public boolean isMessageOrdered() {
-		return messageOrdered;
-	}
-	
-
-	/**
-	 * Get parameters defined in @Message annotation
-	 */
-	private void initMessageParameters() {
-
-		if ((pairSeparator == null) || (keyValuePairSeparator == null)) {
-
-			for (Class<?> cl : models) {
-
-				// Get annotation @Message from the class
-				Message message = cl.getAnnotation(Message.class);
-				
-				// Get annotation @Section from the class
-				Section section = cl.getAnnotation(Section.class);
-
-				if (message != null) {
-
-					// Get Pair Separator parameter
-					ObjectHelper.notNull(message.pairSeparator(),
-							"No Pair Separator has been defined in the @Message annotation !");
-					pairSeparator = message.pairSeparator();
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Pair Separator defined for the message : " + pairSeparator);
-					}
-
-					// Get KeyValuePair Separator parameter
-					ObjectHelper.notNull(message.keyValuePairSeparator(),
-							"No Key Value Pair Separator has been defined in the @Message annotation !");
-					keyValuePairSeparator = message.keyValuePairSeparator();
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Key Value Pair Separator defined for the message : " + keyValuePairSeparator);
-					}
-
-					// Get carriage return parameter
-					crlf = message.crlf();
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Carriage return defined for the message : " + crlf);
-					}
-
-					// Get isOrderer parameter
-					messageOrdered = message.isOrdered();
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Is the message ordered in output : " + messageOrdered);
-					}
-				}
-				
-				if (section != null) {
-					
-					// Test if section number is not null
-					ObjectHelper.notNull(section.nber(), "No number has been defined for the section !");
-					
-					// Get section number and add it to the sections
-					sections.put(cl.getName(), section.nber());
-					
-				}
-			}
-		}
-	}
+    private static final transient Log LOG = LogFactory.getLog(BindyKeyValuePairFactory.class);
 
+    private Map<Integer, KeyValuePairField> mapKeyValuePairField = new LinkedHashMap<Integer, KeyValuePairField>();
+    private Map<Integer, Field> mapAnnotedField = new LinkedHashMap<Integer, Field>();
+    private Map<String, Integer> sections = new HashMap<String, Integer>();
+
+    private String keyValuePairSeparator;
+    private String pairSeparator;
+    private boolean messageOrdered;
+
+    public BindyKeyValuePairFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
+
+        super(resolver, packageNames);
+
+        // Initialize what is specific to Key Value Pair model
+        initKeyValuePairModel();
+    }
+
+    /**
+     * method uses to initialize the model representing the classes who will
+     * bind the data This process will scan for classes according to the package
+     * name provided, check the annotated classes and fields. Next, we retrieve
+     * the parameters required like : Pair Separator & key value pair separator
+     * 
+     * @throws Exception
+     */
+    public void initKeyValuePairModel() throws Exception {
+
+        // Find annotated KeyValuePairfields declared in the Model classes
+        initAnnotedFields();
+
+        // Initialize key value pair parameter(s)
+        initMessageParameters();
+
+    }
+
+    public void initAnnotedFields() {
+
+        for (Class<?> cl : models) {
+
+            for (Field field : cl.getDeclaredFields()) {
+                KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
+                if (keyValuePairField != null) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Key declared in the class : " + cl.getName() + ", key : " + keyValuePairField.tag()
+                                + ", Field : " + keyValuePairField.toString());
+                    }
+                    mapKeyValuePairField.put(keyValuePairField.tag(), keyValuePairField);
+                    mapAnnotedField.put(keyValuePairField.tag(), field);
+                }
+
+                Link linkField = field.getAnnotation(Link.class);
+
+                if (linkField != null) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Class linked  : " + cl.getName() + ", Field" + field.toString());
+                    }
+                    mapAnnotatedLinkField.put(cl.getName(), field);
+                }
+            }
+
+        }
+    }
+
+    public void bind(List<String> data, Map<String, Object> model) throws Exception {
+
+        int pos = 0;
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Data : " + data);
+        }
+
+        while (pos < data.size()) {
+
+            if (!data.get(pos).equals("")) {
+
+                // Separate the key from its value
+                // e.g 8=FIX 4.1 --> key = 8 and Value = FIX 4.1
+                ObjectHelper.notNull(this.keyValuePairSeparator,
+                        "Key Value Pair not defined in the @Message annotation");
+                String[] keyValuePair = data.get(pos).split(this.getKeyValuePairSeparator());
+
+                int tag = Integer.parseInt(keyValuePair[0]);
+                String value = keyValuePair[1];
+
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Key : " + tag + ", value : " + value);
+                }
+
+                KeyValuePairField keyValuePairField = mapKeyValuePairField.get(tag);
+                ObjectHelper.notNull(keyValuePairField, "No tag defined for the field : " + tag);
+
+                Field field = mapAnnotedField.get(tag);
+                field.setAccessible(true);
+
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Tag : " + tag + ", Data : " + value + ", Field type : " + field.getType());
+                }
+
+                Format<?> format;
+                String pattern = keyValuePairField.pattern();
+
+                format = FormatFactory.getFormat(field.getType(), pattern, keyValuePairField.precision());
+                field.set(model.get(field.getDeclaringClass().getName()), format.parse(value));
+
+            }
+
+            pos++;
+        }
+
+    }
+
+    public String unbind(Map<String, Object> model) throws Exception {
+
+        StringBuilder builder = new StringBuilder();
+
+        Map<Integer, KeyValuePairField> keyValuePairFields = new TreeMap<Integer, KeyValuePairField>(mapKeyValuePairField);
+        Iterator<Integer> it = keyValuePairFields.keySet().iterator();
+        
+        // Map containing the OUT position of the field
+        // The key is double and is created using the position of the field and 
+        // location of the class in the message (using section)
+        Map<Integer, String> positions = new TreeMap<Integer, String>();
+
+        // Check if separator exists
+        ObjectHelper.notNull(this.pairSeparator,
+                "The pair separator has not been instantiated or property not defined in the @Message annotation");
+
+        char separator = Converter.getCharDelimitor(this.getPairSeparator());
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : "
+                    + this.getPairSeparator());
+        }
+
+        while (it.hasNext()) {
+
+            KeyValuePairField keyValuePairField = mapKeyValuePairField.get(it.next());
+            ObjectHelper.notNull(keyValuePairField, "KeyValuePair is null !");
+
+            // Retrieve the field
+            Field field = mapAnnotedField.get(keyValuePairField.tag());
+            // Change accessibility to allow to read protected/private fields
+            field.setAccessible(true);
+
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Tag : " + keyValuePairField.tag() + ", Field type : " + field.getType() + ", class : " + field.getDeclaringClass().getName());
+            }
+
+            // Retrieve the format associated to the type
+            Format format;
+            String pattern = keyValuePairField.pattern();
+            format = FormatFactory.getFormat(field.getType(), pattern, keyValuePairField.precision());
+
+            // Get object to be formatted
+            Object obj = model.get(field.getDeclaringClass().getName());
+            
+            if (obj != null) {
+                if (this.isMessageOrdered()) {
+                    // Generate a key using the number of the section
+                    // and the position of the field
+                    Integer key1 = sections.get(obj.getClass().getName());
+                    Integer key2 = keyValuePairField.position();
+                    Integer keyGenerated = generateKey(key1, key2);
+                    
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : " + key1);
+                    }                    
+
+                    // Add the content to the TreeMap according to the position defined
+                    String value = keyValuePairField.tag() + this.getKeyValuePairSeparator() + format.format(field.get(obj));
+                    positions.put(keyGenerated, value);
+
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Positions size : " + positions.size());
+                    }
+                } else {
+                    // Convert the content to a String and append it to the
+                    // builder
+                    // Add the tag followed by its key value pair separator
+                    // the data and finish by the pair separator
+                    String value = keyValuePairField.tag() + this.getKeyValuePairSeparator() + format.format(field.get(obj)) + separator;
+                    builder.append(value);
+                    
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Value added : " + keyValuePairField.tag() + this.getKeyValuePairSeparator()
+                            + format.format(field.get(obj)) + separator);
+                    }
+                }
+            }
+        }
+
+        // Iterate through the list to generate
+        // the message according to the order/position
+        if (this.isMessageOrdered()) {
+
+            Iterator<Integer> posit = positions.keySet().iterator();
+            
+            while (posit.hasNext()) {
+                String value = positions.get(posit.next());
+                
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Value added at the position (" + posit + ") : " + value + separator);
+                }
+                
+                builder.append(value + separator);
+            }
+        }
+
+
+        return builder.toString();
+    }
+
+    /**
+     * Find the pair separator used to delimit the key value pair fields
+     */
+    public String getPairSeparator() {
+        return pairSeparator;
+    }
+
+    /**
+     * Find the key value pair separator used to link the key with its value
+     */
+    public String getKeyValuePairSeparator() {
+        return keyValuePairSeparator;
+    }
+    
+    /**
+     * Flag indicating if the message must be ordered
+     * 
+     * @return boolean
+     */
+    public boolean isMessageOrdered() {
+        return messageOrdered;
+    }
+
+    /**
+     * Get parameters defined in @Message annotation
+     */
+    private void initMessageParameters() {
+        if ((pairSeparator == null) || (keyValuePairSeparator == null)) {
+            for (Class<?> cl : models) {
+                // Get annotation @Message from the class
+                Message message = cl.getAnnotation(Message.class);
+                
+                // Get annotation @Section from the class
+                Section section = cl.getAnnotation(Section.class);
+
+                if (message != null) {
+                    // Get Pair Separator parameter
+                    ObjectHelper.notNull(message.pairSeparator(),
+                            "No Pair Separator has been defined in the @Message annotation !");
+                    pairSeparator = message.pairSeparator();
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Pair Separator defined for the message : " + pairSeparator);
+                    }
+
+                    // Get KeyValuePair Separator parameter
+                    ObjectHelper.notNull(message.keyValuePairSeparator(),
+                            "No Key Value Pair Separator has been defined in the @Message annotation !");
+                    keyValuePairSeparator = message.keyValuePairSeparator();
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Key Value Pair Separator defined for the message : " + keyValuePairSeparator);
+                    }
+
+                    // Get carriage return parameter
+                    crlf = message.crlf();
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Carriage return defined for the message : " + crlf);
+                    }
+
+                    // Get isOrderer parameter
+                    messageOrdered = message.isOrdered();
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Is the message ordered in output : " + messageOrdered);
+                    }
+                }
+                
+                if (section != null) {
+                    // Test if section number is not null
+                    ObjectHelper.notNull(section.number(), "No number has been defined for the section !");
+                    
+                    // Get section number and add it to the sections
+                    sections.put(cl.getName(), section.number());
+                }
+            }
+        }
+    }
 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java Fri Jun 26 19:42:35 2009
@@ -39,53 +39,52 @@
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Message {
 
-	/**
-	 * Name describing the message (optional)
-	 * 
-	 * @return String
-	 */
-	String name() default "";
-
-	/**
-	 * Pair separator used to split the key value pairs in tokens (mandatory)
-	 * 
-	 * @return String
-	 */
-	String pairSeparator();
-
-	/**
-	 * Key value pair separator is used to split the values from their keys
-	 * (mandatory)
-	 * 
-	 * @return String
-	 */
-	String keyValuePairSeparator();
-
-	/**
-	 * type is used to define the type of the message (e.g. FIX, EMX, ...)
-	 * (optional)
-	 */
-	String type() default "FIX";
-
-	/**
-	 * version defines the version of the message (e.g. 4.1, ...) (optional)
-	 */
-	String version() default "4.1";
-
-	/**
-	 * Character to be used to add a carriage return after each record
-	 * (optional) Three values can be used : WINDOWS, UNIX or MAC
-	 * 
-	 * @return String
-	 */
-	String crlf() default "WINDOWS";
-
-	/**
-	 * 
-	 * Indicates if the message must be ordered in output
-	 * 
-	 * @return boolean
-	 */
-	boolean isOrdered() default false;
-
+    /**
+     * Name describing the message (optional)
+     * 
+     * @return String
+     */
+    String name() default "";
+
+    /**
+     * Pair separator used to split the key value pairs in tokens (mandatory)
+     * 
+     * @return String
+     */
+    String pairSeparator();
+
+    /**
+     * Key value pair separator is used to split the values from their keys
+     * (mandatory)
+     * 
+     * @return String
+     */
+    String keyValuePairSeparator();
+
+    /**
+     * type is used to define the type of the message (e.g. FIX, EMX, ...)
+     * (optional)
+     */
+    String type() default "FIX";
+
+    /**
+     * version defines the version of the message (e.g. 4.1, ...) (optional)
+     */
+    String version() default "4.1";
+
+    /**
+     * Character to be used to add a carriage return after each record
+     * (optional) Three values can be used : WINDOWS, UNIX or MAC
+     * 
+     * @return String
+     */
+    String crlf() default "WINDOWS";
+
+    /**
+     * 
+     * Indicates if the message must be ordered in output
+     * 
+     * @return boolean
+     */
+    boolean isOrdered() default false;
 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Section.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Section.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Section.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Section.java Fri Jun 26 19:42:35 2009
@@ -1,5 +1,3 @@
-package org.apache.camel.dataformat.bindy.annotation;
-
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -17,6 +15,8 @@
  * limitations under the License.
  */
 
+package org.apache.camel.dataformat.bindy.annotation;
+
 import java.lang.annotation.Documented;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -30,11 +30,10 @@
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Section {
 
-	/**
-	 * 	 * N° of the section
-	 * 
-	 * @return 
-	 */
-	int nber();
-
+    /**
+     * Number of the section
+     * 
+     * @return 
+     */
+    int number();
 }

Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java (original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java Fri Jun 26 19:42:35 2009
@@ -52,8 +52,7 @@
 
     @Test
     public void testMarshallMessage() throws Exception {
- 
-    	resultEndpoint.expectedBodiesReceived(result);
+        resultEndpoint.expectedBodiesReceived(result);
         template.sendBody(generateModel());
 
         resultEndpoint.assertIsSatisfied();
@@ -89,7 +88,6 @@
         modelObjects.put(trailer.getClass().getName(), trailer);
  
         models.add(modelObjects);
-
         return models;
     }
 

Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java (original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java Fri Jun 26 19:42:35 2009
@@ -27,8 +27,8 @@
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
-import org.apache.camel.dataformat.bindy.model.fix.sorted.header.Header;
 import org.apache.camel.dataformat.bindy.model.fix.sorted.body.Order;
+import org.apache.camel.dataformat.bindy.model.fix.sorted.header.Header;
 import org.apache.camel.dataformat.bindy.model.fix.sorted.trailer.Trailer;
 import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
 import org.apache.commons.logging.Log;
@@ -43,78 +43,77 @@
 @ContextConfiguration(locations = "org.apache.camel.dataformat.bindy.fix.BindySimpleKeyValuePairSortedMarshallTest$ContextConfig", loader = JavaConfigContextLoader.class)
 public class BindySimpleKeyValuePairSortedMarshallTest extends AbstractJUnit4SpringContextTests {
 
-	private static final transient Log LOG = LogFactory.getLog(BindySimpleKeyValuePairSortedMarshallTest.class);
+    private static final transient Log LOG = LogFactory.getLog(BindySimpleKeyValuePairSortedMarshallTest.class);
 
-	private List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
-	private String result = "8=FIX 4.19=2035=034=149=INVMGR56=BRKR1=BE.CHM.00122=411=CHM0001-0148=BE000124567854=158=this is a camel - bindy test10=220\r\n";
+    private List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
+    private String result = "8=FIX 4.19=2035=034=149=INVMGR56=BRKR1=BE.CHM.00122=411=CHM0001-0148=BE000124567854=158=this is a camel - bindy test10=220\r\n";
 
-	@Produce(uri = "direct:start")
-	private ProducerTemplate template;
+    @Produce(uri = "direct:start")
+    private ProducerTemplate template;
 
-	@EndpointInject(uri = "mock:result")
-	private MockEndpoint resultEndpoint;
-
-	@Test
-	public void testMarshallMessage() {
-
-		resultEndpoint.expectedBodiesReceived(result);
-		template.sendBody(generateModel());
-
-		try {
-			resultEndpoint.assertIsSatisfied();
-		} catch (InterruptedException e) {
-			LOG.error("Unit test error : ", e);
-		}
-	}
-
-	public List<Map<String, Object>> generateModel() {
-		Map<String, Object> modelObjects = new HashMap<String, Object>();
-
-		Header header = new Header();
-		header.setBeginString("FIX 4.1");
-		header.setBodyLength(20);
-		header.setMsgSeqNum(1);
-		header.setMsgType("0");
-		header.setSendCompId("INVMGR");
-		header.setTargetCompId("BRKR");
-
-		Trailer trailer = new Trailer();
-		trailer.setCheckSum(220);
-
-		Order order = new Order();
-		order.setAccount("BE.CHM.001");
-		order.setClOrdId("CHM0001-01");
-		order.setIDSource("4");
-		order.setSecurityId("BE0001245678");
-		order.setSide("1");
-		order.setText("this is a camel - bindy test");
-
-		order.setHeader(header);
-		order.setTrailer(trailer);
-
-		modelObjects.put(order.getClass().getName(), order);
-		modelObjects.put(header.getClass().getName(), header);
-		modelObjects.put(trailer.getClass().getName(), trailer);
-
-		models.add(modelObjects);
-
-		return models;
-	}
-
-	@Configuration
-	public static class ContextConfig extends SingleRouteCamelConfiguration {
-		BindyKeyValuePairDataFormat camelDataFormat = new BindyKeyValuePairDataFormat(
-				"org.apache.camel.dataformat.bindy.model.fix.sorted");
-
-		@Override
-		@Bean
-		public RouteBuilder route() {
-			return new RouteBuilder() {
-				@Override
-				public void configure() {
-					from("direct:start").marshal(camelDataFormat).to("mock:result");
-				}
-			};
-		}
-	}
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint resultEndpoint;
+
+    @Test
+    public void testMarshallMessage() {
+
+        resultEndpoint.expectedBodiesReceived(result);
+        template.sendBody(generateModel());
+
+        try {
+            resultEndpoint.assertIsSatisfied();
+        } catch (InterruptedException e) {
+            LOG.error("Unit test error : ", e);
+        }
+    }
+
+    public List<Map<String, Object>> generateModel() {
+        Map<String, Object> modelObjects = new HashMap<String, Object>();
+
+        Header header = new Header();
+        header.setBeginString("FIX 4.1");
+        header.setBodyLength(20);
+        header.setMsgSeqNum(1);
+        header.setMsgType("0");
+        header.setSendCompId("INVMGR");
+        header.setTargetCompId("BRKR");
+
+        Trailer trailer = new Trailer();
+        trailer.setCheckSum(220);
+
+        Order order = new Order();
+        order.setAccount("BE.CHM.001");
+        order.setClOrdId("CHM0001-01");
+        order.setIDSource("4");
+        order.setSecurityId("BE0001245678");
+        order.setSide("1");
+        order.setText("this is a camel - bindy test");
+
+        order.setHeader(header);
+        order.setTrailer(trailer);
+
+        modelObjects.put(order.getClass().getName(), order);
+        modelObjects.put(header.getClass().getName(), header);
+        modelObjects.put(trailer.getClass().getName(), trailer);
+
+        models.add(modelObjects);
+        return models;
+    }
+
+    @Configuration
+    public static class ContextConfig extends SingleRouteCamelConfiguration {
+        BindyKeyValuePairDataFormat camelDataFormat = new BindyKeyValuePairDataFormat(
+            "org.apache.camel.dataformat.bindy.model.fix.sorted");
+
+        @Override
+        @Bean
+        public RouteBuilder route() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    from("direct:start").marshal(camelDataFormat).to("mock:result");
+                }
+            };
+        }
+    }
 }

Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java (original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java Fri Jun 26 19:42:35 2009
@@ -54,7 +54,7 @@
     @Test
     public void testMarshallMessage() throws Exception {
  
-    	resultEndpoint.expectedBodiesReceived(result);
+        resultEndpoint.expectedBodiesReceived(result);
         template.sendBody(generateModel());
 
         resultEndpoint.assertIsSatisfied();

Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/body/Order.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/body/Order.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/body/Order.java (original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/body/Order.java Fri Jun 26 19:42:35 2009
@@ -23,7 +23,7 @@
 import org.apache.camel.dataformat.bindy.model.fix.sorted.header.Header;
 import org.apache.camel.dataformat.bindy.model.fix.sorted.trailer.Trailer;
 
-@Section(nber = 2)
+@Section(number = 2)
 @Message(keyValuePairSeparator = "=", pairSeparator = "\\u0001", type = "FIX", version = "4.1", isOrdered = true)
 public class Order {
     

Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/header/Header.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/header/Header.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/header/Header.java (original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/header/Header.java Fri Jun 26 19:42:35 2009
@@ -22,7 +22,7 @@
 import org.apache.camel.dataformat.bindy.annotation.Section;
 
 @Link
-@Section(nber = 1)
+@Section(number = 1)
 public class Header {
 
     @KeyValuePairField(tag = 8, position = 1) // Message Header

Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/trailer/Trailer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/trailer/Trailer.java?rev=788832&r1=788831&r2=788832&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/trailer/Trailer.java (original)
+++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/trailer/Trailer.java Fri Jun 26 19:42:35 2009
@@ -22,7 +22,7 @@
 import org.apache.camel.dataformat.bindy.annotation.Section;
 
 @Link
-@Section(nber = 3)
+@Section(number = 3)
 public class Trailer {
 
     @KeyValuePairField(tag = 10, position = 1)