Repository: camel
Updated Branches:
  refs/heads/master ada453417 -> 0b541c17c


Component docs


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

Branch: refs/heads/master
Commit: 8f2798351ba345206bb8c5440d839f5fb1272845
Parents: ada4534
Author: Claus Ibsen <davscl...@apache.org>
Authored: Tue May 5 16:27:48 2015 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue May 5 16:27:48 2015 +0200

----------------------------------------------------------------------
 .../camel/component/lucene/LuceneComponent.java | 12 ++++-
 .../component/lucene/LuceneConfiguration.java   | 50 +++++++++++++-------
 .../camel/component/lucene/LuceneEndpoint.java  |  2 +-
 .../camel/component/lucene/LuceneOperation.java | 23 +++++++++
 .../component/pgevent/PgEventEndpoint.java      | 36 +++-----------
 .../schematron/SchematronEndpoint.java          |  5 +-
 .../camel/component/solr/SolrEndpoint.java      | 49 ++++++++++++++++---
 7 files changed, 122 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8f279835/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneComponent.java
 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneComponent.java
index 321db88..805d6da 100644
--- 
a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneComponent.java
+++ 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneComponent.java
@@ -24,7 +24,7 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.impl.UriEndpointComponent;
 
 public class LuceneComponent extends UriEndpointComponent {
-    LuceneConfiguration config;
+    private LuceneConfiguration config;
     
     public LuceneComponent() {
         super(LuceneEndpoint.class);
@@ -45,4 +45,14 @@ public class LuceneComponent extends UriEndpointComponent {
         return luceneEndpoint;
     }
 
+    public LuceneConfiguration getConfig() {
+        return config;
+    }
+
+    /**
+     * To use a shared lucene configuration
+     */
+    public void setConfig(LuceneConfiguration config) {
+        this.config = config;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8f279835/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneConfiguration.java
 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneConfiguration.java
index 6aff71d..b2a5bea 100644
--- 
a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneConfiguration.java
+++ 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneConfiguration.java
@@ -32,13 +32,13 @@ import org.apache.lucene.util.Version;
 @UriParams
 public class LuceneConfiguration {
     private URI uri;
+    private String authority;
+    private Version luceneVersion = Version.LUCENE_4_10_3;
+
     @UriPath @Metadata(required = "true")
     private String host;
     @UriPath @Metadata(required = "true")
-    private String operation;
-    @UriParam
-    private String protocolType;
-    private String authority;
+    private LuceneOperation operation;
     @UriParam(name = "srcDir")
     private File sourceDirectory;
     @UriParam(name = "indexDir")
@@ -47,7 +47,6 @@ public class LuceneConfiguration {
     private Analyzer analyzer;
     @UriParam
     private int maxHits;
-    private Version luceneVersion = Version.LUCENE_4_10_3; 
 
     public LuceneConfiguration() {
     }
@@ -70,7 +69,12 @@ public class LuceneConfiguration {
                     + "Please specify the syntax as \"lucene:[Endpoint 
Name]:[Operation]?[Query]\""); 
         }
         setHost(retrieveTokenFromAuthority("hostname"));
-        setOperation(retrieveTokenFromAuthority("operation"));
+
+        String op = retrieveTokenFromAuthority("operation");
+        if (op != null) {
+            op = op.toLowerCase();
+        }
+        setOperation(LuceneOperation.valueOf(op));
 
         sourceDirectory = component.resolveAndRemoveReferenceParameter(
                 parameters, "srcDir", File.class, null);
@@ -111,27 +115,25 @@ public class LuceneConfiguration {
         this.uri = uri;
     }
 
-    public String getProtocolType() {
-        return protocolType;
-    }
-
-    public void setProtocolType(String protocolType) {
-        this.protocolType = protocolType;
-    }
-
     public String getHost() {
         return host;
     }
 
+    /**
+     * The URL to the lucene server
+     */
     public void setHost(String host) {
         this.host = host;
     }
 
-    public String getOperation() {
+    public LuceneOperation getOperation() {
         return operation;
     }
 
-    public void setOperation(String operation) {
+    /**
+     * Operation to do such as insert or query.
+     */
+    public void setOperation(LuceneOperation operation) {
         this.operation = operation;
     }
 
@@ -147,6 +149,9 @@ public class LuceneConfiguration {
         return sourceDirectory;
     }
 
+    /**
+     * An optional directory containing files to be used to be analyzed and 
added to the index at producer startup.
+     */
     public void setSourceDirectory(File sourceDirectory) {
         this.sourceDirectory = sourceDirectory;
     }
@@ -155,6 +160,9 @@ public class LuceneConfiguration {
         return indexDirectory;
     }
 
+    /**
+     * A file system directory in which index files are created upon analysis 
of the document by the specified analyzer
+     */
     public void setIndexDirectory(File indexDirectory) {
         this.indexDirectory = indexDirectory;
     }
@@ -163,6 +171,11 @@ public class LuceneConfiguration {
         return analyzer;
     }
 
+    /**
+     * An Analyzer builds TokenStreams, which analyze text. It thus represents 
a policy for extracting index terms from text.
+     * The value for analyzer can be any class that extends the abstract class 
org.apache.lucene.analysis.Analyzer.
+     * Lucene also offers a rich set of analyzers out of the box
+     */
     public void setAnalyzer(Analyzer analyzer) {
         this.analyzer = analyzer;
     }
@@ -171,6 +184,9 @@ public class LuceneConfiguration {
         return maxHits;
     }
 
+    /**
+     * An integer value that limits the result set of the search operation
+     */
     public void setMaxHits(int maxHits) {
         this.maxHits = maxHits;
     }
@@ -178,7 +194,7 @@ public class LuceneConfiguration {
     public void setLuceneVersion(Version luceneVersion) {
         this.luceneVersion = luceneVersion;
     }
-    
+
     public Version getLuceneVersion() {
         return luceneVersion;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/8f279835/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
index d31e6dd..01fd455 100644
--- 
a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
+++ 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
@@ -52,7 +52,7 @@ public class LuceneEndpoint extends DefaultEndpoint {
     public LuceneEndpoint(String endpointUri, LuceneComponent component, 
LuceneConfiguration config) throws Exception {
         this(endpointUri, component);
         this.config = config;
-        if (config.getOperation().equalsIgnoreCase("insert")) {
+        if (config.getOperation() == LuceneOperation.insert) {
             this.indexer = new LuceneIndexer(config.getSourceDirectory(), 
config.getIndexDirectory(), config.getAnalyzer());  
             insertFlag = true;
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/8f279835/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneOperation.java
----------------------------------------------------------------------
diff --git 
a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneOperation.java
 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneOperation.java
new file mode 100644
index 0000000..fda54f8
--- /dev/null
+++ 
b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneOperation.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.lucene;
+
+public enum LuceneOperation {
+
+    insert,query
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8f279835/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
 
b/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
index 197d48e..774b3f4 100644
--- 
a/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
+++ 
b/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java
@@ -56,7 +56,6 @@ public class PgEventEndpoint extends DefaultEndpoint {
     private String database;
     @UriPath @Metadata(required = "true")
     private String channel;
-
     @UriParam(defaultValue = "postgres")
     private String user = "postgres";
     @UriParam
@@ -170,99 +169,78 @@ public class PgEventEndpoint extends DefaultEndpoint {
         return true;
     }
 
-    /**
-     * @return the host
-     */
     public String getHost() {
         return host;
     }
 
     /**
-     * @param host the host to set
+     * To connect using hostname and port to the database.
      */
     public void setHost(String host) {
         this.host = host;
     }
 
-    /**
-     * @return the port
-     */
     public Integer getPort() {
         return port;
     }
 
     /**
-     * @param port the port to set
+     * To connect using hostname and port to the database.
      */
     public void setPort(Integer port) {
         this.port = port;
     }
 
-    /**
-     * @return the database
-     */
     public String getDatabase() {
         return database;
     }
 
     /**
-     * @param database the database to set
+     * The database name
      */
     public void setDatabase(String database) {
         this.database = database;
     }
 
-    /**
-     * @return the channel
-     */
     public String getChannel() {
         return channel;
     }
 
     /**
-     * @param channel the channel to set
+     * The channel name
      */
     public void setChannel(String channel) {
         this.channel = channel;
     }
 
-    /**
-     * @return the user
-     */
     public String getUser() {
         return user;
     }
 
     /**
-     * @param user the user to set
+     * Username for login
      */
     public void setUser(String user) {
         this.user = user;
     }
 
-    /**
-     * @return the pass
-     */
     public String getPass() {
         return pass;
     }
 
     /**
-     * @param pass the pass to set
+     * Password for login
      */
     public void setPass(String pass) {
         this.pass = pass;
     }
 
-    /**
-     * @return the datasource
-     */
     public DataSource getDatasource() {
         return datasource;
     }
 
     /**
-     * @param datasource the datasource to set
+     * To connect using the given {@link javax.sql.DataSource} instead of 
using hostname and port.
      */
     public void setDatasource(DataSource datasource) {
         this.datasource = datasource;

http://git-wip-us.apache.org/repos/asf/camel/blob/8f279835/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
 
b/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
index 9c2a213..3c5a7ae 100644
--- 
a/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
+++ 
b/components/camel-schematron/src/main/java/org/apache/camel/component/schematron/SchematronEndpoint.java
@@ -100,6 +100,9 @@ public class SchematronEndpoint extends DefaultEndpoint {
         return rules;
     }
 
+    /**
+     * To use the given schematron rules instead of loading from the path
+     */
     public void setRules(Templates rules) {
         this.rules = rules;
     }
@@ -127,6 +130,6 @@ public class SchematronEndpoint extends DefaultEndpoint {
                 throw new SchematronConfigException("Failed to load rules: " + 
path);
             }
         }
-
     }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8f279835/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
index d63883b..45f9df0 100644
--- 
a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
+++ 
b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
@@ -35,12 +35,13 @@ import org.apache.solr.client.solrj.impl.HttpSolrServer;
 /**
  * Represents a Solr endpoint.
  */
-@UriEndpoint(scheme = "solr", title = "Solr", syntax = "solr:url", 
producerOnly = true, label = "monitoring,search")
+@UriEndpoint(scheme = "solr,solrs,solrCloud", title = "Solr", syntax = 
"solr:url", producerOnly = true, label = "monitoring,search")
 public class SolrEndpoint extends DefaultEndpoint {
 
-    @UriPath @Metadata(required = "true")
-    private String url;
     private String scheme = "http://";;
+
+    @UriPath(description = "Hostname and port for the solr server") 
@Metadata(required = "true")
+    private String url;
     @UriParam(defaultValue = "" + SolrConstants.DEFUALT_STREAMING_QUEUE_SIZE)
     private int streamingQueueSize = 
SolrConstants.DEFUALT_STREAMING_QUEUE_SIZE;
     @UriParam(defaultValue = "" + SolrConstants.DEFAULT_STREAMING_THREAD_COUNT)
@@ -59,9 +60,9 @@ public class SolrEndpoint extends DefaultEndpoint {
     private Boolean followRedirects;
     @UriParam
     private Boolean allowCompression;
-    @UriParam
+    @UriParam(label = "solrCloud")
     private String zkHost;
-    @UriParam
+    @UriParam(label = "solrCloud")
     private String collection;
     @UriParam
     private String requestHandler;
@@ -74,7 +75,10 @@ public class SolrEndpoint extends DefaultEndpoint {
         URL url = new URL(scheme + address);
         this.url = url.toString();
     }
-   
+
+    /**
+     * Set the ZooKeeper host information which the solrCloud could use, such 
as "zkhost=localhost:8123".
+     */
     public void setZkHost(String zkHost) throws UnsupportedEncodingException {
         String decoded = URLDecoder.decode(zkHost, "UTF-8");
         this.zkHost = decoded;
@@ -84,6 +88,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return this.zkHost;
     }
 
+    /**
+     * Set the collection name which the solrCloud server could use
+     */
     public void setCollection(String collection) {
         this.collection = collection;
     }
@@ -172,6 +179,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return true;
     }
 
+    /**
+     * Set the request handler to be used
+     */
     public void setRequestHandler(String requestHandler) {
         this.requestHandler = requestHandler;
     }
@@ -184,6 +194,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return streamingThreadCount;
     }
 
+    /**
+     * Set the number of threads for the StreamingUpdateSolrServer
+     */
     public void setStreamingThreadCount(int streamingThreadCount) {
         this.streamingThreadCount = streamingThreadCount;
     }
@@ -192,6 +205,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return streamingQueueSize;
     }
 
+    /**
+     * Set the queue size for the StreamingUpdateSolrServer
+     */
     public void setStreamingQueueSize(int streamingQueueSize) {
         this.streamingQueueSize = streamingQueueSize;
     }
@@ -200,6 +216,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return maxRetries;
     }
 
+    /**
+     * Maximum number of retries to attempt in the event of transient errors
+     */
     public void setMaxRetries(Integer maxRetries) {
         this.maxRetries = maxRetries;
     }
@@ -208,6 +227,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return soTimeout;
     }
 
+    /**
+     * Read timeout on the underlying HttpConnectionManager. This is desirable 
for queries, but probably not for indexing
+     */
     public void setSoTimeout(Integer soTimeout) {
         this.soTimeout = soTimeout;
     }
@@ -216,6 +238,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return connectionTimeout;
     }
 
+    /**
+     * connectionTimeout on the underlying HttpConnectionManager
+     */
     public void setConnectionTimeout(Integer connectionTimeout) {
         this.connectionTimeout = connectionTimeout;
     }
@@ -224,6 +249,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return defaultMaxConnectionsPerHost;
     }
 
+    /**
+     * maxConnectionsPerHost on the underlying HttpConnectionManager
+     */
     public void setDefaultMaxConnectionsPerHost(Integer 
defaultMaxConnectionsPerHost) {
         this.defaultMaxConnectionsPerHost = defaultMaxConnectionsPerHost;
     }
@@ -232,6 +260,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return maxTotalConnections;
     }
 
+    /**
+     * maxTotalConnection on the underlying HttpConnectionManager
+     */
     public void setMaxTotalConnections(Integer maxTotalConnections) {
         this.maxTotalConnections = maxTotalConnections;
     }
@@ -240,6 +271,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return followRedirects;
     }
 
+    /**
+     * indicates whether redirects are used to get to the Solr server
+     */
     public void setFollowRedirects(Boolean followRedirects) {
         this.followRedirects = followRedirects;
     }
@@ -248,6 +282,9 @@ public class SolrEndpoint extends DefaultEndpoint {
         return allowCompression;
     }
 
+    /**
+     * Server side must support gzip or deflate for this to have any effect
+     */
     public void setAllowCompression(Boolean allowCompression) {
         this.allowCompression = allowCompression;
     }

Reply via email to