avalon-apps-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@apache.org>
Subject RE: Proposed interfaces for InfoMover
Date Fri, 16 Aug 2002 14:43:15 GMT
> From: kevin.s.ruland@mail.sprint.com 
> 
> Berin,
> 
> Are you planning on using Avalon lifecycle management functions for 
> each of
> these components?  If so, then implementors of Input could be 
> Startable 
> and
> start() method would begin the processing for the pipeline.  
> This would 
> allow
> the various components to be configured in any order.


We are absolutely using lifecycle management functions for the
components--but keep in mind that they have no bearing on the
interface.  Also, start() is part of the initialization phase
of the component, so it is called before we are ever ready to
use the component.  It would be an improper use of the lifecycle
interface to call it directly.


> Where would the Notifier get plugged in?  Would each 
> implementor of Input could have an optional Notifier.  In 
> it's "main loop" (whatever 
> actually
> sends transactions down the pipeline), it would then do 
> something like:
> 
> while( more_stuff_to_process() ) {
> 
>   Transaction t = get_next_transaction_to_process();
> 
>   m_Notifier.handleResponse( m_Output.processTransaction( t ));
> 
> }

That would be correct.

> 
> Or would the impelmentors Inputs also implement Notifier?

No.  That would artificially tie Inputs to Notification styles,
so that would be bad.  If we want to change an existing notification
type for a Job, we need to be able to do it on the fly.

An Input would be Serviceable:

abstract class AbstractInput implements Serviceable
{
    protected ServiceManager m_manager;

    public void service( ServiceManager manager )
        throws ServiceException
    {
        m_manager = manager;

        if ( ! m_manager.hasService( Notifier.ROLE ) )
        {
            throw new ServiceException ( Notifier.ROLE, "Cannot get a
Notifier" );
        }
    }
}


When we really need the Notifier we perform this approach:

Notifier notifier = null;

try
{
     notifier = (Notifier) m_manager.lookup( Notifier.ROLE );
}
catch (ServiceException se)
{}

while ( transIterator.hasNext() )
{
    Transaction trans = (Transaction) transIterator.hasNext();
    notifier.handleResponse( m_destination.processTransaction( trans );
}


--
To unsubscribe, e-mail:   <mailto:avalon-apps-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-apps-dev-help@jakarta.apache.org>


Mime
View raw message