Hi Greg:
The DefaultEmbeddedKernel class is very close to termination in favour of a *much* cleaner embedding approach. To get an idea of the direction things are going, take a look at the avalon-sandbox/kernel project. In there you will find a test subdirectory with a single testcase and a properties file.
From MerlinEmbeddedTest:
//
// create a reference to the application you
// want to load (in this case its merlin)
//
Artifact artifact = Artifact.createArtifact( "merlin", "merlin-impl", "3.2-dev" );
//
// establish an initial repository context during // which we supply the cache directory and the // set of remote hosts
//
InitialContext context = new DefaultInitialContext( getMavenRepositoryDirectory(),
getDefaultHosts() );
//
// create a factory for the application and from
// the factory get the initial criteria which is // fully prepared with defaults for everything
//
Builder builder = new DefaultBuilder( context, artifact ); Factory factory = builder.getFactory(); Map criteria = factory.createDefaultCriteria();
//
// The applyLocalProperties method simply looks for // a "merlin.properties" file in the Maven basedir // and sets any merlin properties before passing the // criteria argument to the factory
//
applyLocalProperties( criteria );
Object app = factory.create( criteria );
The object returned above is a full merlin kernel. The other side of the contract is the properties that you can set on the criteria returned from the factory. Here is the list of properties listed by the testcase:
${merlin.override} == null
${merlin.autostart} == true
${merlin.deployment} == [Ljava.net.URL;@135605a
${merlin.repository} == C:\WINNT\Profiles\mcconnell\.avalon
${merlin.home} == C:\merlin
${merlin.kernel} == file:/C:/merlin/config/kernel.xml
${merlin.anchor} == F:\dev\avalon-sandbox\kernel\test
${merlin.debug} == false
${merlin.temp} == C:\TEMP
${merlin.server} == true
${merlin.config} == C:\merlin\config
${merlin.context} == F:\dev\avalon-sandbox\kernel\home
${merlin.system} == C:\merlin\system
${merlin.dir} == F:\dev\avalon-sandbox\kernel
${merlin.info} == trueThe above approach to embedding will be replacing the current embedded approaches across all of the embedded scenarios that exists today.
Cheers, Stephen.
Messner, Greg wrote:
I am planning on embedding Merlin in an application framework we are developing. The framework will provide support for server applications as well as both Swing and CLI applications.
I'm thinking about basing my embedded kernel on org.apache.avalon.merlin.unit.DefaultEmbeddedKernel, mainly because it was the only thing I could locate that seemed appropriate for embedding. Are there any other classes or projects that might provide an example of how to embed Merlin? Or even better is there a kernel already designed to be embedded that I just have not located?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Stephen J. McConnell mailto:[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]
