/** * 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 ); }
/** * This is an extension point. The manager and other classes will only create * RemoteHttpCacheClient through this method. * <p> * @param cattr * @return IRemoteHttpCacheClient */ protected <K, V> IRemoteHttpCacheClient<K, V> createRemoteHttpCacheClientForAttributes( RemoteHttpCacheAttributes cattr ) { IRemoteHttpCacheClient<K, V> client = OptionConverter.instantiateByClassName( cattr .getRemoteHttpClientClassName(), null ); if ( client == null ) { if ( log.isInfoEnabled() ) { log.info( "Creating the default client." ); } client = new RemoteHttpCacheClient<K, V>( ); } client.initialize( cattr ); return client; }
/** * This is an extension point. The manager and other classes will only create * RemoteHttpCacheClient through this method. * @param cattr the cache configuration * @return the client instance */ protected <V, K> IRemoteHttpCacheClient<K, V> createRemoteHttpCacheClientForAttributes(RemoteHttpCacheAttributes cattr) { IRemoteHttpCacheClient<K, V> remoteService = OptionConverter.instantiateByClassName( cattr .getRemoteHttpClientClassName(), null ); if ( remoteService == null ) { if ( log.isInfoEnabled() ) { log.info( "Creating the default client for " + cattr.getCacheName()); } remoteService = new RemoteHttpCacheClient<K, V>( ); } remoteService.initialize( cattr ); return remoteService; }