protected CompositeCacheConfigurator newConfigurator() { return new CompositeCacheConfigurator(); }
/** * Get an ICompositeCacheAttributes for the listed region. *<p> * @param props * @param regName * @return ICompositeCacheAttributes */ protected ICompositeCacheAttributes parseCompositeCacheAttributes( Properties props, String regName ) { return parseCompositeCacheAttributes( props, regName, REGION_PREFIX ); }
/** * Set the default ElementAttributes for new caches. *<p> * @param props */ protected void setDefaultElementAttributes( Properties props ) { IElementAttributes iea = parseElementAttributes( props, "", CompositeCacheConfigurator.DEFAULT_REGION ); compositeCacheManager.setDefaultElementAttributes( iea ); log.info( "setting defaultElementAttributes to " + iea ); }
CompositeCacheConfigurator configurator = new CompositeCacheConfigurator(); AuxiliaryCache<String, String> aux = configurator.parseAuxiliary( props, manager, auxName, regionName ); MockAuxiliaryCache<String, String> result = (MockAuxiliaryCache<String, String>)aux;
IElementAttributes ea = parseElementAttributes( props, regName, ccm.getDefaultElementAttributes(), regionPrefix ); ? parseCompositeCacheAttributes(props, regName, ccm.getDefaultCacheAttributes(), regionPrefix) : cca; CompositeCache<K, V> cache = newCache(instantiationCca, ea); auxCache = parseAuxiliary( props, ccm, auxName, regName );
this.defaultCacheAttr = configurator.parseCompositeCacheAttributes( properties, "", new CompositeCacheAttributes(), DEFAULT_REGION ); this.defaultElementAttr = configurator.parseElementAttributes( properties, "", new ElementAttributes(), DEFAULT_REGION ); configurator.parseSystemRegions( properties, this ); configurator.parseRegions( properties, this );
IElementAttributes ea = parseElementAttributes( props, regName, regionPrefix ); ? new CompositeCache<K, V>( parseCompositeCacheAttributes( props, regName, regionPrefix ), ea ) : new CompositeCache<K, V>( cca, ea ); auxCache = parseAuxiliary( props, auxName, regName );
setDefaultAuxValues( properties ); setDefaultCompositeCacheAttributes( properties ); setDefaultElementAttributes( properties ); parseSystemRegions( properties ); parseRegions( properties );
CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( this ); cache = configurator.parseRegion( this.getConfigurationProperties(), cattr.getCacheName(), this.defaultAuxValues, cattr );
/** * Create cache region. *<p> * @param props * @param regName * @param value * @return CompositeCache */ protected <K, V> CompositeCache<K, V> parseRegion( Properties props, String regName, String value ) { return parseRegion( props, regName, value, null, REGION_PREFIX ); }
/** * Configure the cache using the supplied properties. * <p> * @param props assumed not null */ private void doConfigure( Properties props ) { // We will expose this for managers that need raw properties. this.configurationProperties = props; // set the props value and then configure the ThreadPoolManager ThreadPoolManager.setProps( props ); ThreadPoolManager poolMgr = ThreadPoolManager.getInstance(); if ( log.isDebugEnabled() ) { log.debug( "ThreadPoolManager = " + poolMgr ); } // configure the cache CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( this ); configurator.doConfigure( props ); isConfigured = true; }
CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( manager ); AuxiliaryCache<String, String> aux = configurator.parseAuxiliary( props, auxName, regionName ); MockAuxiliaryCache<String, String> result = (MockAuxiliaryCache<String, String>)aux;
/** * Create cache region. *<p> * @param props Configuration properties * @param ccm Cache hub * @param regName Name of the cache region * @param auxiliaries Comma separated list of auxiliaries * * @return CompositeCache */ protected <K, V> CompositeCache<K, V> parseRegion( Properties props, CompositeCacheManager ccm, String regName, String auxiliaries ) { return parseRegion( props, ccm, regName, auxiliaries, null, REGION_PREFIX ); }
/** * Get all the properties for a region and configure its cache. * <p> * This method tells the other parse method the name of the region prefix. *<p> * @param props * @param regName * @param value * @param cca * @return CompositeCache */ protected <K, V> CompositeCache<K, V> parseRegion( Properties props, String regName, String value, ICompositeCacheAttributes cca ) { return parseRegion( props, regName, value, cca, REGION_PREFIX ); }
/** * Get an ICompositeCacheAttributes for the listed region. *<p> * @param props Configuration properties * @param regName the region name * @param defaultCCAttr the default cache attributes * * @return ICompositeCacheAttributes */ protected ICompositeCacheAttributes parseCompositeCacheAttributes( Properties props, String regName, ICompositeCacheAttributes defaultCCAttr ) { return parseCompositeCacheAttributes( props, regName, defaultCCAttr, REGION_PREFIX ); }
/** * Get all the properties for a region and configure its cache. * <p> * This method tells the other parse method the name of the region prefix. *<p> * @param props Configuration properties * @param ccm Cache hub * @param regName Name of the cache region * @param auxiliaries Comma separated list of auxiliaries * @param cca Cache configuration * * @return CompositeCache */ protected <K, V> CompositeCache<K, V> parseRegion( Properties props, CompositeCacheManager ccm, String regName, String auxiliaries, ICompositeCacheAttributes cca ) { return parseRegion( props, ccm, regName, auxiliaries, cca, REGION_PREFIX ); }
/** * Set the default CompositeCacheAttributes for new caches. *<p> * @param props */ protected void setDefaultCompositeCacheAttributes( Properties props ) { ICompositeCacheAttributes icca = parseCompositeCacheAttributes( props, "", CompositeCacheConfigurator.DEFAULT_REGION ); compositeCacheManager.setDefaultCacheAttributes( icca ); log.info( "setting defaultCompositeCacheAttributes to " + icca ); }
/** * Create caches used internally. System status gives them creation priority. *<p> * @param props Configuration properties * @param ccm Cache hub */ protected void parseSystemRegions( Properties props, CompositeCacheManager ccm ) { for (String key : props.stringPropertyNames() ) { if ( key.startsWith( SYSTEM_REGION_PREFIX ) && key.indexOf( "attributes" ) == -1 ) { String regionName = key.substring( SYSTEM_REGION_PREFIX.length() ); String auxiliaries = OptionConverter.findAndSubst( key, props ); ICache<?, ?> cache; synchronized ( regionName ) { cache = parseRegion( props, ccm, regionName, auxiliaries, null, SYSTEM_REGION_PREFIX ); } ccm.addCache( regionName, cache ); } } }
/** * Create caches used internally. System status gives them creation priority. *<p> * @param props */ protected <K, V> void parseSystemRegions( Properties props ) { Enumeration<?> en = props.propertyNames(); while ( en.hasMoreElements() ) { String key = (String) en.nextElement(); if ( key.startsWith( SYSTEM_REGION_PREFIX ) && key.indexOf( "attributes" ) == -1 ) { String regionName = key.substring( SYSTEM_REGION_PREFIX.length() ); String value = OptionConverter.findAndSubst( key, props ); ICache<K, V> cache; synchronized ( regionName ) { cache = parseRegion( props, regionName, value, null, SYSTEM_REGION_PREFIX ); } compositeCacheManager.addCache( regionName, cache ); } } }
/** * Parse region elements. *<p> * @param props */ protected <K, V> void parseRegions( Properties props ) { List<String> regionNames = new ArrayList<String>(); Enumeration<?> en = props.propertyNames(); while ( en.hasMoreElements() ) { String key = (String) en.nextElement(); if ( key.startsWith( REGION_PREFIX ) && key.indexOf( "attributes" ) == -1 ) { String regionName = key.substring( REGION_PREFIX.length() ); regionNames.add( regionName ); String auxiliaryList = OptionConverter.findAndSubst( key, props ); ICache<K, V> cache; synchronized ( regionName ) { cache = parseRegion( props, regionName, auxiliaryList ); } compositeCacheManager.addCache( regionName, cache ); } } if ( log.isInfoEnabled() ) { log.info( "Parsed regions " + regionNames ); } }