// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstance.java
// public interface FlowInstance extends FlowInstanceDescriptor, FlowInstanceTransitioner {
// 
//     FlowInstanceDescriptor getFlowInstanceDescriptor();    
// }
// 
// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstanceDescriptor.java
// public interface FlowInstanceDescriptor {
// 
//     String getFlowDefinitionId();
// 
//     String getStateDefinitionId();
// 
//     void setStateDefinitionId(String stateDefinitionId);
// 
//     void setFlowDefinitionId(String flowDefinitionId);
// 
//     void setDateEntered(Date date);
// 
//     Date getDateEntered();
// 
//     boolean isWithTimeouts();
// 
//     void setWithTimeouts(boolean hasTimeouts);
//     
// }
// 
// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstanceDescriptorCreator.java
// public interface FlowInstanceDescriptorCreator {
// 
//     /**
//      * Returns a fully constructed and initialized instance of the {@link org.springframework.extensions.workflow.instance.FlowInstanceDescriptor}
//      * @return The FlowInstanceDescriptor instance
//      */
//     FlowInstanceDescriptor create();
// 
// }
// 
// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstanceDescriptorInitializer.java
// public interface FlowInstanceDescriptorInitializer {
// 
//     /**
//      * Perform any custom initialization of the <code>flowInstanceDescriptor</code>.
//      * @param flowInstanceDescriptor An existing instance of FlowInstanceDescriptor subclass.
//      */
//     void initialize(FlowInstanceDescriptor flowInstanceDescriptor);
// 
// }


import org.springframework.extensions.workflow.instance.FlowInstance;
import org.springframework.extensions.workflow.instance.FlowInstanceDescriptor;
import org.springframework.extensions.workflow.instance.FlowInstanceDescriptorCreator;
import org.springframework.extensions.workflow.instance.FlowInstanceDescriptorInitializer;
package org.springframework.extensions.workflow.instance.session;


/**
 * This interface provides methods to interact with the {@link FlowInstance}s.
 * Typically, the FlowSession instances will be Spring beans and you will
 * call its methods to obtain the <code>FlowInstance</code>s.
 * @author janm
 */
public interface FlowSession {

    /**
     * Starts a flow with the given <code>id</code>. The implementation will find
     * a Spring-registred {@link org.springframework.extensions.workflow.FlowDefinition} whose
     * <code>id</code> matches the argument. If no such flow is found,
     * the method will throw {@link org.springframework.extensions.workflow.NoSuchFlowDefinitionException}.
     * This method will not initialize the {@link org.springframework.extensions.workflow.instance.FlowInstanceDescriptor}
     * attached to the <code>FlowDefinition</code>, it will only call its default constructor. To create the descriptor
     * yourself, call {@link #start(String, org.springframework.extensions.workflow.instance.FlowInstanceDescriptorCreator)};
     * to perform custom initialization on an instance of the <code>FlowInstanceDescriptor</code>,
     * call {@link #start(String, org.springframework.extensions.workflow.instance.FlowInstanceDescriptorInitializer)}
     * @param id The identity of the flow, never <code>null</code>
     * @return The FlowInstance at the starting state
     */
    FlowInstance start(String id);

    /**
     * Starts a flow with the given <code>id</code>. The implementation will find
     * a Spring-registred {@link org.springframework.extensions.workflow.FlowDefinition} whose
     * <code>id</code> matches the argument. If no such flow is found,
     * the method will throw {@link org.springframework.extensions.workflow.NoSuchFlowDefinitionException}.
     * The method will call <code>instanceDescriptorCreator.create()</code> to obtain an
     * instance of the <code>FlowInstanceDescriptor</code> for this flow instance.
     * @param id The identity of the flow, never <code>null</code>
     * @param instanceDescriptorCreator The implementaiton of the FlowInstanceDescriptorCreator, never <code>null</code>
     * @return The FlowInstance at the starting state
     */
    FlowInstance start(String id, FlowInstanceDescriptorCreator instanceDescriptorCreator);

    /**
     * Starts a flow with the given <code>id</code>. The implementation will find
     * a Spring-registred {@link org.springframework.extensions.workflow.FlowDefinition} whose
     * <code>id</code> matches the argument. If no such flow is found,
     * the method will throw {@link org.springframework.extensions.workflow.NoSuchFlowDefinitionException}.
     * The method will call <code>instanceDescriptorInitialize.initialize(FlowInstanceDescriptor)</code> to
     * perform additional initialization of the <code>FlowInstanceDescriptor</code> subclass
     * associated with the <code>FlowDefinition</code>.
     * @param id The identity of the flow, never <code>null</code>
     * @param instanceDescriptorInitializer The implementation of the FlowInstanceDescriptorInitializer, never <code>null</code>
     * @return The FlowInstance at the starting state
     */
    FlowInstance start(String id, FlowInstanceDescriptorInitializer instanceDescriptorInitializer);

