Igor Kozlov wrote:

Thanks for answer!


2. Can I add in context my own data differ from String type?


SM> You can include anything derived from java.lang.Object.

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?

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.

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 with

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.....

That's corect - what your looking at is internal context infomraiton which is totally different from the context information supplied to the component.
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]>

Reply via email to