http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java index d6a3049..b31cbb6 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/cache/IgniteCacheEndpoint.java @@ -25,11 +25,13 @@ import org.apache.camel.CamelException; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.component.ignite.AbstractIgniteComponent; import org.apache.camel.component.ignite.AbstractIgniteEndpoint; import org.apache.camel.component.ignite.IgniteComponent; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; import org.apache.ignite.cache.CachePeekMode; @@ -39,48 +41,54 @@ import org.apache.ignite.cache.query.Query; /** * Ignite Cache endpoint. */ -@UriEndpoint(scheme = "ignite:cache", title = "Ignite Cache", syntax = "ignite:cache:[cacheName]", label = "nosql,cache,compute", +@UriEndpoint(firstVersion = "2.17.0", scheme = "ignite-cache", title = "Ignite Cache", syntax = "ignite-cache:[cacheName]", label = "nosql,cache,compute", consumerClass = IgniteCacheContinuousQueryConsumer.class) public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { - @UriParam @Metadata(required = "true") + @UriPath @Metadata(required = "true") private String cacheName; - @UriParam + @UriParam(label = "producer") private IgniteCacheOperation operation; - @UriParam + @UriParam(label = "producer", defaultValue = "false") private boolean failIfInexistentCache; - @UriParam + @UriParam(label = "producer", defaultValue = "ALL") private CachePeekMode cachePeekMode = CachePeekMode.ALL; - @UriParam + @UriParam(label = "producer,consumer") private Query<Entry<Object, Object>> query; - @UriParam + @UriParam(label = "consumer") private CacheEntryEventSerializableFilter<Object, Object> remoteFilter; - @UriParam + @UriParam(label = "consumer", defaultValue = "true") private boolean oneExchangePerUpdate = true; - @UriParam + @UriParam(label = "consumer", defaultValue = "false") private boolean fireExistingQueryResults; - @UriParam + @UriParam(label = "consumer", defaultValue = "true", defaultValueNote = "ContinuousQuery.DFLT_AUTO_UNSUBSCRIBE") private boolean autoUnsubscribe = ContinuousQuery.DFLT_AUTO_UNSUBSCRIBE; - @UriParam + @UriParam(label = "consumer", defaultValue = "1", defaultValueNote = "ContinuousQuery.DFLT_PAGE_SIZE") private int pageSize = ContinuousQuery.DFLT_PAGE_SIZE; - @UriParam + @UriParam(label = "consumer", defaultValue = "0", defaultValueNote = "ContinuousQuery.DFLT_TIME_INTERVAL") private long timeInterval = ContinuousQuery.DFLT_TIME_INTERVAL; + @Deprecated public IgniteCacheEndpoint(String endpointUri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) { super(endpointUri, igniteComponent); cacheName = remainingUri.getHost(); } + public IgniteCacheEndpoint(String endpointUri, String remaining, Map<String, Object> parameters, IgniteCacheComponent igniteComponent) { + super(endpointUri, igniteComponent); + cacheName = remaining; + } + @Override public Producer createProducer() throws Exception { return new IgniteCacheProducer(this, obtainCache()); @@ -113,9 +121,9 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the cache name. + * The cache name. * - * @param cacheName + * @param cacheName cache name */ public void setCacheName(String cacheName) { this.cacheName = cacheName; @@ -124,14 +132,15 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { /** * Gets the cache operation to invoke. * - * @return + * @return cache name */ public IgniteCacheOperation getOperation() { return operation; } /** - * Sets the cache operation to invoke. + * The cache operation to invoke. + * <p>Possible values: GET, PUT, REMOVE, SIZE, REBALANCE, QUERY, CLEAR.</p> * * @param operation */ @@ -140,7 +149,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Gets whether to fail the initialization if the cache doesn't exist. + * Whether to fail the initialization if the cache doesn't exist. * * @return */ @@ -149,7 +158,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets whether to fail the initialization if the cache doesn't exist. + * Whether to fail the initialization if the cache doesn't exist. * * @param failIfInexistentCache */ @@ -167,7 +176,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the {@link CachePeekMode}, only needed for operations that require it ({@link IgniteCacheOperation#SIZE}). + * The {@link CachePeekMode}, only needed for operations that require it ({@link IgniteCacheOperation#SIZE}). * * @param cachePeekMode */ @@ -186,7 +195,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the query to execute, only needed for operations that require it, + * The {@link Query} to execute, only needed for operations that require it, * and for the Continuous Query Consumer. * * @param query @@ -205,7 +214,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the remote filter, only used by the Continuous Query Consumer. + * The remote filter, only used by the Continuous Query Consumer. * * @param remoteFilter */ @@ -224,7 +233,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets whether to pack each update in an individual Exchange, even if multiple updates are + * Whether to pack each update in an individual Exchange, even if multiple updates are * received in one batch. Only used by the Continuous Query Consumer. * * @param oneExchangePerUpdate @@ -243,7 +252,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets whether auto unsubscribe is enabled in the Continuous Query Consumer. + * Whether auto unsubscribe is enabled in the Continuous Query Consumer. * * @param autoUnsubscribe */ @@ -261,7 +270,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the page size. Only used by the Continuous Query Consumer. + * The page size. Only used by the Continuous Query Consumer. * * @param pageSize */ @@ -280,7 +289,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets whether to process existing results that match the query. Used on initialization of + * Whether to process existing results that match the query. Used on initialization of * the Continuous Query Consumer. * * @param fireExistingQueryResults @@ -299,7 +308,7 @@ public class IgniteCacheEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the time interval for the Continuous Query Consumer. + * The time interval for the Continuous Query Consumer. * * @param timeInterval */
http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeComponent.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeComponent.java new file mode 100644 index 0000000..e182182 --- /dev/null +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeComponent.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ignite.compute; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.component.ignite.AbstractIgniteComponent; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; +import org.apache.ignite.Ignite; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Ignite Compute Component. + */ +public class IgniteComputeComponent extends AbstractIgniteComponent { + + public static IgniteComputeComponent fromIgnite(Ignite ignite) { + IgniteComputeComponent answer = new IgniteComputeComponent(); + answer.setIgnite(ignite); + return answer; + } + + public static IgniteComputeComponent fromConfiguration(IgniteConfiguration configuration) { + IgniteComputeComponent answer = new IgniteComputeComponent(); + answer.setIgniteConfiguration(configuration); + return answer; + } + + public static IgniteComputeComponent fromInputStream(InputStream inputStream) { + IgniteComputeComponent answer = new IgniteComputeComponent(); + answer.setConfigurationResource(inputStream); + return answer; + } + + public static IgniteComputeComponent fromUrl(URL url) { + IgniteComputeComponent answer = new IgniteComputeComponent(); + answer.setConfigurationResource(url); + return answer; + } + + public static IgniteComputeComponent fromLocation(String location) { + IgniteComputeComponent answer = new IgniteComputeComponent(); + answer.setConfigurationResource(location); + return answer; + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + ObjectHelper.notNull(getCamelContext(), "Camel Context"); + IgniteComputeEndpoint answer = new IgniteComputeEndpoint(uri, remaining, parameters, this); + setProperties(answer, parameters); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java index d6a3eb2..bdaa8c7 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/compute/IgniteComputeEndpoint.java @@ -25,36 +25,46 @@ import org.apache.camel.Producer; import org.apache.camel.component.ignite.AbstractIgniteEndpoint; import org.apache.camel.component.ignite.ClusterGroupExpression; import org.apache.camel.component.ignite.IgniteComponent; +import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCompute; /** * Ignite Compute endpoint. */ -@UriEndpoint(scheme = "ignite:compute", title = "Ignite Compute", syntax = "ignite:compute:[endpointId]", label = "nosql,cache,compute", producerOnly = true) +@UriEndpoint(firstVersion = "2.17.0", scheme = "ignite-compute", title = "Ignite Compute", syntax = "ignite-compute:[endpointId]", label = "nosql,cache,compute", producerOnly = true) public class IgniteComputeEndpoint extends AbstractIgniteEndpoint { - @UriParam + @UriPath @Metadata(required = "true") + private String endpointId; + + @UriParam(label = "producer") private ClusterGroupExpression clusterGroupExpression; - @UriParam + @UriParam(label = "producer") @Metadata(required = "true") private IgniteComputeExecutionType executionType; - @UriParam + @UriParam(label = "producer") private String taskName; - @UriParam + @UriParam(label = "producer") private String computeName; - @UriParam + @UriParam(label = "producer") private Long timeoutMillis; + @Deprecated public IgniteComputeEndpoint(String uri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) throws ClassNotFoundException { super(uri, igniteComponent); } + public IgniteComputeEndpoint(String uri, String remaining, Map<String, Object> parameters, IgniteComputeComponent igniteComponent) throws ClassNotFoundException { + super(uri, igniteComponent); + } + @Override public Producer createProducer() throws Exception { return new IgniteComputeProducer(this); @@ -81,6 +91,42 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint { } /** + * Gets the endpoint ID. + * + * @return endpoint ID (not used) + */ + public String getEndpointId() { + return endpointId; + } + + /** + * The endpoint ID (not used). + * + * @param endpointId endpoint ID (not used) + */ + public void setEndpointId(String endpointId) { + this.endpointId = endpointId; + } + + /** + * Gets the cluster group expression. + * + * @return cluster group expression + */ + public ClusterGroupExpression getClusterGroupExpression() { + return clusterGroupExpression; + } + + /** + * An expression that returns the Cluster Group for the IgniteCompute instance. + * + * @param clusterGroupExpression cluster group expression + */ + public void setClusterGroupExpression(ClusterGroupExpression clusterGroupExpression) { + this.clusterGroupExpression = clusterGroupExpression; + } + + /** * Gets the execution type of this producer. * * @return @@ -90,7 +136,9 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the execution type of this producer. + * The compute operation to perform. Possible values: CALL, BROADCAST, APPLY, + * EXECUTE, RUN, AFFINITY_CALL, AFFINITY_RUN. + * The component expects different payload types depending on the operation. * * @param executionType */ @@ -108,7 +156,7 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the task name, only applicable if using the {@link IgniteComputeExecutionType#EXECUTE} execution type. + * The task name, only applicable if using the {@link IgniteComputeExecutionType#EXECUTE} execution type. * * @param taskName */ @@ -126,7 +174,7 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the name of the compute job, which will be set via {@link IgniteCompute#withName(String)}. + * The name of the compute job, which will be set via {@link IgniteCompute#withName(String)}. * * @param computeName */ @@ -144,7 +192,7 @@ public class IgniteComputeEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the timeout interval for triggered jobs, in milliseconds, which will be set via {@link IgniteCompute#withTimeout(long)}. + * The timeout interval for triggered jobs, in milliseconds, which will be set via {@link IgniteCompute#withTimeout(long)}. * * @param timeoutMillis */ http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsComponent.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsComponent.java new file mode 100644 index 0000000..b0fced0 --- /dev/null +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsComponent.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ignite.events; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.component.ignite.AbstractIgniteComponent; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; +import org.apache.ignite.Ignite; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Ignite Events Component. + */ +public class IgniteEventsComponent extends AbstractIgniteComponent { + + public static IgniteEventsComponent fromIgnite(Ignite ignite) { + IgniteEventsComponent answer = new IgniteEventsComponent(); + answer.setIgnite(ignite); + return answer; + } + + public static IgniteEventsComponent fromConfiguration(IgniteConfiguration configuration) { + IgniteEventsComponent answer = new IgniteEventsComponent(); + answer.setIgniteConfiguration(configuration); + return answer; + } + + public static IgniteEventsComponent fromInputStream(InputStream inputStream) { + IgniteEventsComponent answer = new IgniteEventsComponent(); + answer.setConfigurationResource(inputStream); + return answer; + } + + public static IgniteEventsComponent fromUrl(URL url) { + IgniteEventsComponent answer = new IgniteEventsComponent(); + answer.setConfigurationResource(url); + return answer; + } + + public static IgniteEventsComponent fromLocation(String location) { + IgniteEventsComponent answer = new IgniteEventsComponent(); + answer.setConfigurationResource(location); + return answer; + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + ObjectHelper.notNull(getCamelContext(), "Camel Context"); + IgniteEventsEndpoint answer = new IgniteEventsEndpoint(uri, remaining, parameters, this); + setProperties(answer, parameters); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java index 1d48a30..d926f95 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java @@ -31,6 +31,7 @@ import org.apache.camel.component.ignite.ClusterGroupExpression; import org.apache.camel.component.ignite.IgniteComponent; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteEvents; import org.apache.ignite.cluster.ClusterGroup; @@ -41,18 +42,22 @@ import org.slf4j.LoggerFactory; /** * Ignite Events endpoint. Only supports consumers. */ -@UriEndpoint(scheme = "ignite:events", title = "Ignite Events", syntax = "ignite:events:[endpointId]", label = "nosql,cache,compute,messaging,data", +@UriEndpoint(firstVersion = "2.17.0", scheme = "ignite-events", title = "Ignite Events", syntax = "ignite-events:[endpointId]", label = "nosql,cache,compute,messaging,data", consumerOnly = true, consumerClass = IgniteEventsConsumer.class) public class IgniteEventsEndpoint extends AbstractIgniteEndpoint { private static final Logger LOG = LoggerFactory.getLogger(IgniteEventsEndpoint.class); - @UriParam + @UriPath + private String endpointId; + + @UriParam(label = "consumer", javaType = "Set<Integer> or String", defaultValue = "EventType.EVTS_ALL") private Set<Integer> events; - @UriParam + @UriParam(label = "consumer") private ClusterGroupExpression clusterGroupExpression; + @Deprecated public IgniteEventsEndpoint(String uri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) { super(uri, igniteComponent); @@ -63,6 +68,16 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint { } } + public IgniteEventsEndpoint(String uri, String remaining, Map<String, Object> parameters, IgniteEventsComponent igniteComponent) { + super(uri, igniteComponent); + + // Initialize subscribed event types with ALL. + events = new HashSet<>(); + for (Integer eventType : EventType.EVTS_ALL) { + events.add(eventType); + } + } + @Override public Producer createProducer() throws Exception { throw new UnsupportedOperationException("The Ignite Events endpoint does not support producers."); @@ -95,6 +110,24 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint { } /** + * Gets the endpoint ID (not used). + * + * @return endpoint ID (not used) + */ + public String getEndpointId() { + return endpointId; + } + + /** + * The endpoint ID (not used). + * + * @param endpointId endpoint ID (not used) + */ + public void setEndpointId(String endpointId) { + this.endpointId = endpointId; + } + + /** * Gets the event types to subscribe to. * * @return @@ -104,7 +137,8 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the event types to subscribe to as a {@link Set}. + * The event IDs to subscribe to as a Set<Integer> directly where + * the IDs are the different constants in org.apache.ignite.events.EventType. * * @param events */ @@ -113,7 +147,7 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the event types to subscribe to as a comma-separated string of event constants as defined in {@link EventType}. + * The event types to subscribe to as a comma-separated string of event constants as defined in {@link EventType}. * <p> * For example: EVT_CACHE_ENTRY_CREATED,EVT_CACHE_OBJECT_REMOVED,EVT_IGFS_DIR_CREATED. * @@ -135,10 +169,20 @@ public class IgniteEventsEndpoint extends AbstractIgniteEndpoint { } } + /** + * Gets the cluster group expression. + * + * @return cluster group expression + */ public ClusterGroupExpression getClusterGroupExpression() { return clusterGroupExpression; } + /** + * The cluster group expression. + * + * @param clusterGroupExpression cluster group expression + */ public void setClusterGroupExpression(ClusterGroupExpression clusterGroupExpression) { this.clusterGroupExpression = clusterGroupExpression; } http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenComponent.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenComponent.java new file mode 100644 index 0000000..456202a --- /dev/null +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenComponent.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ignite.idgen; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.component.ignite.AbstractIgniteComponent; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; +import org.apache.ignite.Ignite; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Ignite ID Generator Component. + */ +public class IgniteIdGenComponent extends AbstractIgniteComponent { + + public static IgniteIdGenComponent fromIgnite(Ignite ignite) { + IgniteIdGenComponent answer = new IgniteIdGenComponent(); + answer.setIgnite(ignite); + return answer; + } + + public static IgniteIdGenComponent fromConfiguration(IgniteConfiguration configuration) { + IgniteIdGenComponent answer = new IgniteIdGenComponent(); + answer.setIgniteConfiguration(configuration); + return answer; + } + + public static IgniteIdGenComponent fromInputStream(InputStream inputStream) { + IgniteIdGenComponent answer = new IgniteIdGenComponent(); + answer.setConfigurationResource(inputStream); + return answer; + } + + public static IgniteIdGenComponent fromUrl(URL url) { + IgniteIdGenComponent answer = new IgniteIdGenComponent(); + answer.setConfigurationResource(url); + return answer; + } + + public static IgniteIdGenComponent fromLocation(String location) { + IgniteIdGenComponent answer = new IgniteIdGenComponent(); + answer.setConfigurationResource(location); + return answer; + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + ObjectHelper.notNull(getCamelContext(), "Camel Context"); + IgniteIdGenEndpoint answer = new IgniteIdGenEndpoint(uri, remaining, parameters, this); + setProperties(answer, parameters); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java index 3e1da3c..5cd86c6 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/idgen/IgniteIdGenEndpoint.java @@ -27,6 +27,7 @@ import org.apache.camel.component.ignite.IgniteComponent; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.apache.camel.util.ObjectHelper; import org.apache.ignite.IgniteAtomicSequence; import org.slf4j.Logger; @@ -35,24 +36,25 @@ import org.slf4j.LoggerFactory; /** * Ignite ID Generator endpoint. */ -@UriEndpoint(scheme = "ignite:idgen", title = "Ignite ID Generator", syntax = "ignite:idgen:[name]", label = "nosql,cache,compute", producerOnly = true) +@UriEndpoint(firstVersion = "2.17.0", scheme = "ignite-idgen", title = "Ignite ID Generator", syntax = "ignite-idgen:[name]", label = "nosql,cache,compute", producerOnly = true) public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint { private static final Logger LOG = LoggerFactory.getLogger(IgniteIdGenEndpoint.class); - @UriParam + @UriPath @Metadata(required = "true") private String name; - @UriParam + @UriParam(label = "producer") private Integer batchSize; - @UriParam(defaultValue = "0") + @UriParam(label = "producer", defaultValue = "0") private Long initialValue = 0L; - @UriParam + @UriParam(label = "producer") private IgniteIdGenOperation operation; + @Deprecated public IgniteIdGenEndpoint(String endpointUri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) throws Exception { super(endpointUri, igniteComponent); name = remainingUri.getHost(); @@ -60,6 +62,13 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint { ObjectHelper.notNull(name, "ID Generator name"); } + public IgniteIdGenEndpoint(String endpointUri, String remaining, Map<String, Object> parameters, IgniteIdGenComponent igniteComponent) throws Exception { + super(endpointUri, igniteComponent); + name = remaining; + + ObjectHelper.notNull(name, "ID Generator name"); + } + @Override public Producer createProducer() throws Exception { IgniteAtomicSequence atomicSeq = ignite().atomicSequence(name, initialValue, false); @@ -81,34 +90,76 @@ public class IgniteIdGenEndpoint extends AbstractIgniteEndpoint { throw new UnsupportedOperationException("The Ignite Id Generator endpoint doesn't support consumers."); } + /** + * Gets the name. + * + * @return name + */ public String getName() { return name; } + /** + * The sequence name. + * + * @param name name + */ public void setName(String name) { this.name = name; } + /** + * Gets the initial value. + * + * @return initial value + */ public Long getInitialValue() { return initialValue; } + /** + * The initial value. + * + * @param initialValue initial value + */ public void setInitialValue(Long initialValue) { this.initialValue = initialValue; } + /** + * Gets the operation. + * + * @return operation + */ public IgniteIdGenOperation getOperation() { return operation; } + /** + * The operation to invoke on the Ignite ID Generator. + * Superseded by the IgniteConstants.IGNITE_IDGEN_OPERATION header in the IN message. + * Possible values: ADD_AND_GET, GET, GET_AND_ADD, GET_AND_INCREMENT, INCREMENT_AND_GET. + * + * @param operation operation + */ public void setOperation(IgniteIdGenOperation operation) { this.operation = operation; } + /** + * Gets the batch size. + * + * @return batch size + */ public Integer getBatchSize() { return batchSize; } + /** + * The batch size. + * + * @param batchSize batch size + */ public void setBatchSize(Integer batchSize) { this.batchSize = batchSize; } http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingComponent.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingComponent.java new file mode 100644 index 0000000..fd66308 --- /dev/null +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingComponent.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ignite.messaging; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.component.ignite.AbstractIgniteComponent; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; +import org.apache.ignite.Ignite; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Ignite Messaging Component. + */ +public class IgniteMessagingComponent extends AbstractIgniteComponent { + + public static IgniteMessagingComponent fromIgnite(Ignite ignite) { + IgniteMessagingComponent answer = new IgniteMessagingComponent(); + answer.setIgnite(ignite); + return answer; + } + + public static IgniteMessagingComponent fromConfiguration(IgniteConfiguration configuration) { + IgniteMessagingComponent answer = new IgniteMessagingComponent(); + answer.setIgniteConfiguration(configuration); + return answer; + } + + public static IgniteMessagingComponent fromInputStream(InputStream inputStream) { + IgniteMessagingComponent answer = new IgniteMessagingComponent(); + answer.setConfigurationResource(inputStream); + return answer; + } + + public static IgniteMessagingComponent fromUrl(URL url) { + IgniteMessagingComponent answer = new IgniteMessagingComponent(); + answer.setConfigurationResource(url); + return answer; + } + + public static IgniteMessagingComponent fromLocation(String location) { + IgniteMessagingComponent answer = new IgniteMessagingComponent(); + answer.setConfigurationResource(location); + return answer; + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + ObjectHelper.notNull(getCamelContext(), "Camel Context"); + IgniteMessagingEndpoint answer = new IgniteMessagingEndpoint(uri, remaining, parameters, this); + setProperties(answer, parameters); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java index 124d4c7..fe3c18d 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/messaging/IgniteMessagingEndpoint.java @@ -28,34 +28,41 @@ import org.apache.camel.component.ignite.IgniteComponent; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteMessaging; /** * Ignite Messaging endpoint. */ -@UriEndpoint(scheme = "ignite:messaging", title = "Ignite Messaging", syntax = "ignite:messaging:[topic]", label = "nosql,cache,messaging", +@UriEndpoint(firstVersion = "2.17.0", scheme = "ignite-messaging", title = "Ignite Messaging", syntax = "ignite-messaging:[topic]", label = "nosql,cache,messaging", consumerClass = IgniteMessagingConsumer.class) public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint { - @UriParam + @UriPath @Metadata(required = "true") private String topic; - @UriParam + @UriParam(label = "consumer,producer") private ClusterGroupExpression clusterGroupExpression; - @UriParam + @UriParam(label = "producer", defaultValue = "UNORDERED") private IgniteMessagingSendMode sendMode = IgniteMessagingSendMode.UNORDERED; - @UriParam + @UriParam(label = "producer") private Long timeout; + @Deprecated public IgniteMessagingEndpoint(String endpointUri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) { super(endpointUri, igniteComponent); topic = remainingUri.getHost(); } + public IgniteMessagingEndpoint(String endpointUri, String remaining, Map<String, Object> parameters, IgniteMessagingComponent igniteComponent) { + super(endpointUri, igniteComponent); + topic = remaining; + } + @Override public Producer createProducer() throws Exception { // Validate options. @@ -92,34 +99,75 @@ public class IgniteMessagingEndpoint extends AbstractIgniteEndpoint { return messaging; } + /** + * Gets the topic name. + * + * @return topic name + */ public String getTopic() { return topic; } + /** + * The topic name. + * + * @param topic topic name + */ public void setTopic(String topic) { this.topic = topic; } + /** + * Gets the cluster group expression. + * + * @return cluster group expression + */ public ClusterGroupExpression getClusterGroupExpression() { return clusterGroupExpression; } + /** + * The cluster group expression. + * + * @param clusterGroupExpression cluster group expression + */ public void setClusterGroupExpression(ClusterGroupExpression clusterGroupExpression) { this.clusterGroupExpression = clusterGroupExpression; } + /** + * Gets the timeout. + * + * @return timeout + */ public Long getTimeout() { return timeout; } + /** + * The timeout for the send operation when using ordered messages. + * + * @param timeout timeout + */ public void setTimeout(Long timeout) { this.timeout = timeout; } + /** + * Gets the send mode. + * + * @return send mode + */ public IgniteMessagingSendMode getSendMode() { return sendMode; } + /** + * The send mode to use. + * Possible values: UNORDERED, ORDERED. + * + * @param sendMode send mode + */ public void setSendMode(IgniteMessagingSendMode sendMode) { this.sendMode = sendMode; } http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueComponent.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueComponent.java new file mode 100644 index 0000000..edf6ee4 --- /dev/null +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueComponent.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ignite.queue; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.component.ignite.AbstractIgniteComponent; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; +import org.apache.ignite.Ignite; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Ignite Queue Component. + */ +public class IgniteQueueComponent extends AbstractIgniteComponent { + + public static IgniteQueueComponent fromIgnite(Ignite ignite) { + IgniteQueueComponent answer = new IgniteQueueComponent(); + answer.setIgnite(ignite); + return answer; + } + + public static IgniteQueueComponent fromConfiguration(IgniteConfiguration configuration) { + IgniteQueueComponent answer = new IgniteQueueComponent(); + answer.setIgniteConfiguration(configuration); + return answer; + } + + public static IgniteQueueComponent fromInputStream(InputStream inputStream) { + IgniteQueueComponent answer = new IgniteQueueComponent(); + answer.setConfigurationResource(inputStream); + return answer; + } + + public static IgniteQueueComponent fromUrl(URL url) { + IgniteQueueComponent answer = new IgniteQueueComponent(); + answer.setConfigurationResource(url); + return answer; + } + + public static IgniteQueueComponent fromLocation(String location) { + IgniteQueueComponent answer = new IgniteQueueComponent(); + answer.setConfigurationResource(location); + return answer; + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + ObjectHelper.notNull(getCamelContext(), "Camel Context"); + IgniteQueueEndpoint answer = new IgniteQueueEndpoint(uri, remaining, parameters, this); + setProperties(answer, parameters); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java index 688a209..0252820 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java @@ -27,6 +27,7 @@ import org.apache.camel.component.ignite.IgniteComponent; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.apache.camel.util.EndpointHelper; import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.ObjectHelper; @@ -36,24 +37,25 @@ import org.apache.ignite.configuration.CollectionConfiguration; /** * Ignite Queue endpoint. */ -@UriEndpoint(scheme = "ignite:queue", title = "Ignite Queues", syntax = "ignite:queue:[name]", label = "nosql,cache", producerOnly = true) +@UriEndpoint(firstVersion = "2.17.0", scheme = "ignite-queue", title = "Ignite Queues", syntax = "ignite-queue:[name]", label = "nosql,cache", producerOnly = true) public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { - @UriParam @Metadata(required = "true") + @UriPath @Metadata(required = "true") private String name; - @UriParam + @UriParam(label = "producer") private int capacity; - @UriParam + @UriParam(label = "producer") private CollectionConfiguration configuration = new CollectionConfiguration(); - @UriParam + @UriParam(label = "producer") private Long timeoutMillis; - @UriParam + @UriParam(label = "producer") private IgniteQueueOperation operation; + @Deprecated public IgniteQueueEndpoint(String endpointUri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) throws Exception { super(endpointUri, igniteComponent); name = remainingUri.getHost(); @@ -68,6 +70,20 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { } } + public IgniteQueueEndpoint(String endpointUri, String remaining, Map<String, Object> parameters, IgniteQueueComponent igniteComponent) throws Exception { + super(endpointUri, igniteComponent); + name = remaining; + + ObjectHelper.notNull(name, "Queue name"); + + // Set the configuration values. + if (!parameters.containsKey("configuration")) { + Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); + EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); + EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); + } + } + @Override public Producer createProducer() throws Exception { IgniteQueue<Object> queue = ignite().queue(name, capacity, configuration); @@ -90,7 +106,7 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the queue name. + * The queue name. * * @param name */ @@ -108,7 +124,9 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the queue operation to perform. + * The operation to invoke on the Ignite Queue. + * Superseded by the IgniteConstants.IGNITE_QUEUE_OPERATION header in the IN message. + * Possible values: CONTAINS, ADD, SIZE, REMOVE, ITERATOR, CLEAR, RETAIN_ALL, ARRAY, DRAIN, ELEMENT, PEEK, OFFER, POLL, TAKE, PUT. * * @param operation */ @@ -126,7 +144,7 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the queue capacity. Default: non-bounded. + * The queue capacity. Default: non-bounded. * * @param capacity */ @@ -144,7 +162,7 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the collection configuration. Default: empty configuration. + * The collection configuration. Default: empty configuration. * <p> * You can also conveniently set inner properties by using <tt>configuration.xyz=123</tt> options. * @@ -164,7 +182,7 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the queue timeout in milliseconds. Default: no timeout. + * The queue timeout in milliseconds. Default: no timeout. * * @param timeoutMillis */ http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetComponent.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetComponent.java new file mode 100644 index 0000000..6a825c2 --- /dev/null +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetComponent.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ignite.set; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.component.ignite.AbstractIgniteComponent; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; +import org.apache.ignite.Ignite; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Ignite Set Component. + */ +public class IgniteSetComponent extends AbstractIgniteComponent { + + public static IgniteSetComponent fromIgnite(Ignite ignite) { + IgniteSetComponent answer = new IgniteSetComponent(); + answer.setIgnite(ignite); + return answer; + } + + public static IgniteSetComponent fromConfiguration(IgniteConfiguration configuration) { + IgniteSetComponent answer = new IgniteSetComponent(); + answer.setIgniteConfiguration(configuration); + return answer; + } + + public static IgniteSetComponent fromInputStream(InputStream inputStream) { + IgniteSetComponent answer = new IgniteSetComponent(); + answer.setConfigurationResource(inputStream); + return answer; + } + + public static IgniteSetComponent fromUrl(URL url) { + IgniteSetComponent answer = new IgniteSetComponent(); + answer.setConfigurationResource(url); + return answer; + } + + public static IgniteSetComponent fromLocation(String location) { + IgniteSetComponent answer = new IgniteSetComponent(); + answer.setConfigurationResource(location); + return answer; + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + ObjectHelper.notNull(getCamelContext(), "Camel Context"); + IgniteSetEndpoint answer = new IgniteSetEndpoint(uri, remaining, parameters, this); + setProperties(answer, parameters); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java index 6125ff9..ff616ba 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java @@ -27,26 +27,28 @@ import org.apache.camel.component.ignite.IgniteComponent; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.apache.camel.util.EndpointHelper; import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.ObjectHelper; import org.apache.ignite.configuration.CollectionConfiguration; /** - * Ignite Cache endpoint. + * Ignite Set endpoint. */ -@UriEndpoint(scheme = "ignite:set", title = "Ignite Sets", syntax = "ignite:set:[name]", label = "nosql,cache", producerOnly = true) +@UriEndpoint(firstVersion = "2.17.0", scheme = "ignite-set", title = "Ignite Sets", syntax = "ignite-set:[name]", label = "nosql,cache", producerOnly = true) public class IgniteSetEndpoint extends AbstractIgniteEndpoint { - @UriParam @Metadata(required = "true") + @UriPath @Metadata(required = "true") private String name; - @UriParam + @UriParam(label = "producer") private CollectionConfiguration configuration = new CollectionConfiguration(); - @UriParam + @UriParam(label = "producer") private IgniteSetOperation operation; + @Deprecated public IgniteSetEndpoint(String endpointUri, URI remainingUri, Map<String, Object> parameters, IgniteComponent igniteComponent) throws Exception { super(endpointUri, igniteComponent); name = remainingUri.getHost(); @@ -62,6 +64,21 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint { } + public IgniteSetEndpoint(String endpointUri, String remaining, Map<String, Object> parameters, IgniteSetComponent igniteComponent) throws Exception { + super(endpointUri, igniteComponent); + name = remaining; + + ObjectHelper.notNull(name, "Set name"); + + // Set the configuration values. + if (!parameters.containsKey("configuration")) { + Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); + EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); + EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); + } + + } + @Override public Producer createProducer() throws Exception { return new IgniteSetProducer(this, ignite().set(name, configuration)); @@ -82,7 +99,7 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the set name. + * The set name. * * @param name */ @@ -100,7 +117,7 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the collection configuration. Default: empty configuration. + * The collection configuration. Default: empty configuration. * <p> * You can also conveniently set inner properties by using <tt>configuration.xyz=123</tt> options. * @@ -120,7 +137,9 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint { } /** - * Sets the set operation to perform. + * The operation to invoke on the Ignite Set. + * Superseded by the IgniteConstants.IGNITE_SETS_OPERATION header in the IN message. + * Possible values: CONTAINS, ADD, SIZE, REMOVE, ITERATOR, CLEAR, RETAIN_ALL, ARRAY.The set operation to perform. * * @param operation */ http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-cache ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-cache b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-cache new file mode 100644 index 0000000..495652e --- /dev/null +++ b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-cache @@ -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.component.ignite.cache.IgniteCacheComponent http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-compute ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-compute b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-compute new file mode 100644 index 0000000..aa87994 --- /dev/null +++ b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-compute @@ -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.component.ignite.compute.IgniteComputeComponent http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-events ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-events b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-events new file mode 100644 index 0000000..299d7ba --- /dev/null +++ b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-events @@ -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.component.ignite.events.IgniteEventsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-idgen ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-idgen b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-idgen new file mode 100644 index 0000000..c13c027 --- /dev/null +++ b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-idgen @@ -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.component.ignite.idgen.IgniteIdGenComponent http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-messaging ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-messaging b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-messaging new file mode 100644 index 0000000..28dbd84 --- /dev/null +++ b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-messaging @@ -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.component.ignite.messaging.IgniteMessagingComponent http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-queue ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-queue b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-queue new file mode 100644 index 0000000..ec3a5e8 --- /dev/null +++ b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-queue @@ -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.component.ignite.queue.IgniteQueueComponent http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-set ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-set b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-set new file mode 100644 index 0000000..4cef5c3 --- /dev/null +++ b/components/camel-ignite/src/main/resources/META-INF/services/org/apache/camel/component/ignite-set @@ -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.component.ignite.set.IgniteSetComponent http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java index d46cd1b..64a77e5 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java @@ -28,7 +28,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -public class AbstractIgniteTest extends CamelTestSupport { +public abstract class AbstractIgniteTest extends CamelTestSupport { /** Ip finder for TCP discovery. */ private static final TcpDiscoveryIpFinder LOCAL_IP_FINDER = new TcpDiscoveryVmIpFinder(false) { { @@ -40,22 +40,25 @@ public class AbstractIgniteTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); - context.addComponent("ignite", buildComponent()); + context.addComponent(getScheme(), createComponent()); return context; } - protected IgniteComponent buildComponent() { + protected IgniteConfiguration createConfiguration() { IgniteConfiguration config = new IgniteConfiguration(); config.setGridName(UUID.randomUUID().toString()); config.setIncludeEventTypes(EventType.EVT_JOB_FINISHED, EventType.EVT_JOB_RESULTED); config.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(LOCAL_IP_FINDER)); - - return IgniteComponent.fromConfiguration(config); + return config; } + protected abstract String getScheme(); + + protected abstract AbstractIgniteComponent createComponent(); + protected Ignite ignite() { if (ignite == null) { - ignite = context.getComponent("ignite", IgniteComponent.class).getIgnite(); + ignite = context.getComponent(getScheme(), AbstractIgniteComponent.class).getIgnite(); } return ignite; } http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java index c44b7f0..0e69006 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java @@ -32,6 +32,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Route; import org.apache.camel.ServiceStatus; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.ignite.cache.IgniteCacheComponent; import org.apache.camel.impl.JndiRegistry; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; @@ -46,6 +47,16 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement private static final long serialVersionUID = 1L; + @Override + protected String getScheme() { + return "ignite-cache"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteCacheComponent.fromConfiguration(createConfiguration()); + } + @Test public void testContinuousQueryDoNotFireExistingEntries() throws Exception { context.startRoute("continuousQuery"); @@ -136,13 +147,13 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement return new RouteBuilder() { @Override public void configure() throws Exception { - from("ignite:cache:testcontinuous1?query=#query1").routeId("continuousQuery").noAutoStartup().to("mock:test1"); + from("ignite-cache:testcontinuous1?query=#query1").routeId("continuousQuery").noAutoStartup().to("mock:test1"); - from("ignite:cache:testcontinuous1?query=#query1&fireExistingQueryResults=true").routeId("continuousQuery.fireExistingEntries").noAutoStartup().to("mock:test2"); + from("ignite-cache:testcontinuous1?query=#query1&fireExistingQueryResults=true").routeId("continuousQuery.fireExistingEntries").noAutoStartup().to("mock:test2"); - from("ignite:cache:testcontinuous1?query=#query1&remoteFilter=#remoteFilter1&fireExistingQueryResults=true").routeId("remoteFilter").noAutoStartup().to("mock:test3"); + from("ignite-cache:testcontinuous1?query=#query1&remoteFilter=#remoteFilter1&fireExistingQueryResults=true").routeId("remoteFilter").noAutoStartup().to("mock:test3"); - from("ignite:cache:testcontinuous1?pageSize=10&oneExchangePerUpdate=false").routeId("groupedUpdate").noAutoStartup().to("mock:test4"); + from("ignite-cache:testcontinuous1?pageSize=10&oneExchangePerUpdate=false").routeId("groupedUpdate").noAutoStartup().to("mock:test4"); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java index 07771bd..159a2e9 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java @@ -27,6 +27,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import org.apache.camel.CamelException; +import org.apache.camel.component.ignite.cache.IgniteCacheComponent; import org.apache.camel.component.ignite.cache.IgniteCacheOperation; import org.apache.camel.util.ObjectHelper; import org.apache.ignite.IgniteCache; @@ -41,9 +42,19 @@ import static com.google.common.truth.Truth.assert_; public class IgniteCacheTest extends AbstractIgniteTest { + @Override + protected String getScheme() { + return "ignite-cache"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteCacheComponent.fromConfiguration(createConfiguration()); + } + @Test public void testAddEntry() { - template.requestBodyAndHeader("ignite:cache:testcache1?operation=PUT", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); + template.requestBodyAndHeader("ignite-cache:testcache1?operation=PUT", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); assert_().that(ignite().cache("testcache1").size(CachePeekMode.ALL)).isEqualTo(1); assert_().that(ignite().cache("testcache1").get("abcd")).isEqualTo("1234"); @@ -51,7 +62,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { @Test public void testAddEntrySet() { - template.requestBody("ignite:cache:testcache1?operation=PUT", ImmutableMap.of("abcd", "1234", "efgh", "5678")); + template.requestBody("ignite-cache:testcache1?operation=PUT", ImmutableMap.of("abcd", "1234", "efgh", "5678")); assert_().that(ignite().cache("testcache1").size(CachePeekMode.ALL)).isEqualTo(2); assert_().that(ignite().cache("testcache1").get("abcd")).isEqualTo("1234"); @@ -62,10 +73,10 @@ public class IgniteCacheTest extends AbstractIgniteTest { public void testGetOne() { testAddEntry(); - String result = template.requestBody("ignite:cache:testcache1?operation=GET", "abcd", String.class); + String result = template.requestBody("ignite-cache:testcache1?operation=GET", "abcd", String.class); assert_().that(result).isEqualTo("1234"); - result = template.requestBodyAndHeader("ignite:cache:testcache1?operation=GET", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "abcd", String.class); + result = template.requestBodyAndHeader("ignite-cache:testcache1?operation=GET", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "abcd", String.class); assert_().that(result).isEqualTo("1234"); } @@ -80,7 +91,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { keys.add("k" + i); } - Map<String, String> result = template.requestBody("ignite:cache:testcache1?operation=GET", keys, Map.class); + Map<String, String> result = template.requestBody("ignite-cache:testcache1?operation=GET", keys, Map.class); for (String k : keys) { assert_().that(result.get(k)).isEqualTo(k.replace("k", "v")); } @@ -96,7 +107,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { keys.add("k" + i); } - Integer result = template.requestBody("ignite:cache:testcache1?operation=SIZE", keys, Integer.class); + Integer result = template.requestBody("ignite-cache:testcache1?operation=SIZE", keys, Integer.class); assert_().that(result).isEqualTo(100); } @@ -119,7 +130,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { } }); - List results = template.requestBodyAndHeader("ignite:cache:testcache1?operation=QUERY", keys, IgniteConstants.IGNITE_CACHE_QUERY, query, List.class); + List results = template.requestBodyAndHeader("ignite-cache:testcache1?operation=QUERY", keys, IgniteConstants.IGNITE_CACHE_QUERY, query, List.class); assert_().that(results.size()).isEqualTo(50); } @@ -136,7 +147,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { // Also add a cache entry with the entire Set as a key. cache.put(keys, "---"); - String result = template.requestBody("ignite:cache:testcache1?operation=GET&treatCollectionsAsCacheObjects=true", keys, String.class); + String result = template.requestBody("ignite-cache:testcache1?operation=GET&treatCollectionsAsCacheObjects=true", keys, String.class); assert_().that(result).isEqualTo("---"); } @@ -149,12 +160,12 @@ public class IgniteCacheTest extends AbstractIgniteTest { assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(2); - template.requestBody("ignite:cache:testcache1?operation=REMOVE", "abcd"); + template.requestBody("ignite-cache:testcache1?operation=REMOVE", "abcd"); assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(1); assert_().that(cache.get("abcd")).isNull(); - template.requestBodyAndHeader("ignite:cache:testcache1?operation=REMOVE", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "efgh"); + template.requestBodyAndHeader("ignite-cache:testcache1?operation=REMOVE", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "efgh"); assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(0); assert_().that(cache.get("efgh")).isNull(); @@ -170,7 +181,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(100); - template.requestBody("ignite:cache:testcache1?operation=CLEAR", "this value won't be used"); + template.requestBody("ignite-cache:testcache1?operation=CLEAR", "this value won't be used"); assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(0); } @@ -179,10 +190,10 @@ public class IgniteCacheTest extends AbstractIgniteTest { public void testHeaderSetRemoveEntry() { testAddEntry(); - String result = template.requestBody("ignite:cache:testcache1?operation=GET", "abcd", String.class); + String result = template.requestBody("ignite-cache:testcache1?operation=GET", "abcd", String.class); assert_().that(result).isEqualTo("1234"); - result = template.requestBodyAndHeader("ignite:cache:testcache1?operation=GET", "abcd", IgniteConstants.IGNITE_CACHE_OPERATION, IgniteCacheOperation.REMOVE, String.class); + result = template.requestBodyAndHeader("ignite-cache:testcache1?operation=GET", "abcd", IgniteConstants.IGNITE_CACHE_OPERATION, IgniteCacheOperation.REMOVE, String.class); // The body has not changed, but the cache entry is gone. assert_().that(result).isEqualTo("abcd"); @@ -192,7 +203,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { @Test public void testAddEntryNoCacheCreation() { try { - template.requestBodyAndHeader("ignite:cache:testcache2?operation=PUT&failIfInexistentCache=true", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); + template.requestBodyAndHeader("ignite-cache:testcache2?operation=PUT&failIfInexistentCache=true", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); } catch (Exception e) { assert_().that(ObjectHelper.getException(CamelException.class, e).getMessage()).startsWith("Ignite cache testcache2 doesn't exist"); return; @@ -203,7 +214,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { @Test public void testAddEntryDoNotPropagateIncomingBody() { - Object result = template.requestBodyAndHeader("ignite:cache:testcache1?operation=PUT&propagateIncomingBodyIfNoReturnValue=false", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd", + Object result = template.requestBodyAndHeader("ignite-cache:testcache1?operation=PUT&propagateIncomingBodyIfNoReturnValue=false", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd", Object.class); assert_().that(ignite().cache("testcache1").size(CachePeekMode.ALL)).isEqualTo(1);
