Repository: camel Updated Branches: refs/heads/master 8d6a94ea0 -> 4cc3541be
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b6134ba Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b6134ba Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b6134ba Branch: refs/heads/master Commit: 5b6134baeabc72b9607f25577685dba7280db10b Parents: 8d6a94e Author: Claus Ibsen <davscl...@apache.org> Authored: Mon May 11 09:05:18 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon May 11 09:05:18 2015 +0200 ---------------------------------------------------------------------- .../camel/component/cache/CacheComponent.java | 5 ++ .../component/cache/CacheConfiguration.java | 57 ++++++++++++++++++-- .../camel/component/cache/CacheEndpoint.java | 14 +++++ 3 files changed, 72 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5b6134ba/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 c19d0c0..d46f40c 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 @@ -62,6 +62,11 @@ public class CacheComponent extends UriEndpointComponent { return cacheManagerFactory; } + /** + * To use the given CacheManagerFactory for creating the CacheManager. + * <p/> + * By default the DefaultCacheManagerFactory is used. + */ public void setCacheManagerFactory(CacheManagerFactory cacheManagerFactory) { this.cacheManagerFactory = cacheManagerFactory; } http://git-wip-us.apache.org/repos/asf/camel/blob/5b6134ba/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 e55d6c4..fe5d99f 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 @@ -21,6 +21,7 @@ import java.util.Map; import net.sf.ehcache.store.MemoryStoreEvictionPolicy; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; import org.apache.camel.spi.UriPath; @@ -28,15 +29,16 @@ import org.apache.camel.util.URISupport; @UriParams public class CacheConfiguration implements Cloneable { - @UriPath + @UriPath @Metadata(required = "true") private String cacheName; @UriParam(defaultValue = "1000") private int maxElementsInMemory = 1000; - @UriParam(defaultValue = "LFU", enums = "LRU,LFU,FIFO,CLOCK") + @UriParam(defaultValue = "LFU", enums = "LRU,LFU,FIFO") private MemoryStoreEvictionPolicy memoryStoreEvictionPolicy = MemoryStoreEvictionPolicy.LFU; @UriParam(defaultValue = "true") private boolean overflowToDisk = true; @UriParam + @Deprecated private String diskStorePath; @UriParam private boolean eternal; @@ -125,6 +127,9 @@ public class CacheConfiguration implements Cloneable { return cacheName; } + /** + * Name of the cache + */ public void setCacheName(String cacheName) { this.cacheName = cacheName; } @@ -133,6 +138,9 @@ public class CacheConfiguration implements Cloneable { return maxElementsInMemory; } + /** + * The number of elements that may be stored in the defined cache in memory. + */ public void setMaxElementsInMemory(int maxElementsInMemory) { this.maxElementsInMemory = maxElementsInMemory; } @@ -141,8 +149,16 @@ public class CacheConfiguration implements Cloneable { return memoryStoreEvictionPolicy; } - public void setMemoryStoreEvictionPolicy( - MemoryStoreEvictionPolicy memoryStoreEvictionPolicy) { + /** + * Which eviction strategy to use when maximum number of elements in memory is reached. The strategy defines + * which elements to be removed. + * <ul> + * <li>LRU - Lest Recently Used</li> + * <li>LFU - Lest Frequently Used</li> + * <li>FIFO - First In First Out</li> + * </ul> + */ + public void setMemoryStoreEvictionPolicy(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy) { this.memoryStoreEvictionPolicy = memoryStoreEvictionPolicy; } @@ -150,14 +166,22 @@ public class CacheConfiguration implements Cloneable { return overflowToDisk; } + /** + * Specifies whether cache may overflow to disk + */ public void setOverflowToDisk(boolean overflowToDisk) { this.overflowToDisk = overflowToDisk; } + @Deprecated public String getDiskStorePath() { return diskStorePath; } + /** + * This parameter is ignored. CacheManager sets it using setter injection. + */ + @Deprecated public void setDiskStorePath(String diskStorePath) { this.diskStorePath = diskStorePath; } @@ -166,6 +190,9 @@ public class CacheConfiguration implements Cloneable { return eternal; } + /** + * Sets whether elements are eternal. If eternal, timeouts are ignored and the element never expires. + */ public void setEternal(boolean eternal) { this.eternal = eternal; } @@ -174,6 +201,9 @@ public class CacheConfiguration implements Cloneable { return timeToLiveSeconds; } + /** + * The maximum time between creation time and when an element expires. Is used only if the element is not eternal + */ public void setTimeToLiveSeconds(long timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } @@ -182,6 +212,9 @@ public class CacheConfiguration implements Cloneable { return timeToIdleSeconds; } + /** + * The maximum amount of time between accesses before an element expires + */ public void setTimeToIdleSeconds(long timeToIdleSeconds) { this.timeToIdleSeconds = timeToIdleSeconds; } @@ -190,6 +223,9 @@ public class CacheConfiguration implements Cloneable { return diskPersistent; } + /** + * Whether the disk store persists between restarts of the application. + */ public void setDiskPersistent(boolean diskPersistent) { this.diskPersistent = diskPersistent; } @@ -198,10 +234,16 @@ public class CacheConfiguration implements Cloneable { return diskExpiryThreadIntervalSeconds; } + /** + * The number of seconds between runs of the disk expiry thread. + */ public void setDiskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds) { this.diskExpiryThreadIntervalSeconds = diskExpiryThreadIntervalSeconds; } + /** + * To configure event listeners using the CacheEventListenerRegistry + */ public void setEventListenerRegistry(CacheEventListenerRegistry eventListenerRegistry) { this.eventListenerRegistry = eventListenerRegistry; } @@ -210,6 +252,9 @@ public class CacheConfiguration implements Cloneable { return eventListenerRegistry; } + /** + * To configure cache loader using the CacheLoaderRegistry + */ public void setCacheLoaderRegistry(CacheLoaderRegistry cacheLoaderRegistry) { this.cacheLoaderRegistry = cacheLoaderRegistry; } @@ -222,6 +267,10 @@ public class CacheConfiguration implements Cloneable { return objectCache; } + /** + * Whether to turn on allowing to store non serializable objects in the cache. + * If this option is enabled then overflow to disk cannot be enabled as well. + */ public void setObjectCache(boolean objectCache) { this.objectCache = objectCache; } http://git-wip-us.apache.org/repos/asf/camel/blob/5b6134ba/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java index 9d037a1..5ecdb38 100755 --- a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java +++ b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheEndpoint.java @@ -88,6 +88,11 @@ public class CacheEndpoint extends DefaultEndpoint { return cacheManagerFactory; } + /** + * To use a custom CacheManagerFactory for creating the CacheManager to be used by this endpoint. + * <p/> + * By default the CacheManagerFactory configured on the component is used. + */ public void setCacheManagerFactory(CacheManagerFactory cacheManagerFactory) { this.cacheManagerFactory = cacheManagerFactory; } @@ -162,6 +167,11 @@ public class CacheEndpoint extends DefaultEndpoint { return operation; } + + /** + * The default cache operation to use. + * If an operation in the message header, then the operation from the header takes precedence. + */ public void setOperation(String operation) { this.operation = operation; } @@ -170,6 +180,10 @@ public class CacheEndpoint extends DefaultEndpoint { return key; } + /** + * The default key to use. + * If a key is provided in the message header, then the key from the header takes precedence. + */ public void setKey(String key) { this.key = key; }