You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by pn...@scancoin.se on 2003/12/17 09:42:50 UTC

SV: [MERLIN]How to get a global lookup for services/components?

Hi Stephen,
thanks for the fast reply.
The scenarion we are dealing with is the exposure of components via
managers, such as XML-RPC and JMX. We looked at the XMLRPC component in
jakarta-fulcrum. There are no meta-tags or xinfo files in the source, e.g.
it's just a plain avalon component. Now, the configuration looks like
 <XmlRpcComponent>
      <!-- Port on which the XML-RPC server will listen for
           incoming connections -->
      <port>12345</port>
      <!-- Parser implementation to use -->
      <parser>org.apache.xerces.parsers.SAXParser</parser>
<handlers>
    <handler>
        <name>MyComponentHandler</name>
        <role>com.company.MyComponent</role>
    </handler>
    <handler>
        <name>MyObjectHandler</name>
        <class>com.company.MyObject</class>
    </handler>
  </handlers>
</XmlRpcComponent>

When you give it a role as the handler, the XmlRpcComponent tries to look up
that in the service manager:
/**
     * Helper that registers a component as a handler with the specified
     * handler name.
     *
     * @param handlerName The name to register this handle as.
     * @param handlerRole The role of the component serving as the handler.
     * @exception Exception If the component could not be looked up.
     */
    private void registerComponentHandler(String handlerName,
                                          String handlerRole)
        throws Exception
    {
        registerHandler(handlerName, manager.lookup(handlerRole));
        getLogger().info("registered: " + handlerName + " with component: "
                + handlerRole);
    }

In the class case, the class is just instantiated and registered which works
fine. It seems that the role scenario will not work.

The framework-implementation of the ServiceManager exposes the  public void
put( final String key, final Object object ) method so these managers are
modifyable by the component I guess, but it seems you had an intention with
that.

Btw, I found exactly that problem in this mail:
http://www.mail-archive.com/dev@avalon.apache.org/msg10550.html

Has anything happened to the finder-nature of a blokc, and how do get to the
context to use the resove() functionality for a lightweight lookup?


Thanks

/peter

> -----Ursprungligt meddelande-----
> Från: Stephen McConnell [mailto:mcconnell@apache.org]
> Skickat: den 16 december 2003 19:32
> Till: Avalon Developers List
> Ämne: Re: [MERLIN]How to get a global lookup for services?
> 
> 
> 
> Hi Peter:
> 
> See notes in-line.
> 
> 
> pnb@scancoin.se wrote:
> 
> >Hi,
> >we are looking a bit closer at the service configuration of 
> Merlin. It seems
> >that every component get's it's own ServiceManager that provides the
> >declared dependencies to the component.
> >
> >Is there a way to look up components at runtime, e.g. by
> >"container/component", that are not in the ServiceManager? 
> >
> 
> No.
> 
> The keys handled by the the service manager are aligned directly with 
> the @avalon.dependency tags for the component to which the service 
> manager is assigned.
> 
> >Or is JNDI etc. used for that?
> >
> >It seems that in the block.xml you can only override already declared
> >dependencies, not insert any new ones?
> >
> 
> Correct.
> 
> If you were inserting new deependecies - you would do this at 
> the level 
> of the type (i.e. under the xinfo - or equivalent 
> @avalon.dependency). 
> If your component needs to aquire something dynamic - then your 
> component should be declaring a dependency on some 
> application specific 
> finder service.  The implementation of that finder service 
> could do some 
> intertesting things with an embedded kernel - but that's 
> another thread.
> 
> >How can you add a dependency after the SM is finished (e.g. when the
> >configuration on a component is called?)
> >
> 
> You cannot - you can only get the depedency you declare at 
> the level of 
> the type.
> This is intentional - if you want to step outside of this 
> constraint you 
> need to be thinking about a service that provides the discovery 
> semantics that you are thinking of.
> 
> What is the "discovery scenario" your dealing with?
> 
> Cheers, Steve.
> 
> 
> >
> >Thanks
> >
> >/peter
> >
> >------------
> >Peter Neubauer
> >Software Manager
> >ScanCoin AB
> >Jägershillgatan 26
> >213 75 Malmö /Sweden
> >
> >Phone:  +46 40 6000 687
> >mail: pnb@scancoin.se 
> >
> >  
> >
> >-------------------------------------------------------------
> -----------
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> >For additional commands, e-mail: dev-help@avalon.apache.org
> >
> 
> -- 
> 
> Stephen J. McConnell
> mailto:mcconnell@apache.org
> 
> |------------------------------------------------|
> | Magic by Merlin                                |
> | Production by Avalon                           |
> |                                                |
> | http://avalon.apache.org/merlin                |
> | http://dpml.net/                               |
> |------------------------------------------------|
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> For additional commands, e-mail: dev-help@avalon.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org