cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1503674 - in /cxf/branches/2.7.x-fixes: ./ rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/ rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/state/ rt/rs/security/sso/saml/src/test/java/or...
Date Tue, 16 Jul 2013 12:05:18 GMT
Author: ay
Date: Tue Jul 16 12:05:17 2013
New Revision: 1503674

URL: http://svn.apache.org/r1503674
Log:
Merged revisions 1503658 via  svn merge from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1503658 | ay | 2013-07-16 13:09:04 +0200 (Tue, 16 Jul 2013) | 1 line
  
  part of CXF-4577 for trunk
........

Added:
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/EHCacheUtilTest.java
      - copied unchanged from r1503658, cxf/trunk/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/EHCacheUtilTest.java
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/test/resources/cxf-test-ehcache.xml
      - copied unchanged from r1503658, cxf/trunk/rt/rs/security/sso/saml/src/test/resources/cxf-test-ehcache.xml
Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheTokenReplayCache.java
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheUtil.java
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/state/EHCacheSPStateManager.java

Propchange: cxf/branches/2.7.x-fixes/
            ('svn:mergeinfo' removed)

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

Modified: cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheTokenReplayCache.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheTokenReplayCache.java?rev=1503674&r1=1503673&r2=1503674&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheTokenReplayCache.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheTokenReplayCache.java
Tue Jul 16 12:05:17 2013
@@ -79,7 +79,7 @@ public class EHCacheTokenReplayCache imp
             // ignore
         }
         if (configFileURL == null) {
-            cacheManager = CacheManager.create();
+            cacheManager = EHCacheUtil.createCacheManager();
         } else {
             Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
             
@@ -93,7 +93,7 @@ public class EHCacheTokenReplayCache imp
                 }
             }
             
-            cacheManager = CacheManager.create(conf);
+            cacheManager = EHCacheUtil.createCacheManager(conf);
         }
         
         CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(CACHE_KEY, cacheManager);

Modified: cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheUtil.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheUtil.java?rev=1503674&r1=1503673&r2=1503674&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheUtil.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/EHCacheUtil.java
Tue Jul 16 12:05:17 2013
@@ -19,12 +19,34 @@
 
 package org.apache.cxf.rs.security.saml.sso;
 
+import java.lang.reflect.Method;
+
+import net.sf.ehcache.CacheException;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.Configuration;
 
 /**
  */
 public final class EHCacheUtil {
+    private static Method cacheManagerCreateMethodNoArg;
+    private static Method cacheManagerCreateMethodConfigurationArg;
+    static {
+        // these methods are either completely available or absent (valid assumption from
2.5.0 to 2.7.2 so far)
+        try {
+            // from 2.5.2
+            cacheManagerCreateMethodNoArg = CacheManager.class.getMethod("newInstance", (Class<?>[])null);
+            cacheManagerCreateMethodConfigurationArg = CacheManager.class.getMethod("newInstance",
Configuration.class);
+        } catch (NoSuchMethodException e) {
+            try {
+                // before 2.5.2
+                cacheManagerCreateMethodNoArg = CacheManager.class.getMethod("create", (Class<?>[])null);
+                cacheManagerCreateMethodConfigurationArg = CacheManager.class.getMethod("create",
Configuration.class);
+            } catch (Throwable t) {
+                // ignore
+            }
+        }
+    }
     
     private EHCacheUtil() {
         // 
@@ -48,4 +70,19 @@ public final class EHCacheUtil {
         return cc;
     }
     
+    public static CacheManager createCacheManager() throws CacheException {
+        try {
+            return (CacheManager)cacheManagerCreateMethodNoArg.invoke(null, (Object[])null);
+        } catch (Exception e) {
+            throw new CacheException(e);
+        }
+    }
+
+    public static CacheManager createCacheManager(Configuration conf) throws CacheException
{
+        try {
+            return (CacheManager)cacheManagerCreateMethodConfigurationArg.invoke(null, new
Object[]{conf});
+        } catch (Exception e) {
+            throw new CacheException(e);
+        }
+    }
 }

Modified: cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/state/EHCacheSPStateManager.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/state/EHCacheSPStateManager.java?rev=1503674&r1=1503673&r2=1503674&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/state/EHCacheSPStateManager.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/state/EHCacheSPStateManager.java
Tue Jul 16 12:05:17 2013
@@ -81,7 +81,7 @@ public class EHCacheSPStateManager imple
             // ignore
         }
         if (configFileURL == null) {
-            cacheManager = CacheManager.create();
+            cacheManager = EHCacheUtil.createCacheManager();
         } else {
             Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
             
@@ -95,7 +95,7 @@ public class EHCacheSPStateManager imple
                 }
             }
             
-            cacheManager = CacheManager.create(conf);
+            cacheManager = EHCacheUtil.createCacheManager(conf);
         }
         
         CacheConfiguration requestCC = EHCacheUtil.getCacheConfiguration(REQUEST_CACHE_KEY,
cacheManager);



Mime
View raw message