org.bibalex.daf.entities.job
Class StartingState

java.lang.Object
  extended by org.bibalex.daf.entities.job.JobState
      extended by org.bibalex.daf.entities.job.StartingState

public class StartingState
extends JobState

This class contains the logic necessary to start the job. Calling makeTransition method will cause the job to be started. Note: The transaction log entry that the job points to, doesn't hold the phase in which the job will start. It might contain the phase the job has just eneded, so we need to get the next phase.

Author:
Shehab.Kamal

Field Summary
private  java.lang.String destination
           
private  java.lang.String errorMessage
           
private  FileHandler ftpHandler
           
private  TransitionInfo info
           
private  Job job
           
private  Phase phase
           
private  java.lang.String source
           
private  User user
           
private  WorkStation workstation
           
 
Constructor Summary
StartingState(Job job, User user, WorkStation workstation)
          Creates a new instance of StartingState.
 
Method Summary
 java.lang.String getErrorMessage()
          This method gets the mesage that is to be displaed to the user
 java.lang.String getName()
          Gets the name of the state.
 int getNoOfFiles()
          Gets the number of files required to be transferred in order to start the job.
 boolean makeTransition()
          Starts the job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

job

private Job job

user

private User user

workstation

private WorkStation workstation

info

private TransitionInfo info

phase

private Phase phase

ftpHandler

private FileHandler ftpHandler

source

private java.lang.String source

destination

private java.lang.String destination

errorMessage

private java.lang.String errorMessage
Constructor Detail

StartingState

public StartingState(Job job,
                     User user,
                     WorkStation workstation)
              throws java.lang.Exception
Creates a new instance of StartingState.

Parameters:
job - The job to start.
user - The user who is starting the job.
workstation - The workstation on which the job will start.
Throws:
java.lang.Exception - If the information necessary to start the job cannot be obtained.
Method Detail

getName

public java.lang.String getName()
Gets the name of the state.

Specified by:
getName in class JobState
Returns:
The name of the state.

getNoOfFiles

public int getNoOfFiles()
Gets the number of files required to be transferred in order to start the job.

Specified by:
getNoOfFiles in class JobState
Returns:
The number of files to start the job.

makeTransition

public boolean makeTransition()
Starts the job. In order to start a job the following actions take place: 0) Assign the job to the user if it is not already assigned. 1) Perform the pre-phase checks. 2) Perform the pre-phase actions. 3) Propagate the status data. 4) Adjust the job status in the database by calling Job_Start.

Specified by:
makeTransition in class JobState
Returns:
True if the job has been started successfully otherwise false.

getErrorMessage

public java.lang.String getErrorMessage()
Description copied from class: JobState
This method gets the mesage that is to be displaed to the user

Specified by:
getErrorMessage in class JobState
Returns:
The error message to be dispalayed to the user