Jakob Praher wrote:
hi merlin insiders,
I am just getting my hands dirty on writing a simple merlin block.
Here are some questions:
-> can any block act as root block?
Any block you care to define or that can be resolved from a target jar file, e.g. The following comand loads the <block/> defintion contained in block.xml as the root block within the kernel.
$ merlin block.xml
Another example - the following command loads a jar file and establishes a block by locating a block.xml inside the jar at the /block-inf/block.xml location:
$ merlin my-demo.jar
-> if not, what are the minimum requirements...
A minimal block:
<block> <implementation> <component name="fred"class="MyClass" activation="true"/> </implementation> </block>
-> afaik is that the default block is the one you pass to the merlin-cli Merlin.class - but:
in fact I don't understand why StandardBlockLoader doesn't throw, when
you don't have a child "engine" under "implementation" in your
block.xml.... .
The <engine/> tag simly defines a classloader (in fact the preferred tag name is <classloader/>). Merlin creates a root classloader which is used as the parent for the root block.
<snip>
Configuration classLoaderConfig = implementation.getChild( "classloader", false );
if( classLoaderConfig == null )
{
classLoaderConfig = implementation.getChild( "engine" );
}
/******* comment ::: ***********/
/* for my block the classLoaderConfig must be null, but this classLoaderConfig is used in createEngine, without null
checks .. */
The following method returns null (because of the false argument) if a <classloader/> element is not found.
implementation.getChild(
"classloader", false );In the case we check for the old fashioned usage of </engine> but because of the method used, the returned configuration will either be (a) the actual engine configuration framgement, or (b) a empty configuration. I.e. this code gurantees that you get a valid classloader defintion.
EngineClassLoader engine = createEngine( classLoaderConfig, path );
</snip>
-> After startup of a very simplistic block - just one component and a block meta data, I get a strange Exception with a stack trace like:
<snip> java.lang.IllegalArgumentException: commons-cli,excalibur-i18n-Extension-Name at java.util.jar.Attributes$Name.<init>(Attributes.java:434) at java.util.jar.Attributes.getValue(Attributes.java:97)
This is becuase you have built merlin partially with a non-patched version of Maven 9. Before you applied you patch to the jar plugin you seem to have already created some jar files - and the manifest declaration in those jar files are corrupted (mevan is delimited extension dependecies with a "," instead of " ". You should delete the maven/repository/avalon and maven/repository/merlin directories and your merlin installation and re-install.
the funny thing is that I actually don't declared these extension - where are their declared ? (looked at the kernel*.xinfo but couldn't find them ).
Maven declared that when you were playing around with the unpactch version (check you manifest declarations for extension dependecies - you should be able to spot the error).
-> What is the override configuration good for - the -cofnig file passt
to merlin - I assume that it is another block.xml file ?
Nope. Its a special configuration file containing a set of targets.
<targets>
<target path="/hello">
<configuration>
<source>External configuration target.</source>
</configuration>
</target>
</targets>Take a look at the tutorial in: merlin/merlin-platform/tutorials/configuration/override/.
-> stupid one: is there somewhere a more complex block example (perhaps in the sandbox-cvs - perhaps I overlooked it ;-) )
The merlin-platform/tutorials covers a lot of ground. There is also the james example in merlin-platform/examles/james/conf/block.xml (demonstrates multiple nest includes of block - i.e. block.xml includes james.xml, james.xml is a block that includes a bunch of cornerstone blocks.
Cheers, Steve.
--
Stephen J. McConnell mailto:[EMAIL PROTECTED] http://www.osm.net
Sent via James running under Merlin as an NT service. http://avalon.apache.org/sandbox/merlin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
