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: InfoMover Interfaces: the Proposals
Date Fri, 16 Aug 2002 20:16:02 GMT
> From: Nicola Ken Barozzi [mailto:nicolaken@apache.org] 
> 
> Berin Loritsch wrote:

<snip/>

> > ---------------- From Me (Third Version) --------------
> > 
> > interface Input
> > {
> >     Transaction getNextTransaction();
> > }
> > 
> > interface Output
> > {
> >     Response process( Transaction trans );
> > }
> > 
> > interface Manipulator
> > {
> >     Transaction manipulate( Transaction trans );
> > }
> > 
> > ----------------- NOTES -------------------
> 
> First not from me... at a first glance I don't get it... 
> ...thinking... ...but it seems that you have solved the 
> threadsafe problem by putting 
> the extra methods needed to setup first and then execute in different 
> objects... interesting...
> 
> So instead of having one object with three methods to call in 
> order, we 
> have three objects each with an atomic method.

Yes. Think of the Job as the MorphPipeline so to speak.  It forwards
stuff on to the next stage.

> 
> I'm still not sure if this is clever or just illusionism 8-) 
> but still 
> thinking...

Here is the processing loop in code:

---------------------------------------------------------------------

Transaction transaction = null;

while ( ( transaction = m_input.getNextTransaction() ) != null )
{
    Iterator it = m_manipulators.iterator();

    while ( it.hasNext() )
    {
        Manipulator manipulator = (Manipulator) it.next();
        transaction = manipulator.process( transaction );

        if ( ! transaction.isSuccessful() )
        {
            m_notifier.notify( transaction.getResponse() );
            break;
        }
    }

    if ( transaction.isSuccessful() )
    {
        m_notifier.notify( m_output.process( transaction ) );
    }
}

---------------------------------------------------------------------

Another alternative is to have the Input return a TransactionIterator
or something like that.


--
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