Albert Zhou wrote:
>I'm new to the avalon framework. Please bear with me.
>
>I'm thinking of using merlin2 to build an application
>with the following
>services/components:
>0. application
>1. model
>2. controller
>3. view
>
>An application container is also created to manage
>these components. For a
>standalone application, these components all reside in
>the container. In other
>scenarios, the view part will be split from the
>model/controller part, ie, they
>will stay in separate containers. This means another
>component, eventsysem,
>will be used by the controller and the view to
>communicate with each other.
>
>I do expect various implementations of these
>components are used for different
>scenarios.
>
>This is the skeleton of the startup.xml file:
><kernel>
>...
> <component name="es" class="DefaultEventSystem"
>activation="startup">
> </component>
> <container name="ac" class="ApplicationContainer">
> <component name="controller"
> class="DefaultController"
> enabled="true"
> activation="true">
> </component>
> <component name="model"
> class="DefaultModel"
> enabled="true"
> activation="true">
> </component>
> <component name="view"
> class="DefaultView"
> enabled="true"
> activation="true">
> </component>
> </container>
>...
></kernel>
>
>Here are some of my questions.
>1. It appears that I need to first start the
>eventsystem in the root container,
> ie, outside of the application container. Am I on
>the right track?
>
Yes - the current container model requires that shared componts/services
are at a higher level in the container hierachy. There is some work
in-progress concerning publication of services so that we can get better
seperation of the component implementation for the service access point
(but thats for later).
>
>2. How do I pass the eventsystem to the application,
>as a context,
> configuration, or parameter? Or should the
>eventsystem be a dependency of
> the application?
>
If the eventsystem is a component then you would typically declare this
as a dependency. It is also feasible to supply a object via the context
although this is not recommended practice (using the context constructor
arguments in the component profile) -
e.g.:
<context class="MyContextCLass">
<import name="avalon:home" key="base"/>
<entry key="location" value="Paris"/>
<entry key="special" class="MySpecialClass">
<parameter>hello</parameter>
</entry>
</context>
See also:
http://jakarta.apache.org/avalon/excalibur/merlin/api/
... merlin/model/ContextDirective.html
>
>3. How do I configure a non-default component,
>preferrably outside the
> startup.xml file?
>
You can do this (a) via reference, or (b) via packaging:
configuration reference
-----------------------
<container name=a-container">
<component name="my-component" class="MyComponentClass" >
<configuration src="../config/bySpecialExternalConfiguration.xml"/>
</component>
</container>
packaged configuration
----------------------
Just include the configuration as an <classname>.xconfig file
in the same package as the class.
Cheers, Steve.
>
>Thanks for your help.
>
>Cheers,
>Albert
>
>=====
>Regards,
>Albert
>
>__________________________________________________
>Do you Yahoo!?
>New DSL Internet Access from SBC & Yahoo!
>http://sbc.yahoo.com
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
--
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]>