Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion components/camel-jcache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<artifactId>hazelcast-all</artifactId>
<version>${hazelcast-version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -111,4 +111,25 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>hazelcast.named.jcache.instance</name>
<value>false</value>
</property>
<property>
<name>hazelcast.jcache.provider.type</name>
<value>server</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.jcache;

import java.util.Map;

import org.apache.camel.CamelContext;
import org.apache.camel.spi.GeneratedPropertyConfigurer;
import org.apache.camel.spi.PropertyConfigurerGetter;
import org.apache.camel.util.CaseInsensitiveMap;
import org.apache.camel.support.component.PropertyConfigurerSupport;

/**
* Generated by camel build tools - do NOT edit this file!
*/
@SuppressWarnings("unchecked")
public class JCacheComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer {
public class JCacheComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {

@Override
public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
Expand All @@ -35,5 +39,42 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj
}
}

@Override
public Map<String, Object> getAllOptions(Object target) {
Map<String, Object> answer = new CaseInsensitiveMap();
answer.put("basicPropertyBinding", boolean.class);
answer.put("bridgeErrorHandler", boolean.class);
answer.put("cacheConfiguration", javax.cache.configuration.Configuration.class);
answer.put("cacheConfigurationProperties", java.util.Map.class);
answer.put("cacheConfigurationPropertiesRef", java.lang.String.class);
answer.put("cachingProvider", java.lang.String.class);
answer.put("configurationUri", java.lang.String.class);
answer.put("lazyStartProducer", boolean.class);
return answer;
}

@Override
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
JCacheComponent target = (JCacheComponent) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "basicpropertybinding":
case "basicPropertyBinding": return target.isBasicPropertyBinding();
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
case "cacheconfiguration":
case "cacheConfiguration": return target.getCacheConfiguration();
case "cacheconfigurationproperties":
case "cacheConfigurationProperties": return target.getCacheConfigurationProperties();
case "cacheconfigurationpropertiesref":
case "cacheConfigurationPropertiesRef": return target.getCacheConfigurationPropertiesRef();
case "cachingprovider":
case "cachingProvider": return target.getCachingProvider();
case "configurationuri":
case "configurationUri": return target.getConfigurationUri();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
default: return null;
}
}
}

Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.jcache;

import java.util.Map;

import org.apache.camel.CamelContext;
import org.apache.camel.spi.GeneratedPropertyConfigurer;
import org.apache.camel.spi.PropertyConfigurerGetter;
import org.apache.camel.util.CaseInsensitiveMap;
import org.apache.camel.support.component.PropertyConfigurerSupport;

/**
* Generated by camel build tools - do NOT edit this file!
*/
@SuppressWarnings("unchecked")
public class JCacheEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer {
public class JCacheEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {

@Override
public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
Expand Down Expand Up @@ -65,5 +69,88 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj
}
}

@Override
public Map<String, Object> getAllOptions(Object target) {
Map<String, Object> answer = new CaseInsensitiveMap();
answer.put("action", java.lang.String.class);
answer.put("basicPropertyBinding", boolean.class);
answer.put("bridgeErrorHandler", boolean.class);
answer.put("cacheConfiguration", javax.cache.configuration.Configuration.class);
answer.put("cacheConfigurationProperties", java.util.Properties.class);
answer.put("cacheLoaderFactory", javax.cache.configuration.Factory.class);
answer.put("cacheWriterFactory", javax.cache.configuration.Factory.class);
answer.put("cachingProvider", java.lang.String.class);
answer.put("configurationUri", java.lang.String.class);
answer.put("createCacheIfNotExists", boolean.class);
answer.put("eventFilters", java.util.List.class);
answer.put("exceptionHandler", org.apache.camel.spi.ExceptionHandler.class);
answer.put("exchangePattern", org.apache.camel.ExchangePattern.class);
answer.put("expiryPolicyFactory", javax.cache.configuration.Factory.class);
answer.put("filteredEvents", java.lang.String.class);
answer.put("lazyStartProducer", boolean.class);
answer.put("lookupProviders", boolean.class);
answer.put("managementEnabled", boolean.class);
answer.put("oldValueRequired", boolean.class);
answer.put("readThrough", boolean.class);
answer.put("statisticsEnabled", boolean.class);
answer.put("storeByValue", boolean.class);
answer.put("synchronous", boolean.class);
answer.put("writeThrough", boolean.class);
return answer;
}

