Author: mcconnell Date: Thu Jun 10 09:06:54 2004 New Revision: 21015 Modified: avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/ComplexComponent.java avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/basic/BasicComponent.java Log: Updating the playground test (housekeeping).
Modified: avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/ComplexComponent.java ============================================================================== --- avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/ComplexComponent.java (original) +++ avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/ComplexComponent.java Thu Jun 10 09:06:54 2004 @@ -61,9 +61,9 @@ /** * @avalon.logger name="internal" - * @avalon.dependency key="simple" - * type="org.apache.avalon.test.playground.basic.BasicService" * @avalon.dependency key="basic" + * type="org.apache.avalon.test.playground.basic.BasicService" version="1.1" + * @avalon.dependency key="simple" * type="org.apache.avalon.test.playground.SimpleService" */ public ComplexComponent( Logger logger, ServiceManager manager ) throws ServiceException @@ -75,8 +75,33 @@ // lookup the primary service // - m_simple = (SimpleService) m_manager.lookup( "simple" ); - m_basic = (BasicService) m_manager.lookup( "basic" ); + Object simple = null; + try + { + simple = m_manager.lookup( "simple" ); + m_simple = (SimpleService) simple; + } + catch( ClassCastException cce ) + { + final String error = + "Container supplied service for the key 'simple' is not an instance of SimpleService: [" + + simple.getClass().getName() + + ", " + + simple.toString() + + "]."; + throw new ServiceException( "simple", error, cce ); + } + + try + { + m_basic = (BasicService) m_manager.lookup( "basic" ); + } + catch( ClassCastException cce ) + { + final String error = + "Container supplied service for the key 'basic' is not an instance of BasicService."; + throw new ServiceException( "simple", error, cce ); + } Logger child = getLogger().getChildLogger( "internal" ); if( child.isInfoEnabled() ) Modified: avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/basic/BasicComponent.java ============================================================================== --- avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/basic/BasicComponent.java (original) +++ avalon/trunk/runtime/test/playground/src/main/org/apache/avalon/test/playground/basic/BasicComponent.java Thu Jun 10 09:06:54 2004 @@ -35,10 +35,12 @@ * <code>BasicService</code> interface and has no dependencies. * * @avalon.component name="basic" lifestyle="singleton" + * @avalon.service type="org.apache.avalon.test.playground.basic.BasicService" * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> */ public class BasicComponent extends AbstractLogEnabled - implements Contextualizable, Configurable, Initializable, Startable, Disposable, BasicService, NullService + implements Contextualizable, Configurable, Initializable, + Startable, Disposable, BasicService, NullService { private String m_location; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]