-----Original Message----- From: Olaf Bergner [mailto:[EMAIL PROTECTED] Sent: Thursday, January 01, 2004 4:34 PM
The solution (that will let you get back to normal code and avoid reflection) is to declare a factory. So instead of using the repository package to load merlin you should use the repository package to load your own factory. The repository package will then create the classloader you need with everything in it and your dependencies in project.xml can be reduced down to nothing more than avalon-repository-main.
Thanks. I'll give it a try. Yet I think I'll have to get my head around some of the deeper merlin/repository mysteries first. Do I understand you correctly in that you are talking about replacing
Artifact artifact = DefaultBuilder.createImplementationArtifact( classloader, getMerlinHome(), getBaseDirectory(), MERLIN_PROPERTIES, IMPLEMENTATION_KEY);
String[] hosts = getHosts();
InitialContext context = new DefaultInitialContext(repository, hosts);
Builder builder = new DefaultBuilder(context, artifact); m_classloader = builder.getClassLoader(); Factory factory = builder.getFactory();
where artifact represents a merlin kernel with some code so that artifact represents a merlin kernel *factory*? But as soon as I switch from using reflection in my testcase to the 'normal' way, e.g. as soon as I do something like
final Kernel meLovelyKernel = (Kernel) factory.create(criteria);
I'll be back to where I came from: maven's got to see the Kernel interface, and thus merlin-api's got to be in project.xml. Or did I get it all wrong? Please bear with me, but I definitely want to get this one straight since it's really been bothering me for quite a while.
Oh, I see. You were talking about *implementation* classes being present on the maven classloader, right? Only those could lead to the scenario you described above. As long as I only code against the API I'll be safe. Is this what you told me in your mail?
Yep!
Take for example avalon-framework-impl, if that's in project.xml it means that everything referenced by the framework must be in project.xml which means logkit must be in there, and anything in kernel that may reference logkit (which includes the composition implementation then has to move to project.xml, and then anything that referenced the composition impl has to move, etc., etc.
Steve.
Thanks for your efforts,
Olaf
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- |------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/ | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
