mcconnell 2002/12/16 21:00:59 Modified: assembly/src/java/org/apache/avalon/assembly/lifecycle/composition CompositionService.java DefaultCompositionService.java Log: Consolidates Composable and Serviceable under a single handler. Revision Changes Path 1.2 +2 -9 avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/composition/CompositionService.java Index: CompositionService.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/composition/CompositionService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CompositionService.java 29 Nov 2002 13:04:54 -0000 1.1 +++ CompositionService.java 17 Dec 2002 05:00:59 -0000 1.2 @@ -57,7 +57,7 @@ /** * A composition service is responsible for the assignment of of a component - * service depedencies vioa service or component managers. + * service depedencies via service or component managers. * * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a> * @version $Revision$ $Date$ @@ -71,12 +71,5 @@ * @param object the object to contextualize */ void service( Appliance appliance, Object object ) throws ServiceException; - - /** - * Runtime composition of a target object. - * @param appliance the appliance - * @param object the object to service - */ - public void compose( Appliance appliance, Object object ) throws ComponentException; } 1.3 +12 -22 avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/composition/DefaultCompositionService.java Index: DefaultCompositionService.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/composition/DefaultCompositionService.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultCompositionService.java 30 Nov 2002 18:12:06 -0000 1.2 +++ DefaultCompositionService.java 17 Dec 2002 05:00:59 -0000 1.3 @@ -51,6 +51,7 @@ package org.apache.avalon.assembly.lifecycle.composition; import org.apache.avalon.framework.component.Composable; +import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.WrapperComponentManager; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.Composable; @@ -100,30 +101,12 @@ "[" + appliance.getProfile().getName() + "]"; getLogger().debug( message ); } - DefaultServiceManager manager = new DefaultServiceManager( appliance ); + StandardServiceManager manager = new StandardServiceManager( appliance ); manager.enableLogging( getLogger().getChildLogger( "manager" ) ); ((Serviceable)object).service( manager ); } - } - - /** - * Runtime composition of a target object. - * @param appliance the appliance - * @param object the object to service - */ - public void compose( Appliance appliance, Object object ) throws ComponentException - { - if( appliance == null ) - { - throw new NullPointerException( "appliance" ); - } - if( object == null ) - { - throw new NullPointerException( "object" ); - } - - if( object instanceof Composable ) + else if( object instanceof Composable ) { if( getLogger().isDebugEnabled() ) { @@ -133,7 +116,14 @@ } DefaultServiceManager manager = new DefaultServiceManager( appliance ); manager.enableLogging( getLogger().getChildLogger( "manager" ) ); - ((Composable)object).compose( new WrapperComponentManager( manager ) ); + try + { + ((Composable)object).compose( new WrapperComponentManager( manager ) ); + } + catch( ComponentException e ) + { + throw new ServiceException( e.getKey(), e ); + } } } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>