/** * Set the default aux list for new caches. * <p> * @param props */ protected void setDefaultAuxValues( Properties props ) { String value = OptionConverter.findAndSubst( DEFAULT_REGION, props ); compositeCacheManager.setDefaultAuxValues(value); if ( log.isInfoEnabled() ) { log.info( "Setting default auxiliaries to " + value ); } }
/** * Set the properties for the object that match the <code>prefix</code> passed as parameter. * <p> * @param properties The new properties value * @param prefix The new properties value */ public void setProperties( Properties properties, String prefix ) { int len = prefix.length(); for ( Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) { String key = (String) e.nextElement(); // handle only properties that start with the desired prefix. if ( key.startsWith( prefix ) ) { // ignore key if it contains dots after the prefix if ( key.indexOf( '.', len + 1 ) > 0 ) { //System.err.println("----------Ignoring---["+key // +"], prefix=["+prefix+"]."); continue; } String value = OptionConverter.findAndSubst( key, properties ); key = key.substring( len ); setProperty( key, value ); } } }
/** * Set the properties for the object that match the <code>prefix</code> passed as parameter. * <p> * @param properties The new properties value * @param prefix The new properties value */ public void setProperties( Properties properties, String prefix ) { int len = prefix.length(); for ( Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) { String key = (String) e.nextElement(); // handle only properties that start with the desired prefix. if ( key.startsWith( prefix ) ) { // ignore key if it contains dots after the prefix if ( key.indexOf( '.', len + 1 ) > 0 ) { //System.err.println("----------Ignoring---["+key // +"], prefix=["+prefix+"]."); continue; } String value = OptionConverter.findAndSubst( key, properties ); key = key.substring( len ); setProperty( key, value ); } } }
/** * Creates an object for the className value of the key. * * @param props * @param key * @param defaultValue * @return Object that was created */ public static <T> T instantiateByKey( Properties props, String key, T defaultValue ) { // Get the value of the property in string form String className = findAndSubst( key, props ); if ( className == null ) { if ( log.isTraceEnabled() ) { log.info( "Could not find value for key " + key ); } return defaultValue; } // Trim className to avoid trailing spaces that cause problems. return OptionConverter.instantiateByClassName( className.trim(), defaultValue ); }
/** * Creates an object for the className value of the key. * <p> * @param props * @param key * @param defaultValue * @return Object that was created */ public static <T> T instantiateByKey( Properties props, String key, T defaultValue ) { // Get the value of the property in string form String className = findAndSubst( key, props ); if ( className == null ) { if ( log.isTraceEnabled() ) { log.info( "Could not find value for key " + key ); } return defaultValue; } // Trim className to avoid trailing spaces that cause problems. return OptionConverter.instantiateByClassName( className.trim(), defaultValue ); }
/** * 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 ); } } }
/** * 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 ); } } }
/** * 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 ); } }
/** * Parse region elements. *<p> * @param props Configuration properties * @param ccm Cache hub */ protected void parseRegions( Properties props, CompositeCacheManager ccm ) { List<String> regionNames = new ArrayList<String>(); for (String key : props.stringPropertyNames() ) { if ( key.startsWith( REGION_PREFIX ) && key.indexOf( "attributes" ) == -1 ) { String regionName = key.substring( REGION_PREFIX.length() ); regionNames.add( regionName ); String auxiliaries = OptionConverter.findAndSubst( key, props ); ICache<?, ?> cache; synchronized ( regionName ) { cache = parseRegion( props, ccm, regionName, auxiliaries ); } ccm.addCache( regionName, cache ); } } if ( log.isInfoEnabled() ) { log.info( "Parsed regions " + regionNames ); } }
this.defaultAuxValues = OptionConverter.findAndSubst( CompositeCacheManager.DEFAULT_REGION, properties );