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/07/31 09:57:00 UTC

[2/6] camel git commit: Added expression docs to Gitbook

Added expression 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/54ce159b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/54ce159b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/54ce159b

Branch: refs/heads/master
Commit: 54ce159bd1eec1790dd545e8e49eb00e5c4d9401
Parents: 3002f8d
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sun Jul 31 11:14:01 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sun Jul 31 11:14:01 2016 +0200

----------------------------------------------------------------------
 docs/user-manual/en/SUMMARY.md      |   2 +-
 docs/user-manual/en/expression.adoc | 136 +++++++++++++++++++++++++++++++
 2 files changed, 137 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/54ce159b/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 0ecc6f4..6771ff3 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -33,13 +33,13 @@
     * [Error Handler](error-handler.adoc)
     * [Exchange](exchange.adoc)
     * [Exchange Pattern](exchange-pattern.adoc)
+    * [Expression](expression.adoc)
     * [Intercept](intercept.adoc)
     * [Registry](registry.adoc)
     * [RX](rx.adoc)
     * [Scala DSL](scala-dsl.adoc)
 
 <!--
-    * [Expression](.adoc)
     * [Injector](.adoc)
     * [Inversion Of Control With Smart Defaults](.adoc)
     * [Languages](.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/54ce159b/docs/user-manual/en/expression.adoc
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/expression.adoc b/docs/user-manual/en/expression.adoc
new file mode 100644
index 0000000..9b7f5ac
--- /dev/null
+++ b/docs/user-manual/en/expression.adoc
@@ -0,0 +1,136 @@
+[[Expression-Expressions]]
+Expressions
+~~~~~~~~~~~
+
+Expressions and link:predicate.html[Predicates] can then be used to
+create the various link:enterprise-integration-patterns.html[Enterprise
+Integration Patterns] in the link:dsl.html[DSL] or
+link:xml-configuration.html[Xml Configuration] like the
+link:recipient-list.html[Recipient List]. +
+ To support dynamic rules Camel supports pluggable
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Expression.html[Expression]
+strategies using a variety of different link:languages.html[Languages].
+
+[[Expression-API]]
+API
+^^^
+
+If you are outside of the link:dsl.html[DSL] and want to create your own
+expressions you can either implement the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Expression.html[Expression
+interface], reuse one of the other builders or try the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/builder/ExpressionBuilder.html[ExpressionBuilder
+class].
+
+[[Expression-Expression]]
+Expression
+++++++++++
+
+The API for a Camel Expression is defined in the
+`org.apache.camel.Expression` interface as shown:
+
+[source,java]
+-------------------------------------------------------------------------------
+public interface Expression {
+
+    /**
+     * Returns the value of the expression on the given exchange
+     *
+     * @param exchange the message exchange on which to evaluate the expression
+     * @param type the expected type of the evaluation result
+     * @return the value of the expression
+     */
+    <T> T evaluate(Exchange exchange, Class<T> type);
+}
+-------------------------------------------------------------------------------
+
+[[Expression-Predicate]]
+Predicate
++++++++++
+
+The API for a Camel Predicate is defined in the
+`org.apache.camel.Predicate` interface as shown:
+
+[source,java]
+-------------------------------------------------------------------------------
+public interface Predicate {
+
+    /**
+     * Evaluates the predicate on the message exchange and returns true if this
+     * exchange matches the predicate
+     * 
+     * @param exchange the message exchange
+     * @return true if the predicate matches
+     */
+    boolean matches(Exchange exchange);
+
+}
+-------------------------------------------------------------------------------
+
+[[Expression-ExpressionLanguages]]
+Expression Languages
+^^^^^^^^^^^^^^^^^^^^
+
+The following languages are supported out of the box
+
+* link:bean-language.html[Bean Language] for using Java for expressions
+* link:constant.html[Constant]
+* the unified link:el.html[EL] from JSP and JSF
+* link:header.html[Header]
+* link:jsonpath.html[JSonPath]
+* link:jxpath.html[JXPath]
+* link:mvel.html[Mvel]
+* link:ognl.html[OGNL]
+* link:ref-language.html[Ref Language]
+* link:exchangeproperty.html[ExchangeProperty]
+/�link:property.html[Property]
+* link:scripting-languages.html[Scripting Languages] such as
+** link:beanshell.html[BeanShell]
+** link:javascript.html[JavaScript]
+** link:groovy.html[Groovy]
+** link:python.html[Python]
+** link:php.html[PHP]
+** link:ruby.html[Ruby]
+* link:simple.html[Simple]
+** link:file-language.html[File Language]
+* link:spel.html[Spring Expression Language]
+* link:sql.html[SQL]
+* link:tokenizer.html[Tokenizer]
+* link:xpath.html[XPath]
+* link:xquery.html[XQuery]
+* link:vtd-xml.html[VTD-XML]
+
+Most of these languages is also supported used as
+link:annotation-based-expression-language.html[Annotation Based
+Expression Language].
+
+[[Expression-UsingExpressionsinyourIDE]]
+Using Expressions in your IDE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To use different expression and predicates in your IDE you need to
+perform a static import of the builder class for the language(s) you
+wish to use.
+
+[width="100%",cols="20%,80%",options="header",]
+|=======================================================================
+|Language(s) |Builder class to import
+
+|link:scripting-languages.html[Scripting Languages] such as
+link:beanshell.html[BeanShell], link:javascript.html[JavaScript],
+link:groovy.html[Groovy], link:php.html[PHP], link:python.html[Python]
+and link:ruby.html[Ruby] |http://camel.apache.org/maven/current/camel-script/apidocs/org/apache/camel/builder/script/ScriptBuilder.html[org.apache.camel.builder.script.ScriptBuilder]
+
+|link:sql.html[SQL] |http://camel.apache.org/maven/current/camel-josql/apidocs/org/apache/camel/builder/sql/SqlBuilder.html[org.apache.camel.builder.josql.SqlBuilder]
+
+|link:xpath.html[XPath] |http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/builder/xml/XPathBuilder.html[org.apache.camel.builder.xml.XPathBuilder]
+
+|link:xquery.html[XQuery] |http://camel.apache.org/maven/current/camel-saxon/apidocs/org/apache/camel/builder/saxon/XQueryBuilder.html[org.apache.camel.builder.saxon.XQueryBuilder]
+|=======================================================================
+
+[[Expression-SeeAlso]]
+See Also
+++++++++
+
+* link:predicate.html[Predicate]
+