avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinay <vinay...@yahoo.com>
Subject [merlin.patch] Verification of Lifecycle extension by DefaultTypeRepository
Date Mon, 14 Jul 2003 06:43:43 GMT
Patch to
org.apache.avalon.assembly.engine.impl.DefaultTypeRepository
to enable verification of presence of lifecycle 
extension interface(s) declared within the extension
descriptor.
Regards,
Vinay


=====================================================

64a65
> import
org.apache.avalon.meta.info.ExtensionDescriptor;
194c195
<         }
---
>         }
198c199
<               "Unexpected error while attempting to
build a type from the clas
sname: "
---
>               "Unexpected error while attempting to
build a type from the clas
sname: "
378a380,381
>         //verify existence of lifecyle extension
classes
>         Class[]
lifecycleExtensions=getExtensionClasses(type);
403c406
<                 list.add( getServiceClass(
services[i] ) );
---
>                 list.add( getServiceClass( service )
);
455a459,496
>
>       /**
>        * Return the set of lifecycle extension
classes provided by the given t
ype
>        * @param type the component type
>        * @return an array of classes represnting the
lifecycle extension inter
faces provided by the type
>        */
>       private Class[] getExtensionClasses( Type type
)
>       {
>               ArrayList list = new ArrayList();
>               ExtensionDescriptor[] extensions =
type.getExtensions();
>               for( int i = 0; i < extensions.length;
i++ )
>               {
>                       ExtensionDescriptor extension
= extensions[i];
>                       list.add( getExtensionClass(
extension ) );
>               }
>               return (Class[]) list.toArray( new
Class[0] );
>       }
>
>       /**
>        * Returns the lifecycle extension class
provided by the type.
>        * @param extension the lifecycle extension
type
>        * @return the class implementing the
extension type
>        * @exception TypeRuntimeException if a
classloader error occurs
>        */
>       private Class getExtensionClass(
ExtensionDescriptor extension ) throws
TypeRuntimeException
>       {
>               final String classname =
extension.getReference().getClassname()
;
>               try
>               {
>                       return
m_classloader.loadClass( classname );
>               } catch( Throwable e )
>               {
>                       final String error =
>                                       "Could not
load lifecycle extension clas
s of type: "
>                                       + classname;
>                       throw new
TypeRuntimeException( error, e );
>               }
>       }

=====================================================


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message