You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/07/15 15:05:55 UTC
[1/2] camel git commit: CAMEL-10133 Allow to configure the SSL
configuration of the lumberjack component at the component level
Repository: camel
Updated Branches:
refs/heads/master 9e574afcf -> 0b46b0820
CAMEL-10133 Allow to configure the SSL configuration of the lumberjack component at the component level
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e60279cd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e60279cd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e60279cd
Branch: refs/heads/master
Commit: e60279cd723e9e63909c566a33fbf5c42031a1ef
Parents: 9e574af
Author: Antoine DESSAIGNE <an...@gmail.com>
Authored: Fri Jul 15 16:13:56 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 15 17:04:27 2016 +0200
----------------------------------------------------------------------
.../src/main/docs/lumberjack.adoc | 14 +++++++++++-
.../lumberjack/LumberjackComponent.java | 15 ++++++++++++
.../lumberjack/LumberjackEndpoint.java | 24 ++++++++++++++++++--
3 files changed, 50 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e60279cd/components/camel-lumberjack/src/main/docs/lumberjack.adoc
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/docs/lumberjack.adoc b/components/camel-lumberjack/src/main/docs/lumberjack.adoc
index 7d560cb..3b0083a 100644
--- a/components/camel-lumberjack/src/main/docs/lumberjack.adoc
+++ b/components/camel-lumberjack/src/main/docs/lumberjack.adoc
@@ -40,14 +40,26 @@ Options
^^^^^^^
+
// component options: START
-The Lumberjack component has no options.
+The Lumberjack component supports 1 options which are listed below.
+
+
+
+{% raw %}
+[width="100%",cols="2s,1m,8",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| sslContextParameters | SSLContextParameters | Sets the default SSL configuration to use for all the endpoints. You can also configure it directly at the endpoint level.
+|=======================================================================
+{% endraw %}
// component options: END
+
// endpoint options: START
The Lumberjack component supports 7 endpoint options which are listed below:
http://git-wip-us.apache.org/repos/asf/camel/blob/e60279cd/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
index 096d10f..96fbb3d 100644
--- a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
@@ -20,6 +20,7 @@ import java.util.Map;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.util.jsse.SSLContextParameters;
/**
* The class is the Camel component for the Lumberjack server
@@ -27,6 +28,8 @@ import org.apache.camel.impl.UriEndpointComponent;
public class LumberjackComponent extends UriEndpointComponent {
static final int DEFAULT_PORT = 5044;
+ private SSLContextParameters sslContextParameters;
+
public LumberjackComponent() {
this(LumberjackEndpoint.class);
}
@@ -54,4 +57,16 @@ public class LumberjackComponent extends UriEndpointComponent {
setProperties(answer, parameters);
return answer;
}
+
+ public SSLContextParameters getSslContextParameters() {
+ return sslContextParameters;
+ }
+
+ /**
+ * Sets the default SSL configuration to use for all the endpoints. You can also configure it directly at
+ * the endpoint level.
+ */
+ public void setSslContextParameters(SSLContextParameters sslContextParameters) {
+ this.sslContextParameters = sslContextParameters;
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/e60279cd/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
index a86fe14..8c9d23d 100644
--- a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.lumberjack;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
import javax.net.ssl.SSLContext;
import org.apache.camel.Processor;
@@ -45,14 +47,18 @@ public class LumberjackEndpoint extends DefaultEndpoint {
}
@Override
+ public LumberjackComponent getComponent() {
+ return (LumberjackComponent) super.getComponent();
+ }
+
+ @Override
public Producer createProducer() throws Exception {
throw new UnsupportedOperationException("The Lumberjack component cannot be used as a producer");
}
@Override
public LumberjackConsumer createConsumer(Processor processor) throws Exception {
- SSLContext sslContext = sslContextParameters != null ? sslContextParameters.createSSLContext(getCamelContext()) : null;
- return new LumberjackConsumer(this, processor, host, port, sslContext);
+ return new LumberjackConsumer(this, processor, host, port, provideSSLContext());
}
@Override
@@ -60,7 +66,21 @@ public class LumberjackEndpoint extends DefaultEndpoint {
return true;
}
+ public SSLContextParameters getSslContextParameters() {
+ return sslContextParameters;
+ }
+
public void setSslContextParameters(SSLContextParameters sslContextParameters) {
this.sslContextParameters = sslContextParameters;
}
+
+ private SSLContext provideSSLContext() throws GeneralSecurityException, IOException {
+ if (sslContextParameters != null) {
+ return sslContextParameters.createSSLContext(getCamelContext());
+ } else if (getComponent().getSslContextParameters() != null) {
+ return getComponent().getSslContextParameters().createSSLContext(getCamelContext());
+ } else {
+ return null;
+ }
+ }
}
[2/2] camel git commit: Add SB files. This fixes #1078
Posted by da...@apache.org.
Add SB files. This fixes #1078
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0b46b082
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0b46b082
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0b46b082
Branch: refs/heads/master
Commit: 0b46b082049738055bf46491564f66b9590dd11c
Parents: e60279c
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 15 17:05:47 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 15 17:05:47 2016 +0200
----------------------------------------------------------------------
.../LumberjackComponentAutoConfiguration.java | 52 ++++++++++++++++++++
.../LumberjackComponentConfiguration.java | 44 +++++++++++++++++
.../main/resources/META-INF/spring.factories | 19 +++++++
3 files changed, 115 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0b46b082/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java
new file mode 100644
index 0000000..56c0466
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java
@@ -0,0 +1,52 @@
+/**
+ * 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.lumberjack.springboot;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.lumberjack.LumberjackComponent;
+import org.apache.camel.util.IntrospectionSupport;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Configuration
+@EnableConfigurationProperties(LumberjackComponentConfiguration.class)
+public class LumberjackComponentAutoConfiguration {
+
+ @Bean
+ @ConditionalOnClass(CamelContext.class)
+ @ConditionalOnMissingBean(LumberjackComponent.class)
+ public LumberjackComponent configureLumberjackComponent(
+ CamelContext camelContext,
+ LumberjackComponentConfiguration configuration) throws Exception {
+ LumberjackComponent component = new LumberjackComponent();
+ component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
+ return component;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/0b46b082/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java
new file mode 100644
index 0000000..e3dc61d
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java
@@ -0,0 +1,44 @@
+/**
+ * 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.lumberjack.springboot;
+
+import org.apache.camel.util.jsse.SSLContextParameters;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Camel Lumberjack log streaming component
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.lumberjack")
+public class LumberjackComponentConfiguration {
+
+ /**
+ * Sets the default SSL configuration to use for all the endpoints. You can
+ * also configure it directly at the endpoint level.
+ */
+ private SSLContextParameters sslContextParameters;
+
+ public SSLContextParameters getSslContextParameters() {
+ return sslContextParameters;
+ }
+
+ public void setSslContextParameters(
+ SSLContextParameters sslContextParameters) {
+ this.sslContextParameters = sslContextParameters;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/0b46b082/components/camel-lumberjack/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/resources/META-INF/spring.factories b/components/camel-lumberjack/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..e006396
--- /dev/null
+++ b/components/camel-lumberjack/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.camel.component.lumberjack.springboot.LumberjackComponentAutoConfiguration