@Override
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
JCacheEndpoint target = (JCacheEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "action": return target.getConfiguration().getAction();
case "basicpropertybinding":
case "basicPropertyBinding": return target.isBasicPropertyBinding();
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
case "cacheconfiguration":
case "cacheConfiguration": return target.getConfiguration().getCacheConfiguration();
case "cacheconfigurationproperties":
case "cacheConfigurationProperties": return target.getConfiguration().getCacheConfigurationProperties();
case "cacheloaderfactory":
case "cacheLoaderFactory": return target.getConfiguration().getCacheLoaderFactory();
case "cachewriterfactory":
case "cacheWriterFactory": return target.getConfiguration().getCacheWriterFactory();
case "cachingprovider":
case "cachingProvider": return target.getConfiguration().getCachingProvider();
case "configurationuri":
case "configurationUri": return target.getConfiguration().getConfigurationUri();
case "createcacheifnotexists":
case "createCacheIfNotExists": return target.getConfiguration().isCreateCacheIfNotExists();
case "eventfilters":
case "eventFilters": return target.getConfiguration().getEventFilters();
case "exceptionhandler":
case "exceptionHandler": return target.getExceptionHandler();
case "exchangepattern":
case "exchangePattern": return target.getExchangePattern();
case "expirypolicyfactory":
case "expiryPolicyFactory": return target.getConfiguration().getExpiryPolicyFactory();
case "filteredevents":
case "filteredEvents": return target.getConfiguration().getFilteredEvents();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
case "lookupproviders":
case "lookupProviders": return target.getConfiguration().isLookupProviders();
case "managementenabled":
case "managementEnabled": return target.getConfiguration().isManagementEnabled();
case "oldvaluerequired":
case "oldValueRequired": return target.getConfiguration().isOldValueRequired();
case "readthrough":
case "readThrough": return target.getConfiguration().isReadThrough();
case "statisticsenabled":
case "statisticsEnabled": return target.getConfiguration().isStatisticsEnabled();
case "storebyvalue":
case "storeByValue": return target.getConfiguration().isStoreByValue();
case "synchronous": return target.getConfiguration().isSynchronous();
case "writethrough":
case "writeThrough": return target.getConfiguration().isWriteThrough();
default: return null;
}
}
}

3 changes: 1 addition & 2 deletions components/camel-jcache/src/main/docs/jcache-component.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,9 @@ It's not strictly speaking related to Camel XML DSL, but JCache providers usuall

[source,xml]
----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.11.xsd" >
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd">

<cache name="spring">
<key-type class-name="java.lang.String"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import javax.cache.CacheManager;
import javax.cache.Caching;

import com.hazelcast.instance.impl.HazelcastInstanceFactory;
import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;
import org.junit.After;
Expand All @@ -42,8 +41,7 @@ public void testCacheManagerFromContext() throws Exception {
// Send exchange
Object responseBody = this.template().requestBody("direct:policy-context-manager", key);

// Verify the cacheManager "hzsecond" registered in the CamelContext was
// used
// Verify the cacheManager "hzsecond" registered in the CamelContext was used
assertNull(lookupCache("contextCacheManager"));
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(URI.create("hzsecond"), null);
Cache cache = cacheManager.getCache("contextCacheManager");
Expand Down Expand Up @@ -74,10 +72,6 @@ public void after() {
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(URI.create("hzsecond"), null);
cacheManager.getCacheNames().forEach(s -> cacheManager.destroyCache(s));
Caching.getCachingProvider().close(URI.create("hzsecond"), null);

// We need to shutdown the second instance using the Hazelcast api.
// close(URI,ClassLoader) doesn't do that.
HazelcastInstanceFactory.getHazelcastInstance("hzsecond").shutdown();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
-->
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-4.0.xsd" >
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd">

<cache name="spring">
<key-type class-name="java.lang.String"/>
Expand Down