http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultComponent.java new file mode 100644 index 0000000..f47a9fd --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultComponent.java @@ -0,0 +1,227 @@ +/** + * 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.hazelcast; + +import java.io.InputStream; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +import com.hazelcast.client.HazelcastClient; +import com.hazelcast.client.config.ClientConfig; +import com.hazelcast.client.config.XmlClientConfigBuilder; +import com.hazelcast.config.Config; +import com.hazelcast.config.XmlConfigBuilder; +import com.hazelcast.core.Hazelcast; +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.Endpoint; +import org.apache.camel.impl.DefaultComponent; +import org.apache.camel.spi.Metadata; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.ResourceHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.apache.camel.component.hazelcast.HazelcastConstants.HAZELCAST_CONFIGU_PARAM; +import static org.apache.camel.component.hazelcast.HazelcastConstants.HAZELCAST_CONFIGU_URI_PARAM; +import static org.apache.camel.component.hazelcast.HazelcastConstants.HAZELCAST_INSTANCE_NAME_PARAM; +import static org.apache.camel.component.hazelcast.HazelcastConstants.HAZELCAST_INSTANCE_PARAM; + +public abstract class HazelcastDefaultComponent extends DefaultComponent { + private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastDefaultComponent.class); + + private final Set<HazelcastInstance> customHazelcastInstances; + @Metadata(label = "advanced") + private HazelcastInstance hazelcastInstance; + @Metadata(label = "advanced", defaultValue = "" + HazelcastConstants.HAZELCAST_NODE_MODE) + private String hazelcastMode = HazelcastConstants.HAZELCAST_NODE_MODE; + + public HazelcastDefaultComponent() { + super(); + this.customHazelcastInstances = new LinkedHashSet<>(); + } + + public HazelcastDefaultComponent(final CamelContext context) { + super(context); + this.customHazelcastInstances = new LinkedHashSet<>(); + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + + // use the given hazelcast Instance or create one if not given + HazelcastInstance hzInstance; + if (ObjectHelper.equal(getHazelcastMode(), HazelcastConstants.HAZELCAST_NODE_MODE)) { + hzInstance = getOrCreateHzInstance(getCamelContext(), parameters); + } else { + hzInstance = getOrCreateHzClientInstance(getCamelContext(), parameters); + } + + String defaultOperation = getAndRemoveOrResolveReferenceParameter(parameters, HazelcastConstants.OPERATION_PARAM, String.class); + if (defaultOperation == null) { + defaultOperation = getAndRemoveOrResolveReferenceParameter(parameters, "defaultOperation", String.class); + } + + HazelcastDefaultEndpoint endpoint = doCreateEndpoint(uri, remaining, parameters, hzInstance); + endpoint.setDefaultOperation(defaultOperation); + return endpoint; + } + + protected abstract HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception; + + @Override + public void doStart() throws Exception { + super.doStart(); + } + + @Override + public void doStop() throws Exception { + for (HazelcastInstance hazelcastInstance : customHazelcastInstances) { + hazelcastInstance.getLifecycleService().shutdown(); + } + + customHazelcastInstances.clear(); + + super.doStop(); + } + + public HazelcastInstance getHazelcastInstance() { + return hazelcastInstance; + } + + /** + * The hazelcast instance reference which can be used for hazelcast endpoint. + * If you don't specify the instance reference, camel use the default hazelcast instance from the camel-hazelcast instance. + */ + public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { + this.hazelcastInstance = hazelcastInstance; + } + + public String getHazelcastMode() { + return hazelcastMode; + } + + /** + * The hazelcast mode reference which kind of instance should be used. + * If you don't specify the mode, then the node mode will be the default. + */ + public void setHazelcastMode(String hazelcastMode) { + this.hazelcastMode = hazelcastMode; + } + + protected HazelcastInstance getOrCreateHzInstance(CamelContext context, Map<String, Object> parameters) throws Exception { + HazelcastInstance hzInstance = null; + Config config = null; + + // Query param named 'hazelcastInstance' (if exists) overrides the instance that was set + hzInstance = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_INSTANCE_PARAM, HazelcastInstance.class); + + // Check if an already created instance is given then just get instance by its name. + if (hzInstance == null && parameters.get(HAZELCAST_INSTANCE_NAME_PARAM) != null) { + hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM)); + } + + // If instance neither supplied nor found by name, try to lookup its config + // as reference or as xml configuration file. + if (hzInstance == null) { + config = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_CONFIGU_PARAM, Config.class); + if (config == null) { + String configUri = getAndRemoveParameter(parameters, HAZELCAST_CONFIGU_URI_PARAM, String.class); + if (configUri != null) { + configUri = getCamelContext().resolvePropertyPlaceholders(configUri); + } + if (configUri != null) { + InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context, configUri); + config = new XmlConfigBuilder(is).build(); + } + } + + if (hazelcastInstance == null && config == null) { + config = new XmlConfigBuilder().build(); + // Disable the version check + config.getProperties().setProperty("hazelcast.version.check.enabled", "false"); + config.getProperties().setProperty("hazelcast.phone.home.enabled", "false"); + + hzInstance = Hazelcast.newHazelcastInstance(config); + } else if (config != null) { + if (ObjectHelper.isNotEmpty(config.getInstanceName())) { + hzInstance = Hazelcast.getOrCreateHazelcastInstance(config); + } else { + hzInstance = Hazelcast.newHazelcastInstance(config); + } + } + + if (hzInstance != null) { + if (this.customHazelcastInstances.add(hzInstance)) { + LOGGER.debug("Add managed HZ instance {}", hzInstance.getName()); + } + } + } + + return hzInstance == null ? hazelcastInstance : hzInstance; + } + + protected HazelcastInstance getOrCreateHzClientInstance(CamelContext context, Map<String, Object> parameters) throws Exception { + HazelcastInstance hzInstance = null; + ClientConfig config = null; + + // Query param named 'hazelcastInstance' (if exists) overrides the instance that was set + hzInstance = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_INSTANCE_PARAM, HazelcastInstance.class); + + // Check if an already created instance is given then just get instance by its name. + if (hzInstance == null && parameters.get(HAZELCAST_INSTANCE_NAME_PARAM) != null) { + hzInstance = Hazelcast.getHazelcastInstanceByName((String) parameters.get(HAZELCAST_INSTANCE_NAME_PARAM)); + } + + // If instance neither supplied nor found by name, try to lookup its config + // as reference or as xml configuration file. + if (hzInstance == null) { + config = resolveAndRemoveReferenceParameter(parameters, HAZELCAST_CONFIGU_PARAM, ClientConfig.class); + if (config == null) { + String configUri = getAndRemoveParameter(parameters, HAZELCAST_CONFIGU_URI_PARAM, String.class); + if (configUri != null) { + configUri = getCamelContext().resolvePropertyPlaceholders(configUri); + } + if (configUri != null) { + InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context, configUri); + config = new XmlClientConfigBuilder(is).build(); + } + } + + if (hazelcastInstance == null && config == null) { + config = new XmlClientConfigBuilder().build(); + // Disable the version check + config.getProperties().setProperty("hazelcast.version.check.enabled", "false"); + config.getProperties().setProperty("hazelcast.phone.home.enabled", "false"); + + hzInstance = HazelcastClient.newHazelcastClient(config); + } else if (config != null) { + hzInstance = HazelcastClient.newHazelcastClient(config); + } + + if (hzInstance != null) { + if (this.customHazelcastInstances.add(hzInstance)) { + LOGGER.debug("Add managed HZ instance {}", hzInstance.getName()); + } + } + } + + return hzInstance == null ? hazelcastInstance : hzInstance; + } +}
http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultEndpoint.java index cb6f08d..db23cba 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/HazelcastDefaultEndpoint.java @@ -32,10 +32,8 @@ import org.apache.camel.spi.UriPath; /** * The hazelcast component allows you to work with the Hazelcast distributed data grid / cache. */ -@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast", title = "Hazelcast", syntax = "hazelcast:command:cacheName", consumerClass = HazelcastDefaultConsumer.class, label = "cache,datagrid") public abstract class HazelcastDefaultEndpoint extends DefaultEndpoint { - @UriPath @Metadata(required = "true") protected HazelcastCommand command; @UriPath @Metadata(required = "true") protected String cacheName; http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberComponent.java new file mode 100644 index 0000000..a786fb9 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberComponent.java @@ -0,0 +1,42 @@ +/** + * 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.hazelcast.atomicnumber; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastAtomicnumberComponent extends HazelcastDefaultComponent { + + public HazelcastAtomicnumberComponent() { + super(); + } + + public HazelcastAtomicnumberComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + return new HazelcastAtomicnumberEndpoint(hzInstance, uri, this, remaining); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberEndpoint.java index b30e642..904d074 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/HazelcastAtomicnumberEndpoint.java @@ -21,12 +21,20 @@ import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.component.hazelcast.HazelcastCommand; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +/** + * The hazelcast-atomicvalue component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> atomic number, which + * is an object that simply provides a grid wide number (long). + */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-atomicvalue", title = "Hazelcast Atomic Number", syntax = "hazelcast-atomicvalue:cacheName", producerOnly = true, label = "cache,datagrid") public class HazelcastAtomicnumberEndpoint extends HazelcastDefaultEndpoint { public HazelcastAtomicnumberEndpoint(HazelcastInstance hazelcastInstance, String uri, Component component, final String cacheName) { super(hazelcastInstance, uri, component, cacheName); + setCommand(HazelcastCommand.atomicvalue); } public Consumer createConsumer(Processor processor) throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceComponent.java new file mode 100644 index 0000000..2368fb3 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceComponent.java @@ -0,0 +1,42 @@ +/** + * 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.hazelcast.instance; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastInstanceComponent extends HazelcastDefaultComponent { + + public HazelcastInstanceComponent() { + super(); + } + + public HazelcastInstanceComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + return new HazelcastInstanceEndpoint(hzInstance, uri, this); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceEndpoint.java index c4c78c5..51907f1 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/instance/HazelcastInstanceEndpoint.java @@ -20,13 +20,21 @@ import com.hazelcast.core.HazelcastInstance; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.component.hazelcast.HazelcastComponent; +import org.apache.camel.component.hazelcast.HazelcastCommand; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +/** + * The hazelcast-instance component is used to consume join/leave events of the cache instance in the cluster. + */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-instance", title = "Hazelcast Instance", syntax = "hazelcast-instance:cacheName", + consumerOnly = true, consumerClass = HazelcastInstanceConsumer.class, label = "cache,datagrid") public class HazelcastInstanceEndpoint extends HazelcastDefaultEndpoint { - public HazelcastInstanceEndpoint(HazelcastInstance hazelcastInstance, String uri, HazelcastComponent component) { + public HazelcastInstanceEndpoint(HazelcastInstance hazelcastInstance, String uri, HazelcastDefaultComponent component) { super(hazelcastInstance, uri, component); + setCommand(HazelcastCommand.instance); } public Consumer createConsumer(Processor processor) throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListComponent.java new file mode 100644 index 0000000..e69f135 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListComponent.java @@ -0,0 +1,42 @@ +/** + * 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.hazelcast.list; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastListComponent extends HazelcastDefaultComponent { + + public HazelcastListComponent() { + super(); + } + + public HazelcastListComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + return new HazelcastListEndpoint(hzInstance, uri, this, remaining); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListEndpoint.java index c66a379..df2cb80 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListEndpoint.java @@ -22,15 +22,19 @@ import org.apache.camel.Consumer; import org.apache.camel.Endpoint; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.component.hazelcast.HazelcastCommand; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; /** - * Hazelcast List {@link Endpoint} implementation. + * The hazelcast-list component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> distributed list. */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-list", title = "Hazelcast List", syntax = "hazelcast-list:cacheName", label = "cache,datagrid") public class HazelcastListEndpoint extends HazelcastDefaultEndpoint { public HazelcastListEndpoint(HazelcastInstance hazelcastInstance, String endpointUri, Component component, String cacheName) { super(hazelcastInstance, endpointUri, component, cacheName); + setCommand(HazelcastCommand.list); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapComponent.java new file mode 100644 index 0000000..f178805 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapComponent.java @@ -0,0 +1,42 @@ +/** + * 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.hazelcast.map; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastMapComponent extends HazelcastDefaultComponent { + + public HazelcastMapComponent() { + super(); + } + + public HazelcastMapComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + return new HazelcastMapEndpoint(hzInstance, uri, remaining, this); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapEndpoint.java index e15bd6d..2c7ac6d 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapEndpoint.java @@ -20,13 +20,20 @@ import com.hazelcast.core.HazelcastInstance; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.component.hazelcast.HazelcastComponent; +import org.apache.camel.component.hazelcast.HazelcastCommand; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +/** + * The hazelcast-map component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> distributed map. + */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-map", title = "Hazelcast Map", syntax = "hazelcast-map:cacheName", label = "cache,datagrid") public class HazelcastMapEndpoint extends HazelcastDefaultEndpoint { - public HazelcastMapEndpoint(HazelcastInstance hazelcastInstance, String uri, String cacheName, HazelcastComponent component) { + public HazelcastMapEndpoint(HazelcastInstance hazelcastInstance, String uri, String cacheName, HazelcastDefaultComponent component) { super(hazelcastInstance, uri, component, cacheName); + setCommand(HazelcastCommand.map); } public Consumer createConsumer(Processor processor) throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapComponent.java new file mode 100644 index 0000000..6eb11b2 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapComponent.java @@ -0,0 +1,42 @@ +/** + * 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.hazelcast.multimap; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastMultimapComponent extends HazelcastDefaultComponent { + + public HazelcastMultimapComponent() { + super(); + } + + public HazelcastMultimapComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + return new HazelcastMultimapEndpoint(hzInstance, uri, remaining, this); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapEndpoint.java index a7b4ce7..a73d0cd 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapEndpoint.java @@ -20,13 +20,20 @@ import com.hazelcast.core.HazelcastInstance; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.component.hazelcast.HazelcastComponent; +import org.apache.camel.component.hazelcast.HazelcastCommand; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +/** + * The hazelcast-multimap component is used to to access <a href="http://www.hazelcast.com/">Hazelcast</a> distributed multimap. + */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-multimap", title = "Hazelcast Multimap", syntax = "hazelcast-multimap:cacheName", label = "cache,datagrid") public class HazelcastMultimapEndpoint extends HazelcastDefaultEndpoint { - public HazelcastMultimapEndpoint(HazelcastInstance hazelcastInstance, String uri, String cacheName, HazelcastComponent component) { + public HazelcastMultimapEndpoint(HazelcastInstance hazelcastInstance, String uri, String cacheName, HazelcastDefaultComponent component) { super(hazelcastInstance, uri, component, cacheName); + setCommand(HazelcastCommand.multimap); } public Consumer createConsumer(Processor processor) throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueComponent.java new file mode 100644 index 0000000..ba8bc75 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueComponent.java @@ -0,0 +1,42 @@ +/** + * 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.hazelcast.queue; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastQueueComponent extends HazelcastDefaultComponent { + + public HazelcastQueueComponent() { + super(); + } + + public HazelcastQueueComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + return new HazelcastQueueEndpoint(hzInstance, uri, this, remaining); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueEndpoint.java index 678270e..7b5d5dd 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueEndpoint.java @@ -21,15 +21,19 @@ import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.component.hazelcast.HazelcastCommand; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; /** - * + * The hazelcast-queue component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> distributed queue. */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-queue", title = "Hazelcast Queue", syntax = "hazelcast-queue:cacheName", label = "cache,datagrid") public class HazelcastQueueEndpoint extends HazelcastDefaultEndpoint { public HazelcastQueueEndpoint(HazelcastInstance hazelcastInstance, String endpointUri, Component component, String cacheName) { super(hazelcastInstance, endpointUri, component, cacheName); + setCommand(HazelcastCommand.queue); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapComponent.java new file mode 100644 index 0000000..7d720e9 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapComponent.java @@ -0,0 +1,42 @@ +/** + * 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.hazelcast.replicatedmap; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastReplicatedmapComponent extends HazelcastDefaultComponent { + + public HazelcastReplicatedmapComponent() { + super(); + } + + public HazelcastReplicatedmapComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + return new HazelcastReplicatedmapEndpoint(hzInstance, uri, remaining, this); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapEndpoint.java index 79f36d6..bfe646b 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/HazelcastReplicatedmapEndpoint.java @@ -20,13 +20,20 @@ import com.hazelcast.core.HazelcastInstance; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.component.hazelcast.HazelcastComponent; +import org.apache.camel.component.hazelcast.HazelcastCommand; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +/** + * The hazelcast-replicatedmap component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> replicated map. + */ +@UriEndpoint(firstVersion = "2.16.0", scheme = "hazelcast-replicatedmap", title = "Hazelcast Replicated Map", syntax = "hazelcast-replicatedmap:cacheName", label = "cache,datagrid") public class HazelcastReplicatedmapEndpoint extends HazelcastDefaultEndpoint { - public HazelcastReplicatedmapEndpoint(HazelcastInstance hazelcastInstance, String uri, String cacheName, HazelcastComponent component) { + public HazelcastReplicatedmapEndpoint(HazelcastInstance hazelcastInstance, String uri, String cacheName, HazelcastDefaultComponent component) { super(hazelcastInstance, uri, component, cacheName); + setCommand(HazelcastCommand.replicatedmap); } public Consumer createConsumer(Processor processor) throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferComponent.java new file mode 100644 index 0000000..27c0957 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferComponent.java @@ -0,0 +1,43 @@ +/** + * 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.hazelcast.ringbuffer; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastRingbufferComponent extends HazelcastDefaultComponent { + + public HazelcastRingbufferComponent() { + super(); + } + + public HazelcastRingbufferComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + HazelcastRingbufferEndpoint answer = new HazelcastRingbufferEndpoint(hzInstance, uri, this, remaining); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferEndpoint.java index 6b0df4a..21dc075 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/HazelcastRingbufferEndpoint.java @@ -21,12 +21,19 @@ import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.component.hazelcast.HazelcastCommand; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +/** + * The hazelcast-ringbuffer component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> distributed ringbuffer. + */ +@UriEndpoint(firstVersion = "2.16.0", scheme = "hazelcast-ringbuffer", title = "Hazelcast Ringbuffer", syntax = "hazelcast-ringbuffer:cacheName", producerOnly = true, label = "cache,datagrid") public class HazelcastRingbufferEndpoint extends HazelcastDefaultEndpoint { public HazelcastRingbufferEndpoint(HazelcastInstance hazelcastInstance, String uri, Component component, final String cacheName) { super(hazelcastInstance, uri, component, cacheName); + setCommand(HazelcastCommand.ringbuffer); } public Consumer createConsumer(Processor processor) throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaComponent.java new file mode 100644 index 0000000..f2172a4 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaComponent.java @@ -0,0 +1,46 @@ +/** + * 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.hazelcast.seda; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastSedaComponent extends HazelcastDefaultComponent { + + public HazelcastSedaComponent() { + super(); + } + + public HazelcastSedaComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + final HazelcastSedaConfiguration config = new HazelcastSedaConfiguration(); + setProperties(config, parameters); + config.setQueueName(remaining); + HazelcastSedaEndpoint answer = new HazelcastSedaEndpoint(hzInstance, uri, this, config); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java index a4b89fa..b638498 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java @@ -23,25 +23,29 @@ import org.apache.camel.Consumer; import org.apache.camel.Endpoint; import org.apache.camel.Processor; import org.apache.camel.Producer; -import org.apache.camel.component.hazelcast.HazelcastComponent; +import org.apache.camel.component.hazelcast.HazelcastCommand; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; import org.apache.camel.util.ObjectHelper; /** - * Hazelcast SEDA {@link Endpoint} implementation. + * The hazelcast-seda component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> {@link BlockingQueue}. */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-seda", title = "Hazelcast SEDA", syntax = "hazelcast-seda:cacheName", label = "cache,datagrid") public class HazelcastSedaEndpoint extends HazelcastDefaultEndpoint { private final BlockingQueue<Object> queue; private final HazelcastSedaConfiguration configuration; - public HazelcastSedaEndpoint(final HazelcastInstance hazelcastInstance, final String uri, final HazelcastComponent component, final HazelcastSedaConfiguration configuration) { + public HazelcastSedaEndpoint(final HazelcastInstance hazelcastInstance, final String uri, final HazelcastDefaultComponent component, final HazelcastSedaConfiguration configuration) { super(hazelcastInstance, uri, component); this.queue = hazelcastInstance.getQueue(configuration.getQueueName()); this.configuration = configuration; if (ObjectHelper.isEmpty(configuration.getQueueName())) { throw new IllegalArgumentException("Queue name is missing."); } + setCommand(HazelcastCommand.seda); } public Producer createProducer() throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetComponent.java new file mode 100644 index 0000000..04a6dda --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetComponent.java @@ -0,0 +1,43 @@ +/** + * 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.hazelcast.set; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastSetComponent extends HazelcastDefaultComponent { + + public HazelcastSetComponent() { + super(); + } + + public HazelcastSetComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + HazelcastSetEndpoint answer = new HazelcastSetEndpoint(hzInstance, uri, this, remaining); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetEndpoint.java index fe4c27d..077bb3e 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/set/HazelcastSetEndpoint.java @@ -22,15 +22,19 @@ import org.apache.camel.Consumer; import org.apache.camel.Endpoint; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.component.hazelcast.HazelcastCommand; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; /** - * Hazelcast Set {@link Endpoint} implementation. + * The camel {@link Endpoint} to access <a href="http://www.hazelcast.com/">Hazelcast</a> distributed set. */ +@UriEndpoint(firstVersion = "2.7.0", scheme = "hazelcast-set", title = "Hazelcast Set", syntax = "hazelcast-set:cacheName", label = "cache,datagrid") public class HazelcastSetEndpoint extends HazelcastDefaultEndpoint { public HazelcastSetEndpoint(HazelcastInstance hazelcastInstance, String endpointUri, Component component, String cacheName) { super(hazelcastInstance, endpointUri, component, cacheName); + setCommand(HazelcastCommand.set); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicComponent.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicComponent.java new file mode 100644 index 0000000..d2876c8 --- /dev/null +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicComponent.java @@ -0,0 +1,45 @@ +/** + * 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.hazelcast.topic; + +import java.util.Map; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.HazelcastDefaultComponent; +import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; + +public class HazelcastTopicComponent extends HazelcastDefaultComponent { + + public HazelcastTopicComponent() { + super(); + } + + public HazelcastTopicComponent(final CamelContext context) { + super(context); + } + + @Override + protected HazelcastDefaultEndpoint doCreateEndpoint(String uri, String remaining, Map<String, Object> parameters, HazelcastInstance hzInstance) throws Exception { + final HazelcastTopicConfiguration config = new HazelcastTopicConfiguration(); + setProperties(config, parameters); + HazelcastTopicEndpoint answer = new HazelcastTopicEndpoint(hzInstance, uri, this, remaining, config); + return answer; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicEndpoint.java index f9aefb7..59c6e95 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicEndpoint.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/topic/HazelcastTopicEndpoint.java @@ -22,8 +22,14 @@ import org.apache.camel.Consumer; import org.apache.camel.MultipleConsumersSupport; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.component.hazelcast.HazelcastCommand; import org.apache.camel.component.hazelcast.HazelcastDefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +/** + * The hazelcast-topic component is used to access <a href="http://www.hazelcast.com/">Hazelcast</a> distributed topic. + */ +@UriEndpoint(firstVersion = "2.15.0", scheme = "hazelcast-topic", title = "Hazelcast Topic", syntax = "hazelcast-topic:cacheName", label = "cache,datagrid") public class HazelcastTopicEndpoint extends HazelcastDefaultEndpoint implements MultipleConsumersSupport { private final HazelcastTopicConfiguration configuration; @@ -31,6 +37,7 @@ public class HazelcastTopicEndpoint extends HazelcastDefaultEndpoint implements public HazelcastTopicEndpoint(HazelcastInstance hazelcastInstance, String endpointUri, Component component, String cacheName, final HazelcastTopicConfiguration configuration) { super(hazelcastInstance, endpointUri, component, cacheName); this.configuration = configuration; + setCommand(HazelcastCommand.topic); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-atomicvalue ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-atomicvalue b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-atomicvalue new file mode 100644 index 0000000..583616a --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-atomicvalue @@ -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.hazelcast.atomicnumber.HazelcastAtomicnumberComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-instance ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-instance b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-instance new file mode 100644 index 0000000..4d47929 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-instance @@ -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.hazelcast.instance.HazelcastInstanceComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-list ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-list b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-list new file mode 100644 index 0000000..97c33f9 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-list @@ -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.hazelcast.list.HazelcastListComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-map ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-map b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-map new file mode 100644 index 0000000..24adef8 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-map @@ -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.hazelcast.map.HazelcastMapComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-multimap ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-multimap b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-multimap new file mode 100644 index 0000000..62f82a0 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-multimap @@ -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.hazelcast.multimap.HazelcastMultimapComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-queue ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-queue b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-queue new file mode 100644 index 0000000..cc350f2 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-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.hazelcast.queue.HazelcastQueueComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-replicatedmap ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-replicatedmap b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-replicatedmap new file mode 100644 index 0000000..5c1fbc6 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-replicatedmap @@ -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.hazelcast.replicatedmap.HazelcastReplicatedmapComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-ringbuffer ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-ringbuffer b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-ringbuffer new file mode 100644 index 0000000..f2e3e65 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-ringbuffer @@ -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.hazelcast.ringbuffer.HazelcastRingbufferComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-seda ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-seda b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-seda new file mode 100644 index 0000000..4d96a59 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-seda @@ -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.hazelcast.seda.HazelcastSedaComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-set ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-set b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-set new file mode 100644 index 0000000..313d664 --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-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.hazelcast.set.HazelcastSetComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-topic ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-topic b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-topic new file mode 100644 index 0000000..407d64f --- /dev/null +++ b/components/camel-hazelcast/src/main/resources/META-INF/services/org/apache/camel/component/hazelcast-topic @@ -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.hazelcast.topic.HazelcastTopicComponent http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java index 5f2c54e..7fd1316 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java @@ -134,30 +134,30 @@ public class HazelcastAtomicnumberProducerTest extends HazelcastCamelTestSupport public void configure() throws Exception { from("direct:setInvalid").setHeader(HazelcastConstants.OPERATION, constant("invalid")) - .to(String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + .to(String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); from("direct:set").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.SETVALUE_OPERATION)) - .to(String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + .to(String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); - from("direct:get").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION)).to(String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + from("direct:get").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_OPERATION)).to(String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); from("direct:increment").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.INCREMENT_OPERATION)).to( - String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); from("direct:decrement").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DECREMENT_OPERATION)).to( - String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); from("direct:destroy").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.DESTROY_OPERATION)).to( - String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); from("direct:compareAndSet").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.COMPARE_AND_SET_OPERATION)).to( - String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); from("direct:getAndAdd").setHeader(HazelcastConstants.OPERATION, constant(HazelcastConstants.GET_AND_ADD_OPERATION)).to( - String.format("hazelcast:%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); + String.format("hazelcast-%sfoo", HazelcastConstants.ATOMICNUMBER_PREFIX)); - from("direct:setWithOperationNumber").toF("hazelcast:%sfoo?operation=%s", HazelcastConstants.ATOMICNUMBER_PREFIX, HazelcastConstants.SETVALUE_OPERATION); - from("direct:setWithOperationName").toF("hazelcast:%sfoo?operation=setvalue", HazelcastConstants.ATOMICNUMBER_PREFIX); + from("direct:setWithOperationNumber").toF("hazelcast-%sfoo?operation=%s", HazelcastConstants.ATOMICNUMBER_PREFIX, HazelcastConstants.SETVALUE_OPERATION); + from("direct:setWithOperationName").toF("hazelcast-%sfoo?operation=setvalue", HazelcastConstants.ATOMICNUMBER_PREFIX); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelSpringTestSupport.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelSpringTestSupport.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelSpringTestSupport.java index 2a9fa73..39d6307 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelSpringTestSupport.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelSpringTestSupport.java @@ -34,9 +34,7 @@ public abstract class HazelcastCamelSpringTestSupport extends CamelSpringTestSup protected CamelContext createCamelContext() throws Exception { MockitoAnnotations.initMocks(this); CamelContext context = super.createCamelContext(); - HazelcastComponent hazelcastComponent = new HazelcastComponent(context); - hazelcastComponent.setHazelcastInstance(hazelcastInstance); - context.addComponent("hazelcast", hazelcastComponent); + HazelcastCamelTestHelper.registerHazelcastComponents(context, hazelcastInstance); trainHazelcastInstance(hazelcastInstance); return context; } http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelTestHelper.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelTestHelper.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelTestHelper.java new file mode 100644 index 0000000..425eb5a --- /dev/null +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastCamelTestHelper.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.hazelcast; + +import com.hazelcast.core.HazelcastInstance; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.atomicnumber.HazelcastAtomicnumberComponent; +import org.apache.camel.component.hazelcast.instance.HazelcastInstanceComponent; +import org.apache.camel.component.hazelcast.list.HazelcastListComponent; +import org.apache.camel.component.hazelcast.map.HazelcastMapComponent; +import org.apache.camel.component.hazelcast.multimap.HazelcastMultimapComponent; +import org.apache.camel.component.hazelcast.queue.HazelcastQueueComponent; +import org.apache.camel.component.hazelcast.replicatedmap.HazelcastReplicatedmapComponent; +import org.apache.camel.component.hazelcast.ringbuffer.HazelcastRingbufferComponent; +import org.apache.camel.component.hazelcast.seda.HazelcastSedaComponent; +import org.apache.camel.component.hazelcast.set.HazelcastSetComponent; +import org.apache.camel.component.hazelcast.topic.HazelcastTopicComponent; + +public final class HazelcastCamelTestHelper { + + private HazelcastCamelTestHelper() { + } + + public static void registerHazelcastComponents(CamelContext context, HazelcastInstance hazelcastInstance) { + HazelcastAtomicnumberComponent atomic = new HazelcastAtomicnumberComponent(context); + atomic.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-atomicvalue", atomic); + HazelcastInstanceComponent instance = new HazelcastInstanceComponent(context); + instance.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-instance", instance); + HazelcastListComponent list = new HazelcastListComponent(context); + list.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-list", list); + HazelcastMapComponent map = new HazelcastMapComponent(context); + map.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-map", map); + HazelcastMultimapComponent multimap = new HazelcastMultimapComponent(context); + multimap.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-multimap", multimap); + HazelcastQueueComponent queue = new HazelcastQueueComponent(context); + queue.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-queue", queue); + HazelcastReplicatedmapComponent replicatedmap = new HazelcastReplicatedmapComponent(context); + replicatedmap.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-replicatedmap", replicatedmap); + HazelcastRingbufferComponent ringbuffer = new HazelcastRingbufferComponent(context); + ringbuffer.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-ringbuffer", ringbuffer); + HazelcastSedaComponent seda = new HazelcastSedaComponent(context); + seda.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-seda", seda); + HazelcastSetComponent set = new HazelcastSetComponent(context); + set.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-set", set); + HazelcastTopicComponent topic = new HazelcastTopicComponent(context); + topic.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast-topic", topic); + HazelcastComponent old = new HazelcastComponent(context); + old.setHazelcastInstance(hazelcastInstance); + context.addComponent("hazelcast", old); + } + +}