001    /**
002     * Property of Hammurapi Group
003     */
004    package com.hammurapi.flow.runtime;
005    
006    import java.io.Serializable;
007    import java.util.Collection;
008    import java.util.List;
009    import java.util.concurrent.Callable;
010    import java.util.concurrent.Future;
011    
012    import com.hammurapi.util.Context;
013    
014    
015    /**
016     * Provides invocation details for Java methods and is also used
017     * for invocation serialization.
018     * @author Pavel
019     * @param <S> Flow state type.
020     * @param <A> Argument type.
021     */
022    public interface Invocation<S, A> extends Serializable {
023            
024            /**
025             * Result of invocation
026             * @author Pavel Vlasov
027             *
028             */
029            interface InvocationResult extends Callable<Collection<Future<?>>>, Serializable {
030    
031            }
032            
033            /**
034             * Implementations set this constant to provide methods access
035             * to properties and context in implementation-neutral way. 
036             */
037            Invocation<?, ?> INSTANCE = Util.loadService(Invocation.class);
038            
039            /**
040             * @return Properties.
041             */
042            PropertySet getProperties();
043            
044            /**
045             * @return Invocation context.
046             */
047            Context getContext();
048            
049            /**
050             * @return processing path.
051             */
052            List<ProcessingPathElement> getProcessingPath();
053            
054            /**
055             * @return Arguments.
056             */
057            A[] getArguments();
058            
059            /**
060             * @return Flow state - a shared object available to all invocations.
061             */
062            S getFlowState();
063    }