Repository: camel
Updated Branches:
  refs/heads/master 8739eafec -> 3c4b97f03


Component docs


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

Branch: refs/heads/master
Commit: 3c4b97f03bc907a8045c945d316c4fbb7dfbbd8f
Parents: 8739eaf
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sun Jun 14 17:44:17 2015 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sun Jun 14 17:44:17 2015 +0200

----------------------------------------------------------------------
 .../camel/component/cometd/CometdComponent.java | 18 ++++++
 .../camel/component/cometd/CometdConsumer.java  |  2 +-
 .../camel/component/cometd/CometdEndpoint.java  | 62 ++++++++++++++++----
 .../component/cometd/CometdConsumerTest.java    |  2 +-
 .../cometd/CometdProducerConsumerTest.java      |  2 +-
 5 files changed, 70 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3c4b97f0/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
index fed38ae..50e3b53 100644
--- 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
+++ 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
@@ -256,18 +256,30 @@ public class CometdComponent extends UriEndpointComponent 
{
         return sslKeystore;
     }
 
+    /**
+     * The password for the keystore when using SSL.
+     */
     public void setSslKeyPassword(String sslKeyPassword) {
         this.sslKeyPassword = sslKeyPassword;
     }
 
+    /**
+     * The password when using SSL.
+     */
     public void setSslPassword(String sslPassword) {
         this.sslPassword = sslPassword;
     }
 
+    /**
+     * The path to the keystore.
+     */
     public void setSslKeystore(String sslKeystore) {
         this.sslKeystore = sslKeystore;
     }
 
+    /**
+     * To use a custom configured SecurityPolicy to control authorization
+     */
     public void setSecurityPolicy(SecurityPolicy securityPolicy) {
         this.securityPolicy = securityPolicy;
     }
@@ -280,6 +292,9 @@ public class CometdComponent extends UriEndpointComponent {
         return extensions;
     }
 
+    /**
+     * To use a list of custom BayeuxServer.Extension that allows modifying 
incoming and outgoing requests.
+     */
     public void setExtensions(List<BayeuxServer.Extension> extensions) {
         this.extensions = extensions;
     }
@@ -302,6 +317,9 @@ public class CometdComponent extends UriEndpointComponent {
         return sslContextParameters;
     }
 
+    /**
+     * To configure security using SSLContextParameters
+     */
     public void setSslContextParameters(SSLContextParameters 
sslContextParameters) {
         this.sslContextParameters = sslContextParameters;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/3c4b97f0/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
index 8b8470e..3ddf9f6 100644
--- 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
+++ 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
@@ -85,7 +85,7 @@ public class CometdConsumer extends DefaultConsumer 
implements CometdProducerCon
         }
 
         private CometdBinding createBinding(BayeuxServerImpl bayeux) {
-            boolean enableSessionHeaders = endpoint == null ? false : 
endpoint.areSessionHeadersEnabled();
+            boolean enableSessionHeaders = endpoint == null ? false : 
endpoint.isSessionHeadersEnabled();
             return new CometdBinding(bayeux, enableSessionHeaders);
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/3c4b97f0/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
index d553ff0..43d2a35 100644
--- 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
+++ 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
@@ -33,19 +33,17 @@ import org.apache.camel.util.ObjectHelper;
 /**
  * Endpoint for Camel Cometd.
  */
-@UriEndpoint(scheme = "cometd,cometds", title = "CometD", syntax = 
"cometd:protocol:host:port/channelName", consumerClass = CometdConsumer.class, 
label = "websocket")
+@UriEndpoint(scheme = "cometd,cometds", title = "CometD", syntax = 
"cometd:host:port/channelName", consumerClass = CometdConsumer.class, label = 
"websocket")
 public class CometdEndpoint extends DefaultEndpoint {
 
     private CometdComponent component;
 
     private URI uri;
-    @UriPath @Metadata(required = "true")
-    private String protocol;
-    @UriPath @Metadata(required = "true")
+    @UriPath(description = "Hostname") @Metadata(required = "true")
     private String host;
-    @UriPath @Metadata(required = "true")
+    @UriPath(description = "Host port number") @Metadata(required = "true")
     private int port;
-    @UriPath @Metadata(required = "true")
+    @UriPath(description = "The channelName represents a topic that can be 
subscribed to by the Camel endpoints.") @Metadata(required = "true")
     private String channelName;
     @UriParam
     private String baseResource;
@@ -59,17 +57,17 @@ public class CometdEndpoint extends DefaultEndpoint {
     private int multiFrameInterval = 1500;
     @UriParam(defaultValue = "true")
     private boolean jsonCommented = true;
-    @UriParam
+    @UriParam(label = "consumer")
     private boolean sessionHeadersEnabled;
-    @UriParam(defaultValue = "1")
+    @UriParam(defaultValue = "1", enums = "0,1,2")
     private int logLevel = 1;
     @UriParam
     private boolean crossOriginFilterOn;
-    @UriParam
+    @UriParam(defaultValue = "*")
     private String allowedOrigins;
     @UriParam
     private String filterPath;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "producer", defaultValue = "true")
     private boolean disconnectLocalSession = true;
 
     public CometdEndpoint(CometdComponent component, String uri, String 
remaining, Map<String, Object> parameters) {
@@ -77,7 +75,6 @@ public class CometdEndpoint extends DefaultEndpoint {
         this.component = component;
         try {
             this.uri = new URI(uri);
-            this.protocol = this.uri.getScheme();
             this.host = this.uri.getHost();
             this.port = this.uri.getPort();
             this.channelName = remaining;
@@ -142,6 +139,11 @@ public class CometdEndpoint extends DefaultEndpoint {
         return baseResource;
     }
 
+    /**
+     * The root directory for the web resources or classpath. Use the protocol 
file: or classpath: depending
+     * if you want that the component loads the resource from file system or 
classpath.
+     * Classpath is required for OSGI deployment where the resources are 
packaged in the jar
+     */
     public void setBaseResource(String baseResource) {
         this.baseResource = baseResource;
     }
@@ -150,6 +152,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return timeout;
     }
 
+    /**
+     * The server side poll timeout in milliseconds. This is how long the 
server will hold a reconnect request before responding.
+     */
     public void setTimeout(int timeout) {
         this.timeout = timeout;
     }
@@ -158,6 +163,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return interval;
     }
 
+    /**
+     * The client side poll timeout in milliseconds. How long a client will 
wait between reconnects
+     */
     public void setInterval(int interval) {
         this.interval = interval;
     }
@@ -166,6 +174,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return maxInterval;
     }
 
+    /**
+     * The max client side poll timeout in milliseconds. A client will be 
removed if a connection is not received in this time.
+     */
     public void setMaxInterval(int maxInterval) {
         this.maxInterval = maxInterval;
     }
@@ -174,6 +185,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return multiFrameInterval;
     }
 
+    /**
+     * The client side poll timeout, if multiple connections are detected from 
the same browser.
+     */
     public void setMultiFrameInterval(int multiFrameInterval) {
         this.multiFrameInterval = multiFrameInterval;
     }
@@ -182,15 +196,21 @@ public class CometdEndpoint extends DefaultEndpoint {
         return jsonCommented;
     }
 
+    /**
+     * If true, the server will accept JSON wrapped in a comment and will 
generate JSON wrapped in a comment. This is a defence against Ajax Hijacking.
+     */
     public void setJsonCommented(boolean commented) {
         jsonCommented = commented;
     }
-    
+
+    /**
+     * Whether to include the server session headers in the Camel message when 
creating a Camel Message for incoming requests.
+     */
     public void setSessionHeadersEnabled(boolean enable) {
         this.sessionHeadersEnabled = enable;
     }
 
-    public boolean areSessionHeadersEnabled() {
+    public boolean isSessionHeadersEnabled() {
         return sessionHeadersEnabled;
     }
 
@@ -198,6 +218,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return logLevel;
     }
 
+    /**
+     * Logging level. 0=none, 1=info, 2=debug.
+     */
     public void setLogLevel(int logLevel) {
         this.logLevel = logLevel;
     }
@@ -206,6 +229,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return allowedOrigins;
     }
 
+    /**
+     * The origins domain that support to cross, if the crosssOriginFilterOn 
is true
+     */
     public void setAllowedOrigins(String allowedOrigins) {
         this.allowedOrigins = allowedOrigins;
     }
@@ -214,6 +240,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return crossOriginFilterOn;
     }
 
