camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1143947 - in /camel/branches/camel-2.7.x: ./ components/camel-cache/src/main/java/org/apache/camel/component/cache/ components/camel-cache/src/main/java/org/apache/camel/processor/cache/ components/camel-cache/src/test/java/org/apache/came...
Date Thu, 07 Jul 2011 18:10:10 GMT
Author: dkulp
Date: Thu Jul  7 18:10:10 2011
New Revision: 1143947

URL: http://svn.apache.org/viewvc?rev=1143947&view=rev
Log:
Merged revisions 1090960,1090969 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1090960 | davsclaus | 2011-04-11 03:52:41 -0400 (Mon, 11 Apr 2011) | 1 line
  
  CAMEL-3849: Fixed camel-cache to load ehcache.xml in OSGi. Thanks to Piotr Klimczak for
the patch.
........
  r1090969 | davsclaus | 2011-04-11 04:18:51 -0400 (Mon, 11 Apr 2011) | 1 line
  
  CAMEL-3849: Added camel-cache osgi unit test.
........

Added:
    camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/DefaultCacheManagerFactory.java
      - copied unchanged from r1090969, camel/trunk/components/camel-cache/src/main/java/org/apache/camel/component/cache/DefaultCacheManagerFactory.java
    camel/branches/camel-2.7.x/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheManagerFactoryRefTest.java
      - copied unchanged from r1090969, camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheManagerFactoryRefTest.java
    camel/branches/camel-2.7.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/
      - copied from r1090969, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/
    camel/branches/camel-2.7.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/CacheTest.java
      - copied unchanged from r1090969, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/CacheTest.java
Modified:
    camel/branches/camel-2.7.x/   (props changed)
    camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
    camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheManagerFactory.java
    camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedMessageBodyReplacer.java
    camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedTokenReplacer.java
    camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedXPathReplacer.java
    camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheValidate.java

Propchange: camel/branches/camel-2.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul  7 18:10:10 2011
@@ -1 +1 @@
-/camel/trunk:1083696,1086231,1087276,1087612,1087856,1088583,1088916-1088917,1089275,1090166,1091518,1091771,1091799,1092068,1092577,1092667,1093978,1094156,1095405,1095469,1095471,1095475-1095476,1097912,1099417,1102162,1104076,1124497,1127744,1127988,1131411,1134252,1134501,1135364,1139163,1143925
+/camel/trunk:1083696,1086231,1087276,1087612,1087856,1088583,1088916-1088917,1089275,1090166,1090960-1090969,1091518,1091771,1091799,1092068,1092577,1092667,1093978,1094156,1095405,1095469,1095471,1095475-1095476,1097912,1099417,1102162,1104076,1124497,1127744,1127988,1131411,1134252,1134501,1135364,1139163,1143925

