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 2018/12/13 08:35:10 UTC
[camel] 02/10: CAMEL-12954 - first review feedbacks,
still need to make karaf feature test passing
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4a3d409e51b84dd797c25d4fcd97e61238958160
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Fri Nov 23 15:33:17 2018 +0100
CAMEL-12954 - first review feedbacks, still need to make karaf feature test passing
---
components/camel-websocket-jsr356/pom.xml | 8 +-
.../src/main/docs/websocket-jsr356-component.adoc | 18 +-
.../jsr356/CamelServerEndpoint.java | 2 +-
.../{ => websocket}/jsr356/ClientSessions.java | 44 ++---
.../{ => websocket}/jsr356/JSR356Constants.java | 2 +-
.../{ => websocket}/jsr356/JSR356Consumer.java | 4 +-
.../{ => websocket}/jsr356/JSR356Endpoint.java | 6 +-
.../{ => websocket}/jsr356/JSR356Producer.java | 12 +-
.../jsr356/JSR356WebSocketComponent.java | 21 +--
.../{ => websocket}/jsr356/ServletIntegration.java | 2 +-
.../javax.servlet.ServletContainerInitializer | 2 +-
.../camel/component/{jsr356 => websocket-jsr356} | 2 +-
.../{ => websocket}/jsr356/JSR356ConsumerTest.java | 8 +-
.../{ => websocket}/jsr356/JSR356ProducerTest.java | 6 +-
components/readme.adoc | 3 +
docs/user-manual/en/SUMMARY.md | 1 +
.../karaf/features/src/main/resources/features.xml | 5 +
.../camel-websocket-jsr356-starter/pom.xml | 53 ++++++
.../JSR356WebSocketComponentAutoConfiguration.java | 129 +++++++++++++
.../JSR356WebSocketComponentConfiguration.java | 54 ++++++
.../JSR356WebSocketComponentAutoConfiguration.java | 129 +++++++++++++
.../JSR356WebSocketComponentConfiguration.java | 54 ++++++
.../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++++
.../src/main/resources/META-INF/NOTICE.txt | 11 ++
.../src/main/resources/META-INF/spring.factories | 19 ++
.../src/main/resources/META-INF/spring.provides | 17 ++
platforms/spring-boot/components-starter/pom.xml | 1 +
.../itest/karaf/CamelWebsocketJsr356Test.java | 20 +-
28 files changed, 757 insertions(+), 79 deletions(-)
diff --git a/components/camel-websocket-jsr356/pom.xml b/components/camel-websocket-jsr356/pom.xml
index 0d31019..dcc234c 100644
--- a/components/camel-websocket-jsr356/pom.xml
+++ b/components/camel-websocket-jsr356/pom.xml
@@ -36,15 +36,15 @@
<tomcat.version>9.0.13</tomcat.version>
<camel.osgi.export.pkg>
- org.apache.camel.component.jsr356.*;${camel.osgi.version}
+ org.apache.camel.component.websocket.jsr356.*;${camel.osgi.version}
</camel.osgi.export.pkg>
<camel.osgi.import.pkg>
- !org.apache.camel.component.jsr356.*,
- javax.websocket;version="[1.0,3)",
+ !org.apache.camel.component.websocket.jsr356.*,
+ javax.websocket.*;version="[1.1,2)";resolution:=optional,
${camel.osgi.import.defaults},
*
</camel.osgi.import.pkg>
- <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=jsr356</camel.osgi.export.service>
+ <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=websocket-jsr356</camel.osgi.export.service>
</properties>
<dependencies>
diff --git a/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc b/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc
index f84d8b2..796f0f2 100644
--- a/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc
+++ b/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc
@@ -1,5 +1,8 @@
-[[websocket-component]]
+[[websocket-jsr356-component]]
+== Javax Websocket Component
== Websocket JSR356 Component
+*Available as of Camel version 2.23*
+
*Available as of Camel version 2.23*
@@ -14,14 +17,14 @@ To consume from the local instance on a particular `path` the messages:
[source,java]
----
-jsr356://${path}
+websocket-jsr356://${path}
----
To consume from a remote instance - i.e. Camel will be a client - on a particular `uri` the messages:
[source,java]
----
-jsr356://${uri}
+websocket-jsr356://${uri}
----
You can append query options to the URI in the following format,
@@ -31,10 +34,5 @@ You can append query options to the URI in the following format,
// component options: START
-[width="100%",cols="2,5,^1,2",options="header"]
-|===
-| Name | Description | Default | Type
-| *sessionCount* (consumer/producer) | Number of session to pool. | 1 | Integer > 0
-| *context* (consumer/producer) | The servlet context (path) to use if ambiguous to deploy locally endpoints. | - | String
-|===
-// component options: END
+The Javax Websocket component has no options.
+// component options: END
\ No newline at end of file
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/CamelServerEndpoint.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/CamelServerEndpoint.java
similarity index 98%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/CamelServerEndpoint.java
rename to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/CamelServerEndpoint.java
index 462cbe9..2f21a33 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/CamelServerEndpoint.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/CamelServerEndpoint.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import java.io.IOException;
import java.io.InputStream;
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/ClientSessions.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/ClientSessions.java
similarity index 81%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/ClientSessions.java
rename to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/ClientSessions.java
index 929fa38..0b7363b 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/ClientSessions.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/ClientSessions.java
@@ -14,9 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
-import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.stream.Collectors.toList;
import java.io.Closeable;
@@ -25,10 +24,9 @@ import java.io.InputStream;
import java.net.URI;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CompletionStage;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiConsumer;
-import java.util.function.Function;
+import java.util.function.Consumer;
import java.util.stream.IntStream;
import javax.websocket.ClientEndpointConfig;
@@ -69,26 +67,28 @@ class ClientSessions implements Closeable {
sessions.addAll(IntStream.range(0, expectedCount).mapToObj(idx -> doConnect()).collect(toList()));
}
- public <T> CompletionStage<T> execute(final Function<Session, CompletionStage<T>> apply) {
+ public void execute(final Consumer<Session> apply) {
+ Session session = null;
try {
- final Session session = sessions.take();
- return apply.apply(session)
- .handle((result, exception) -> {
- sessions.offer(session);
- if (exception != null) {
- if (RuntimeException.class.isInstance(exception)) {
- throw RuntimeException.class.cast(exception);
- }
- if (Error.class.isInstance(exception)) {
- throw Error.class.cast(exception);
- }
- throw new IllegalStateException(exception);
- }
- return result;
- });
- } catch (final InterruptedException e) {
+ session = sessions.take();
+ apply.accept(session);
+ } catch (final RuntimeException re) {
+ log.error(re.getMessage(), re);
+ if (session.isOpen()) {
+ try {
+ session.close(new CloseReason(CloseReason.CloseCodes.CLOSED_ABNORMALLY, re.getMessage()));
+ } catch (final IOException errorOnClose) {
+ log.debug(errorOnClose.getMessage(), errorOnClose);
+ }
+ }
+ session = null;
+ throw re;
+ } catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
- return completedFuture(null);
+ } finally {
+ if (session != null) {
+ sessions.offer(session);
+ }
}
}
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Constants.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Constants.java
similarity index 95%
copy from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Constants.java
copy to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Constants.java
index 7a07faa..4c2a3ea 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Constants.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Constants.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
public interface JSR356Constants {
String SESSION = "jsr356.session";
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Consumer.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Consumer.java
similarity index 98%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Consumer.java
rename to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Consumer.java
index eb562cb..4ddff9d 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Consumer.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Consumer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import static java.util.Optional.ofNullable;
@@ -61,7 +61,7 @@ public class JSR356Consumer extends DefaultConsumer {
@Override
protected void doStart() throws Exception {
super.doStart();
- final String endpointKey = getEndpoint().getEndpointUri().substring("jsr356://".length());
+ final String endpointKey = getEndpoint().getEndpointUri().substring("websocket-jsr356://".length());
if (endpointKey.contains("://")) { // we act as a client
final ClientEndpointConfig.Builder clientConfig = ClientEndpointConfig.Builder.create(); // todo: config
manager = new ClientSessions(sessionCount, URI.create(endpointKey), clientConfig.build(), onMessage);
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Endpoint.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Endpoint.java
similarity index 91%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Endpoint.java
rename to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Endpoint.java
index 2c232aa..6126d78 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Endpoint.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Endpoint.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
@@ -25,8 +25,8 @@ import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
@UriEndpoint(
- firstVersion = "2.23.0", scheme = "jsr356", title = "Javax Websocket",
- syntax = "jsr356:/resourceUri", consumerClass = JSR356Consumer.class, label = "jsr356")
+ firstVersion = "2.23.0", scheme = "websocket-jsr356", title = "Javax Websocket",
+ syntax = "websocket-jsr356:/resourceUri", consumerClass = JSR356Consumer.class, label = "jsr356")
public class JSR356Endpoint extends DefaultEndpoint {
@UriPath(description = "If a path (/foo) it will deploy locally the endpoint, " +
"if an uri it will connect to the corresponding server")
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Producer.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
similarity index 88%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Producer.java
rename to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
index 7b6ccef..60c425a 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Producer.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356Producer.java
@@ -14,14 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import static java.util.Optional.ofNullable;
import java.io.IOException;
import java.net.URI;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionStage;
import java.util.function.BiConsumer;
import javax.websocket.ClientEndpointConfig;
@@ -62,7 +60,7 @@ public class JSR356Producer extends DefaultAsyncProducer {
@Override
protected void doStart() throws Exception {
super.doStart();
- final String endpointKey = getEndpoint().getEndpointUri().substring("jsr356://".length());
+ final String endpointKey = getEndpoint().getEndpointUri().substring("websocket-jsr356://".length());
if (!endpointKey.contains("://")) { // we act as a client in all cases here
throw new IllegalArgumentException("You should pass a client uri");
}
@@ -72,14 +70,12 @@ public class JSR356Producer extends DefaultAsyncProducer {
onExchange = (ex, cb) -> manager.execute(session -> doSend(ex, session));
}
- private CompletionStage<Object> doSend(final Exchange ex, final Session session) {
- final CompletableFuture<Object> future = new CompletableFuture<>();
+ private void doSend(final Exchange ex, final Session session) {
try {
- getEndpoint().getComponent().sendMessage(session, ex.getIn().getBody());
+ JSR356WebSocketComponent.sendMessage(session, ex.getIn().getBody());
} catch (final IOException e) {
ex.setException(e);
}
- return future;
}
@Override
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356WebSocketComponent.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356WebSocketComponent.java
similarity index 81%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356WebSocketComponent.java
rename to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356WebSocketComponent.java
index 5176419..a53d3e5 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356WebSocketComponent.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/JSR356WebSocketComponent.java
@@ -14,24 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import static java.util.Optional.ofNullable;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import javax.websocket.RemoteEndpoint;
import javax.websocket.Session;
import javax.websocket.server.ServerContainer;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;
import org.apache.camel.spi.Metadata;
+import org.apache.camel.util.IOHelper;
public class JSR356WebSocketComponent extends DefaultComponent {
// didn't find a better way to handle that unless we can assume the CamelContext is in the ServletContext
@@ -45,21 +46,15 @@ public class JSR356WebSocketComponent extends DefaultComponent {
return new JSR356Endpoint(this, uri);
}
- public void sendMessage(final Session session, final Object message) throws IOException {
+ public static void sendMessage(final Session session, final Object message) throws IOException {
+ final RemoteEndpoint.Basic basicRemote = session.getBasicRemote(); // todo: handle async?
synchronized (session) {
- // todo: handle async?
if (String.class.isInstance(message)) {
- session.getBasicRemote().sendText(String.valueOf(message));
+ basicRemote.sendText(String.valueOf(message));
} else if (ByteBuffer.class.isInstance(message)) {
- session.getBasicRemote().sendBinary(ByteBuffer.class.cast(message));
+ basicRemote.sendBinary(ByteBuffer.class.cast(message));
} else if (InputStream.class.isInstance(message)) {
- int read;
- final InputStream in = InputStream.class.cast(message);
- final byte[] buffer = new byte[8192]; // todo: config
- final OutputStream out = session.getBasicRemote().getSendStream();
- while ((read = in.read(buffer)) >= 0) {
- out.write(buffer, 0, read);
- }
+ IOHelper.copy(InputStream.class.cast(message), basicRemote.getSendStream());
} else {
throw new IllegalArgumentException("Unsupported input: " + message);
}
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/ServletIntegration.java b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/ServletIntegration.java
similarity index 97%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/ServletIntegration.java
rename to components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/ServletIntegration.java
index 660b8b9..898cfdc 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/ServletIntegration.java
+++ b/components/camel-websocket-jsr356/src/main/java/org/apache/camel/websocket/jsr356/ServletIntegration.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import static java.util.Optional.ofNullable;
diff --git a/components/camel-websocket-jsr356/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/components/camel-websocket-jsr356/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
index 46f0334..7abc779 100644
--- a/components/camel-websocket-jsr356/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
+++ b/components/camel-websocket-jsr356/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
@@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-org.apache.camel.jsr356.ServletIntegration
+org.apache.camel.websocket.jsr356.ServletIntegration
diff --git a/components/camel-websocket-jsr356/src/main/resources/META-INF/services/org/apache/camel/component/jsr356 b/components/camel-websocket-jsr356/src/main/resources/META-INF/services/org/apache/camel/component/websocket-jsr356
similarity index 92%
rename from components/camel-websocket-jsr356/src/main/resources/META-INF/services/org/apache/camel/component/jsr356
rename to components/camel-websocket-jsr356/src/main/resources/META-INF/services/org/apache/camel/component/websocket-jsr356
index 60f541e..f3ece3d 100644
--- a/components/camel-websocket-jsr356/src/main/resources/META-INF/services/org/apache/camel/component/jsr356
+++ b/components/camel-websocket-jsr356/src/main/resources/META-INF/services/org/apache/camel/component/websocket-jsr356
@@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-class=org.apache.camel.jsr356.JSR356WebSocketComponent
+class=org.apache.camel.websocket.jsr356.JSR356WebSocketComponent
diff --git a/components/camel-websocket-jsr356/src/test/java/org/apache/camel/jsr356/JSR356ConsumerTest.java b/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ConsumerTest.java
similarity index 93%
rename from components/camel-websocket-jsr356/src/test/java/org/apache/camel/jsr356/JSR356ConsumerTest.java
rename to components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ConsumerTest.java
index 2b84b96..65e508e 100644
--- a/components/camel-websocket-jsr356/src/test/java/org/apache/camel/jsr356/JSR356ConsumerTest.java
+++ b/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ConsumerTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import java.io.IOException;
import java.net.URI;
@@ -43,7 +43,7 @@ public class JSR356ConsumerTest extends CamelTestSupport {
@Rule
public final MeecrowaveRule servlet = new MeecrowaveRule(new Meecrowave.Builder() {{
randomHttpPort();
- setScanningPackageIncludes("org.apache.camel.jsr356.JSR356ConsumerTest$"); // deploy test classes
+ setScanningPackageIncludes("org.apache.camel.websocket.jsr356.JSR356ConsumerTest$"); // deploy test classes
}}, "");
@Rule
@@ -82,12 +82,12 @@ public class JSR356ConsumerTest extends CamelTestSupport {
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
- from("jsr356:///test")
+ from("websocket-jsr356:///test")
.id("camel_consumer_acts_as_server")
.convertBodyTo(String.class)
.to("mock:ensureServerModeReceiveProperlyExchanges");
- from("jsr356://ws://localhost:" + servlet.getConfiguration().getHttpPort() + "/existingserver")
+ from("websocket-jsr356://ws://localhost:" + servlet.getConfiguration().getHttpPort() + "/existingserver")
.id("camel_consumer_acts_as_client")
.convertBodyTo(String.class)
.to("mock:ensureClientModeReceiveProperlyExchanges");
diff --git a/components/camel-websocket-jsr356/src/test/java/org/apache/camel/jsr356/JSR356ProducerTest.java b/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ProducerTest.java
similarity index 91%
rename from components/camel-websocket-jsr356/src/test/java/org/apache/camel/jsr356/JSR356ProducerTest.java
rename to components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ProducerTest.java
index 8e5a3de..c1f3cb9 100644
--- a/components/camel-websocket-jsr356/src/test/java/org/apache/camel/jsr356/JSR356ProducerTest.java
+++ b/components/camel-websocket-jsr356/src/test/java/org/apache/camel/websocket/jsr356/JSR356ProducerTest.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.websocket.jsr356;
import static java.util.Collections.singletonList;
@@ -42,7 +42,7 @@ public class JSR356ProducerTest extends CamelTestSupport {
@Rule
public final MeecrowaveRule servlet = new MeecrowaveRule(new Meecrowave.Builder() {{
randomHttpPort();
- setScanningPackageIncludes("org.apache.camel.jsr356.JSR356ProducerTest$"); // deploy test classes
+ setScanningPackageIncludes("org.apache.camel.websocket.jsr356.JSR356ProducerTest$"); // deploy test classes
}}, "");
@Rule
@@ -66,7 +66,7 @@ public class JSR356ProducerTest extends CamelTestSupport {
from("direct:ensureServerModeSendsProperly")
.id("camel_consumer_acts_as_client")
.convertBodyTo(String.class)
- .to("jsr356://ws://localhost:" + servlet.getConfiguration().getHttpPort() + "/existingserver");
+ .to("websocket-jsr356://ws://localhost:" + servlet.getConfiguration().getHttpPort() + "/existingserver");
}
};
}
diff --git a/components/readme.adoc b/components/readme.adoc
index 0ef5b4a..b0f5126 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -437,6 +437,9 @@ Number of Components: 309 in 209 JAR artifacts (22 deprecated)
| link:camel-javaspace/src/main/docs/javaspace-component.adoc[JavaSpace] (camel-javaspace) +
`javaspace:url` | 2.1 | *deprecated* Sending and receiving messages through JavaSpace.
+| link:camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc[Javax Websocket] (camel-websocket-jsr356) +
+`websocket-jsr356:/resourceUri` | 2.23 | Camel WebSocket using JSR356 (javax)
+
| link:camel-jbpm/src/main/docs/jbpm-component.adoc[JBPM] (camel-jbpm) +
`jbpm:connectionURL` | 2.6 | The jbpm component provides integration with jBPM (Business Process Management).
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 6a853a7..2de3caf 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -302,6 +302,7 @@
* [IRC](irc-component.adoc)
* [IronMQ](ironmq-component.adoc)
* [JavaSpace](javaspace-component.adoc)
+ * [Javax Websocket](websocket-jsr356-component.adoc)
* [JBPM](jbpm-component.adoc)
* [JCache](jcache-component.adoc)
* [JClouds](jclouds-component.adoc)
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 9933049..dc8c946 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -2438,6 +2438,11 @@
<bundle dependency='true'>mvn:javax.servlet/javax.servlet-api/${javax.servlet-api-version}</bundle>
<bundle>mvn:org.apache.camel/camel-websocket/${project.version}</bundle>
</feature>
+ <feature name='camel-websocket-jsr356' version='${project.version}' resolver='(obr)' start-level='50'>
+ <feature>jetty</feature>
+ <feature version='${project.version}'>camel-core</feature>
+ <bundle>mvn:org.apache.camel/camel-websocket-jsr356/${project.version}</bundle>
+ </feature>
<feature name='camel-web3j' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
<bundle dependency='true'>wrap:mvn:org.web3j/core/${web3j-version}</bundle>
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/pom.xml b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/pom.xml
new file mode 100644
index 0000000..600bf07
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>components-starter</artifactId>
+ <version>2.23.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>camel-websocket-jsr356-starter</artifactId>
+ <packaging>jar</packaging>
+ <name>Spring-Boot Starter :: camel-websocket-jsr356</name>
+ <description>Spring-Boot Starter for Camel WebSocket using JSR356 (javax)</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-websocket-jsr356</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--START OF GENERATED CODE-->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ </dependency>
+ <!--END OF GENERATED CODE-->
+ </dependencies>
+</project>
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java
new file mode 100644
index 0000000..b76f689
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java
@@ -0,0 +1,129 @@
+/**
+ * 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.jsr356.springboot;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.CamelContext;
+import org.apache.camel.jsr356.JSR356WebSocketComponent;
+import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.ComponentConfigurationProperties;
+import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
+import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@Configuration
+@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
+ JSR356WebSocketComponentAutoConfiguration.GroupConditions.class})
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+@EnableConfigurationProperties({ComponentConfigurationProperties.class,
+ JSR356WebSocketComponentConfiguration.class})
+public class JSR356WebSocketComponentAutoConfiguration {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(JSR356WebSocketComponentAutoConfiguration.class);
+ @Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
+ private CamelContext camelContext;
+ @Autowired
+ private JSR356WebSocketComponentConfiguration configuration;
+ @Autowired(required = false)
+ private List<ComponentCustomizer<JSR356WebSocketComponent>> customizers;
+
+ static class GroupConditions extends GroupCondition {
+ public GroupConditions() {
+ super("camel.component", "camel.component.websocket-jsr356");
+ }
+ }
+
+ @Lazy
+ @Bean(name = "websocket-jsr356-component")
+ @ConditionalOnMissingBean(JSR356WebSocketComponent.class)
+ public JSR356WebSocketComponent configureJSR356WebSocketComponent()
+ throws Exception {
+ JSR356WebSocketComponent component = new JSR356WebSocketComponent();
+ component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ CamelPropertiesHelper.setCamelProperties(camelContext,
+ nestedProperty, nestedParameters, false);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ CamelPropertiesHelper.setCamelProperties(camelContext, component,
+ parameters, false);
+ if (ObjectHelper.isNotEmpty(customizers)) {
+ for (ComponentCustomizer<JSR356WebSocketComponent> customizer : customizers) {
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.websocket-jsr356.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.websocket-jsr356.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
+ }
+ }
+ return component;
+ }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentConfiguration.java
new file mode 100644
index 0000000..1fa588a
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentConfiguration.java
@@ -0,0 +1,54 @@
+/**
+ * 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.jsr356.springboot;
+
+import javax.annotation.Generated;
+import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Camel WebSocket using JSR356 (javax)
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@ConfigurationProperties(prefix = "camel.component.websocket-jsr356")
+public class JSR356WebSocketComponentConfiguration
+ extends
+ ComponentConfigurationPropertiesCommon {
+
+ /**
+ * Whether to enable auto configuration of the websocket-jsr356 component.
+ * This is enabled by default.
+ */
+ private Boolean enabled;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/websocket/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/websocket/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java
new file mode 100644
index 0000000..bd059c9
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/websocket/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java
@@ -0,0 +1,129 @@
+/**
+ * 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.websocket.jsr356.springboot;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.ComponentConfigurationProperties;
+import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
+import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.websocket.jsr356.JSR356WebSocketComponent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@Configuration
+@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
+ JSR356WebSocketComponentAutoConfiguration.GroupConditions.class})
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+@EnableConfigurationProperties({ComponentConfigurationProperties.class,
+ JSR356WebSocketComponentConfiguration.class})
+public class JSR356WebSocketComponentAutoConfiguration {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(JSR356WebSocketComponentAutoConfiguration.class);
+ @Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
+ private CamelContext camelContext;
+ @Autowired
+ private JSR356WebSocketComponentConfiguration configuration;
+ @Autowired(required = false)
+ private List<ComponentCustomizer<JSR356WebSocketComponent>> customizers;
+
+ static class GroupConditions extends GroupCondition {
+ public GroupConditions() {
+ super("camel.component", "camel.component.websocket-jsr356");
+ }
+ }
+
+ @Lazy
+ @Bean(name = "websocket-jsr356-component")
+ @ConditionalOnMissingBean(JSR356WebSocketComponent.class)
+ public JSR356WebSocketComponent configureJSR356WebSocketComponent()
+ throws Exception {
+ JSR356WebSocketComponent component = new JSR356WebSocketComponent();
+ component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ CamelPropertiesHelper.setCamelProperties(camelContext,
+ nestedProperty, nestedParameters, false);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ CamelPropertiesHelper.setCamelProperties(camelContext, component,
+ parameters, false);
+ if (ObjectHelper.isNotEmpty(customizers)) {
+ for (ComponentCustomizer<JSR356WebSocketComponent> customizer : customizers) {
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.websocket-jsr356.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.websocket-jsr356.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
+ }
+ }
+ return component;
+ }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/websocket/jsr356/springboot/JSR356WebSocketComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/websocket/jsr356/springboot/JSR356WebSocketComponentConfiguration.java
new file mode 100644
index 0000000..90d581c
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/websocket/jsr356/springboot/JSR356WebSocketComponentConfiguration.java
@@ -0,0 +1,54 @@
+/**
+ * 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.websocket.jsr356.springboot;
+
+import javax.annotation.Generated;
+import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Camel WebSocket using JSR356 (javax)
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@ConfigurationProperties(prefix = "camel.component.websocket-jsr356")
+public class JSR356WebSocketComponentConfiguration
+ extends
+ ComponentConfigurationPropertiesCommon {
+
+ /**
+ * Whether to enable auto configuration of the websocket-jsr356 component.
+ * This is enabled by default.
+ */
+ private Boolean enabled;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..3052b01
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/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.jsr356.springboot.JSR356WebSocketComponentAutoConfiguration
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..b4cd9b6
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+provides: camel-websocket-jsr356
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index 737b164..82d8269 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -357,6 +357,7 @@
<module>camel-vertx-starter</module>
<module>camel-weather-starter</module>
<module>camel-web3j-starter</module>
+ <module>camel-websocket-jsr356-starter</module>
<module>camel-websocket-starter</module>
<module>camel-wordpress-starter</module>
<module>camel-xchange-starter</module>
diff --git a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Constants.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWebsocketJsr356Test.java
similarity index 66%
rename from components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Constants.java
rename to tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWebsocketJsr356Test.java
index 7a07faa..556e596 100644
--- a/components/camel-websocket-jsr356/src/main/java/org/apache/camel/jsr356/JSR356Constants.java
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWebsocketJsr356Test.java
@@ -14,9 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.jsr356;
+package org.apache.camel.itest.karaf;
-public interface JSR356Constants {
- String SESSION = "jsr356.session";
- String USE_INCOMING_SESSION = "jsr356.producer.session.incoming.use";
-}
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelWebsocketJsr356Test extends BaseKarafTest {
+
+ public static final String COMPONENT = extractName(CamelWebsocketJsr356Test.class);
+
+ @Test
+ public void test() throws Exception {
+ testComponent(COMPONENT);
+ }
+}
\ No newline at end of file