Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F18717A1A for ; Tue, 24 Feb 2015 11:18:51 +0000 (UTC) Received: (qmail 54014 invoked by uid 500); 24 Feb 2015 11:18:51 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 53958 invoked by uid 500); 24 Feb 2015 11:18:51 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 53949 invoked by uid 99); 24 Feb 2015 11:18:50 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Feb 2015 11:18:50 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id AB541AC0110 for ; Tue, 24 Feb 2015 11:18:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r941291 [2/2] - in /websites/production/camel/content: book-in-one-page.html book-languages-appendix.html cache/main.pageCache file-language.html Date: Tue, 24 Feb 2015 11:18:50 -0000 To: commits@camel.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150224111850.AB541AC0110@hades.apache.org> Modified: websites/production/camel/content/file-language.html ============================================================================== --- websites/production/camel/content/file-language.html (original) +++ websites/production/camel/content/file-language.html Tue Feb 24 11:18:49 2015 @@ -92,7 +92,7 @@

From Camel 2.2 onwards, the file language is now merged with Simple language which means you can use all the file syntax directly within the simple language.

-

The File Expression Language is an extension to the Simple language, adding file related capabilities. These capabilities are related to common use cases working with file path and names. The goal is to allow expressions to be used with the File and FTP components for setting dynamic file patterns for both consumer and producer.

Syntax

This language is an extension to the Simple language so the Simple syntax applies also. So the table below only lists the additional.
As opposed to Simple language File Language also supports Constant expressions so you can enter a fixed filename.

All the fil e tokens use the same expression name as the method on the java.io.File object, for instance file:absolute refers to the java.io.File.getAbsolute() method. Notice that not all expressions are supported by the current Exchange. For instance the FTP component supports some of the options, where as the File component supports all of them.

Expression

Type

File Consumer

File Producer

FTP Consumer

FTP Producer

Description

file:name

String

yes

no

yes

no

refers to the file name (is relative to the starting directory, see note below)

file:name.ext

String

yes

no

yes

no

Camel 2.3: refers to the file extension only

file:name.noext

String

yes

no

yes

no

refers to the file name with no extension (is relative to the starting directory, see note below)

file:onlyname

String

yes

no

yes< /p>

no

refers to the file name only with no leading paths.

file:onlyname.noext

String

yes

no

yes

no

refers to the file name only with no extension and with no leading paths.

file:ext

String

yes

no

yes

no

refers to the file extension only

file:parent

String

yes

no

yes

no

refers to the file parent

file:path

String

yes

no

yes

no

refers to the file path

file:absolute

Boolean

yes

no

no

no

refers to whether the file is regarded as absolute or relative

file:absolute.path

String

yes

no

no

no

refers to the absolute file path

file:length

Long

yes

no

yes

no

refers to the file length returned as a Long type

file:size

Long

yes

no

yes

no

Camel 2.5: refers to the file length returned as a Long type

file:modified

Date

yes

no

yes

no

efers to the file last modified returned as a Date type

date:command:pattern

String

yes

yes

yes

yes

for date formatting using the java.text.SimepleDateFormate patterns. Is an extension to the Simple language. Additional command is: file (consumers only) for the last modified timestamp of the file. Notice: all the commands from the Simple language can also be used.

File token example

Relative paths

We have a java.io.File handle for the file hello.txt in the following relative directory: .\filelanguage\test. And we configure our endpoint to use this starting directory .\filelanguage. The file tokens will return as:

Expression

Returns

file:name

test\hello.txt

file:name.ext

txt

file:name.noext

test\hello

file:onlyname

hello.txt

file:onlyname.noext

hello

file:ext

txt

file:parent

filelanguage\test

file:path

filelanguage\test\hello.txt

file:absolute

false

file:absolute.path

\workspace\camel\camel-core\target\filelanguage\test\hello.txt

Absolute paths

We have a java.io.File handle for the file hello.txt in the following absolute d irectory: \workspace\camel\camel-core\target\filelanguage\test. And we configure out endpoint to use the absolute starting directory \workspace\camel\camel-core\target\filelanguage. The file tokens will return as:

Expression

Returns

file:name

test\hello.txt