+    /**
+     * If true, the server will support for cross-domain filtering
+     */
     public void setCrossOriginFilterOn(boolean crossOriginFilterOn) {
         this.crossOriginFilterOn = crossOriginFilterOn;
     }
@@ -222,6 +251,9 @@ public class CometdEndpoint extends DefaultEndpoint {
         return filterPath;
     }
 
+    /**
+     * The filterPath will be used by the CrossOriginFilter, if the 
crosssOriginFilterOn is true
+     */
     public void setFilterPath(String filterPath) {
         this.filterPath = filterPath;
     }
@@ -230,6 +262,10 @@ public class CometdEndpoint extends DefaultEndpoint {
         return disconnectLocalSession;
     }
 
+    /**
+     * Whether to disconnect local sessions after publishing a message to its 
channel.
+     * Disconnecting local session is needed as they are not swept by default 
by CometD, and therefore you can run out of memory.
+     */
     public void setDisconnectLocalSession(boolean disconnectLocalSession) {
         this.disconnectLocalSession = disconnectLocalSession;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/3c4b97f0/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
 
b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
index f723f6b..9e5c6ba 100644
--- 
a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
+++ 
b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
@@ -96,7 +96,7 @@ public class CometdConsumerTest {
     @Test
     public void testSessionHeadersAdded() throws Exception {
         // setup
-        when(endpoint.areSessionHeadersEnabled()).thenReturn(true);
+        when(endpoint.isSessionHeadersEnabled()).thenReturn(true);
         testObj.start();
         ServerMessage cometdMessage = mock(ServerMessage.class);
         Exchange exchange = mock(Exchange.class);

http://git-wip-us.apache.org/repos/asf/camel/blob/3c4b97f0/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
 
b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
index 53f0ba9..59653b0 100644
--- 
a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
+++ 
b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
@@ -94,7 +94,7 @@ public class CometdProducerConsumerTest extends 
CamelTestSupport {
         // assert
         assertTrue(result instanceof CometdEndpoint);
         CometdEndpoint cometdEndpoint = (CometdEndpoint)result;
-        assertTrue(cometdEndpoint.areSessionHeadersEnabled());
+        assertTrue(cometdEndpoint.isSessionHeadersEnabled());
     }
     
     @Test

Reply via email to