Igor Kozlov wrote:
Thanks for answer!The above context creation mechanism is limited to (a) importing context entries from the container - typically standard keys, and (b) constructor based context value creation directives.
SM> You can include anything derived from java.lang.Object.2. Can I add in context my own data differ from String type?
But how I can do this?
This from example:
<component name="basic-sample" class="org.apache.excalibur.playground.BasicComponent" activation="startup">
<categories priority="DEBUG">
<category priority="WARN" name="loader" />
</categories>
<context class="org.apache.excalibur.playground.BasicContext">
<entry key="location">My Place</entry>
<import name="avalon:home" key="home"/>
</context>
</component>
Key "location" is set to String and key "home" set to value from
parent context. And if I want set key "servletContext" to
HttpServletContext value - where I must do this?
Take a look at the javadoc for the Entry and Parameter classes:
http://jakarta.apache.org/avalon/sandbox/meta/api/org/apache/avalon/meta/model/Entry.html
http://jakarta.apache.org/avalon/sandbox/meta/api/org/apache/avalon/meta/model/Parameter.html
However, this will probably not meet you requirements (see note at end of emil).
When Merlin kernel initialize withThat's corect - what your looking at is internal context infomraiton which is totally different from the context information supplied to the component.
final DefaultController controller = new DefaultController();
DefaultContext context = new DefaultContext();
context.put( DefaultController.DIR_KEY, base );
context.put( DefaultController.PATH_KEY, filename );
context.makeReadOnly();
try
{
controller.contextualize( context );
controller.initialize();
controller.start();
}
catch( FileNotFoundException e )
{
}
<code>context</+code> don't pass to components as parent.....
Note: Following feedback from the list - I've restructured a lot of the assembly stuff to make it much easier to provide custom context to a component. This is still work in progress and will not be included in Merlin fro a couple more weeks. But when its done I'll be posting information here.
Cheers, Steve.
--
Stephen J. McConnell
OSM SARL
digital products for a global economy
mailto:[EMAIL PROTECTED]
http://www.osm.net
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
