![]() |
![]() |
spring-context-3.2.5.RELEASE16:53:11.072 INFO jd.cli.Main - Decompiling spring-context-3.2.5.RELEASE.jar package org.springframework.cache; public abstract interface Cache { public abstract String getName(); public abstract Object getNativeCache(); public abstract ValueWrapper get(Object paramObject); public abstract void put(Object paramObject1, Object paramObject2); public abstract void evict(Object paramObject); public abstract void clear(); public static abstract interface ValueWrapper { public abstract Object get(); } } /* Location: * Qualified Name: org.springframework.cache.Cache * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache; public abstract interface Cache$ValueWrapper { public abstract Object get(); } /* Location: * Qualified Name: org.springframework.cache.Cache.ValueWrapper * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache; import java.util.Collection; public abstract interface CacheManager { public abstract Cache getCache(String paramString); public abstract Collection<String> getCacheNames(); } /* Location: * Qualified Name: org.springframework.cache.CacheManager * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; class CachingConfigurationSelector$1 {} /* Location: * Qualified Name: org.springframework.cache.annotation.CachingConfigurationSelector.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import org.springframework.cache.CacheManager; import org.springframework.cache.interceptor.KeyGenerator; public abstract interface CachingConfigurer { public abstract CacheManager cacheManager(); public abstract KeyGenerator keyGenerator(); } /* Location: * Qualified Name: org.springframework.cache.annotation.CachingConfigurer * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import org.springframework.context.annotation.AdviceMode; import org.springframework.context.annotation.AdviceModeImportSelector; import org.springframework.context.annotation.AutoProxyRegistrar; public class CachingConfigurationSelector extends AdviceModeImportSelector<EnableCaching> { public String[] selectImports(AdviceMode adviceMode) { switch (adviceMode) { case PROXY: return new String[] { AutoProxyRegistrar.class.getName(), ProxyCachingConfiguration.class.getName() }; case ASPECTJ: return new String[] { "org.springframework.cache.aspectj.AspectJCachingConfiguration" }; } return null; } } /* Location: * Qualified Name: org.springframework.cache.annotation.CachingConfigurationSelector * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.lang.annotation.Annotation; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface Cacheable { String[] value(); String key() default ""; String condition() default ""; String unless() default ""; } /* Location: * Qualified Name: org.springframework.cache.annotation.Cacheable * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.lang.annotation.Annotation; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface CachePut { String[] value(); String key() default ""; String condition() default ""; String unless() default ""; } /* Location: * Qualified Name: org.springframework.cache.annotation.CachePut * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.io.Serializable; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import org.springframework.cache.interceptor.AbstractFallbackCacheOperationSource; import org.springframework.cache.interceptor.CacheOperation; import org.springframework.util.Assert; public class AnnotationCacheOperationSource extends AbstractFallbackCacheOperationSource implements Serializable { private final boolean publicMethodsOnly; private final Set<CacheAnnotationParser> annotationParsers; public AnnotationCacheOperationSource() { this(true); } public AnnotationCacheOperationSource(boolean publicMethodsOnly) { this.publicMethodsOnly = publicMethodsOnly; annotationParsers = new LinkedHashSet(1); annotationParsers.add(new SpringCacheAnnotationParser()); } public AnnotationCacheOperationSource(CacheAnnotationParser annotationParser) { publicMethodsOnly = true; Assert.notNull(annotationParser, "CacheAnnotationParser must not be null"); annotationParsers = Collections.singleton(annotationParser); } public AnnotationCacheOperationSource(CacheAnnotationParser... annotationParsers) { publicMethodsOnly = true; Assert.notEmpty(annotationParsers, "At least one CacheAnnotationParser needs to be specified"); Set<CacheAnnotationParser> parsers = new LinkedHashSet(annotationParsers.length); Collections.addAll(parsers, annotationParsers); this.annotationParsers = parsers; } public AnnotationCacheOperationSource(Set<CacheAnnotationParser> annotationParsers) { publicMethodsOnly = true; Assert.notEmpty(annotationParsers, "At least one CacheAnnotationParser needs to be specified"); this.annotationParsers = annotationParsers; } protected Collection<CacheOperation> findCacheOperations(Class<?> clazz) { return determineCacheOperations(clazz); } protected Collection<CacheOperation> findCacheOperations(Method method) { return determineCacheOperations(method); } protected Collection<CacheOperation> determineCacheOperations(AnnotatedElement ae) { Collection<CacheOperation> ops = null; for (CacheAnnotationParser annotationParser : annotationParsers) { Collection<CacheOperation> annOps = annotationParser.parseCacheAnnotations(ae); if (annOps != null) { if (ops == null) { ops = new ArrayList(); } ops.addAll(annOps); } } return ops; } protected boolean allowPublicMethodsOnly() { return publicMethodsOnly; } public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof AnnotationCacheOperationSource)) { return false; } AnnotationCacheOperationSource otherCos = (AnnotationCacheOperationSource)other; return (annotationParsers.equals(annotationParsers)) && (publicMethodsOnly == publicMethodsOnly); } public int hashCode() { return annotationParsers.hashCode(); } } /* Location: * Qualified Name: org.springframework.cache.annotation.AnnotationCacheOperationSource * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.lang.annotation.Annotation; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface CacheEvict { String[] value(); String key() default ""; String condition() default ""; boolean allEntries() default false; boolean beforeInvocation() default false; } /* Location: * Qualified Name: org.springframework.cache.annotation.CacheEvict * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.util.Collection; import java.util.Iterator; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.CacheManager; import org.springframework.cache.interceptor.KeyGenerator; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportAware; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.type.AnnotationMetadata; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; @Configuration public abstract class AbstractCachingConfiguration implements ImportAware { protected AnnotationAttributes enableCaching; protected CacheManager cacheManager; protected KeyGenerator keyGenerator; @Autowired(required=false) private Collection<CacheManager> cacheManagerBeans; @Autowired(required=false) private Collection<CachingConfigurer> cachingConfigurers; public void setImportMetadata(AnnotationMetadata importMetadata) { enableCaching = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false)); Assert.notNull(enableCaching, "@EnableCaching is not present on importing class " + importMetadata.getClassName()); } @PostConstruct protected void reconcileCacheManager() { if (!CollectionUtils.isEmpty(cachingConfigurers)) { int nConfigurers = cachingConfigurers.size(); if (nConfigurers > 1) { throw new IllegalStateException(nConfigurers + " implementations of " + "CachingConfigurer were found when only 1 was expected. " + "Refactor the configuration such that CachingConfigurer is " + "implemented only once or not at all."); } CachingConfigurer cachingConfigurer = (CachingConfigurer)cachingConfigurers.iterator().next(); this.cacheManager = cachingConfigurer.cacheManager(); keyGenerator = cachingConfigurer.keyGenerator(); } else if (!CollectionUtils.isEmpty(cacheManagerBeans)) { int nManagers = cacheManagerBeans.size(); if (nManagers > 1) { throw new IllegalStateException(nManagers + " beans of type CacheManager " + "were found when only 1 was expected. Remove all but one of the " + "CacheManager bean definitions, or implement CachingConfigurer " + "to make explicit which CacheManager should be used for " + "annotation-driven cache management."); } CacheManager cacheManager = (CacheManager)cacheManagerBeans.iterator().next(); this.cacheManager = cacheManager; } else { throw new IllegalStateException("No bean of type CacheManager could be found. Register a CacheManager bean or remove the @EnableCaching annotation from your configuration."); } } } /* Location: * Qualified Name: org.springframework.cache.annotation.AbstractCachingConfiguration * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.util.ArrayList; import java.util.Collection; import org.springframework.cache.interceptor.CacheEvictOperation; import org.springframework.cache.interceptor.CacheOperation; import org.springframework.cache.interceptor.CachePutOperation; import org.springframework.cache.interceptor.CacheableOperation; import org.springframework.util.ObjectUtils; public class SpringCacheAnnotationParser implements CacheAnnotationParser, Serializable { public Collection<CacheOperation> parseCacheAnnotations(AnnotatedElement ae) { Collection<CacheOperation> ops = null; Collection<Cacheable> cacheables = getAnnotations(ae, Cacheable.class); if (cacheables != null) { ops = lazyInit(ops); for (Cacheable cacheable : cacheables) { ops.add(parseCacheableAnnotation(ae, cacheable)); } } Collection<CacheEvict> evicts = getAnnotations(ae, CacheEvict.class); if (evicts != null) { ops = lazyInit(ops); for (CacheEvict e : evicts) { ops.add(parseEvictAnnotation(ae, e)); } } Collection<CachePut> updates = getAnnotations(ae, CachePut.class); if (updates != null) { ops = lazyInit(ops); for (CachePut p : updates) { ops.add(parseUpdateAnnotation(ae, p)); } } Collection<Caching> caching = getAnnotations(ae, Caching.class); if (caching != null) { ops = lazyInit(ops); for (Caching c : caching) { ops.addAll(parseCachingAnnotation(ae, c)); } } return ops; } private <T extends Annotation> Collection<CacheOperation> lazyInit(Collection<CacheOperation> ops) { return ops != null ? ops : new ArrayList(1); } CacheableOperation parseCacheableAnnotation(AnnotatedElement ae, Cacheable caching) { CacheableOperation cuo = new CacheableOperation(); cuo.setCacheNames(caching.value()); cuo.setCondition(caching.condition()); cuo.setUnless(caching.unless()); cuo.setKey(caching.key()); cuo.setName(ae.toString()); return cuo; } CacheEvictOperation parseEvictAnnotation(AnnotatedElement ae, CacheEvict caching) { CacheEvictOperation ceo = new CacheEvictOperation(); ceo.setCacheNames(caching.value()); ceo.setCondition(caching.condition()); ceo.setKey(caching.key()); ceo.setCacheWide(caching.allEntries()); ceo.setBeforeInvocation(caching.beforeInvocation()); ceo.setName(ae.toString()); return ceo; } CacheOperation parseUpdateAnnotation(AnnotatedElement ae, CachePut caching) { CachePutOperation cuo = new CachePutOperation(); cuo.setCacheNames(caching.value()); cuo.setCondition(caching.condition()); cuo.setUnless(caching.unless()); cuo.setKey(caching.key()); cuo.setName(ae.toString()); return cuo; } Collection<CacheOperation> parseCachingAnnotation(AnnotatedElement ae, Caching caching) { Collection<CacheOperation> ops = null; Cacheable[] cacheables = caching.cacheable(); if (!ObjectUtils.isEmpty(cacheables)) { ops = lazyInit(ops); for (Cacheable cacheable : cacheables) { ops.add(parseCacheableAnnotation(ae, cacheable)); } } CacheEvict[] evicts = caching.evict(); if (!ObjectUtils.isEmpty(evicts)) { ops = lazyInit(ops); for (CacheEvict evict : evicts) { ops.add(parseEvictAnnotation(ae, evict)); } } CachePut[] updates = caching.put(); if (!ObjectUtils.isEmpty(updates)) { ops = lazyInit(ops); for (CachePut update : updates) { ops.add(parseUpdateAnnotation(ae, update)); } } return ops; } private <T extends Annotation> Collection<T> getAnnotations(AnnotatedElement ae, Class<T> annotationType) { Collection<T> anns = new ArrayList(2); T ann = ae.getAnnotation(annotationType); if (ann != null) { anns.add(ann); } for (Annotation metaAnn : ae.getAnnotations()) { ann = metaAnn.annotationType().getAnnotation(annotationType); if (ann != null) { anns.add(ann); } } return anns.isEmpty() ? null : anns; } public boolean equals(Object other) { return (this == other) || ((other instanceof SpringCacheAnnotationParser)); } public int hashCode() { return SpringCacheAnnotationParser.class.hashCode(); } } /* Location: * Qualified Name: org.springframework.cache.annotation.SpringCacheAnnotationParser * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.lang.annotation.Annotation; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface Caching { Cacheable[] cacheable() default {}; CachePut[] put() default {}; CacheEvict[] evict() default {}; } /* Location: * Qualified Name: org.springframework.cache.annotation.Caching * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor; import org.springframework.cache.interceptor.CacheInterceptor; import org.springframework.cache.interceptor.CacheOperationSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; import org.springframework.core.annotation.AnnotationAttributes; @Configuration public class ProxyCachingConfiguration extends AbstractCachingConfiguration { @Bean(name={"org.springframework.cache.config.internalCacheAdvisor"}) @Role(2) public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor() { BeanFactoryCacheOperationSourceAdvisor advisor = new BeanFactoryCacheOperationSourceAdvisor(); advisor.setCacheOperationSource(cacheOperationSource()); advisor.setAdvice(cacheInterceptor()); advisor.setOrder(((Integer)enableCaching.getNumber("order")).intValue()); return advisor; } @Bean @Role(2) public CacheOperationSource cacheOperationSource() { return new AnnotationCacheOperationSource(); } @Bean @Role(2) public CacheInterceptor cacheInterceptor() { CacheInterceptor interceptor = new CacheInterceptor(); interceptor.setCacheOperationSources(new CacheOperationSource[] { cacheOperationSource() }); if (cacheManager != null) { interceptor.setCacheManager(cacheManager); } if (keyGenerator != null) { interceptor.setKeyGenerator(keyGenerator); } return interceptor; } } /* Location: * Qualified Name: org.springframework.cache.annotation.ProxyCachingConfiguration * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.lang.annotation.Annotation; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.context.annotation.AdviceMode; import org.springframework.context.annotation.Import; @Target({java.lang.annotation.ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Import({CachingConfigurationSelector.class}) public @interface EnableCaching { boolean proxyTargetClass() default false; AdviceMode mode() default AdviceMode.PROXY; int order() default Integer.MAX_VALUE; } /* Location: * Qualified Name: org.springframework.cache.annotation.EnableCaching * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.annotation; import java.lang.reflect.AnnotatedElement; import java.util.Collection; import org.springframework.cache.interceptor.CacheOperation; public abstract interface CacheAnnotationParser { public abstract Collection<CacheOperation> parseCacheAnnotations(AnnotatedElement paramAnnotatedElement); } /* Location: * Qualified Name: org.springframework.cache.annotation.CacheAnnotationParser * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.concurrent; import java.io.Serializable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.springframework.cache.Cache; import org.springframework.cache.Cache.ValueWrapper; import org.springframework.cache.support.SimpleValueWrapper; public class ConcurrentMapCache implements Cache { private static final Object NULL_HOLDER = new NullHolder(null); private final String name; private final ConcurrentMap<Object, Object> store; private final boolean allowNullValues; public ConcurrentMapCache(String name) { this(name, new ConcurrentHashMap(256), true); } public ConcurrentMapCache(String name, boolean allowNullValues) { this(name, new ConcurrentHashMap(256), allowNullValues); } public ConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues) { this.name = name; this.store = store; this.allowNullValues = allowNullValues; } public String getName() { return name; } public ConcurrentMap getNativeCache() { return store; } public boolean isAllowNullValues() { return allowNullValues; } public Cache.ValueWrapper get(Object key) { Object value = store.get(key); return value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null; } public void put(Object key, Object value) { store.put(key, toStoreValue(value)); } public void evict(Object key) { store.remove(key); } public void clear() { store.clear(); } protected Object fromStoreValue(Object storeValue) { if ((allowNullValues) && (storeValue == NULL_HOLDER)) { return null; } return storeValue; } protected Object toStoreValue(Object userValue) { if ((allowNullValues) && (userValue == null)) { return NULL_HOLDER; } return userValue; } private static class NullHolder implements Serializable {} } /* Location: * Qualified Name: org.springframework.cache.concurrent.ConcurrentMapCache * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.concurrent; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; public class ConcurrentMapCacheManager implements CacheManager { private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap(16); private boolean dynamic = true; public ConcurrentMapCacheManager() {} public ConcurrentMapCacheManager(String... cacheNames) { setCacheNames(Arrays.asList(cacheNames)); } public void setCacheNames(Collection<String> cacheNames) { if (cacheNames != null) { for (String name : cacheNames) { cacheMap.put(name, createConcurrentMapCache(name)); } dynamic = false; } } public Collection<String> getCacheNames() { return Collections.unmodifiableSet(cacheMap.keySet()); } public Cache getCache(String name) { Cache cache = (Cache)cacheMap.get(name); if ((cache == null) && (dynamic)) { synchronized (cacheMap) { cache = (Cache)cacheMap.get(name); if (cache == null) { cache = createConcurrentMapCache(name); cacheMap.put(name, cache); } } } return cache; } protected Cache createConcurrentMapCache(String name) { return new ConcurrentMapCache(name); } } /* Location: * Qualified Name: org.springframework.cache.concurrent.ConcurrentMapCacheManager * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.concurrent; class ConcurrentMapCache$1 {} /* Location: * Qualified Name: org.springframework.cache.concurrent.ConcurrentMapCache.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.concurrent; import java.util.concurrent.ConcurrentMap; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.StringUtils; public class ConcurrentMapCacheFactoryBean implements FactoryBean<ConcurrentMapCache>, BeanNameAware, InitializingBean { private String name = ""; private ConcurrentMap<Object, Object> store; private boolean allowNullValues = true; private ConcurrentMapCache cache; public void setName(String name) { this.name = name; } public void setStore(ConcurrentMap<Object, Object> store) { this.store = store; } public void setAllowNullValues(boolean allowNullValues) { this.allowNullValues = allowNullValues; } public void setBeanName(String beanName) { if (!StringUtils.hasLength(name)) { setName(beanName); } } public void afterPropertiesSet() { cache = (store != null ? new ConcurrentMapCache(name, store, allowNullValues) : new ConcurrentMapCache(name, allowNullValues)); } public ConcurrentMapCache getObject() { return cache; } public Class<?> getObjectType() { return ConcurrentMapCache.class; } public boolean isSingleton() { return true; } } /* Location: * Qualified Name: org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.concurrent; import java.io.Serializable; class ConcurrentMapCache$NullHolder implements Serializable {} /* Location: * Qualified Name: org.springframework.cache.concurrent.ConcurrentMapCache.NullHolder * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.support; import org.springframework.cache.Cache.ValueWrapper; public class SimpleValueWrapper implements Cache.ValueWrapper { private final Object value; public SimpleValueWrapper(Object value) { this.value = value; } public Object get() { return value; } } /* Location: * Qualified Name: org.springframework.cache.support.SimpleValueWrapper * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.support; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.springframework.beans.factory.InitializingBean; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; public abstract class AbstractCacheManager implements CacheManager, InitializingBean { private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap(16); private Set<String> cacheNames = new LinkedHashSet(16); public void afterPropertiesSet() { Collection<? extends Cache> caches = loadCaches(); cacheMap.clear(); cacheNames.clear(); for (Cache cache : caches) { cacheMap.put(cache.getName(), decorateCache(cache)); cacheNames.add(cache.getName()); } } protected final void addCache(Cache cache) { cacheMap.put(cache.getName(), decorateCache(cache)); cacheNames.add(cache.getName()); } protected Cache decorateCache(Cache cache) { return cache; } public Cache getCache(String name) { return (Cache)cacheMap.get(name); } public Collection<String> getCacheNames() { return Collections.unmodifiableSet(cacheNames); } protected abstract Collection<? extends Cache> loadCaches(); } /* Location: * Qualified Name: org.springframework.cache.support.AbstractCacheManager * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.support; import java.util.Collection; import org.springframework.cache.Cache; public class SimpleCacheManager extends AbstractCacheManager { private Collection<? extends Cache> caches; public void setCaches(Collection<? extends Cache> caches) { this.caches = caches; } protected Collection<? extends Cache> loadCaches() { return caches; } } /* Location: * Qualified Name: org.springframework.cache.support.SimpleCacheManager * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.support; import org.springframework.cache.Cache; import org.springframework.cache.Cache.ValueWrapper; class NoOpCacheManager$NoOpCache implements Cache { private final String name; public NoOpCacheManager$NoOpCache(String name) { this.name = name; } public void clear() {} public void evict(Object key) {} public Cache.ValueWrapper get(Object key) { return null; } public String getName() { return name; } public Object getNativeCache() { return null; } public void put(Object key, Object value) {} } /* Location: * Qualified Name: org.springframework.cache.support.NoOpCacheManager.NoOpCache * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.support; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import org.springframework.beans.factory.InitializingBean; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.util.Assert; public class CompositeCacheManager implements InitializingBean, CacheManager { private List<CacheManager> cacheManagers; private boolean fallbackToNoOpCache = false; public void setCacheManagers(Collection<CacheManager> cacheManagers) { Assert.notEmpty(cacheManagers, "cacheManagers Collection must not be empty"); this.cacheManagers = new ArrayList(); this.cacheManagers.addAll(cacheManagers); } public void setFallbackToNoOpCache(boolean fallbackToNoOpCache) { this.fallbackToNoOpCache = fallbackToNoOpCache; } public void afterPropertiesSet() { if (fallbackToNoOpCache) { cacheManagers.add(new NoOpCacheManager()); } } public Cache getCache(String name) { for (CacheManager cacheManager : cacheManagers) { Cache cache = cacheManager.getCache(name); if (cache != null) { return cache; } } return null; } public Collection<String> getCacheNames() { List<String> names = new ArrayList(); for (CacheManager manager : cacheManagers) { names.addAll(manager.getCacheNames()); } return Collections.unmodifiableList(names); } } /* Location: * Qualified Name: org.springframework.cache.support.CompositeCacheManager * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.support; import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.springframework.cache.Cache; import org.springframework.cache.Cache.ValueWrapper; import org.springframework.cache.CacheManager; public class NoOpCacheManager implements CacheManager { private final ConcurrentMap<String, Cache> caches; private final Set<String> cacheNames; public NoOpCacheManager() { caches = new ConcurrentHashMap(16); cacheNames = new LinkedHashSet(16); } public Cache getCache(String name) { Cache cache = (Cache)caches.get(name); if (cache == null) { caches.putIfAbsent(name, new NoOpCache(name)); synchronized (cacheNames) { cacheNames.add(name); } } return (Cache)caches.get(name); } /* Error */ public java.util.Collection<String> getCacheNames() { // Byte code: // 0: aload_0 // 1: getfield 7 org/springframework/cache/support/NoOpCacheManager:cacheNames Ljava/util/Set; // 4: dup // 5: astore_1 // 6: monitorenter // 7: aload_0 // 8: getfield 7 org/springframework/cache/support/NoOpCacheManager:cacheNames Ljava/util/Set; // 11: invokestatic 14 java/util/Collections:unmodifiableSet (Ljava/util/Set;)Ljava/util/Set; // 14: aload_1 // 15: monitorexit // 16: areturn // 17: astore_2 // 18: aload_1 // 19: monitorexit // 20: aload_2 // 21: athrow // Line number table: // Java source line #67 -> byte code offset #0 // Java source line #68 -> byte code offset #7 // Java source line #69 -> byte code offset #17 // Local variable table: // start length slot name signature // 0 22 0 this NoOpCacheManager // 5 14 1 Ljava/lang/Object; Object // 17 4 2 localObject1 Object // Exception table: // from to target type // 7 16 17 finally // 17 20 17 finally } private static class NoOpCache implements Cache { private final String name; public NoOpCache(String name) { this.name = name; } public void clear() {} public void evict(Object key) {} public Cache.ValueWrapper get(Object key) { return null; } public String getName() { return name; } public Object getNativeCache() { return null; } public void put(Object key, Object value) {} } } /* Location: * Qualified Name: org.springframework.cache.support.NoOpCacheManager * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.interceptor; import org.springframework.aop.Pointcut; import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean; import org.springframework.aop.support.DefaultPointcutAdvisor; public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean { private final CacheInterceptor cachingInterceptor = new CacheInterceptor(); private Pointcut pointcut; public void setPointcut(Pointcut pointcut) { this.pointcut = pointcut; } protected Object createMainInterceptor() { cachingInterceptor.afterPropertiesSet(); if (pointcut != null) { return new DefaultPointcutAdvisor(pointcut, cachingInterceptor); } throw new UnsupportedOperationException(); } public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) { cachingInterceptor.setCacheOperationSources(cacheOperationSources); } } /* Location: * Qualified Name: org.springframework.cache.interceptor.CacheProxyFactoryBean * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.interceptor; import java.io.Serializable; import java.lang.reflect.Method; import org.springframework.aop.support.StaticMethodMatcherPointcut; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; abstract class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut implements Serializable { public boolean matches(Method method, Class<?> targetClass) { CacheOperationSource cas = getCacheOperationSource(); return (cas != null) && (!CollectionUtils.isEmpty(cas.getCacheOperations(method, targetClass))); } public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof CacheOperationSourcePointcut)) { return false; } CacheOperationSourcePointcut otherPc = (CacheOperationSourcePointcut)other; return ObjectUtils.nullSafeEquals(getCacheOperationSource(), otherPc.getCacheOperationSource()); } public int hashCode() { return CacheOperationSourcePointcut.class.hashCode(); } public String toString() { return getClass().getName() + ": " + getCacheOperationSource(); } protected abstract CacheOperationSource getCacheOperationSource(); } /* Location: * Qualified Name: org.springframework.cache.interceptor.CacheOperationSourcePointcut * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.interceptor; import java.io.Serializable; import java.lang.reflect.Method; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; public class CacheInterceptor extends CacheAspectSupport implements MethodInterceptor, Serializable { private static class ThrowableWrapper extends RuntimeException { private final Throwable original; ThrowableWrapper(Throwable original) { this.original = original; } } public Object invoke(final MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); CacheAspectSupport.Invoker aopAllianceInvoker = new CacheAspectSupport.Invoker() { public Object invoke() { try { return invocation.proceed(); } catch (Throwable ex) { throw new CacheInterceptor.ThrowableWrapper(ex); } } }; try { return execute(aopAllianceInvoker, invocation.getThis(), method, invocation.getArguments()); } catch (ThrowableWrapper th) { throw original; } } } /* Location: * Qualified Name: org.springframework.cache.interceptor.CacheInterceptor * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.interceptor; import java.lang.reflect.Method; import java.util.Collection; import org.springframework.cache.Cache; import org.springframework.util.Assert; class CacheExpressionRootObject { private final Collection<Cache> caches; private final Method method; private final Object[] args; private final Object target; private final Class<?> targetClass; public CacheExpressionRootObject(Collection<Cache> caches, Method method, Object[] args, Object target, Class<?> targetClass) { Assert.notNull(method, "Method is required"); Assert.notNull(targetClass, "targetClass is required"); this.method = method; this.target = target; this.targetClass = targetClass; this.args = args; this.caches = caches; } public Collection<Cache> getCaches() { return caches; } public Method getMethod() { return method; } public String getMethodName() { return method.getName(); } public Object[] getArgs() { return args; } public Object getTarget() { return target; } public Class<?> getTargetClass() { return targetClass; } } /* Location: * Qualified Name: org.springframework.cache.interceptor.CacheExpressionRootObject * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.interceptor; class CacheInterceptor$ThrowableWrapper extends RuntimeException { private final Throwable original; CacheInterceptor$ThrowableWrapper(Throwable original) { this.original = original; } } /* Location: * Qualified Name: org.springframework.cache.interceptor.CacheInterceptor.ThrowableWrapper * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.springframework.cache.interceptor; import java.lang.reflect.Method; import java.util.Collection; import org.springframework.cache.Cache; import org.springframework.expression.EvaluationContext; import org.springframework.util.StringUtils; public class CacheAspectSupport$CacheOperationContext { private final CacheOperation operation; private final Method method; private final Object[] args; private final Object target; private final Class<?> targetClass; private final Collection<Cache> caches; public CacheAspectSupport$CacheOperationContext(CacheOperation arg1, Method operation, Object[] method, Object arg Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|