You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/05/02 08:48:49 UTC

[1/2] camel git commit: Added camel-jsch docs to Gitbook

Repository: camel
Updated Branches:
  refs/heads/master 65aea6a54 -> 802c3dbb5


Added camel-jsch docs to Gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a9e450b2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a9e450b2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a9e450b2

Branch: refs/heads/master
Commit: a9e450b293aeef6780c5d1a7995beab728b5e150
Parents: 65aea6a
Author: Andrea Cosentino <an...@gmail.com>
Authored: Mon May 2 08:43:38 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Mon May 2 08:43:38 2016 +0200

----------------------------------------------------------------------
 components/camel-jsch/src/main/docs/scp.adoc | 127 ++++++++++++++++++++++
 docs/user-manual/en/SUMMARY.md               |   1 +
 2 files changed, 128 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a9e450b2/components/camel-jsch/src/main/docs/scp.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jsch/src/main/docs/scp.adoc b/components/camel-jsch/src/main/docs/scp.adoc
new file mode 100644
index 0000000..ce604f2
--- /dev/null
+++ b/components/camel-jsch/src/main/docs/scp.adoc
@@ -0,0 +1,127 @@
+[[Jsch-Jsch]]
+Jsch
+~~~~
+
+The *camel-jsch* component supports the
+http://en.wikipedia.org/wiki/Secure_copy[SCP protocol] using the Client
+API of the http://www.jcraft.com/jsch/[Jsch] project. Jsch is already
+used in camel by the link:ftp.html[FTP] component for the *sftp:*
+protocol.
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-jsch</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[Jsch-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+---------------------------------------
+scp://host[:port]/destination[?options]
+---------------------------------------
+
+You can append query options to the URI in the following format,
+`?option=value&option=value&...`
+
+The file name can be specified either in the <path> part of the URI or
+as a "CamelFileName" header on the message (`Exchange.FILE_NAME` if used
+in code).
+
+[[Jsch-Options]]
+Options
+^^^^^^^
+
+
+// component options: START
+The SCP component supports 1 options which are listed below.
+
+
+
+[width="100%",cols="2s,1m,8",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| verboseLogging | boolean | JSCH is verbose logging out of the box. Therefore we turn the logging down to DEBUG logging by default. But setting this option to true turns on the verbose logging again.
+|=======================================================================
+// component options: END
+
+
+
+// endpoint options: START
+The SCP component supports 42 endpoint options which are listed below:
+
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| host | producer |  | String | *Required* Hostname of the FTP server
+| port | producer |  | int | Port of the FTP server
+| directoryName | producer |  | String | The starting directory
+| binary | producer | false | boolean | Specifies the file transfer mode BINARY or ASCII. Default is ASCII (false).
+| charset | producer |  | String | This option is used to specify the encoding of the file. You can use this on the consumer to specify the encodings of the files which allow Camel to know the charset it should load the file content in case the file content is being accessed. Likewise when writing a file you can use this option to specify which charset to write the file as well.
+| chmod | producer | 664 | String | Allows you to set chmod on the stored file. For example chmod=664.
+| ciphers | producer |  | String | Set a comma separated list of ciphers that will be used in order of preference. Possible cipher names are defined by JCraft JSCH. Some examples include: aes128-ctraes128-cbc3des-ctr3des-cbcblowfish-cbcaes192-cbcaes256-cbc. If not specified the default list from JSCH will be used.
+| disconnect | producer | false | boolean | Whether or not to disconnect from remote FTP server right after use. Disconnect will only disconnect the current connection to the FTP server. If you have a consumer which you want to stop then you need to stop the consumer/route instead.
+| doneFileName | producer |  | String | If provided then Camel will write a 2nd done file when the original file has been written. The done file will be empty. This option configures what file name to use. Either you can specify a fixed name. Or you can use dynamic placeholders. The done file will always be written in the same folder as the original file. Only $file.name and $file.name.noext is supported as dynamic placeholders.
+| download | producer | false | boolean | Whether the FTP consumer should download the file. If this option is set to false then the message body will be null but the consumer will still trigger a Camel Exchange that has details about the file such as file name file size etc. It's just that the file will not be downloaded.
+| fastExistsCheck | producer | false | boolean | If set this option to be true camel-ftp will use the list file directly to check if the file exists. Since some FTP server may not support to list the file directly if the option is false camel-ftp will use the old way to list the directory and check if the file exists. This option also influences readLock=changed to control whether it performs a fast check to update file information or not. This can be used to speed up the process if the FTP server has a lot of files.
+| fileExist | producer | Override | GenericFileExist | What to do if a file already exists with the same name. Override which is the default replaces the existing file. Append - adds content to the existing file. Fail - throws a GenericFileOperationException indicating that there is already an existing file. Ignore - silently ignores the problem and does not override the existing file but assumes everything is okay. Move - option requires to use the moveExisting option to be configured as well. The option eagerDeleteTargetFile can be used to control what to do if an moving the file and there exists already an existing file otherwise causing the move operation to fail. The Move option will move any existing files before writing the target file. TryRename Camel is only applicable if tempFileName option is in use. This allows to try renaming the file from the temporary name to the actual name without doing any exists check.This check may be faster on some file systems and especially FT
 P servers.
+| fileName | producer |  | String | Use Expression such as File Language to dynamically set the filename. For consumers it's used as a filename filter. For producers it's used to evaluate the filename to write. If an expression is set it take precedence over the CamelFileName header. (Note: The header itself can also be an Expression). The expression options support both String and Expression types. If the expression is a String type it is always evaluated using the File Language. If the expression is an Expression type the specified Expression type is used - this allows you for instance to use OGNL expressions. For the consumer you can use it to filter filenames so you can for instance consume today's file using the File Language syntax: mydata-$date:now:yyyyMMdd.txt. The producers support the CamelOverruleFileName header which takes precedence over any existing CamelFileName header; the CamelOverruleFileName is a header that is used only once and makes it easier as this avoids to 
 temporary store CamelFileName and have to restore it afterwards.
+| flatten | producer | false | boolean | Flatten is used to flatten the file name path to strip any leading paths so it's just the file name. This allows you to consume recursively into sub-directories but when you eg write the files to another directory they will be written in a single directory. Setting this to true on the producer enforces that any file name in CamelFileName header will be stripped for any leading paths.
+| knownHostsFile | producer |  | String | Sets the known_hosts file so that the jsch endpoint can do host key verification.
+| maximumReconnectAttempts | producer |  | int | Specifies the maximum reconnect attempts Camel performs when it tries to connect to the remote FTP server. Use 0 to disable this behavior.
+| moveExisting | producer |  | String | Expression (such as File Language) used to compute file name to use when fileExist=Move is configured. To move files into a backup subdirectory just enter backup. This option only supports the following File Language tokens: file:name file:name.ext file:name.noext file:onlyname file:onlyname.noext file:ext and file:parent. Notice the file:parent is not supported by the FTP component as the FTP component can only move any existing files to a relative directory based on current dir as base.
+| passiveMode | producer | false | boolean | Sets passive mode connections. Default is active mode connections.
+| privateKeyFile | producer |  | String | Set the private key file to that the SFTP endpoint can do private key verification.
+| privateKeyFilePassphrase | producer |  | String | Set the private key file passphrase to that the SFTP endpoint can do private key verification.
+| reconnectDelay | producer |  | long | Delay in millis Camel will wait before performing a reconnect attempt.
+| separator | producer | UNIX | PathSeparator | Sets the path separator to be used. UNIX = Uses unix style path separator Windows = Uses windows style path separator Auto = (is default) Use existing path separator in file name
+| strictHostKeyChecking | producer | no | String | Sets whether to use strict host key checking. Possible values are: no yes
+| tempFileName | producer |  | String | The same as tempPrefix option but offering a more fine grained control on the naming of the temporary filename as it uses the File Language.
+| tempPrefix | producer |  | String | This option is used to write the file using a temporary name and then after the write is complete rename it to the real name. Can be used to identify files being written and also avoid consumers (not using exclusive read locks) reading in progress files. Is often used by FTP when uploading big files.
+| useUserKnownHostsFile | producer | true | boolean | If knownHostFile has not been explicit configured then use the host file from System.getProperty(user.home) /.ssh/known_hosts
+| allowNullBody | producer (advanced) | false | boolean | Used to specify if a null body is allowed during file writing. If set to true then an empty file will be created when set to false and attempting to send a null body to the file component a GenericFileWriteException of 'Cannot write null body to file.' will be thrown. If the fileExist option is set to 'Override' then the file will be truncated and if set to append the file will remain unchanged.
+| eagerDeleteTargetFile | producer (advanced) | true | boolean | Whether or not to eagerly delete any existing target file. This option only applies when you use fileExists=Override and the tempFileName option as well. You can use this to disable (set it to false) deleting the target file before the temp file is written. For example you may write big files and want the target file to exists during the temp file is being written. This ensure the target file is only deleted until the very last moment just before the temp file is being renamed to the target filename. This option is also used to control whether to delete any existing files when fileExist=Move is enabled and an existing file exists. If this option copyAndDeleteOnRenameFails false then an exception will be thrown if an existing file existed if its true then the existing file is deleted before the move operation.
+| keepLastModified | producer (advanced) | false | boolean | Will keep the last modified timestamp from the source file (if any). Will use the Exchange.FILE_LAST_MODIFIED header to located the timestamp. This header can contain either a java.util.Date or long with the timestamp. If the timestamp exists and the option is enabled it will set this timestamp on the written file. Note: This option only applies to the file producer. You cannot use this option with any of the ftp producers.
+| sendNoop | producer (advanced) | true | boolean | Whether to send a noop command as a pre-write check before uploading files to the FTP server. This is enabled by default as a validation of the connection is still valid which allows to silently re-connect to be able to upload the file. However if this causes problems you can turn this option off.
+| autoCreate | advanced | true | boolean | Automatically create missing directories in the file's pathname. For the file consumer that means creating the starting directory. For the file producer it means the directory the files should be written to.
+| bufferSize | advanced | 131072 | int | Write buffer sized in bytes.
+| connectTimeout | advanced | 10000 | int | Sets the connect timeout for waiting for a connection to be established Used by both FTPClient and JSCH
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| siteCommand | advanced |  | String | Sets optional site command(s) to be executed after successful login. Multiple site commands can be separated using a new line character (\n).
+| soTimeout | advanced | 300000 | int | Sets the so timeout Used only by FTPClient
+| stepwise | advanced | true | boolean | Sets whether we should stepwise change directories while traversing file structures when downloading files or as well when uploading a file to a directory. You can disable this if you for example are in a situation where you cannot change directory on the FTP server due security reasons.
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+| throwExceptionOnConnectFailed | advanced | false | boolean | Should an exception be thrown if connection failed (exhausted) By default exception is not thrown and a WARN is logged. You can use this to enable exception being thrown and handle the thrown exception from the org.apache.camel.spi.PollingConsumerPollStrategy rollback method.
+| timeout | advanced | 30000 | int | Sets the data timeout for waiting for reply Used only by FTPClient
+| password | security |  | String | Password to use for login
+| username | security |  | String | Username to use for login
+|=======================================================================
+// endpoint options: END
+
+
+[[Jsch-Limitations]]
+Limitations
+^^^^^^^^^^^
+
+Currently camel-jsch only supports a
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Producer.html[Producer]
+(i.e. copy files to another host).�
+
+[[Jsch-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/a9e450b2/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index a8df1e8..e0e9eab 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -182,6 +182,7 @@
     * [NATS](nats.adoc)
     * [Properties](properties.adoc)
     * [Quickfix](quickfix.adoc)
+    * [Scp](scp.adoc)
     * [SJMS](sjms.adoc)
     * [SJMS Batch](sjms-batch.adoc)
     * [Twitter](twitter.adoc)


[2/2] camel git commit: Added camel-jsonpath language to Gitbook

Posted by ac...@apache.org.
Added camel-jsonpath language to Gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/802c3dbb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/802c3dbb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/802c3dbb

Branch: refs/heads/master
Commit: 802c3dbb55943d2ed616b5e82f6f30bb0f35932b
Parents: a9e450b
Author: Andrea Cosentino <an...@gmail.com>
Authored: Mon May 2 08:47:56 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Mon May 2 08:47:56 2016 +0200

----------------------------------------------------------------------
 .../camel-jsonpath/src/main/docs/jsonpath.adoc  | 156 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 157 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/802c3dbb/components/camel-jsonpath/src/main/docs/jsonpath.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jsonpath/src/main/docs/jsonpath.adoc b/components/camel-jsonpath/src/main/docs/jsonpath.adoc
new file mode 100644
index 0000000..cf1eeee
--- /dev/null
+++ b/components/camel-jsonpath/src/main/docs/jsonpath.adoc
@@ -0,0 +1,156 @@
+[[JSonPath-JSonPath]]
+JSonPath
+~~~~~~~~
+
+*Available as of Camel 2.13*
+
+Camel supports https://code.google.com/p/json-path/[JSonPath] to allow
+using link:expression.html[Expression] or link:predicate.html[Predicate]
+on json messages.
+
+[source,java]
+-----------------------------------------------------
+from("queue:books.new")
+  .choice()
+    .when().jsonpath("$.store.book[?(@.price < 10)]")
+      .to("jms:queue:book.cheap")
+    .when().jsonpath("$.store.book[?(@.price < 30)]")
+      .to("jms:queue:book.average")
+    .otherwise()
+      .to("jms:queue:book.expensive")
+-----------------------------------------------------
+
+[[JSonPath-UsingXMLconfiguration]]
+Using XML configuration
+^^^^^^^^^^^^^^^^^^^^^^^
+
+If you prefer to configure your routes in your link:spring.html[Spring]
+XML file then you can use link:jsonpath.html[JSonPath] expressions as
+follows
+
+[source,xml]
+-------------------------------------------------------------------------
+  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:start"/>
+      <choice>
+        <when>
+          <jsonpath>$.store.book[?(@.price &lt; 10)]</jsonpath>
+          <to uri="mock:cheap"/>
+        </when>
+        <when>
+          <jsonpath>$.store.book[?(@.price &lt; 30)]</jsonpath>
+          <to uri="mock:average"/>
+        </when>
+        <otherwise>
+          <to uri="mock:expensive"/>
+        </otherwise>
+      </choice>
+    </route>
+  </camelContext>
+-------------------------------------------------------------------------
+
+[[JSonPath-Syntax]]
+Syntax
+^^^^^^
+
+See the https://code.google.com/p/json-path/[JSonPath] project page for
+further examples.
+
+[[JSonPath-Suppressexceptions]]
+Suppress exceptions
+~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.16*
+
+By default jsonpath will throw an exception if the json payload does not
+have a valid path accordingly to the configured jsonpath expression. In
+some use-cases you may want to ignore this in case the json payload
+contains optional data. Therefore you can set the option
+suppressExceptions to true to ignore this as shown:
+
+[source,java]
+---------------------------------------------------
+from("direct:start")
+    .choice()
+        // use true to suppress exceptions
+        .when().jsonpath("person.middlename", true)
+            .to("mock:middle")
+        .otherwise()
+            .to("mock:other");
+---------------------------------------------------
+
+And in XML DSL:
+
+[source,xml]
+--------------------------------------------------------------------------
+    <route>
+      <from uri="direct:start"/>
+      <choice>
+        <when>
+          <jsonpath suppressExceptions="true">person.middlename</jsonpath>
+          <to uri="mock:middle"/>
+        </when>
+        <otherwise>
+          <to uri="mock:other"/>
+        </otherwise>
+      </choice>
+    </route>
+--------------------------------------------------------------------------
+
+�
+
+This option is also available on the�`@JsonPath`�annotation.
+
+[[JSonPath-JSonPathinjection]]
+JSonPath injection
+~~~~~~~~~~~~~~~~~~
+
+You can use link:bean-integration.html[Bean Integration] to invoke a
+method on a bean and use various languages such as JSonPath to extract a
+value from the message and bind it to a method parameter.
+
+For example
+
+[source,java]
+---------------------------------------------------------------------------------------------------
+public class Foo {
+    
+    @Consume(uri = "activemq:queue:books.new")
+    public void doSomething(@JsonPath("$.store.book[*].author") String author, @Body String json) {
+      // process the inbound message here
+    }
+}
+---------------------------------------------------------------------------------------------------
+
+[[JSonPath-EncodingDetection]]
+Encoding Detection
+~~~~~~~~~~~~~~~~~~
+
+*Since Camel version 2.16*, the encoding of the JSON document is
+detected automatically, if the document is encoded in unicode �(UTF-8,
+UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE ) as specified in �RFC-4627. If
+the encoding is a non-unicode encoding, you can either make sure that
+you enter the document in String format to the JSONPath component or you
+can specify the encoding in the header�"*CamelJsonPathJsonEncoding*"
+(JsonpathConstants.HEADER_JSON_ENCODING).
+
+[[JSonPath-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use JSonPath in your camel routes you need to add the a dependency on
+*camel-jsonpath* which implements the JSonPath language.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,xml]
+-----------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-jsonpath</artifactId>
+  <version>x.x.x</version>
+</dependency>
+-----------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/802c3dbb/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index e0e9eab..e471da1 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -194,6 +194,7 @@
 * [Expession Languages](languages.adoc)
     * [Bean Language](bean-language.adoc)
     * [Constant](constant.adoc)
+    * [Jsonpath](jsonpath.adoc)
     * [SQL](josql.adoc)
 
 * Data Formats