org.apache.camel.language.simple
Class SimpleLanguage
java.lang.Object
org.apache.camel.language.simple.SimpleLanguageSupport
org.apache.camel.language.simple.SimpleLanguage
- All Implemented Interfaces:
- IsSingleton, Language
public class SimpleLanguage
- extends SimpleLanguageSupport
A simple language
which maps simple property style notations to access headers and bodies.
Examples of supported expressions are:
- id to access the inbound message id
- in.body or body to access the inbound body
- out.body to access the inbound body
- in.header.foo or header.foo to access an inbound header called 'foo'
- out.header.foo to access an outbound header called 'foo'
- property.foo to access the exchange property called 'foo'
- sys.foo to access the system property called 'foo'
- exception.messsage to access the exception message
- date:<command>:<pattern> for date formatting using the
SimpleDateFormat patterns.
Supported commands are: now for current timestamp,
in.header.xxx or header.xxx to use the Date object in the in header.
out.header.xxx to use the Date object in the out header.
- bean:<bean expression> to invoke a bean using the
BeanLanguage
The simple language now also includes file language out of the box which means the following expression is also
supported:
- file:name to access the file name (is relative, see note below))
- file:name.noext to access the file name with no extension
- file:ext to access the file extension
- file:onlyname to access the file name (no paths)
- file:onlyname.noext to access the file name (no paths) with no extension
- file:parent to access the parent file name
- file:path to access the file path name
- file:absolute is the file regarded as absolute or relative
- file:absolute.path to access the absolute file path name
- file:length to access the file length as a Long type
- file:modified to access the file last modified as a Date type
- date:<command>:<pattern> for date formatting using the
SimpleDateFormat patterns.
Additional Supported commands are: file for the last modified timestamp of the file.
All the commands from SimpleLanguage is also available.
The relative file is the filename with the starting directory clipped, as opposed to path that will
return the full path including the starting directory.
The only file is the filename only with all paths clipped.
- Version:
- $Revision: 898656 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleLanguage
public SimpleLanguage()
simple
public static Expression simple(String expression)
createSimpleExpression
protected Expression createSimpleExpression(String expression,
boolean strict)
- Description copied from class:
SimpleLanguageSupport
- Creates the simple expression based on the extracted content from the ${ } place holders
- Specified by:
createSimpleExpression in class SimpleLanguageSupport
- Parameters:
expression - the content between ${ and }strict - whether it is strict mode or not, if strict it will throw a
ExpressionIllegalSyntaxException if the expression was not known.
Set to false to support constant expressions
- Returns:
- the expression
createSimpleFileExpression
public Expression createSimpleFileExpression(String remainder)
isSingleton
public boolean isSingleton()
- Description copied from interface:
IsSingleton
- Wheter this class supports being singleton or not.
- Returns:
- true to be a single shared instance, false to create new instances.
Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.