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 2019/04/06 09:58:53 UTC
[camel] branch cloud2 created (now 2328b39)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git.
at 2328b39 Upgrade karaf features version
This branch includes the following new commits:
new 80d1e98 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 607716c CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 4b9d061 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new edffa04 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new d934615 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 463c929 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new b601921 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 2589de7 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new b45f7d8 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new a16b494 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 3b8ef32 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 05397db CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 26a8dcb CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
new 2328b39 Upgrade karaf features version
The 14 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[camel] 14/14: Upgrade karaf features version
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2328b3905a8e91c716efc1382d7b63d7bb66ad36
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Apr 6 11:12:40 2019 +0200
Upgrade karaf features version
---
platforms/karaf/features/src/main/resources/features.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index f5bc782..a5bbad4 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -17,7 +17,7 @@
limitations under the License.
-->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name='camel-${project.version}'>
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name='camel-${project.version}'>
<repository>mvn:org.apache.cxf.karaf/apache-cxf/${cxf-version}/xml/features</repository>
<repository>mvn:org.apache.jclouds.karaf/jclouds-karaf/${jclouds-version}/xml/features</repository>
<repository>mvn:org.ops4j.pax.cdi/pax-cdi-features/${pax-cdi-version}/xml/features</repository>
[camel] 05/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit d93461599919034ce6e6880aff4d47829232c740
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 16:43:36 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
core/camel-cloud/pom.xml | 37 +-
.../impl/cloud/ServiceCallProcessorFactory.java} | 179 ++++-----
.../org/apache/camel/model/ServiceCallDefinition | 18 +
.../impl/cloud/CachingServiceDiscoveryTest.java | 0
.../impl/cloud/CombinedServiceDiscoveryTest.java | 0
.../impl/cloud/CombinedServiceFilterTest.java | 0
.../apache/camel/impl/cloud/LoadBalancerTest.java | 0
.../impl/cloud/ServiceCallConfigurationTest.java | 0
.../camel/impl/cloud/ServiceDefinitionTest.java | 0
.../camel/impl/cloud/ServiceRegistryTest.java | 0
.../src/test/resources/log4j2.properties | 33 ++
.../cloud/ServiceCallExpressionConfiguration.java | 11 +-
.../apache/camel/reifier/ServiceCallReifier.java | 431 +--------------------
core/pom.xml | 2 +-
14 files changed, 173 insertions(+), 538 deletions(-)
diff --git a/core/camel-cloud/pom.xml b/core/camel-cloud/pom.xml
index 3ac8325..28f48e5 100644
--- a/core/camel-cloud/pom.xml
+++ b/core/camel-cloud/pom.xml
@@ -41,24 +41,43 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>spi-annotations</artifactId>
- <optional>true</optional>
+ <artifactId>camel-core</artifactId>
</dependency>
+ <!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>meta-annotations</artifactId>
- <optional>true</optional>
+ <artifactId>camel-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
+ <!-- logging -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>com.github.ben-manes.caffeine</groupId>
- <artifactId>caffeine</artifactId>
- <version>${caffeine-version}</version>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
diff --git a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
similarity index 73%
copy from core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
copy to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
index 74a3457..eb0904a 100644
--- a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
@@ -1,20 +1,20 @@
-/*
+/**
* 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
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
* 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.reifier;
+package org.apache.camel.impl.cloud;
import java.util.Optional;
import java.util.function.Function;
@@ -32,15 +32,8 @@ import org.apache.camel.cloud.ServiceExpressionFactory;
import org.apache.camel.cloud.ServiceFilter;
import org.apache.camel.cloud.ServiceFilterAware;
import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
-import org.apache.camel.impl.cloud.DefaultServiceCallProcessor;
-import org.apache.camel.impl.cloud.DefaultServiceLoadBalancer;
-import org.apache.camel.impl.cloud.HealthyServiceFilter;
-import org.apache.camel.impl.cloud.PassThroughServiceFilter;
-import org.apache.camel.impl.cloud.RandomServiceChooser;
-import org.apache.camel.impl.cloud.RoundRobinServiceChooser;
+import org.apache.camel.impl.TypedProcessorFactory;
import org.apache.camel.model.ModelCamelContext;
-import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinitionConstants;
@@ -49,14 +42,13 @@ import org.apache.camel.support.CamelContextHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.function.Suppliers;
import org.apache.camel.util.function.ThrowingHelper;
-
import static org.apache.camel.support.CamelContextHelper.findByType;
import static org.apache.camel.support.CamelContextHelper.lookup;
-class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
+public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCallDefinition> {
- ServiceCallReifier(ProcessorDefinition<?> definition) {
- super((ServiceCallDefinition) definition);
+ protected ServiceCallProcessorFactory() {
+ super(ServiceCallDefinition.class);
}
// *****************************
@@ -64,12 +56,12 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
// *****************************
@Override
- public Processor createProcessor(RouteContext routeContext) throws Exception {
+ public Processor doCreateProcessor(RouteContext routeContext, ServiceCallDefinition definition) throws Exception {
final CamelContext camelContext = routeContext.getCamelContext();
- final ServiceDiscovery serviceDiscovery = retrieveServiceDiscovery(camelContext);
- final ServiceFilter serviceFilter = retrieveServiceFilter(camelContext);
- final ServiceChooser serviceChooser = retrieveServiceChooser(camelContext);
- final ServiceLoadBalancer loadBalancer = retrieveLoadBalancer(camelContext);
+ final ServiceDiscovery serviceDiscovery = retrieveServiceDiscovery(camelContext, definition);
+ final ServiceFilter serviceFilter = retrieveServiceFilter(camelContext, definition);
+ final ServiceChooser serviceChooser = retrieveServiceChooser(camelContext, definition);
+ final ServiceLoadBalancer loadBalancer = retrieveLoadBalancer(camelContext, definition);
CamelContextAware.trySetCamelContext(serviceDiscovery, camelContext);
CamelContextAware.trySetCamelContext(serviceFilter, camelContext);
@@ -90,7 +82,7 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
// The component configured on EIP takes precedence vs configured on configuration.
String endpointScheme = definition.getComponent();
if (endpointScheme == null) {
- ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
+ ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext, definition);
if (conf != null) {
endpointScheme = conf.getComponent();
}
@@ -106,7 +98,7 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
// The uri configured on EIP takes precedence vs configured on configuration.
String endpointUri = definition.getUri();
if (endpointUri == null) {
- ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
+ ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext, definition);
if (conf != null) {
endpointUri = conf.getUri();
}
@@ -131,7 +123,7 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
endpointUri,
definition.getPattern(),
loadBalancer,
- retrieveExpression(camelContext, endpointScheme));
+ retrieveExpression(camelContext, endpointScheme, definition));
}
// *****************************
@@ -160,7 +152,7 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
return config;
}
- private ServiceCallConfigurationDefinition retrieveConfig(CamelContext camelContext) {
+ private ServiceCallConfigurationDefinition retrieveConfig(CamelContext camelContext, ServiceCallDefinition definition) {
ServiceCallConfigurationDefinition config = null;
if (definition.getConfigurationRef() != null) {
// lookup in registry firstNotNull
@@ -198,24 +190,24 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
return answer;
}
- private ServiceDiscovery retrieveServiceDiscovery(CamelContext camelContext) throws Exception {
+ private ServiceDiscovery retrieveServiceDiscovery(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
return Suppliers.firstNotNull(
- () -> (definition.getServiceDiscoveryConfiguration() != null) ? definition.getServiceDiscoveryConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceDiscovery.class, camelContext, definition::getServiceDiscovery, definition::getServiceDiscoveryRef),
- // Linked configuration
- () -> retrieveServiceDiscovery(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceDiscovery(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceDiscovery.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_DISCOVERY_ID, ServiceDiscovery.class)
+ () -> (definition.getServiceDiscoveryConfiguration() != null) ? definition.getServiceDiscoveryConfiguration().newInstance(camelContext) : null,
+ // Local configuration
+ () -> retrieve(ServiceDiscovery.class, camelContext, definition::getServiceDiscovery, definition::getServiceDiscoveryRef),
+ // Linked configuration
+ () -> retrieveServiceDiscovery(camelContext, this::retrieveConfig),
+ // Default configuration
+ () -> retrieveServiceDiscovery(camelContext, this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceDiscovery.class),
+ // From registry
+ () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_DISCOVERY_ID, ServiceDiscovery.class)
).orElseGet(
- // Default, that's s little ugly but a load balancer may live without
- // (i.e. the Ribbon one) so let's delegate the null check to the actual
- // impl.
- () -> null
+ // Default, that's s little ugly but a load balancer may live without
+ // (i.e. the Ribbon one) so let's delegate the null check to the actual
+ // impl.
+ () -> null
);
}
@@ -254,22 +246,22 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
return answer;
}
- private ServiceFilter retrieveServiceFilter(CamelContext camelContext) throws Exception {
+ private ServiceFilter retrieveServiceFilter(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
return Suppliers.firstNotNull(
- () -> (definition.getServiceFilterConfiguration() != null) ? definition.getServiceFilterConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceFilter.class, camelContext, definition::getServiceFilter, definition::getServiceFilterRef),
- // Linked configuration
- () -> retrieveServiceFilter(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceFilter(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceFilter.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class)
+ () -> (definition.getServiceFilterConfiguration() != null) ? definition.getServiceFilterConfiguration().newInstance(camelContext) : null,
+ // Local configuration
+ () -> retrieve(ServiceFilter.class, camelContext, definition::getServiceFilter, definition::getServiceFilterRef),
+ // Linked configuration
+ () -> retrieveServiceFilter(camelContext, this::retrieveConfig),
+ // Default configuration
+ () -> retrieveServiceFilter(camelContext, this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceFilter.class),
+ // From registry
+ () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class)
).orElseGet(
- // Default
- () -> new HealthyServiceFilter()
+ // Default
+ () -> new HealthyServiceFilter()
);
}
@@ -304,21 +296,21 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
return answer;
}
- private ServiceChooser retrieveServiceChooser(CamelContext camelContext) throws Exception {
+ private ServiceChooser retrieveServiceChooser(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
return Suppliers.firstNotNull(
- // Local configuration
- () -> retrieve(ServiceChooser.class, camelContext, definition::getServiceChooser, definition::getServiceChooserRef),
- // Linked configuration
- () -> retrieveServiceChooser(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceChooser(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceChooser.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class)
+ // Local configuration
+ () -> retrieve(ServiceChooser.class, camelContext, definition::getServiceChooser, definition::getServiceChooserRef),
+ // Linked configuration
+ () -> retrieveServiceChooser(camelContext, this::retrieveConfig),
+ // Default configuration
+ () -> retrieveServiceChooser(camelContext, this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceChooser.class),
+ // From registry
+ () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class)
).orElseGet(
- // Default
- () -> new RoundRobinServiceChooser()
+ // Default
+ () -> new RoundRobinServiceChooser()
);
}
@@ -346,22 +338,22 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
return answer;
}
- private ServiceLoadBalancer retrieveLoadBalancer(CamelContext camelContext) throws Exception {
+ private ServiceLoadBalancer retrieveLoadBalancer(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
return Suppliers.firstNotNull(
- () -> (definition.getLoadBalancerConfiguration() != null) ? definition.getLoadBalancerConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceLoadBalancer.class, camelContext, definition::getLoadBalancer, definition::getLoadBalancerRef),
- // Linked configuration
- () -> retrieveLoadBalancer(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveLoadBalancer(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceLoadBalancer.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_LOAD_BALANCER_ID, ServiceLoadBalancer.class)
+ () -> (definition.getLoadBalancerConfiguration() != null) ? definition.getLoadBalancerConfiguration().newInstance(camelContext) : null,
+ // Local configuration
+ () -> retrieve(ServiceLoadBalancer.class, camelContext, definition::getLoadBalancer, definition::getLoadBalancerRef),
+ // Linked configuration
+ () -> retrieveLoadBalancer(camelContext, this::retrieveConfig),
+ // Default configuration
+ () -> retrieveLoadBalancer(camelContext, this::retrieveDefaultConfig),
+ // Check if there is a single instance in the registry
+ () -> findByType(camelContext, ServiceLoadBalancer.class),
+ // From registry
+ () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_LOAD_BALANCER_ID, ServiceLoadBalancer.class)
).orElseGet(
- // Default
- () -> new DefaultServiceLoadBalancer()
+ // Default
+ () -> new DefaultServiceLoadBalancer()
);
}
@@ -389,17 +381,17 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
return answer;
}
- private Expression retrieveExpression(CamelContext camelContext, String component) throws Exception {
+ private Expression retrieveExpression(CamelContext camelContext, String component, ServiceCallDefinition definition) throws Exception {
Optional<Expression> expression = Suppliers.firstNotNull(
- () -> (definition.getExpressionConfiguration() != null) ? definition.getExpressionConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(Expression.class, camelContext, definition::getExpression, definition::getExpressionRef),
- // Linked configuration
- () -> retrieveExpression(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveExpression(camelContext, this::retrieveDefaultConfig),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID, Expression.class)
+ () -> (definition.getExpressionConfiguration() != null) ? definition.getExpressionConfiguration().newInstance(camelContext) : null,
+ // Local configuration
+ () -> retrieve(Expression.class, camelContext, definition::getExpression, definition::getExpressionRef),
+ // Linked configuration
+ () -> retrieveExpression(camelContext, this::retrieveConfig),
+ // Default configuration
+ () -> retrieveExpression(camelContext, this::retrieveDefaultConfig),
+ // From registry
+ () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID, Expression.class)
);
if (expression.isPresent()) {
@@ -458,5 +450,4 @@ class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
return answer;
}
-
}
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
new file mode 100644
index 0000000..ad3c7d9
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/model/ServiceCallDefinition
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.impl.cloud.ServiceCallProcessorFactory
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
similarity index 100%
rename from core/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
rename to core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java
similarity index 100%
rename from core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java
rename to core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryTest.java
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java
similarity index 100%
rename from core/camel-core/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java
rename to core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/CombinedServiceFilterTest.java
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java
similarity index 100%
rename from core/camel-core/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java
rename to core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/LoadBalancerTest.java
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
similarity index 100%
rename from core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
rename to core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java
similarity index 100%
rename from core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java
rename to core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceDefinitionTest.java
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java
similarity index 100%
rename from core/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java
rename to core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceRegistryTest.java
diff --git a/core/camel-cloud/src/test/resources/log4j2.properties b/core/camel-cloud/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..65d5151
--- /dev/null
+++ b/core/camel-cloud/src/test/resources/log4j2.properties
@@ -0,0 +1,33 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-cloud-test.log
+appender.file.append = true
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+rootLogger.level = INFO
+
+rootLogger.appenderRef.file.ref = file
+#rootLogger.appenderRef.console.ref = console
+
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
index c82c067..34169ec 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
@@ -35,7 +35,7 @@ import org.apache.camel.Expression;
import org.apache.camel.NoFactoryAvailableException;
import org.apache.camel.cloud.ServiceCallConstants;
import org.apache.camel.cloud.ServiceExpressionFactory;
-import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
+//import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
import org.apache.camel.model.IdentifiedType;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.PropertyDefinition;
@@ -276,10 +276,11 @@ public class ServiceCallExpressionConfiguration extends IdentifiedType implement
}
}
} else {
- answer = new DefaultServiceCallExpression(
- ObjectHelper.notNull(hostHeader, "hostHeader"),
- ObjectHelper.notNull(portHeader, "portHeader")
- );
+ // TODO: Make this possible to create in camel-cloud
+// answer = new DefaultServiceCallExpression(
+// ObjectHelper.notNull(hostHeader, "hostHeader"),
+// ObjectHelper.notNull(portHeader, "portHeader")
+// );
}
return answer;
diff --git a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java b/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
index 74a3457..b5c1cbd 100644
--- a/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
+++ b/core/camel-core/src/main/java/org/apache/camel/reifier/ServiceCallReifier.java
@@ -16,447 +16,20 @@
*/
package org.apache.camel.reifier;
-import java.util.Optional;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.Expression;
import org.apache.camel.Processor;
-import org.apache.camel.cloud.ServiceChooser;
-import org.apache.camel.cloud.ServiceChooserAware;
-import org.apache.camel.cloud.ServiceDiscovery;
-import org.apache.camel.cloud.ServiceDiscoveryAware;
-import org.apache.camel.cloud.ServiceExpressionFactory;
-import org.apache.camel.cloud.ServiceFilter;
-import org.apache.camel.cloud.ServiceFilterAware;
-import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.impl.cloud.DefaultServiceCallExpression;
-import org.apache.camel.impl.cloud.DefaultServiceCallProcessor;
-import org.apache.camel.impl.cloud.DefaultServiceLoadBalancer;
-import org.apache.camel.impl.cloud.HealthyServiceFilter;
-import org.apache.camel.impl.cloud.PassThroughServiceFilter;
-import org.apache.camel.impl.cloud.RandomServiceChooser;
-import org.apache.camel.impl.cloud.RoundRobinServiceChooser;
-import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinition;
-import org.apache.camel.model.cloud.ServiceCallDefinitionConstants;
import org.apache.camel.spi.RouteContext;
-import org.apache.camel.support.CamelContextHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.function.Suppliers;
-import org.apache.camel.util.function.ThrowingHelper;
-
-import static org.apache.camel.support.CamelContextHelper.findByType;
-import static org.apache.camel.support.CamelContextHelper.lookup;
class ServiceCallReifier extends ProcessorReifier<ServiceCallDefinition> {
ServiceCallReifier(ProcessorDefinition<?> definition) {
- super((ServiceCallDefinition) definition);
+ super(ServiceCallDefinition.class.cast(definition));
}
- // *****************************
- // Processor Factory
- // *****************************
-
@Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
- final CamelContext camelContext = routeContext.getCamelContext();
- final ServiceDiscovery serviceDiscovery = retrieveServiceDiscovery(camelContext);
- final ServiceFilter serviceFilter = retrieveServiceFilter(camelContext);
- final ServiceChooser serviceChooser = retrieveServiceChooser(camelContext);
- final ServiceLoadBalancer loadBalancer = retrieveLoadBalancer(camelContext);
-
- CamelContextAware.trySetCamelContext(serviceDiscovery, camelContext);
- CamelContextAware.trySetCamelContext(serviceFilter, camelContext);
- CamelContextAware.trySetCamelContext(serviceChooser, camelContext);
- CamelContextAware.trySetCamelContext(loadBalancer, camelContext);
-
- if (loadBalancer instanceof ServiceDiscoveryAware) {
- ((ServiceDiscoveryAware) loadBalancer).setServiceDiscovery(serviceDiscovery);
- }
- if (loadBalancer instanceof ServiceFilterAware) {
- ((ServiceFilterAware) loadBalancer).setServiceFilter(serviceFilter);
- }
- if (loadBalancer instanceof ServiceChooserAware) {
- ((ServiceChooserAware) loadBalancer).setServiceChooser(serviceChooser);
- }
-
- // The component is used to configure the default scheme to use (eg camel component name).
- // The component configured on EIP takes precedence vs configured on configuration.
- String endpointScheme = definition.getComponent();
- if (endpointScheme == null) {
- ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
- if (conf != null) {
- endpointScheme = conf.getComponent();
- }
- }
- if (endpointScheme == null) {
- ServiceCallConfigurationDefinition conf = retrieveDefaultConfig(camelContext);
- if (conf != null) {
- endpointScheme = conf.getComponent();
- }
- }
-
- // The uri is used to tweak the uri.
- // The uri configured on EIP takes precedence vs configured on configuration.
- String endpointUri = definition.getUri();
- if (endpointUri == null) {
- ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
- if (conf != null) {
- endpointUri = conf.getUri();
- }
- }
- if (endpointUri == null) {
- ServiceCallConfigurationDefinition conf = retrieveDefaultConfig(camelContext);
- if (conf != null) {
- endpointUri = conf.getUri();
- }
- }
-
- // Service name is mandatory
- ObjectHelper.notNull(definition.getName(), "Service name");
-
- endpointScheme = ThrowingHelper.applyIfNotEmpty(endpointScheme, camelContext::resolvePropertyPlaceholders, () -> ServiceCallDefinitionConstants.DEFAULT_COMPONENT);
- endpointUri = ThrowingHelper.applyIfNotEmpty(endpointUri, camelContext::resolvePropertyPlaceholders, () -> null);
-
- return new DefaultServiceCallProcessor(
- camelContext,
- camelContext.resolvePropertyPlaceholders(definition.getName()),
- endpointScheme,
- endpointUri,
- definition.getPattern(),
- loadBalancer,
- retrieveExpression(camelContext, endpointScheme));
- }
-
- // *****************************
- // Helpers
- // *****************************
-
- private ServiceCallConfigurationDefinition retrieveDefaultConfig(CamelContext camelContext) {
- // check if a default configuration is bound to the registry
- ServiceCallConfigurationDefinition config = camelContext.adapt(ModelCamelContext.class).getServiceCallConfiguration(null);
-
- if (config == null) {
- // Or if it is in the registry
- config = lookup(
- camelContext,
- ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_CONFIG_ID,
- ServiceCallConfigurationDefinition.class);
- }
-
- if (config == null) {
- // If no default is set either by searching by name or bound to the
- // camel context, assume that if there is a single instance in the
- // registry, that is the default one
- config = findByType(camelContext, ServiceCallConfigurationDefinition.class);
- }
-
- return config;
- }
-
- private ServiceCallConfigurationDefinition retrieveConfig(CamelContext camelContext) {
- ServiceCallConfigurationDefinition config = null;
- if (definition.getConfigurationRef() != null) {
- // lookup in registry firstNotNull
- config = lookup(camelContext, definition.getConfigurationRef(), ServiceCallConfigurationDefinition.class);
- if (config == null) {
- // and fallback as service configuration
- config = camelContext.adapt(ModelCamelContext.class).getServiceCallConfiguration(definition.getConfigurationRef());
- }
- }
-
- return config;
- }
-
- // ******************************************
- // ServiceDiscovery
- // ******************************************
-
- private ServiceDiscovery retrieveServiceDiscovery(CamelContext camelContext, Function<CamelContext, ServiceCallConfigurationDefinition> function) throws Exception {
- ServiceDiscovery answer = null;
-
- ServiceCallConfigurationDefinition config = function.apply(camelContext);
- if (config != null) {
- if (config.getServiceDiscoveryConfiguration() != null) {
- answer = config.getServiceDiscoveryConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- ServiceDiscovery.class,
- camelContext,
- config::getServiceDiscovery,
- config::getServiceDiscoveryRef
- );
- }
- }
-
- return answer;
- }
-
- private ServiceDiscovery retrieveServiceDiscovery(CamelContext camelContext) throws Exception {
- return Suppliers.firstNotNull(
- () -> (definition.getServiceDiscoveryConfiguration() != null) ? definition.getServiceDiscoveryConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceDiscovery.class, camelContext, definition::getServiceDiscovery, definition::getServiceDiscoveryRef),
- // Linked configuration
- () -> retrieveServiceDiscovery(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceDiscovery(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceDiscovery.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_DISCOVERY_ID, ServiceDiscovery.class)
- ).orElseGet(
- // Default, that's s little ugly but a load balancer may live without
- // (i.e. the Ribbon one) so let's delegate the null check to the actual
- // impl.
- () -> null
- );
- }
-
- // ******************************************
- // ServiceFilter
- // ******************************************
-
- private ServiceFilter retrieveServiceFilter(CamelContext camelContext, Function<CamelContext, ServiceCallConfigurationDefinition> function) throws Exception {
- ServiceFilter answer = null;
-
- ServiceCallConfigurationDefinition config = function.apply(camelContext);
- if (config != null) {
- if (config.getServiceFilterConfiguration() != null) {
- answer = config.getServiceFilterConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- ServiceFilter.class,
- camelContext,
- config::getServiceFilter,
- config::getServiceFilterRef
- );
- }
-
- if (answer == null) {
- String ref = config.getServiceFilterRef();
- if (ObjectHelper.equal("healthy", ref, true)) {
- answer = new HealthyServiceFilter();
- } else if (ObjectHelper.equal("pass-through", ref, true)) {
- answer = new PassThroughServiceFilter();
- } else if (ObjectHelper.equal("passthrough", ref, true)) {
- answer = new PassThroughServiceFilter();
- }
- }
- }
-
- return answer;
- }
-
- private ServiceFilter retrieveServiceFilter(CamelContext camelContext) throws Exception {
- return Suppliers.firstNotNull(
- () -> (definition.getServiceFilterConfiguration() != null) ? definition.getServiceFilterConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceFilter.class, camelContext, definition::getServiceFilter, definition::getServiceFilterRef),
- // Linked configuration
- () -> retrieveServiceFilter(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceFilter(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceFilter.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_FILTER_ID, ServiceFilter.class)
- ).orElseGet(
- // Default
- () -> new HealthyServiceFilter()
- );
- }
-
- // ******************************************
- // ServiceChooser
- // ******************************************
-
- private ServiceChooser retrieveServiceChooser(CamelContext camelContext, Function<CamelContext, ServiceCallConfigurationDefinition> function) throws Exception {
- ServiceChooser answer = null;
-
- ServiceCallConfigurationDefinition config = function.apply(camelContext);
- if (config != null) {
- answer = retrieve(
- ServiceChooser.class,
- camelContext,
- config::getServiceChooser,
- config::getServiceChooserRef
- );
-
- if (answer == null) {
- String ref = config.getServiceChooserRef();
- if (ObjectHelper.equal("roundrobin", ref, true)) {
- answer = new RoundRobinServiceChooser();
- } else if (ObjectHelper.equal("round-robin", ref, true)) {
- answer = new RoundRobinServiceChooser();
- } else if (ObjectHelper.equal("random", ref, true)) {
- answer = new RandomServiceChooser();
- }
- }
- }
-
- return answer;
- }
-
- private ServiceChooser retrieveServiceChooser(CamelContext camelContext) throws Exception {
- return Suppliers.firstNotNull(
- // Local configuration
- () -> retrieve(ServiceChooser.class, camelContext, definition::getServiceChooser, definition::getServiceChooserRef),
- // Linked configuration
- () -> retrieveServiceChooser(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveServiceChooser(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceChooser.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_CHOOSER_ID, ServiceChooser.class)
- ).orElseGet(
- // Default
- () -> new RoundRobinServiceChooser()
- );
- }
-
- // ******************************************
- // LoadBalancer
- // ******************************************
-
- private ServiceLoadBalancer retrieveLoadBalancer(CamelContext camelContext, Function<CamelContext, ServiceCallConfigurationDefinition> function) throws Exception {
- ServiceLoadBalancer answer = null;
-
- ServiceCallConfigurationDefinition config = function.apply(camelContext);
- if (config != null) {
- if (config.getLoadBalancerConfiguration() != null) {
- answer = config.getLoadBalancerConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- ServiceLoadBalancer.class,
- camelContext,
- config::getLoadBalancer,
- config::getLoadBalancerRef
- );
- }
- }
-
- return answer;
- }
-
- private ServiceLoadBalancer retrieveLoadBalancer(CamelContext camelContext) throws Exception {
- return Suppliers.firstNotNull(
- () -> (definition.getLoadBalancerConfiguration() != null) ? definition.getLoadBalancerConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(ServiceLoadBalancer.class, camelContext, definition::getLoadBalancer, definition::getLoadBalancerRef),
- // Linked configuration
- () -> retrieveLoadBalancer(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveLoadBalancer(camelContext, this::retrieveDefaultConfig),
- // Check if there is a single instance in the registry
- () -> findByType(camelContext, ServiceLoadBalancer.class),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_LOAD_BALANCER_ID, ServiceLoadBalancer.class)
- ).orElseGet(
- // Default
- () -> new DefaultServiceLoadBalancer()
- );
- }
-
- // ******************************************
- // Expression
- // ******************************************
-
- private Expression retrieveExpression(CamelContext camelContext, Function<CamelContext, ServiceCallConfigurationDefinition> function) throws Exception {
- Expression answer = null;
-
- ServiceCallConfigurationDefinition config = function.apply(camelContext);
- if (config != null) {
- if (config.getExpressionConfiguration() != null) {
- answer = config.getExpressionConfiguration().newInstance(camelContext);
- } else {
- answer = retrieve(
- Expression.class,
- camelContext,
- config::getExpression,
- config::getExpressionRef
- );
- }
- }
-
- return answer;
- }
-
- private Expression retrieveExpression(CamelContext camelContext, String component) throws Exception {
- Optional<Expression> expression = Suppliers.firstNotNull(
- () -> (definition.getExpressionConfiguration() != null) ? definition.getExpressionConfiguration().newInstance(camelContext) : null,
- // Local configuration
- () -> retrieve(Expression.class, camelContext, definition::getExpression, definition::getExpressionRef),
- // Linked configuration
- () -> retrieveExpression(camelContext, this::retrieveConfig),
- // Default configuration
- () -> retrieveExpression(camelContext, this::retrieveDefaultConfig),
- // From registry
- () -> lookup(camelContext, ServiceCallDefinitionConstants.DEFAULT_SERVICE_CALL_EXPRESSION_ID, Expression.class)
- );
-
- if (expression.isPresent()) {
- return expression.get();
- } else {
- String lookupName = component + "-service-expression";
- // First try to find the factory from the registry.
- ServiceExpressionFactory factory = CamelContextHelper.lookup(camelContext, lookupName, ServiceExpressionFactory.class);
- if (factory != null) {
- // If a factory is found in the registry do not re-configure it as
- // it should be pre-configured.
- return factory.newInstance(camelContext);
- } else {
-
- Class<?> type = null;
-
- try {
- // Then use Service factory.
- type = camelContext.getFactoryFinder(ServiceCallDefinitionConstants.RESOURCE_PATH).findClass(lookupName);
- } catch (Exception e) {
- }
-
- if (ObjectHelper.isNotEmpty(type)) {
- if (ServiceExpressionFactory.class.isAssignableFrom(type)) {
- factory = (ServiceExpressionFactory) camelContext.getInjector().newInstance(type);
- } else {
- throw new IllegalArgumentException(
- "Resolving Expression: " + lookupName + " detected type conflict: Not a ServiceExpressionFactory implementation. Found: " + type.getName());
- }
- } else {
- // If no factory is found, returns the default
- factory = context -> new DefaultServiceCallExpression();
- }
-
- return factory.newInstance(camelContext);
- }
- }
- }
-
- // ************************************
- // Helpers
- // ************************************
-
- private <T> T retrieve(Class<T> type, CamelContext camelContext, Supplier<T> instanceSupplier, Supplier<String> refSupplier) {
- T answer = null;
- if (instanceSupplier != null) {
- answer = instanceSupplier.get();
- }
-
- if (answer == null && refSupplier != null) {
- String ref = refSupplier.get();
- if (ref != null) {
- answer = lookup(camelContext, ref, type);
- }
- }
-
- return answer;
+ throw new IllegalStateException("Cannot find camel-cloud on the classpath.");
}
}
diff --git a/core/pom.xml b/core/pom.xml
index 08b7958..539c51c 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -40,13 +40,13 @@
<module>camel-support</module>
<module>camel-caffeine-lrucache</module>
<module>camel-headersmap</module>
- <module>camel-cloud</module>
<module>camel-management-api</module>
<module>camel-management-impl</module>
<module>camel-base</module>
<module>camel-core</module>
<module>camel-core-osgi</module>
<module>camel-core-xml</module>
+ <module>camel-cloud</module>
</modules>
<build>
[camel] 03/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4b9d061edd739f423366874e671eeac8d73d3e86
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 15:20:45 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
.../org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
index 9d0b4a1..11d3940 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
@@ -27,8 +27,8 @@ import org.apache.camel.Message;
import org.apache.camel.cloud.ServiceCallConstants;
import org.apache.camel.cloud.ServiceDefinition;
import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.language.simple.SimpleLanguage;
import org.apache.camel.processor.SendDynamicProcessor;
+import org.apache.camel.spi.Language;
import org.apache.camel.support.AsyncProcessorSupport;
import org.apache.camel.support.service.ServiceHelper;
import org.apache.camel.util.ObjectHelper;
@@ -204,9 +204,8 @@ public class DefaultServiceCallProcessor extends AsyncProcessorSupport {
* @param exchange the exchange
* @return the computed expression
*/
- private String applySimpleLanguage(String expression, Exchange exchange) {
- return SimpleLanguage.hasSimpleFunction(expression)
- ? SimpleLanguage.simple(expression).evaluate(exchange, String.class)
- : expression;
+ private static String applySimpleLanguage(String expression, Exchange exchange) {
+ Language simple = exchange.getContext().resolveLanguage("simple");
+ return simple.createExpression(expression).evaluate(exchange, String.class);
}
}
[camel] 09/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b45f7d85f53fb6befb99be8548c4c24ab34f02b3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 17:42:21 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
components/camel-dns/pom.xml | 3 +--
components/camel-etcd/pom.xml | 3 +--
components/camel-http4/pom.xml | 5 ++---
components/camel-jetty-common/pom.xml | 6 +++---
components/camel-kubernetes/pom.xml | 3 +--
components/camel-netty4-http/pom.xml | 4 ++++
components/camel-ribbon/pom.xml | 3 +--
components/camel-service/pom.xml | 3 +--
components/camel-spring-boot/pom.xml | 4 ++++
9 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/components/camel-dns/pom.xml b/components/camel-dns/pom.xml
index 22e8805..b609249 100644
--- a/components/camel-dns/pom.xml
+++ b/components/camel-dns/pom.xml
@@ -34,10 +34,9 @@
<dependencies>
- <!-- requires camel-core -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>dnsjava</groupId>
diff --git a/components/camel-etcd/pom.xml b/components/camel-etcd/pom.xml
index f009e24..1cc81e1 100644
--- a/components/camel-etcd/pom.xml
+++ b/components/camel-etcd/pom.xml
@@ -38,10 +38,9 @@
<dependencies>
- <!-- requires camel-core due camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<!-- etcd -->
diff --git a/components/camel-http4/pom.xml b/components/camel-http4/pom.xml
index 7422b61..a1dfd1c 100644
--- a/components/camel-http4/pom.xml
+++ b/components/camel-http4/pom.xml
@@ -34,9 +34,8 @@
<description>Camel HTTP (Apache HttpClient 4.x) support</description>
<properties>
- <!-- CAMEL-7010 Now we move to HttpClient 4.3 API -->
<camel.osgi.import.before.defaults>
- org.apache.http.*;version="[4.3,5)"
+ org.apache.http.*;version="[4.5,5)"
</camel.osgi.import.before.defaults>
</properties>
@@ -44,7 +43,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-jetty-common/pom.xml b/components/camel-jetty-common/pom.xml
index c6a37a4..8b4b9f1 100644
--- a/components/camel-jetty-common/pom.xml
+++ b/components/camel-jetty-common/pom.xml
@@ -31,11 +31,11 @@
<packaging>jar</packaging>
<name>Camel :: Jetty :: Common</name>
- <description>Camel Jetty 8.x/9.x support</description>
+ <description>Camel Jetty 9.x support</description>
<properties>
<camel.osgi.import.before.defaults>
- org.eclipse.jetty.*;version="[9.3,10)",
+ org.eclipse.jetty.*;version="[9.4,10)",
javax.servlet.*;version="${servlet-version-range}"
</camel.osgi.import.before.defaults>
</properties>
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-kubernetes/pom.xml b/components/camel-kubernetes/pom.xml
index ec85bd6..8fca3ec 100644
--- a/components/camel-kubernetes/pom.xml
+++ b/components/camel-kubernetes/pom.xml
@@ -36,10 +36,9 @@
</properties>
<dependencies>
- <!-- requires camel-core due camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
diff --git a/components/camel-netty4-http/pom.xml b/components/camel-netty4-http/pom.xml
index 1867f2a..dd08d5b 100644
--- a/components/camel-netty4-http/pom.xml
+++ b/components/camel-netty4-http/pom.xml
@@ -46,6 +46,10 @@
<artifactId>camel-http-common</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api-version}</version>
diff --git a/components/camel-ribbon/pom.xml b/components/camel-ribbon/pom.xml
index 611490b..8ce01f9 100644
--- a/components/camel-ribbon/pom.xml
+++ b/components/camel-ribbon/pom.xml
@@ -41,10 +41,9 @@
<dependencies>
- <!-- needs camel-core because of camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
diff --git a/components/camel-service/pom.xml b/components/camel-service/pom.xml
index 4cf8608..6e96f8c 100644
--- a/components/camel-service/pom.xml
+++ b/components/camel-service/pom.xml
@@ -38,10 +38,9 @@
<dependencies>
- <!-- needs camel-core because of camel cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<!-- test dependencies -->
diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml
index 5a9acf1..1d19d7f 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -69,6 +69,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ </dependency>
<!-- JMX is enabled by default -->
<dependency>
<groupId>org.apache.camel</groupId>
[camel] 10/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a16b49479d272d3ea5ee04ed1517bead543aa509
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 20:08:40 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
bom/camel-bom/pom.xml | 5 +++++
components/camel-undertow/pom.xml | 2 +-
.../spring-boot-dm/camel-spring-boot-dependencies/pom.xml | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index e6c1dbb..13af97a 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -553,6 +553,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-cm-sms</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/components/camel-undertow/pom.xml b/components/camel-undertow/pom.xml
index 81828db..b8f5318 100644
--- a/components/camel-undertow/pom.xml
+++ b/components/camel-undertow/pom.xml
@@ -38,7 +38,7 @@
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 138fdd9..2a6ab61 100644
--- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -763,6 +763,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-cm-sms</artifactId>
<version>${project.version}</version>
</dependency>
[camel] 13/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 26a8dcba491396179b835798cd2c0e0511390947
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Apr 6 11:12:25 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
apache-camel/pom.xml | 4 ++++
apache-camel/src/main/descriptors/common-bin.xml | 1 +
components/camel-http4/pom.xml | 2 +-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 7bf678f..2f8f64a 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -84,6 +84,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-xml</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ </dependency>
<!-- NOTE: auto-generated list of components when building camel catalog -->
<!-- camel components: START -->
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index e3e94ea..8f3ba61 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -36,6 +36,7 @@
<include>org.apache.camel:camel-core</include>
<include>org.apache.camel:camel-core-osgi</include>
<include>org.apache.camel:camel-core-xml</include>
+ <include>org.apache.camel:camel-cloud</include>
<!-- NOTE: auto-generated list of components when building camel catalog -->
<!-- camel components: START -->
diff --git a/components/camel-http4/pom.xml b/components/camel-http4/pom.xml
index a1dfd1c..9969b23 100644
--- a/components/camel-http4/pom.xml
+++ b/components/camel-http4/pom.xml
@@ -35,7 +35,7 @@
<properties>
<camel.osgi.import.before.defaults>
- org.apache.http.*;version="[4.5,5)"
+ org.apache.http.*;version="[4.4,5)"
</camel.osgi.import.before.defaults>
</properties>
[camel] 02/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 607716cbc964f3c7bb9b5046d4a18dd9ee26b2f4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 15:17:37 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
core/camel-api/src/main/java/org/apache/camel/Route.java | 1 +
.../org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java | 5 ++---
.../src/main/java/org/apache/camel/impl/DefaultRouteContext.java | 1 +
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/core/camel-api/src/main/java/org/apache/camel/Route.java b/core/camel-api/src/main/java/org/apache/camel/Route.java
index aeaba49..49087d9 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Route.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Route.java
@@ -33,6 +33,7 @@ import org.apache.camel.spi.RouteContext;
public interface Route extends EndpointAware {
String ID_PROPERTY = "id";
+ String CUSTOM_ID_PROPERTY = "customId";
String PARENT_PROPERTY = "parent";
String GROUP_PROPERTY = "group";
String REST_PROPERTY = "rest";
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
index ffea02d..ad48e39 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
@@ -28,7 +28,6 @@ import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.cloud.DiscoverableService;
import org.apache.camel.cloud.ServiceDefinition;
import org.apache.camel.cloud.ServiceRegistry;
-import org.apache.camel.model.RouteDefinition;
import org.apache.camel.support.RoutePolicySupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -167,8 +166,8 @@ public class ServiceRegistrationRoutePolicy extends RoutePolicySupport implement
String serviceId = properties.get(ServiceDefinition.SERVICE_META_ID);
if (serviceId == null) {
// if not check if the route id is custom and use it
- RouteDefinition definition = (RouteDefinition) route.getRouteContext().getRoute();
- if (definition.hasCustomIdAssigned()) {
+ boolean custom = "true".equals(route.getProperties().get(Route.CUSTOM_ID_PROPERTY));
+ if (custom) {
serviceId = route.getId();
}
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
index 7f5830a..20f8539 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
@@ -229,6 +229,7 @@ public class DefaultRouteContext implements RouteContext {
// and create the route that wraps the UoW
Route edcr = new EventDrivenConsumerRoute(this, getEndpoint(), internal);
edcr.getProperties().put(Route.ID_PROPERTY, routeId);
+ edcr.getProperties().put(Route.CUSTOM_ID_PROPERTY, route.hasCustomIdAssigned() ? "true" : "false");
edcr.getProperties().put(Route.PARENT_PROPERTY, Integer.toHexString(route.hashCode()));
edcr.getProperties().put(Route.DESCRIPTION_PROPERTY, route.getDescriptionText());
if (route.getGroup() != null) {
[camel] 12/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 05397db22b2e1ec315a7c94daee6732fee737238
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 23:54:09 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
components/camel-cdi/pom.xml | 6 ++++++
components/camel-test-blueprint/pom.xml | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/components/camel-cdi/pom.xml b/components/camel-cdi/pom.xml
index 8c4f7f6..7a605ca 100644
--- a/components/camel-cdi/pom.xml
+++ b/components/camel-cdi/pom.xml
@@ -125,6 +125,12 @@
<!-- test dependencies -->
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/components/camel-test-blueprint/pom.xml b/components/camel-test-blueprint/pom.xml
index 7f1a6b6..1bae325 100644
--- a/components/camel-test-blueprint/pom.xml
+++ b/components/camel-test-blueprint/pom.xml
@@ -52,6 +52,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<!-- exclude aries blueprint as we add these dependencies explicit -->
<exclusions>
[camel] 07/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b6019213a760da6ef34225c988fbf2eaedb078b7
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 17:14:55 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
components/camel-consul/pom.xml | 3 +--
components/camel-zookeeper/pom.xml | 3 +--
.../org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java | 6 +++---
parent/pom.xml | 5 +++++
platforms/karaf/features/src/main/resources/features.xml | 1 +
5 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/components/camel-consul/pom.xml b/components/camel-consul/pom.xml
index 6d18805..9ad068e 100644
--- a/components/camel-consul/pom.xml
+++ b/components/camel-consul/pom.xml
@@ -37,10 +37,9 @@
</properties>
<dependencies>
- <!-- core required: org.apache.camel.cloud, org.apache.camel.impl.cloud -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>com.orbitz.consul</groupId>
diff --git a/components/camel-zookeeper/pom.xml b/components/camel-zookeeper/pom.xml
index a60be71..952e1e4 100644
--- a/components/camel-zookeeper/pom.xml
+++ b/components/camel-zookeeper/pom.xml
@@ -38,10 +38,9 @@
<dependencies>
- <!-- requires camel-core due camel-cloud and others -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
+ <artifactId>camel-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
index 3626ef8..0d9b5c0 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
@@ -47,7 +47,9 @@ import static org.apache.camel.support.CamelContextHelper.lookup;
public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCallDefinition> {
- protected ServiceCallProcessorFactory() {
+ private volatile ServiceCallDefinition definition;
+
+ public ServiceCallProcessorFactory() {
super(ServiceCallDefinition.class);
}
@@ -55,8 +57,6 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
// Processor Factory
// *****************************
- private volatile ServiceCallDefinition definition;
-
@Override
public Processor doCreateProcessor(RouteContext routeContext, ServiceCallDefinition definition) throws Exception {
this.definition = definition;
diff --git a/parent/pom.xml b/parent/pom.xml
index f90c53a..6073d3d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -827,6 +827,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-cloud</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-headersmap</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 205442d..f5bc782 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -52,6 +52,7 @@
<bundle>mvn:org.apache.camel/camel-management-impl/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-core/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-core-osgi/${project.version}</bundle>
+ <bundle>mvn:org.apache.camel/camel-cloud/${project.version}</bundle>
<!-- core components -->
<bundle>mvn:org.apache.camel/camel-browse/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-controlbus/${project.version}</bundle>
[camel] 06/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 463c929e525b28c83ec6b9cc1c85a7abb5c76957
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 16:52:51 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
core/camel-cloud/pom.xml | 17 ++++++++++++
.../impl/cloud/ServiceCallProcessorFactory.java | 30 ++++++++++++----------
2 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/core/camel-cloud/pom.xml b/core/camel-cloud/pom.xml
index 28f48e5..0c88956 100644
--- a/core/camel-cloud/pom.xml
+++ b/core/camel-cloud/pom.xml
@@ -41,6 +41,18 @@
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>spi-annotations</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>meta-annotations</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
@@ -62,6 +74,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
index eb0904a..3626ef8 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
@@ -55,13 +55,17 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
// Processor Factory
// *****************************
+ private volatile ServiceCallDefinition definition;
+
@Override
public Processor doCreateProcessor(RouteContext routeContext, ServiceCallDefinition definition) throws Exception {
+ this.definition = definition;
+
final CamelContext camelContext = routeContext.getCamelContext();
- final ServiceDiscovery serviceDiscovery = retrieveServiceDiscovery(camelContext, definition);
- final ServiceFilter serviceFilter = retrieveServiceFilter(camelContext, definition);
- final ServiceChooser serviceChooser = retrieveServiceChooser(camelContext, definition);
- final ServiceLoadBalancer loadBalancer = retrieveLoadBalancer(camelContext, definition);
+ final ServiceDiscovery serviceDiscovery = retrieveServiceDiscovery(camelContext);
+ final ServiceFilter serviceFilter = retrieveServiceFilter(camelContext);
+ final ServiceChooser serviceChooser = retrieveServiceChooser(camelContext);
+ final ServiceLoadBalancer loadBalancer = retrieveLoadBalancer(camelContext);
CamelContextAware.trySetCamelContext(serviceDiscovery, camelContext);
CamelContextAware.trySetCamelContext(serviceFilter, camelContext);
@@ -82,7 +86,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
// The component configured on EIP takes precedence vs configured on configuration.
String endpointScheme = definition.getComponent();
if (endpointScheme == null) {
- ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext, definition);
+ ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
if (conf != null) {
endpointScheme = conf.getComponent();
}
@@ -98,7 +102,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
// The uri configured on EIP takes precedence vs configured on configuration.
String endpointUri = definition.getUri();
if (endpointUri == null) {
- ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext, definition);
+ ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
if (conf != null) {
endpointUri = conf.getUri();
}
@@ -123,7 +127,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
endpointUri,
definition.getPattern(),
loadBalancer,
- retrieveExpression(camelContext, endpointScheme, definition));
+ retrieveExpression(camelContext, endpointScheme));
}
// *****************************
@@ -152,7 +156,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
return config;
}
- private ServiceCallConfigurationDefinition retrieveConfig(CamelContext camelContext, ServiceCallDefinition definition) {
+ private ServiceCallConfigurationDefinition retrieveConfig(CamelContext camelContext) {
ServiceCallConfigurationDefinition config = null;
if (definition.getConfigurationRef() != null) {
// lookup in registry firstNotNull
@@ -190,7 +194,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
return answer;
}
- private ServiceDiscovery retrieveServiceDiscovery(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
+ private ServiceDiscovery retrieveServiceDiscovery(CamelContext camelContext) throws Exception {
return Suppliers.firstNotNull(
() -> (definition.getServiceDiscoveryConfiguration() != null) ? definition.getServiceDiscoveryConfiguration().newInstance(camelContext) : null,
// Local configuration
@@ -246,7 +250,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
return answer;
}
- private ServiceFilter retrieveServiceFilter(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
+ private ServiceFilter retrieveServiceFilter(CamelContext camelContext) throws Exception {
return Suppliers.firstNotNull(
() -> (definition.getServiceFilterConfiguration() != null) ? definition.getServiceFilterConfiguration().newInstance(camelContext) : null,
// Local configuration
@@ -296,7 +300,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
return answer;
}
- private ServiceChooser retrieveServiceChooser(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
+ private ServiceChooser retrieveServiceChooser(CamelContext camelContext) throws Exception {
return Suppliers.firstNotNull(
// Local configuration
() -> retrieve(ServiceChooser.class, camelContext, definition::getServiceChooser, definition::getServiceChooserRef),
@@ -338,7 +342,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
return answer;
}
- private ServiceLoadBalancer retrieveLoadBalancer(CamelContext camelContext, ServiceCallDefinition definition) throws Exception {
+ private ServiceLoadBalancer retrieveLoadBalancer(CamelContext camelContext) throws Exception {
return Suppliers.firstNotNull(
() -> (definition.getLoadBalancerConfiguration() != null) ? definition.getLoadBalancerConfiguration().newInstance(camelContext) : null,
// Local configuration
@@ -381,7 +385,7 @@ public class ServiceCallProcessorFactory extends TypedProcessorFactory<ServiceCa
return answer;
}
- private Expression retrieveExpression(CamelContext camelContext, String component, ServiceCallDefinition definition) throws Exception {
+ private Expression retrieveExpression(CamelContext camelContext, String component) throws Exception {
Optional<Expression> expression = Suppliers.firstNotNull(
() -> (definition.getExpressionConfiguration() != null) ? definition.getExpressionConfiguration().newInstance(camelContext) : null,
// Local configuration
[camel] 08/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2589de7f0a7fd85d7423275e24d870d374e68403
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 17:33:25 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
.../camel/impl/cloud/DefaultServiceCallProcessor.java | 8 ++++++--
.../apache/camel/cloud/aggregating-service-discovery | 17 +++++++++++++++++
.../org/apache/camel/cloud/blacklist-service-filter | 17 +++++++++++++++++
.../org/apache/camel/cloud/caching-service-discovery | 17 +++++++++++++++++
.../org/apache/camel/cloud/chained-service-filter | 17 +++++++++++++++++
.../org/apache/camel/cloud/combined-service-discovery | 17 +++++++++++++++++
.../org/apache/camel/cloud/combined-service-filter | 17 +++++++++++++++++
.../apache/camel/cloud/default-service-load-balancer | 17 +++++++++++++++++
.../org/apache/camel/cloud/healthy-service-filter | 17 +++++++++++++++++
.../org/apache/camel/cloud/pass-through-service-filter | 17 +++++++++++++++++
.../org/apache/camel/cloud/static-service-discovery | 17 +++++++++++++++++
.../org/apache/camel/impl/DefaultProcessorFactory.java | 1 +
.../org/apache/camel/impl/DefaultProducerCache.java | 2 +-
13 files changed, 178 insertions(+), 3 deletions(-)
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
index 9218ce9..5ff978b 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
@@ -210,7 +210,11 @@ public class DefaultServiceCallProcessor extends AsyncProcessorSupport {
* @return the computed expression
*/
private static String applySimpleLanguage(String expression, Exchange exchange) {
- Language simple = exchange.getContext().resolveLanguage("simple");
- return simple.createExpression(expression).evaluate(exchange, String.class);
+ if (expression != null) {
+ Language simple = exchange.getContext().resolveLanguage("simple");
+ return simple.createExpression(expression).evaluate(exchange, String.class);
+ } else {
+ return null;
+ }
}
}
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/aggregating-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/aggregating-service-discovery
new file mode 100644
index 0000000..675af88
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/aggregating-service-discovery
@@ -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.
+#
+class=org.apache.camel.impl.cloud.AggregatingServiceDiscoveryFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/blacklist-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/blacklist-service-filter
new file mode 100644
index 0000000..29ee4e6
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/blacklist-service-filter
@@ -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.
+#
+class=org.apache.camel.impl.cloud.BlacklistServiceFilterFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/caching-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/caching-service-discovery
new file mode 100644
index 0000000..7a57359
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/caching-service-discovery
@@ -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.
+#
+class=org.apache.camel.impl.cloud.CachingServiceDiscoveryFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/chained-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/chained-service-filter
new file mode 100644
index 0000000..6eb18b5
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/chained-service-filter
@@ -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.
+#
+class=org.apache.camel.impl.cloud.ChainedServiceFilterFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-discovery
new file mode 100644
index 0000000..67efb31
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-discovery
@@ -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.
+#
+class=org.apache.camel.impl.cloud.CombinedServiceDiscoveryFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-filter
new file mode 100644
index 0000000..68cdfc2
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/combined-service-filter
@@ -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.
+#
+class=org.apache.camel.impl.cloud.CombinedServiceFilterFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/default-service-load-balancer b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/default-service-load-balancer
new file mode 100644
index 0000000..16644c8
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/default-service-load-balancer
@@ -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.
+#
+class=org.apache.camel.impl.cloud.DefaultServiceLoadBalancerFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/healthy-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/healthy-service-filter
new file mode 100644
index 0000000..b1cdd65
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/healthy-service-filter
@@ -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.
+#
+class=org.apache.camel.impl.cloud.HealthyServiceFilterFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/pass-through-service-filter b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/pass-through-service-filter
new file mode 100644
index 0000000..e1e1912
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/pass-through-service-filter
@@ -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.
+#
+class=org.apache.camel.impl.cloud.PassThroughServiceFilterFactory
\ No newline at end of file
diff --git a/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/static-service-discovery b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/static-service-discovery
new file mode 100644
index 0000000..5d2f763
--- /dev/null
+++ b/core/camel-cloud/src/main/resources/META-INF/services/org/apache/camel/cloud/static-service-discovery
@@ -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.
+#
+class=org.apache.camel.impl.cloud.StaticServiceDiscoveryFactory
\ No newline at end of file
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
index a9c18c8..c26b895 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
@@ -91,6 +91,7 @@ public class DefaultProcessorFactory implements ProcessorFactory {
Expression expression = (Expression) args.get("expression");
ExchangePattern pattern = (ExchangePattern) args.get("exchangePattern");
answer = new SendDynamicProcessor(uri, expression);
+ answer.setCamelContext(camelContext);
if (pattern != null) {
answer.setPattern(pattern);
}
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java
index 04b1723..48c1494 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerCache.java
@@ -60,7 +60,7 @@ public class DefaultProducerCache extends ServiceSupport implements ProducerCach
this.producers = new ServicePool<>(Endpoint::createAsyncProducer, AsyncProducer::getEndpoint, maxCacheSize);
// only if JMX is enabled
- if (camelContext.getManagementStrategy().getManagementAgent() != null) {
+ if (camelContext.getManagementStrategy() != null && camelContext.getManagementStrategy().getManagementAgent() != null) {
this.extendedStatistics = camelContext.getManagementStrategy().getManagementAgent().getStatisticsLevel().isExtended();
} else {
this.extendedStatistics = false;
[camel] 04/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit edffa0469b852c68e1bb5d77c3b06cf14cfccc7f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 16:11:50 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
.../org/apache/camel/spi/ProcessorFactory.java | 15 ++++++++++++++
.../impl/cloud/DefaultServiceCallProcessor.java | 19 ++++++++++-------
.../apache/camel/impl/DefaultProcessorFactory.java | 24 ++++++++++++++++++++++
.../apache/camel/impl/TypedProcessorFactory.java | 7 +++++++
.../processor/CustomProcessorFactoryTest.java | 9 ++++++++
5 files changed, 67 insertions(+), 7 deletions(-)
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java
index cf750e6..b88cf57 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ProcessorFactory.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.spi;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
import org.apache.camel.NamedNode;
import org.apache.camel.Processor;
@@ -56,4 +59,16 @@ public interface ProcessorFactory {
*/
Processor createProcessor(RouteContext routeContext, NamedNode definition) throws Exception;
+ /**
+ * Creates a processor by the name of the definition. This should only be used in some special situations
+ * where the processor is used internally in some features such as camel-cloud.
+ *
+ * @param camelContext the camel context
+ * @param definitionName the name of the definition that represents the processor
+ * @param args arguments for creating the processor (name=vale pairs)
+ * @return the created processor, or <tt>null</tt> if this situation is not yet implemented.
+ * @throws Exception can be thrown if error creating the processor
+ */
+ Processor createProcessor(CamelContext camelContext, String definitionName, Map<String, Object> args) throws Exception;
+
}
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
index 11d3940..9218ce9 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
@@ -16,19 +16,22 @@
*/
package org.apache.camel.impl.cloud;
+import java.util.HashMap;
import java.util.Map;
import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Expression;
import org.apache.camel.Message;
+import org.apache.camel.Processor;
import org.apache.camel.cloud.ServiceCallConstants;
import org.apache.camel.cloud.ServiceDefinition;
import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.processor.SendDynamicProcessor;
import org.apache.camel.spi.Language;
+import org.apache.camel.support.AsyncProcessorConverterHelper;
import org.apache.camel.support.AsyncProcessorSupport;
import org.apache.camel.support.service.ServiceHelper;
import org.apache.camel.util.ObjectHelper;
@@ -44,7 +47,7 @@ public class DefaultServiceCallProcessor extends AsyncProcessorSupport {
private final CamelContext camelContext;
private final ServiceLoadBalancer loadBalancer;
private final Expression expression;
- private SendDynamicProcessor processor;
+ private AsyncProcessor processor;
public DefaultServiceCallProcessor(
CamelContext camelContext, String name, String scheme, String uri, ExchangePattern exchangePattern,
@@ -122,11 +125,13 @@ public class DefaultServiceCallProcessor extends AsyncProcessorSupport {
ObjectHelper.notNull(expression, "expression");
ObjectHelper.notNull(loadBalancer, "load balancer");
- processor = new SendDynamicProcessor(uri, expression);
- processor.setCamelContext(camelContext);
- if (exchangePattern != null) {
- processor.setPattern(exchangePattern);
- }
+ Map<String, Object> args = new HashMap<>();
+ args.put("uri", uri);
+ args.put("expression", expression);
+ args.put("pattern", exchangePattern);
+
+ Processor send = camelContext.getProcessorFactory().createProcessor(camelContext, "SendDynamicProcessor", args);
+ processor = AsyncProcessorConverterHelper.convert(send);
// Start services if needed
ServiceHelper.startService(processor);
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
index 2a7b9a1..a9c18c8 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
@@ -16,9 +16,15 @@
*/
package org.apache.camel.impl;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Expression;
import org.apache.camel.NamedNode;
import org.apache.camel.NoFactoryAvailableException;
import org.apache.camel.Processor;
+import org.apache.camel.processor.SendDynamicProcessor;
import org.apache.camel.spi.FactoryFinder;
import org.apache.camel.spi.ProcessorFactory;
import org.apache.camel.spi.RouteContext;
@@ -75,4 +81,22 @@ public class DefaultProcessorFactory implements ProcessorFactory {
return null;
}
+
+ @Override
+ public Processor createProcessor(CamelContext camelContext, String definitionName, Map<String, Object> args) throws Exception {
+ // currently only SendDynamicProcessor is supported
+ SendDynamicProcessor answer = null;
+ if ("SendDynamicProcessor".equals(definitionName)) {
+ String uri = (String) args.get("uri");
+ Expression expression = (Expression) args.get("expression");
+ ExchangePattern pattern = (ExchangePattern) args.get("exchangePattern");
+ answer = new SendDynamicProcessor(uri, expression);
+ if (pattern != null) {
+ answer.setPattern(pattern);
+ }
+ }
+
+ return answer;
+ }
+
}
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java b/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
index e25137d..ab91921 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/TypedProcessorFactory.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.impl;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
import org.apache.camel.NamedNode;
import org.apache.camel.Processor;
import org.apache.camel.model.ProcessorDefinition;
@@ -47,6 +50,10 @@ public class TypedProcessorFactory<T extends ProcessorDefinition<T>> implements
return null;
}
+ @Override
+ public Processor createProcessor(CamelContext camelContext, String definitionName, Map<String, Object> args) throws Exception {
+ return null;
+ }
protected Processor doCreateChildProcessor(RouteContext routeContext, T definition, boolean mandatory) throws Exception {
return null;
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
index 23b9aa3..6f97c5a 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.processor;
+import java.util.Map;
+
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.NamedNode;
@@ -83,10 +85,12 @@ public class CustomProcessorFactoryTest extends ContextTestSupport {
// START SNIPPET: e3
public static class MyFactory implements ProcessorFactory {
+ @Override
public Processor createChildProcessor(RouteContext routeContext, NamedNode definition, boolean mandatory) throws Exception {
return null;
}
+ @Override
public Processor createProcessor(RouteContext routeContext, NamedNode definition) throws Exception {
if (definition instanceof SplitDefinition) {
// add additional output to the splitter
@@ -103,6 +107,11 @@ public class CustomProcessorFactoryTest extends ContextTestSupport {
// before the processor was created
return null;
}
+
+ @Override
+ public Processor createProcessor(CamelContext camelContext, String definitionName, Map<String, Object> args) throws Exception {
+ return null;
+ }
}
// END SNIPPET: e3
[camel] 01/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 80d1e980842dfc844416b98db504c887cf944763
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 1 04:45:17 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
.../apache/camel/cloud/DiscoverableService.java | 0
.../apache/camel/cloud/ServiceCallConstants.java | 0
.../org/apache/camel/cloud/ServiceChooser.java | 0
.../apache/camel/cloud/ServiceChooserAware.java | 0
.../apache/camel/cloud/ServiceChooserFactory.java | 0
.../org/apache/camel/cloud/ServiceDefinition.java | 0
.../org/apache/camel/cloud/ServiceDiscovery.java | 0
.../apache/camel/cloud/ServiceDiscoveryAware.java | 0
.../camel/cloud/ServiceDiscoveryFactory.java | 0
.../camel/cloud/ServiceExpressionFactory.java | 0
.../org/apache/camel/cloud/ServiceFactory.java | 0
.../java/org/apache/camel/cloud/ServiceFilter.java | 0
.../org/apache/camel/cloud/ServiceFilterAware.java | 0
.../apache/camel/cloud/ServiceFilterFactory.java | 0
.../java/org/apache/camel/cloud/ServiceHealth.java | 0
.../apache/camel/cloud/ServiceLoadBalancer.java | 0
.../camel/cloud/ServiceLoadBalancerFactory.java | 0
.../camel/cloud/ServiceLoadBalancerFunction.java | 0
.../org/apache/camel/cloud/ServiceRegistry.java | 0
.../main/java/org/apache/camel/cloud/package.html | 0
core/camel-cloud/pom.xml | 66 ++++++++++++++++++++++
.../camel/impl/cloud/AbstractServiceRegistry.java | 0
.../camel/impl/cloud/BlacklistServiceFilter.java | 0
.../impl/cloud/BlacklistServiceFilterFactory.java | 0
.../camel/impl/cloud/CachingServiceDiscovery.java | 0
.../impl/cloud/CachingServiceDiscoveryFactory.java | 0
.../camel/impl/cloud/CombinedServiceDiscovery.java | 0
.../cloud/CombinedServiceDiscoveryFactory.java | 0
.../camel/impl/cloud/CombinedServiceFilter.java | 0
.../impl/cloud/CombinedServiceFilterFactory.java | 0
.../impl/cloud/DefaultServiceCallExpression.java | 4 +-
.../impl/cloud/DefaultServiceCallProcessor.java | 0
.../camel/impl/cloud/DefaultServiceDefinition.java | 0
.../camel/impl/cloud/DefaultServiceDiscovery.java | 0
.../camel/impl/cloud/DefaultServiceFilter.java | 0
.../camel/impl/cloud/DefaultServiceHealth.java | 0
.../impl/cloud/DefaultServiceLoadBalancer.java | 0
.../cloud/DefaultServiceLoadBalancerFactory.java | 0
.../camel/impl/cloud/HealthyServiceFilter.java | 0
.../impl/cloud/HealthyServiceFilterFactory.java | 0
.../camel/impl/cloud/PassThroughServiceFilter.java | 0
.../cloud/PassThroughServiceFilterFactory.java | 0
.../camel/impl/cloud/RandomServiceChooser.java | 0
.../camel/impl/cloud/RoundRobinServiceChooser.java | 0
.../impl}/cloud/ServiceCallExpressionSupport.java | 3 +-
.../impl/cloud/ServiceRegistrationRoutePolicy.java | 0
.../ServiceRegistrationRoutePolicyFactory.java | 0
.../camel/impl/cloud/ServiceRegistryHelper.java | 0
.../camel/impl/cloud/ServiceRegistrySelectors.java | 0
.../camel/impl/cloud/StaticServiceDiscovery.java | 0
.../impl/cloud/StaticServiceDiscoveryFactory.java | 0
.../java/org/apache/camel/impl/cloud/package.html | 0
core/pom.xml | 1 +
53 files changed, 70 insertions(+), 4 deletions(-)
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/DiscoverableService.java b/core/camel-api/src/main/java/org/apache/camel/cloud/DiscoverableService.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/DiscoverableService.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/DiscoverableService.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceCallConstants.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooser.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooser.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooser.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooser.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserAware.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceChooserFactory.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDefinition.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDefinition.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDefinition.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDefinition.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryAware.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceDiscoveryFactory.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceExpressionFactory.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFactory.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFactory.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFactory.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFactory.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilter.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilter.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilter.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilter.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterAware.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceFilterFactory.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceHealth.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceHealth.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceHealth.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceHealth.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancer.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFactory.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceLoadBalancerFunction.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceRegistry.java b/core/camel-api/src/main/java/org/apache/camel/cloud/ServiceRegistry.java
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceRegistry.java
rename to core/camel-api/src/main/java/org/apache/camel/cloud/ServiceRegistry.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/package.html b/core/camel-api/src/main/java/org/apache/camel/cloud/package.html
similarity index 100%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/package.html
rename to core/camel-api/src/main/java/org/apache/camel/cloud/package.html
diff --git a/core/camel-cloud/pom.xml b/core/camel-cloud/pom.xml
new file mode 100644
index 0000000..3ac8325
--- /dev/null
+++ b/core/camel-cloud/pom.xml
@@ -0,0 +1,66 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+ 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>core</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-cloud</artifactId>
+ <packaging>jar</packaging>
+ <name>Camel :: Cloud</name>
+ <description>Camel Cloud support</description>
+
+ <properties>
+ <firstVersion>3.0</firstVersion>
+ <label>cloud</label>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>spi-annotations</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>meta-annotations</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.github.ben-manes.caffeine</groupId>
+ <artifactId>caffeine</artifactId>
+ <version>${caffeine-version}</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/AbstractServiceRegistry.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilterFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscovery.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceDiscoveryFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilter.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/CombinedServiceFilterFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
similarity index 94%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
index 8b8c5ad..58ccb3e 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallExpression.java
@@ -16,13 +16,11 @@
*/
package org.apache.camel.impl.cloud;
-import org.apache.camel.cloud.ServiceCallExpressionSupport;
-import org.apache.camel.model.cloud.ServiceCallDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Support class for custom implementations of {@link ServiceCallDefinition ServiceCall EIP} components.
+ * Support class for custom implementations of ServiceCall EIP components.
* <p/>
* Below are some examples how to call a service and what Camel endpoint URI is constructed based on the input:
* <pre>
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceFilter.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancer.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceLoadBalancerFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilterFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilterFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RandomServiceChooser.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/RoundRobinServiceChooser.java
diff --git a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallExpressionSupport.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallExpressionSupport.java
similarity index 96%
rename from core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallExpressionSupport.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallExpressionSupport.java
index 1879209..dd69366 100644
--- a/core/camel-base/src/main/java/org/apache/camel/cloud/ServiceCallExpressionSupport.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallExpressionSupport.java
@@ -14,10 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.cloud;
+package org.apache.camel.impl.cloud;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.cloud.ServiceCallConstants;
import org.apache.camel.support.ExchangeHelper;
import org.apache.camel.support.ExpressionAdapter;
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicyFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistryHelper.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrySelectors.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscoveryFactory.java
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/cloud/package.html b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/package.html
similarity index 100%
rename from core/camel-core/src/main/java/org/apache/camel/impl/cloud/package.html
rename to core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/package.html
diff --git a/core/pom.xml b/core/pom.xml
index a8fbeb3..08b7958 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -40,6 +40,7 @@
<module>camel-support</module>
<module>camel-caffeine-lrucache</module>
<module>camel-headersmap</module>
+ <module>camel-cloud</module>
<module>camel-management-api</module>
<module>camel-management-impl</module>
<module>camel-base</module>
[camel] 11/14: CAMEL-13380: camel-core - Move cloud out into
camel-cloud component. Woprk in progress
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch cloud2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3b8ef32b5c91a55b52a9683dbf88d3bd11dd0395
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 5 22:14:36 2019 +0200
CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress
---
core/camel-cloud/pom.xml | 5 +++++
.../org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java | 2 +-
.../main/java/org/apache/camel/impl/DefaultProcessorFactory.java | 6 +++---
.../main/java/org/apache/camel/processor/SendDynamicProcessor.java | 5 -----
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/core/camel-cloud/pom.xml b/core/camel-cloud/pom.xml
index 0c88956..4309ee4 100644
--- a/core/camel-cloud/pom.xml
+++ b/core/camel-cloud/pom.xml
@@ -79,6 +79,11 @@
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>java-hamcrest</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
index 5ff978b..5603f19 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/DefaultServiceCallProcessor.java
@@ -128,7 +128,7 @@ public class DefaultServiceCallProcessor extends AsyncProcessorSupport {
Map<String, Object> args = new HashMap<>();
args.put("uri", uri);
args.put("expression", expression);
- args.put("pattern", exchangePattern);
+ args.put("exchangePattern", exchangePattern);
Processor send = camelContext.getProcessorFactory().createProcessor(camelContext, "SendDynamicProcessor", args);
processor = AsyncProcessorConverterHelper.convert(send);
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
index c26b895..725e8a0 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultProcessorFactory.java
@@ -89,11 +89,11 @@ public class DefaultProcessorFactory implements ProcessorFactory {
if ("SendDynamicProcessor".equals(definitionName)) {
String uri = (String) args.get("uri");
Expression expression = (Expression) args.get("expression");
- ExchangePattern pattern = (ExchangePattern) args.get("exchangePattern");
+ ExchangePattern exchangePattern = (ExchangePattern) args.get("exchangePattern");
answer = new SendDynamicProcessor(uri, expression);
answer.setCamelContext(camelContext);
- if (pattern != null) {
- answer.setPattern(pattern);
+ if (exchangePattern != null) {
+ answer.setPattern(exchangePattern);
}
}
diff --git a/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java b/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
index 3ac4a0a..2857dfd 100644
--- a/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
+++ b/core/camel-core/src/main/java/org/apache/camel/processor/SendDynamicProcessor.java
@@ -55,11 +55,6 @@ public class SendDynamicProcessor extends AsyncProcessorSupport implements IdAwa
protected int cacheSize;
protected boolean allowOptimisedComponents = true;
- public SendDynamicProcessor(Expression expression) {
- this.uri = null;
- this.expression = expression;
- }
-
public SendDynamicProcessor(String uri, Expression expression) {
this.uri = uri;
this.expression = expression;