Propchange: camel/branches/camel-2.7.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java?rev=1143947&r1=1143946&r2=1143947&view=diff
==============================================================================
--- camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
(original)
+++ camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
Thu Jul  7 18:10:10 2011
@@ -27,7 +27,7 @@ import org.apache.camel.util.ServiceHelp
 
 public class CacheComponent extends DefaultComponent {
     private CacheConfiguration configuration;
-    private CacheManagerFactory cacheManagerFactory = new CacheManagerFactory();
+    private CacheManagerFactory cacheManagerFactory = new DefaultCacheManagerFactory();
     
     public CacheComponent() {
         configuration = new CacheConfiguration();
@@ -46,9 +46,11 @@ public class CacheComponent extends Defa
         CacheConfiguration config = configuration.copy();
 
         config.parseURI(new URI(uri));
-        
+
+        setProperties(this, parameters);
+        setProperties(config, parameters);
+
         CacheEndpoint cacheEndpoint = new CacheEndpoint(uri, this, config, cacheManagerFactory);
-        setProperties(cacheEndpoint.getConfig(), parameters);
         return cacheEndpoint;
     }
 

Modified: camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheManagerFactory.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheManagerFactory.java?rev=1143947&r1=1143946&r2=1143947&view=diff
==============================================================================
--- camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheManagerFactory.java
(original)
+++ camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheManagerFactory.java
Thu Jul  7 18:10:10 2011
@@ -19,17 +19,26 @@ package org.apache.camel.component.cache
 import net.sf.ehcache.CacheManager;
 import org.apache.camel.impl.ServiceSupport;
 
-public class CacheManagerFactory extends ServiceSupport {
+public abstract class CacheManagerFactory extends ServiceSupport {
     private CacheManager cacheManager;
 
     public synchronized CacheManager instantiateCacheManager() {
         if (cacheManager == null) {
-            cacheManager = CacheManager.getInstance();
+            cacheManager = createCacheManagerInstance();
         }
         
         return cacheManager;
     }
 
+    /**
+     * Creates {@link CacheManager}.
+     * <p/>
+     * The default implementation is {@link DefaultCacheManagerFactory}.
+     *
+     * @return {@link CacheManager}
+     */
+    protected abstract CacheManager createCacheManagerInstance();
+
     @Override
     protected void doStart() throws Exception {
     }

Modified: camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedMessageBodyReplacer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedMessageBodyReplacer.java?rev=1143947&r1=1143946&r2=1143947&view=diff
==============================================================================
--- camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedMessageBodyReplacer.java
(original)
+++ camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedMessageBodyReplacer.java
Thu Jul  7 18:10:10 2011
@@ -21,7 +21,7 @@ import net.sf.ehcache.Ehcache;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.component.cache.CacheManagerFactory;
+import org.apache.camel.component.cache.DefaultCacheManagerFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +44,7 @@ public class CacheBasedMessageBodyReplac
 
     public void process(Exchange exchange) throws Exception {
         // Cache the buffer to the specified Cache against the specified key
-        cacheManager = new CacheManagerFactory().instantiateCacheManager();
+        cacheManager = new DefaultCacheManagerFactory().instantiateCacheManager();
 
         if (isValid(cacheManager, cacheName, key)) {
             cache = cacheManager.getCache(cacheName);

Modified: camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedTokenReplacer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedTokenReplacer.java?rev=1143947&r1=1143946&r2=1143947&view=diff
==============================================================================
--- camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedTokenReplacer.java
(original)
+++ camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedTokenReplacer.java
Thu Jul  7 18:10:10 2011
@@ -20,9 +20,10 @@ import java.io.InputStream;
 
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Ehcache;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.component.cache.CacheManagerFactory;
+import org.apache.camel.component.cache.DefaultCacheManagerFactory;
 import org.apache.camel.converter.IOConverter;
 import org.apache.camel.util.IOHelper;
 import org.slf4j.Logger;
@@ -49,7 +50,7 @@ public class CacheBasedTokenReplacer ext
 
     public void process(Exchange exchange) throws Exception {
         // Cache the buffer to the specified Cache against the specified key
-        cacheManager = new CacheManagerFactory().instantiateCacheManager();
+        cacheManager = new DefaultCacheManagerFactory().instantiateCacheManager();
 
         if (isValid(cacheManager, cacheName, key)) {
             cache = cacheManager.getCache(cacheName);

Modified: camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedXPathReplacer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedXPathReplacer.java?rev=1143947&r1=1143946&r2=1143947&view=diff
==============================================================================
--- camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedXPathReplacer.java
(original)
+++ camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheBasedXPathReplacer.java
Thu Jul  7 18:10:10 2011
@@ -32,7 +32,7 @@ import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Ehcache;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.component.cache.CacheManagerFactory;
+import org.apache.camel.component.cache.DefaultCacheManagerFactory;
 import org.apache.camel.converter.IOConverter;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.util.IOHelper;
@@ -63,7 +63,7 @@ public class CacheBasedXPathReplacer ext
 
     public void process(Exchange exchange) throws Exception {
         // Cache the buffer to the specified Cache against the specified key
-        cacheManager = new CacheManagerFactory().instantiateCacheManager();
+        cacheManager = new DefaultCacheManagerFactory().instantiateCacheManager();
 
         if (isValid(cacheManager, cacheName, key)) {
             cache = cacheManager.getCache(cacheName);

Modified: camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheValidate.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheValidate.java?rev=1143947&r1=1143946&r2=1143947&view=diff
==============================================================================
--- camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheValidate.java
(original)
+++ camel/branches/camel-2.7.x/components/camel-cache/src/main/java/org/apache/camel/processor/cache/CacheValidate.java
Thu Jul  7 18:10:10 2011
@@ -31,17 +31,12 @@ public class CacheValidate {
         }
 
         if (!cacheManager.cacheExists(cacheName)) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("No existing Cache found with name: " + cacheName
-                        + ". Please ensure a cache is first instantiated using a Cache Consumer
or Cache Producer."
-                        + " Replacement will not be performed since the cache " + cacheName
+ "does not presently exist");
-            }
+            LOG.debug("No existing Cache found with name: {}"
+                    + ". Please ensure a cache is first instantiated using a Cache Consumer
or Cache Producer."
+                    + " Replacement will not be performed since the cache {} does not presently
exist", cacheName, cacheName);
             return false;
         }
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Found an existing cache: " + cacheName);
-        }
+        LOG.debug("Found an existing cache: {}", cacheName);
 
         if (LOG.isTraceEnabled()) {
             LOG.trace("Cache " + cacheName + " currently contains " + cacheManager.getCache(cacheName).getSize()
+ " elements");
@@ -49,11 +44,8 @@ public class CacheValidate {
         Ehcache cache = cacheManager.getCache(cacheName);
 
         if (!cache.isKeyInCache(key)) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("No Key with name: " + key
-                        + "presently exists in the cache. It is also possible that the key
may have expired in the cache."
-                        + " Replacement will not be performed until an appropriate key/value
pair is added to (or) found in the cache.");
-            }
+            LOG.debug("No Key with name: {} presently exists in the cache. It is also possible
that the key may have expired in the cache."
+                    + " Replacement will not be performed until an appropriate key/value
pair is added to (or) found in the cache.", key);
             return false;
         }
 



Mime
View raw message