If I understand your problem correctly you are disturbed as to what is
Merlin's equivalent of the main method. While it is correct that the
activation flag tells Merlin when to deploy a component it's got nothing to
do with determining the entry point of a whole application. This is indeed
something to confuse the uninitiated. I think you are looking for a
component implementing the org.apache.avalon.framework.activity.Startable or
the org.apache.avalon.framework.activity.Executable interface. IIRC the
contract surrounding these interfaces states that Startable's start() resp.
Executable's execute() method will be called immediately after deploying the
component. These methods are meant to start resp. execute a component and
thus probably come closest to what you are looking for. To make it very
clear: you won't find what you are looking for in any block.xml or other
config file. This knowledge is implicit in the source code, not explicit in
some config file.

That being said it seems - after a rather quick and casual glance at the
source for OpenIM - that in this case the whole thing starts in
net.java.dev.openim.IMServerImpl's initialize() method where the necessary
server sockets are created and bound to the IMServer. I think this is not
the pure gospel, but then again I don't know that much about the Avalon
framework.

So returning to your question: the Avalon framework defines a well-known
lifecycle for components, i.e. it states which methods defined in its
lifecycle interfaces are called in which order. So if you want to start your
application you've got to utilize this knowledge and put your start logic in
an appropriate method in one of your components of which you are certain
that it will be called by the container. I think start() in Startable resp.
execute() in Executable are meant for this purpose but I have found that
people tend to rather use initialize() in Initializable.

Hope this answers your question.

Cheers,

Olaf