file:name.ext

txt

file:name.noext

test\hello

file:onlyname

hello.txt

file:onlyname.noext

hello

file:ext

txt

file:parent

\workspace\camel\camel-core\target\filelanguage\test

file:path

\workspace\camel\camel-core\target\filelanguage\test\hello.txt

file:absolute

true

file:absolute.path

\workspace\camel\camel-co re\target\filelanguage\test\hello.txt

Samples

You can enter a fixed Constant expression such as myfile.txt:

+

The File Expression Language is an extension to the Simple language, adding file related capabilities. These capabilities are related to common use cases working with file path and names. The goal is to allow expressions to be used with the File and FTP components for setting dynamic file patterns for both consumer and producer.

Syntax

This language is an extension to the Simple language so the Simple syntax applies also. So the table below only lists the additional.
As opposed to Simple language File Language also supports Constant expressions so you can enter a fixed filename.

All the fil e tokens use the same expression name as the method on the java.io.File object, for instance file:absolute refers to the java.io.File.getAbsolute() method. Notice that not all expressions are supported by the current Exchange. For instance the FTP component supports some of the options, where as the File component supports all of them.

Expression

Type

File Consumer

File Producer

FTP Consumer

FTP Producer

Description

file:name

String

yes

no

yes

no

refers to the file name (is relative to the starting directory, see note below)

file:name.ext

String

yes

no

yes

no

Camel 2.3: refers to the file extension only

file:name.noext

String

yes

no

yes

no

refers to the file name with no extension (is relative to the starting directory, see note below)

file:onlyname

String

yes

no

yes< /p>

no

refers to the file name only with no leading paths.

file:onlyname.noext

String

yes

no

yes

no

refers to the file name only with no extension and with no leading paths.

file:ext

String

yes

no

yes

no

refers to the file extension only

file:parent

String

yes

no

yes

no

refers to the file parent

file:path

String

yes

no

yes

no

refers to the file path

file:absolute

Boolean

yes

no

no

no

refers to whether the file is regarded as absolute or relative

file:absolute.path

String

yes

no

no

no

refers to the absolute file path

file:length

Long

yes

no

yes

no

refers to the file length returned as a Long type

file:size

Long

yes

no

yes

no

Camel 2.5: refers to the file length returned as a Long type

file:modified

Date

yes

no

yes

no

efers to the file last modified returned as a Date type

date:command:pattern

String

yes

yes

yes

yes

for date formatting using the java.text.SimpleDateFormat patterns. Is an extension to the Simple language. Additional command is: file (consumers only) for the last modified timestamp of the file. Notice: all the commands from the Simple language can also be used.

File token example

Relative paths

We have a java.io.File handle for the file hello.txt in the following relative directory: .\filelanguage\test. And we configure our endpoint to use this starting directory .\ filelanguage. The file tokens will return as:

< tr>

Expression

Returns

file:name

test\hello.txt

file:name.ext

txt

file:name.noext

test\hello

file:onlyname

hello.txt

file:onlyname.noext

hello

file:ext

txt

file:parent

filelanguage\test

file:path

filelanguage\test\hello.txt

file:absolute

false

file:absolute.path

\workspace\camel\camel-core\target\filelanguage\test\hello.txt

Absolute paths

We have a java.io.File handle for the file hello.txt in the following absolute dir ectory: \workspace\camel\camel-core\target\filelanguage\test. And we configure out endpoint to use the absolute starting directory \workspace\camel\camel-core\target\filelanguage. The file tokens will return as:

Expression

Returns

file:name

test\hello.txt

file:name.ext

txt

file:name.noext

test\hello

file:onlyname

hello.txt

file:onlyname.noext

hello

file:ext

txt

file:parent

\workspace\camel\camel-core\target\filelanguage\test

file:path

\workspace\camel\camel-core\target\filelanguage\test\hello.txt

file:absolute

true

file:absolute.path

\workspace\camel\camel-core \target\filelanguage\test\hello.txt

Samples

You can enter a fixed Constant expression such as myfile.txt:

Lets assume we use the file consumer to read files and want to move the read files to backup folder with the current date as a sub folder. This can be archieved using an expression like: