Hi All, esp. the Leo's! :)

Thanks guys for widing my perspectives on how to create components within 
Avalon :)

I'll give the various approaches a go and see which one works best in my
particular application.

Cheers,

Marcus

On Mon, Jul 28, 2003 at 10:49:20AM +0200, Leo Simons wrote:
> Marcus Crafter wrote:
> >On Fri, Jul 25, 2003 at 11:09:46AM -0400, Berin Loritsch wrote:
> >
> >Currently I have a component requires a URI location to work, it has
> >4 or so methods in it's interface, each of them need the remote URI 
> >location
> >for the methods to work. At the moment I specify the URI location 
> >as a parameter to each method, something like:
> >
> >interface Component {
> >
> >     void doOp1(URI uri);
> >     void doOp2(URI uri);
> >     void doOp3(URI uri);
> >     void dpOp4(URI uri);
> >}
> >
> >Ideally I'd like to be able to specify the URI once, and then be able to 
> >call the methods, outside of Avalon you'd do something like:
> >
> >Component c = new Component("http://host/location/";);
> >c.doOp1();
> >....
> >c.doOp2();
> >
> >as a constructor parameter.
> 
> think of seperating various types of constructor arguments for your comp 
> into the comp configuration, the comp dependencies, etc etc. The URI is 
> logically part of the client component configuration, right? Jason van 
> Zyl did this in plexus with the Configurator pattern:
> 
> interface ServiceBroker extends ServiceManager
> {
>       Object lookup( String role, Configuration configuration );
> }
> 
> the easy way out is to not make everything into an avalon component, but 
> have an avalon component provide you with the worker class:
> 
> interface MyComponentManager
> {
>       String ROLE = MyComponentManager.class.getName();
>       Component newInstance( String URI );
> }
> 
> mcm = (MyComponentManager)m_sm.lookup( MyComponentManager.ROLE );
> component = mcm.newInstance( m_configuration
>       .getchild( "component-uri" ).getValue() );
> 
> the clean way out is probably to use a lifecycle extension to decorate 
> your component with transaction support and make the client component 
> configuration part of the transaction state.
> 
> 
> cheers!
> 
> 
> - Leo
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

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

Reply via email to