> -----Original Message-----
> From: Nader Aeinehchi [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 09, 2004 2:11 PM
> To: [EMAIL PROTECTED]
> Subject: Entry point in block.xml in Merlin
>
>
> Hi
>
> I am trying to understand what the entry point in a block.xml is.
>
> For example, I looket at OpenIM that is built upon Merlin. OpenIM
> is launched with:
>
> merlin .... openim\jars\openim-server-impl-1.2.jar
>
> Now when I look at the block.xml filen within the above jar file,
> I find lots of component definition, but I cannot see which
> component is launched first.
>
> Please help.
>
> Thanks.
>
>
> See the enclosed block.xml from openim.
>
> Best Regards
>
> --
> Nader Aeinehchi
> Aasenhagen 66 E
> 2020 Skedsmokorset
> NORWAY
> Direct and Mobile +47 41 44 29 57
> Tel (private): +47 64 83 09 08
> Fax +47 64 83 08 07
> www.aeinehchi.com
>
>
>
> <container name="openim">
>
>    <services>
>      <service type="net.java.dev.openim.SimpleMessageRouter">
>        <source>SimpleMessageRouter</source>
>      </service>
>    </services>
>
>    <categories>
>      <category name="threads/classloader/scanner" priority="ERROR"/>
>    </categories>
>
>    <!--
>    Block implementation.
>    -->
>    <classloader>
>      <classpath>
>        <repository>
>            <!-- OpenIM -->
>            <resource id="openim:openim-server-api" version="1.2"/>
>            <resource id="openim:openim-storage-api" version="1.2"/>
>            <resource id="openim:openim-storage-impl" version="1.2"/>
>            <resource id="openim:openim-users-manager-api" version="1.3"/>
>            <resource id="openim:openim-users-manager-impl" version="1.3"/>
>
>            <!-- XPP -->
>            <resource id="kxml2:kxml2" version="2.1.8"/>
>
>            <!-- Commons -->
>            <resource id="commons-lang:commons-lang" version="1.0.1"/>
>            <resource id="commons-collections:commons-collections"
> version="2.1"/>
>
>            <!-- Avalon -->
>            <resource id="avalon-framework:avalon-framework-api"
> version="4.1.5"/>
>            <resource id="avalon-framework:avalon-framework-impl"
> version="4.1.5"/>
>
>            <!-- Cornerstone -->
>            <resource
> id="cornerstone-threads:cornerstone-threads-api" version="1.0"/>
>
>            <resource
> id="cornerstone-sockets:cornerstone-sockets-api" version="1.0"/>
>
>            <resource
> id="cornerstone-connection:cornerstone-connection-api" version="1.0"/>
>            <resource
> id="cornerstone-connection:cornerstone-connection-impl" version="1.0"/>
>
>            <resource
> id="cornerstone-scheduler:cornerstone-scheduler-api" version="1.0"/>
>
>            <resource
> id="cornerstone-datasources:cornerstone-datasources-api" version="1.0"/>
>
>            <!-- Excalibur -->
>            <resource id="excalibur-pool:excalibur-pool" version="1.2"/>
>            <resource id="excalibur-thread:excalibur-thread"
> version="1.1.1"/>
>            <resource id="excalibur:excalibur-collections" version="1.0"/>
>            <resource id="excalibur:excalibur-io" version="1.1"/>
>            <resource
> id="excalibur-concurrent:excalibur-concurrent" version="1.0"/>
>
>            <!-- XStream -->
>            <resource id="xstream:xstream" version="0.3"/>
>
>         </repository>
>      </classpath>
>    </classloader>
>
>
>    <include name="threads"
>        id="cornerstone-threads:cornerstone-threads-impl"
>        version="1.0"/>
>
>    <include name="sockets"
>        id="cornerstone-sockets:cornerstone-sockets-impl"
>        version="1.0">
>       <target path="manager">
>         <configuration>
>             <server-sockets>
>                 <factory name="plain"
>
> class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerS
> ocketFactory"/>
>                 <factory name="secure"
>
> class="org.apache.avalon.cornerstone.blocks.sockets.TLSServerSocke
> tFactory" >
>                    <ssl-factory>
>                     <keystore>
>                       <file>conf/keystore</file> <!-- keystore
> file location -->
>                       <password>openim</password> <!-- Key Store
> file password, only used to check keystore integrity -->
>                       <key-password>openim</key-password> <!--
> Only required when you need to decrypt a private key -->
>                       <type>JKS</type> <!-- Key Store file
> format, defaults to JKS -->
>                       <algorithm>SunX509</algorithm> <!--
> Cryptography provider ID, defaults to SunX509 -->
>                    </keystore>
>
>                    <!-- SSL protocol to use, defaults to TLS,
> another possible value is SSL -->
>                    <protocol>TLS</protocol>
>
>                  </ssl-factory>
>
>                    <timeout>0</timeout>
>                    <!-- With this option set to a non-zero
> timeout, a call to
>                      accept() for this ServerSocket will block
> for only this amount of
>                      time. If the timeout expires, a
> java.io.InterruptedIOException is
>                      raised, though the ServerSocket is still
> valid. Default value is 0. -->
>                    <authenticate-client>false</authenticate-client>
>                    <!-- Whether or not the client must present a
> certificate to
>                       confirm its identity. Defaults to false. -->
>                  </factory>
>             </server-sockets>
>
>             <client-sockets>
>                 <factory name="plain"
>
> class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketF
> actory"/>
>             </client-sockets>
>         </configuration>
>       </target>
>    </include>
>
>    <include name="scheduler"
>        id="cornerstone-scheduler:cornerstone-scheduler-impl"
>        version="1.0"/>
>
>    <include name="datasources"
>        id="cornerstone-datasources:cornerstone-datasources-impl"
>        version="1.0"/>
>
>
>   <include name="storage"
>         id="openim:openim-storage-impl" version="1.2"/>
>
>   <include name="users-manager"
>         id="openim:openim-users-manager-impl" version="1.3"/>
>
>
>
>
>    <component name="IMServer"
> class="net.java.dev.openim.IMServerImpl" activation="startup"/>
>    <component name="ServerParameters"
> class="net.java.dev.openim.ServerParametersImpl" activation="lazy"/>
>    <component name="IMConnectionHandler"
> class="net.java.dev.openim.IMConnectionHandlerImpl" activation="lazy"/>
>    <component name="IMPresenceHolder"
> class="net.java.dev.openim.IMPresenceHolderImpl" activation="lazy"/>
>    <component name="IMRouter"
> class="net.java.dev.openim.IMRouterImpl" activation="lazy"/>
>    <component name="S2SConnectorManager"
> class="net.java.dev.openim.S2SConnectorManagerImpl" activation="lazy"/>
>    <component name="S2SConnector"
> class="net.java.dev.openim.S2SConnectorImpl" activation="lazy"/>
>    <component name="SubscriptionManager"
> class="net.java.dev.openim.SubscriptionManagerImpl" activation="lazy"/>
>    <component name="ModuleManager"
> class="net.java.dev.openim.ModuleManagerImpl" activation="lazy"/>
>    <component name="SimpleMessageRouter"
> class="net.java.dev.openim.SimpleMessageRouterImpl" activation="lazy"/>
>
>    <component name="SessionsManager"
> class="net.java.dev.openim.session.SessionsManagerImpl"
> activation="lazy"/>
>    <component name="IMClientSession"
> class="net.java.dev.openim.session.IMClientSessionImpl"
> activation="lazy"/>
>    <component name="IMServerSession"
> class="net.java.dev.openim.session.IMServerSessionImpl"
> activation="lazy"/>
>
>    <component name="User"
> class="net.java.dev.openim.data.jabber.UserImpl" activation="lazy"/>
>    <component name="UsersManager"
> class="net.java.dev.openim.data.UsersManagerImpl" activation="lazy"/>
>
>    <component name="Streams"
> class="net.java.dev.openim.jabber.StreamsImpl" activation="lazy"/>
>    <component name="Error"
> class="net.java.dev.openim.jabber.ErrorImpl" activation="lazy"/>
>
>    <component name="client.Body"
> class="net.java.dev.openim.jabber.client.BodyImpl" activation="lazy"/>
>    <component name="client.Iq"
> class="net.java.dev.openim.jabber.client.IqImpl" activation="lazy"/>
>    <component name="client.Message"
> class="net.java.dev.openim.jabber.client.MessageImpl" activation="lazy"/>
>    <component name="client.Presence"
> class="net.java.dev.openim.jabber.client.PresenceImpl" activation="lazy"/>
>    <component name="client.Priority"
> class="net.java.dev.openim.jabber.client.PriorityImpl" activation="lazy"/>
>    <component name="client.Show"
> class="net.java.dev.openim.jabber.client.ShowImpl" activation="lazy"/>
>    <component name="client.Status"
> class="net.java.dev.openim.jabber.client.StatusImpl" activation="lazy"/>
>    <component name="client.Subject"
> class="net.java.dev.openim.jabber.client.SubjectImpl" activation="lazy"/>
>    <component name="client.Thread"
> class="net.java.dev.openim.jabber.client.ThreadImpl" activation="lazy"/>
>
>    <component name="iq.auth.Digest"
> class="net.java.dev.openim.jabber.iq.auth.DigestImpl" activation="lazy"/>
>    <component name="iq.auth.Password"
> class="net.java.dev.openim.jabber.iq.auth.PasswordImpl"
> activation="lazy"/>
>    <component name="iq.auth.Query"
> class="net.java.dev.openim.jabber.iq.auth.QueryImpl" activation="lazy"/>
>    <component name="iq.auth.Resource"
> class="net.java.dev.openim.jabber.iq.auth.ResourceImpl"
> activation="lazy"/>
>    <component name="iq.auth.Username"
> class="net.java.dev.openim.jabber.iq.auth.UsernameImpl"
> activation="lazy"/>
>
>    <component name="iq.browse.Query"
> class="net.java.dev.openim.jabber.iq.browse.QueryImpl" activation="lazy"/>
>
>    <component name="iq.search.Query"
> class="net.java.dev.openim.jabber.iq.search.QueryImpl" activation="lazy"/>
>
>    <component name="iq.oob.Query"
> class="net.java.dev.openim.jabber.iq.oob.QueryImpl" activation="lazy"/>
>
>    <component name="iq.jprivate.Query"
> class="net.java.dev.openim.jabber.iq.jprivate.QueryImpl"
> activation="lazy"/>
>
>    <component name="iq.register.Password"
> class="net.java.dev.openim.jabber.iq.register.PasswordImpl"
> activation="lazy"/>
>    <component name="iq.register.Query"
> class="net.java.dev.openim.jabber.iq.register.QueryImpl"
> activation="lazy"/>
>    <component name="iq.register.Username"
> class="net.java.dev.openim.jabber.iq.register.UsernameImpl"
> activation="lazy"/>
>    <component name="iq.register.Remove"
> class="net.java.dev.openim.jabber.iq.register.RemoveImpl"
> activation="lazy"/>
>
>    <component name="iq.roster.Group"
> class="net.java.dev.openim.jabber.iq.roster.GroupImpl" activation="lazy"/>
>    <component name="iq.roster.Item"
> class="net.java.dev.openim.jabber.iq.roster.ItemImpl" activation="lazy"/>
>    <component name="iq.roster.Query"
> class="net.java.dev.openim.jabber.iq.roster.QueryImpl" activation="lazy"/>
>
>    <component name="iq.vcardtemp.VCard"
> class="net.java.dev.openim.jabber.iq.vcardtemp.VCardImpl"
> activation="lazy"/>
>
>    <component name="server.Body"
> class="net.java.dev.openim.jabber.server.BodyImpl" activation="lazy"/>
>    <component name="server.Error"
> class="net.java.dev.openim.jabber.server.ErrorImpl" activation="lazy"/>
>    <component name="server.Iq"
> class="net.java.dev.openim.jabber.server.IqImpl" activation="lazy"/>
>    <component name="server.Message"
> class="net.java.dev.openim.jabber.server.MessageImpl" activation="lazy"/>
>    <component name="server.Presence"
> class="net.java.dev.openim.jabber.server.PresenceImpl" activation="lazy"/>
>    <component name="server.Priority"
> class="net.java.dev.openim.jabber.server.PriorityImpl" activation="lazy"/>
>    <component name="server.Show"
> class="net.java.dev.openim.jabber.server.ShowImpl" activation="lazy"/>
>    <component name="server.Status"
> class="net.java.dev.openim.jabber.server.StatusImpl" activation="lazy"/>
>    <component name="server.Subject"
> class="net.java.dev.openim.jabber.server.SubjectImpl" activation="lazy"/>
>    <component name="server.Thread"
> class="net.java.dev.openim.jabber.server.ThreadImpl" activation="lazy"/>
>
>    <component name="server.dialback.Result"
> class="net.java.dev.openim.jabber.server.dialback.ResultImpl"
> activation="lazy"/>
>    <component name="server.dialback.Verify"
> class="net.java.dev.openim.jabber.server.dialback.VerifyImpl"
> activation="lazy"/>
>
>    <component name="MessageLogger"
> class="net.java.dev.openim.log.MessageLoggerImpl" activation="lazy"/>
>    <component name="MessageRecorder"
> class="net.java.dev.openim.log.MessageRecorderImpl" activation="lazy"/>
>
> </container>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to