CAMEL-7999: More components include documentation

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

Branch: refs/heads/master
Commit: 48e7ab534ba51b812e757e65d7337b5332c6db1f
Parents: 362c8bc
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sun Jan 4 10:56:32 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sun Jan 4 10:56:32 2015 +0100

----------------------------------------------------------------------
 .../camel/component/xmlrpc/XmlRpcComponent.java |  20 ++-
 .../component/xmlrpc/XmlRpcConfiguration.java   | 168 +++++++++++++++++++
 .../camel/component/xmlrpc/XmlRpcEndpoint.java  |  41 ++++-
 3 files changed, 216 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/48e7ab53/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java
 
b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java
index 4ebdd41..b081f1d 100644
--- 
a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java
+++ 
b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcComponent.java
@@ -19,23 +19,25 @@ package org.apache.camel.component.xmlrpc;
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+import org.apache.camel.impl.UriEndpointComponent;
 
 /**
  * Represents the component that manages {@link XmlRpcEndpoint}.
  */
-public class XmlRpcComponent extends DefaultComponent {
+public class XmlRpcComponent extends UriEndpointComponent {
+
+    public XmlRpcComponent() {
+        super(XmlRpcEndpoint.class);
+    }
 
     protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
+        XmlRpcConfiguration configuration = new XmlRpcConfiguration();
+        setProperties(configuration, parameters);
+
         // current we just use the uri as the server address
         XmlRpcEndpoint endpoint = new XmlRpcEndpoint(uri, this, remaining);
-        XmlRpcClientConfigImpl clientConfig = endpoint.getClientConfig();
-        // find out the clientConfigurer first
-        XmlRpcClientConfigurer clientConfigurer = 
resolveAndRemoveReferenceParameter(parameters, "clientConfigurer", 
XmlRpcClientConfigurer.class);
-        endpoint.setClientConfigurer(clientConfigurer);
-        // we just use the XmlRpcClientConfig to take the parameters
-        setProperties(clientConfig, parameters);
+        endpoint.setConfiguration(configuration);
+        setProperties(endpoint, parameters);
         return endpoint;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/48e7ab53/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConfiguration.java
 
b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConfiguration.java
new file mode 100644
index 0000000..40c93c6
--- /dev/null
+++ 
b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcConfiguration.java
@@ -0,0 +1,168 @@
+/**
+ * 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.xmlrpc;
+
+import java.util.TimeZone;
+
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.xmlrpc.common.XmlRpcRequestProcessor;
+
+@UriParams
+public class XmlRpcConfiguration {
+
+    @UriParam
+    private boolean enabledForExtensions;
+    @UriParam
+    private boolean contentLengthOptional;
+    @UriParam
+    private String basicEncoding;
+    @UriParam
+    private String encoding;
+    @UriParam
+    private java.util.TimeZone timeZone;
+    @UriParam
+    private boolean gzipCompressing;
+    @UriParam
+    private boolean gzipRequesting;
+    @UriParam
+    private String basicUserName;
+    @UriParam
+    private String basicPassword;
+    @UriParam
+    private int connectionTimeout;
+    @UriParam
+    private int replyTimeout;
+    @UriParam
+    private boolean enabledForExceptions;
+    @UriParam
+    private org.apache.xmlrpc.common.XmlRpcRequestProcessor xmlRpcServer;
+    @UriParam
+    private String userAgent;
+
+    public boolean isEnabledForExtensions() {
+        return enabledForExtensions;
+    }
+
+    public void setEnabledForExtensions(boolean enabledForExtensions) {
+        this.enabledForExtensions = enabledForExtensions;
+    }
+
+    public boolean isContentLengthOptional() {
+        return contentLengthOptional;
+    }
+
+    public void setContentLengthOptional(boolean contentLengthOptional) {
+        this.contentLengthOptional = contentLengthOptional;
+    }
+
+    public String getBasicEncoding() {
+        return basicEncoding;
+    }
+
+    public void setBasicEncoding(String basicEncoding) {
+        this.basicEncoding = basicEncoding;
+    }
+
+    public String getEncoding() {
+        return encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public TimeZone getTimeZone() {
+        return timeZone;
+    }
+
+    public void setTimeZone(TimeZone timeZone) {
+        this.timeZone = timeZone;
+    }
+
+    public boolean isGzipCompressing() {
+        return gzipCompressing;
+    }
+
+    public void setGzipCompressing(boolean gzipCompressing) {
+        this.gzipCompressing = gzipCompressing;
+    }
+
+    public boolean isGzipRequesting() {
+        return gzipRequesting;
+    }
+
+    public void setGzipRequesting(boolean gzipRequesting) {
+        this.gzipRequesting = gzipRequesting;
+    }
+
+    public String getBasicUserName() {
+        return basicUserName;
+    }
+
+    public void setBasicUserName(String basicUserName) {
+        this.basicUserName = basicUserName;
+    }
+
+    public String getBasicPassword() {
+        return basicPassword;
+    }
+
+    public void setBasicPassword(String basicPassword) {
+        this.basicPassword = basicPassword;
+    }
+
+    public int getConnectionTimeout() {
+        return connectionTimeout;
+    }
+
+    public void setConnectionTimeout(int connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    public int getReplyTimeout() {
+        return replyTimeout;
+    }
+
+    public void setReplyTimeout(int replyTimeout) {
+        this.replyTimeout = replyTimeout;
+    }
+
+    public boolean isEnabledForExceptions() {
+        return enabledForExceptions;
+    }
+
+    public void setEnabledForExceptions(boolean enabledForExceptions) {
+        this.enabledForExceptions = enabledForExceptions;
+    }
+
+    public XmlRpcRequestProcessor getXmlRpcServer() {
+        return xmlRpcServer;
+    }
+
+    public void setXmlRpcServer(XmlRpcRequestProcessor xmlRpcServer) {
+        this.xmlRpcServer = xmlRpcServer;
+    }
+
+    public String getUserAgent() {
+        return userAgent;
+    }
+
+    public void setUserAgent(String userAgent) {
+        this.userAgent = userAgent;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/48e7ab53/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java
 
b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java
index 2cbe7d3..f97aba4 100644
--- 
a/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java
+++ 
b/components/camel-xmlrpc/src/main/java/org/apache/camel/component/xmlrpc/XmlRpcEndpoint.java
@@ -18,22 +18,35 @@ package org.apache.camel.component.xmlrpc;
 
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.SynchronousDelegateProducer;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.IntrospectionSupport;
 import org.apache.xmlrpc.client.XmlRpcClient;
 import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
 
 /**
  * Represents a xmlrpc endpoint.
  */
+@UriEndpoint(scheme = "xmlrpc", label = "transformation")
 public class XmlRpcEndpoint extends DefaultEndpoint {
+    @UriPath
     private String address;
+    @UriParam
+    private XmlRpcConfiguration configuration;
+    @UriParam
     private String defaultMethodName;
+    @UriParam
     private XmlRpcClientConfigurer clientConfigurer;
+    @UriParam
     private XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
 
     public XmlRpcEndpoint() {
@@ -79,6 +92,9 @@ public class XmlRpcEndpoint extends DefaultEndpoint {
         return address;
     }
 
+    /**
+     * The server url
+     */
     public void setAddress(String address) {
         this.address = address;
     }
@@ -106,8 +122,25 @@ public class XmlRpcEndpoint extends DefaultEndpoint {
     public void setDefaultMethodName(String defaultMethodName) {
         this.defaultMethodName = defaultMethodName;
     }
-    
-    
-    
-    
+
+    public XmlRpcConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(XmlRpcConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+
+        if (clientConfig == null) {
+            clientConfig = new XmlRpcClientConfigImpl();
+        }
+
+        Map<String, Object> params = new HashMap<String, Object>();
+        IntrospectionSupport.getProperties(configuration, params, null);
+        setProperties(clientConfig, params);
+    }
 }

Reply via email to