org.bibalex.daf.entities.job
Class UploadingState

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

public class UploadingState
extends JobState

This class contains the logic necessary to upload the job. Calling makeTransition method will cause the job to be uploaded.

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  int noOfFiles
           
private  Phase phase
           
private  java.lang.String source
           
private  boolean uploadWholeFolder
           
private  User user
           
private  WorkStation workstation
           
 
Constructor Summary
UploadingState(Job job, User user, WorkStation workstation, boolean uploadWholeFolder)
          Creates a new instance of UploadingState.
 
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 upload the job.
 boolean makeTransition()
          Uploads the job from the user's workstation to the server.
Note: Uploading the job is recorded in the database.
 
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

noOfFiles

private int noOfFiles

uploadWholeFolder

private boolean uploadWholeFolder

errorMessage

private java.lang.String errorMessage
Constructor Detail

UploadingState

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

Parameters:
job - The job to upload.
user - The user who is uploading the job.
workstation - The workstation from which the job will be uploaded.
uploadWholeFolder - True to upload the whole folder. False to upload the folders matching the phase definition.
Throws:
java.lang.Exception - If the information necessary to upload 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 upload the job.

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

makeTransition

public boolean makeTransition()
Uploads the job from the user's workstation to the server.
Note: Uploading the job is recorded in the database.

Specified by:
makeTransition in class JobState
Returns:
True if the job has been uploaded 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