ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject Re: [myrmidon] declaring roles in typelibs
Date Wed, 30 Jan 2002 09:12:27 GMT

On Wed, 30 Jan 2002 00:15, Adam Murdoch wrote:
> I'm looking at how we might allow typelibs to declare custom roles.  The
> reason is so that types/tasks in a typelib can use the new
> add(RoleInterface) configuration methods, for roles declared in the
> typelib.

How do you intend to solve the ClassLoader problem - namely can a role only 
be used by types in the same type library?

> Most of this is already done, I just wanted to double-check that it is a
> reasonable plan:
> * Add RoleManager.addNameRoleMapping(), so that the deployer can create
> roles.


> * Move DefaultRoleManager.initialize() and DefaultDeployer.initialize(),
> into a new method Deployer.deployFromResources( ClassLoader ).  This would
> be used by DefaultEmbeddor to deploy from lib/*.jar and lib/*.zip (that is,
> from the context classloader at that point).


> * DefaultDeployer adds the roles from a typelib, on the first import from a
> typelib.  This would happen for the first of any of the deployX( ) methods.

Something "smells" about this but I can't put my finger on it ;)

> There's a few other related changes:
> * Change DefaultDeployer to keep track of the ClassLoader for each typelib,
> to reuse them across multiple imports from the same typelib.  The plan is
> to push all classloader creation into DefaultDeployer, then later extract
> out a general-purpose ClassLoaderManager component/service.

+10000 ;)

> * Change AbstractTypeDef and ConverterDef to use the Deployer to add
> converters and types.

As long as they can still construct their own ClassLoaders and explicitly 
pass in their own registrations. ie If Want to compile atask and then can't 
bothered to create an antlib I still want to be able to taskdef it?

> * Add TypeManager.registerType( Class roleInterface, String typeName,
> TypeFactory factory ), to avoid the type manager having to deal with
> classloaders to find the role interface.

+0.5 Though something feels a bit icky about this too ;) I think I just have 
an extreme allergy to passing around Class objects after being burned several 
times in the past after doing so ;)



 Mark Twain: "In the real world, the right thing never
happens in the right place at the right time. It is 
the task of journalists and historians to rectify 
this error."

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message