    /**
     * Returns a {@link FlowInstance} for the given {@link org.springframework.extensions.workflow.instance.FlowInstanceDescriptor}.
     * This allows you to "step into" the flow -- the <code>FlowInstanceDescriptor</code> carries, amongst other properties,
     * the identity of the current state.<br/>
     * Typically, you will use this method to get the <code>FlowInstance</code> for
     * the <code>FlowInstanceDescriptor</code> you obtained from a database lookup, for instance.
     * @param descriptor The FlowInstanceDescriptor instance, never <code>null</code>
     * @return The FlowInstance at the appropriate state
     */
// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstance.java
// public interface FlowInstance extends FlowInstanceDescriptor, FlowInstanceTransitioner {
// 
//     FlowInstanceDescriptor getFlowInstanceDescriptor();    
// }
// 
// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstanceDescriptor.java
// public interface FlowInstanceDescriptor {
// 
//     String getFlowDefinitionId();
// 
//     String getStateDefinitionId();
// 
//     void setStateDefinitionId(String stateDefinitionId);
// 
//     void setFlowDefinitionId(String flowDefinitionId);
// 
//     void setDateEntered(Date date);
// 
//     Date getDateEntered();
// 
//     boolean isWithTimeouts();
// 
//     void setWithTimeouts(boolean hasTimeouts);
//     
// }
// 
// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstanceDescriptorCreator.java
// public interface FlowInstanceDescriptorCreator {
// 
//     /**
//      * Returns a fully constructed and initialized instance of the {@link org.springframework.extensions.workflow.instance.FlowInstanceDescriptor}
//      * @return The FlowInstanceDescriptor instance
//      */
//     FlowInstanceDescriptor create();
// 
// }
// 
// Path: src/main/java/org/springframework/extensions/workflow/instance/FlowInstanceDescriptorInitializer.java
// public interface FlowInstanceDescriptorInitializer {
// 
//     /**
//      * Perform any custom initialization of the <code>flowInstanceDescriptor</code>.
//      * @param flowInstanceDescriptor An existing instance of FlowInstanceDescriptor subclass.
//      */
//     void initialize(FlowInstanceDescriptor flowInstanceDescriptor);
// 
// }


// Path: src/main/java/org/springframework/extensions/workflow/instance/session/FlowSession.java
import org.springframework.extensions.workflow.instance.FlowInstance;
import org.springframework.extensions.workflow.instance.FlowInstanceDescriptor;
import org.springframework.extensions.workflow.instance.FlowInstanceDescriptorCreator;
import org.springframework.extensions.workflow.instance.FlowInstanceDescriptorInitializer;

package org.springframework.extensions.workflow.instance.session;


/**
 * This interface provides methods to interact with the {@link FlowInstance}s.
 * Typically, the FlowSession instances will be Spring beans and you will
 * call its methods to obtain the <code>FlowInstance</code>s.
 * @author janm
 */
public interface FlowSession {

    /**
     * Starts a flow with the given <code>id</code>. The implementation will find
     * a Spring-registred {@link org.springframework.extensions.workflow.FlowDefinition} whose
     * <code>id</code> matches the argument. If no such flow is found,
     * the method will throw {@link org.springframework.extensions.workflow.NoSuchFlowDefinitionException}.
     * This method will not initialize the {@link org.springframework.extensions.workflow.instance.FlowInstanceDescriptor}
     * attached to the <code>FlowDefinition</code>, it will only call its default constructor. To create the descriptor
     * yourself, call {@link #start(String, org.springframework.extensions.workflow.instance.FlowInstanceDescriptorCreator)};
     * to perform custom initialization on an instance of the <code>FlowInstanceDescriptor</code>,
     * call {@link #start(String, org.springframework.extensions.workflow.instance.FlowInstanceDescriptorInitializer)}
     * @param id The identity of the flow, never <code>null</code>
     * @return The FlowInstance at the starting state
     */
    FlowInstance start(String id);

    /**
     * Starts a flow with the given <code>id</code>. The implementation will find
     * a Spring-registred {@link org.springframework.extensions.workflow.FlowDefinition} whose
     * <code>id</code> matches the argument. If no such flow is found,
     * the method will throw {@link org.springframework.extensions.workflow.NoSuchFlowDefinitionException}.
     * The method will call <code>instanceDescriptorCreator.create()</code> to obtain an
     * instance of the <code>FlowInstanceDescriptor</code> for this flow instance.
     * @param id The identity of the flow, never <code>null</code>
     * @param instanceDescriptorCreator The implementaiton of the FlowInstanceDescriptorCreator, never <code>null</code>
     * @return The FlowInstance at the starting state
     */
    FlowInstance start(String id, FlowInstanceDescriptorCreator instanceDescriptorCreator);

    /**
     * Starts a flow with the given <code>id</code>. The implementation will find
     * a Spring-registred {@link org.springframework.extensions.workflow.FlowDefinition} whose
     * <code>id</code> matches the argument. If no such flow is found,
     * the method will throw {@link org.springframework.extensions.workflow.NoSuchFlowDefinitionException}.
     * The method will call <code>instanceDescriptorInitialize.initialize(FlowInstanceDescriptor)</code> to
     * perform additional initialization of the <code>FlowInstanceDescriptor</code> subclass
     * associated with the <code>FlowDefinition</code>.
     * @param id The identity of the flow, never <code>null</code>
     * @param instanceDescriptorInitializer The implementation of the FlowInstanceDescriptorInitializer, never <code>null</code>
     * @return The FlowInstance at the starting state
     */
    FlowInstance start(String id, FlowInstanceDescriptorInitializer instanceDescriptorInitializer);

    /**
     * Returns a {@link FlowInstance} for the given {@link org.springframework.extensions.workflow.instance.FlowInstanceDescriptor}.
     * This allows you to "step into" the flow -- the <code>FlowInstanceDescriptor</code> carries, amongst other properties,
     * the identity of the current state.<br/>
     * Typically, you will use this method to get the <code>FlowInstance</code> for
     * the <code>FlowInstanceDescriptor</code> you obtained from a database lookup, for instance.
     * @param descriptor The FlowInstanceDescriptor instance, never <code>null</code>
     * @return The FlowInstance at the appropriate state
     */
    FlowInstance find(FlowInstanceDescriptor descriptor);