/** * Configure specified object if it implements the * {@link Configurable} interface. * * @param object the object to Start * @param configuration the configuration object to use during * configuration. May be null in which case the specified object * must not implement Configurable * @throws ConfigurationException if there is a problem Configuring object, * or the object is Configurable but Configuration is null * @throws IllegalArgumentException if the object is Configurable but * Configuration is null */ public static void configure( final Object object, final Configuration configuration ) throws ConfigurationException { if( object instanceof Configurable ) { if( null == configuration ) { final String message = "configuration is null"; throw new IllegalArgumentException( message ); } ( (Configurable)object ).configure( configuration ); } }
((Configurable) this.node).configure(config);
((Configurable) component).configure(configuration);
((Configurable) component).configure(configuration);
( (Configurable)m_loggermanager ).configure( configuration.getChildren()[ 0 ] );
/** * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration configuration) throws ConfigurationException { Object rawInstance = this.getRawInstance(false); if( rawInstance instanceof Configurable ) { try { this.getParentLogger().debug( "Configurable.configure() for " + this.getShorthand() ); ((Configurable) rawInstance).configure(configuration); } catch (ConfigurationException e) { String msg = "Configuring the following service failed : " + this.getShorthand(); this.getParentLogger().error(msg,e); throw e; } catch (Throwable t) { String msg = "Configuring the following service failed : " + this.getShorthand(); this.getParentLogger().error(msg,t); throw new ConfigurationException(msg,t); } } }
/** * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) * * @param configuration the configuration * @throws ConfigurationException if fails to contextualize the config */ public void configure(Configuration configuration) throws ConfigurationException { Object rawInstance = this.getRawInstance(false); if( rawInstance instanceof Configurable ) { try { this.getParentLogger().debug( "Configurable.configure() for " + this.getShorthand() ); ((Configurable) rawInstance).configure(configuration); } catch (ConfigurationException e) { String msg = "Configuring the following service failed : " + this.getShorthand(); this.getParentLogger().error(msg,e); throw e; } catch (Throwable t) { String msg = "Configuring the following service failed : " + this.getShorthand(); this.getParentLogger().error(msg,t); throw new ConfigurationException(msg,t); } } }