Repository: camel
Updated Branches:
refs/heads/master 21541cf65 -> ae91e61ec
CAMEL-8766 camel-cache - CacheConfiguration - parseURI not needed
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae91e61e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae91e61e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae91e61e
Branch: refs/heads/master
Commit: ae91e61ecebeedf17a98c6fc5bdbf8085e9cd94b
Parents: 21541cf
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Mon May 11 14:26:12 2015 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Mon May 11 15:41:03 2015 +0200
----------------------------------------------------------------------
.../camel/component/cache/CacheComponent.java | 2 +-
.../component/cache/CacheConfiguration.java | 53 --------------------
2 files changed, 1 insertion(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ae91e61e/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
index d46f40c..e15ba85 100755
--- a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
+++ b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
@@ -49,9 +49,9 @@ public class CacheComponent extends UriEndpointComponent {
ObjectHelper.notNull(configuration, "configuration");
CacheConfiguration config = configuration.copy();
- config.parseURI(new URI(uri));
setProperties(this, parameters);
setProperties(config, parameters);
+ config.setCacheName(remaining);
CacheEndpoint cacheEndpoint = new CacheEndpoint(uri, this, config, cacheManagerFactory);
setProperties(cacheEndpoint, parameters);
http://git-wip-us.apache.org/repos/asf/camel/blob/ae91e61e/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
index fe5d99f..858f136 100755
--- a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
+++ b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
@@ -60,10 +60,6 @@ public class CacheConfiguration implements Cloneable {
public CacheConfiguration() {
}
- public CacheConfiguration(URI uri) throws Exception {
- parseURI(uri);
- }
-
public CacheConfiguration copy() {
try {
CacheConfiguration copy = (CacheConfiguration) clone();
@@ -73,55 +69,6 @@ public class CacheConfiguration implements Cloneable {
throw new RuntimeCamelException(e);
}
}
-
- public void parseURI(URI uri) throws Exception {
- String protocol = uri.getScheme();
-
- if (!protocol.equalsIgnoreCase("cache")) {
- throw new IllegalArgumentException("Unrecognized Cache protocol: " + protocol
+ " for uri: " + uri);
- }
-
- setCacheName(uri.getHost());
-
- Map<String, Object> cacheSettings = URISupport.parseParameters(uri);
- if (cacheSettings.containsKey("maxElementsInMemory")) {
- setMaxElementsInMemory(Integer.valueOf((String) cacheSettings.get("maxElementsInMemory")));
- }
- if (cacheSettings.containsKey("overflowToDisk")) {
- setOverflowToDisk(Boolean.valueOf((String) cacheSettings.get("overflowToDisk")));
- }
- if (cacheSettings.containsKey("diskStorePath")) {
- setDiskStorePath((String)cacheSettings.get("diskStorePath"));
- }
- if (cacheSettings.containsKey("eternal")) {
- setEternal(Boolean.valueOf((String) cacheSettings.get("eternal")));
- }
- if (cacheSettings.containsKey("timeToLiveSeconds")) {
- setTimeToLiveSeconds(Long.valueOf((String) cacheSettings.get("timeToLiveSeconds")));
- }
- if (cacheSettings.containsKey("timeToIdleSeconds")) {
- setTimeToIdleSeconds(Long.valueOf((String) cacheSettings.get("timeToIdleSeconds")));
- }
- if (cacheSettings.containsKey("diskPersistent")) {
- setDiskPersistent(Boolean.valueOf((String) cacheSettings.get("diskPersistent")));
- }
- if (cacheSettings.containsKey("diskExpiryThreadIntervalSeconds")) {
- setDiskExpiryThreadIntervalSeconds(Long.valueOf((String) cacheSettings.get("diskExpiryThreadIntervalSeconds")));
- }
- if (cacheSettings.containsKey("memoryStoreEvictionPolicy")) {
- String policy = (String) cacheSettings.get("memoryStoreEvictionPolicy");
- // remove leading if any given as fromString uses LRU, LFU or FIFO
- policy = policy.replace("MemoryStoreEvictionPolicy.", "");
- setMemoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.fromString(policy));
- }
- if (cacheSettings.containsKey("objectCache")) {
- setObjectCache(Boolean.valueOf((String) cacheSettings.get("objectCache")));
- }
-
- if (isObjectCache() && (isOverflowToDisk() || isDiskPersistent())) {
- throw new IllegalArgumentException("Unable to create object cache with disk access");
- }
- }
public String getCacheName() {
return cacheName;
|