>Also - what is the embedding scenario?
>Merlin CLI or something special? >If its something special - what is in the classloader that is launching Merlin.
Hi, (and thanks for interest /regards Peter)
This is the java source for the embedding part (as by the example for embedded use)
--- start snippet package com.euronetics.cappuccino;
import java.io.File; import java.util.Map;
import org.apache.avalon.repository.Artifact; import org.apache.avalon.repository.provider.Builder; import org.apache.avalon.repository.provider.Factory; import org.apache.avalon.repository.provider.InitialContextFactory; import org.apache.avalon.repository.provider.InitialContext; import org.apache.avalon.repository.main.DefaultInitialContextFactory;
/**
* An example of the embedding of a merlin kernel inside a main
* method. The objective of the example is to demonstrate a
* simple embedded scenario.
*/
public class Cappuccino
{
public static void main( String[] args ) throws Exception
{
//
// Create the initial context factory. This establishes
// the application group from which properties will
// be resolved. It also provides operations supporting
// customization of the application environment.
// InitialContextFactory initial =
new DefaultInitialContextFactory( "merlin" );
File home = initial.getHomeDirectory();
initial.setCacheDirectory( new File( home, "system" ) );
InitialContext context = initial.createInitialContext(); //
// Using the initial context we can now load any repository
// application using an artifact specification. Meta
// information associated with the artifact is used to
// construct the classloader that the application needs in
// order to execute.
// // String spec = "artifact:merlin/merlin-impl#3.3-SNAPSHOT";
String group = "merlin";
String id = "merlin-impl";
String version = "3.3-SNAPSHOT";
// Artifact artifact = Artifact.createArtifact( spec );
Artifact artifact = Artifact.createArtifact(group, id, version);
Builder builder = context.newBuilder( artifact ); //
// With the classloader established we can go ahead and
// and get the application factory. The factory has already
// been parameterized with defaults derived from properties
// based on the application group. We can provide
// overriding values by setting the factory criteria to
// application specific values following which we instantiate
// the application.
// Factory factory = builder.getFactory();
Map criteria = factory.createDefaultCriteria();
criteria.put( "merlin.server", "false" );
factory.create( criteria );
System.out.println("Merlin kernel established for Cappuccino");
}
}
--- end snippetand here comes the bootstrap script
--- start snippet #!/bin/sh
# CLASSPATH
MAVEN_REPOSITORY=/home/petje/.maven/repository
AVALON_REPOSITORY_API=${MAVEN_REPOSITORY}/avalon-repository/jars/avalon-repository-api-2.0-SNAPSHOT.jar
AVALON_REPOSITORY_IMPL=${MAVEN_REPOSITORY}/avalon-repository/jars/avalon-repository-impl-2.0-SNAPSHOT.jar
AVALON_REPOSITORY_MAIN=${MAVEN_REPOSITORY}/avalon-repository/jars/avalon-repository-main-2.0-SNAPSHOT.jar
AVALON_REPOSITORY_SPI=${MAVEN_REPOSITORY}/avalon-repository/jars/avalon-repository-spi-2.0-SNAPSHOT.jar
AVALON_UTIL_I18N=${MAVEN_REPOSITORY}/avalon-util/jars/avalon-util-i18n-1.0.0.jar
AVALON_FRAMEWORK_API=${MAVEN_REPOSITORY}/avalon-framwork/jars/avalon-framework-api-SNAPSHOT.jar
CAPPUCCINO=/home/petje/cappuccino/target/classesCLASSPATH=${AVALON_REPOSITORY_API}:${AVALON_REPOSITORY_IMPL}:${AVALON_REPOSITORY_MAIN}:${AVALON_REPOSITORY_SPI}:${AVALON_UTIL_I18N}:${AVALON_FRAMEWORK_API}:${CAPPUCCINO}# EXECUTING CLASS CLASS=com.euronetics.cappuccino.Cappuccino
echo Starting Cappuccino with...
echo Classpath=${CLASSPATH}
echo Class=${CLASS}java -cp ${CLASSPATH} ${CLASS}---- stop snippet
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
