|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bibalex.daf.entities.job.JobState org.bibalex.daf.entities.job.DownloadingState
public class DownloadingState
This class contains the logic necessary to download the job. Calling makeTransition method will cause the job to be downloaded.
Field Summary | |
---|---|
private java.lang.String |
destination
|
private boolean |
downloadWholeFolder
|
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 User |
user
|
private WorkStation |
workstation
|
Constructor Summary | |
---|---|
DownloadingState(Job job,
User user,
WorkStation workstation,
boolean downloadWholeFolder)
Creates a new instance of DownloadingState. |
Method Summary | |
---|---|
private PhaseDef |
getDownloadPhaseDef()
Gets the phase definition used to download the job. |
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 download the job. |
boolean |
makeTransition()
Downloads the job from the user's workstation to the server. Note: Downloading the job is recorded in the database. |
private int |
similarFolderIndex(FolderElement[] folders,
FolderElement folder)
Determines whether the given folder matches a folder in the given array or not. A folder is said to be similar to another folder if the "Name" and "NewName" attributes are the same. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Job job
private User user
private WorkStation workstation
private TransitionInfo info
private Phase phase
private FileHandler ftpHandler
private java.lang.String source
private java.lang.String destination
private int noOfFiles
private boolean downloadWholeFolder
private java.lang.String errorMessage
Constructor Detail |
---|
public DownloadingState(Job job, User user, WorkStation workstation, boolean downloadWholeFolder) throws java.lang.Exception
job
- The job to download.user
- The user who is downloading the job.workstation
- The workstation to which the job will downloaded.downloadWholeFolder
- True to download the whole folder. False to download the folders matching the phase definition.
java.lang.Exception
- If the information necessary to download the job cannot be obtained.Method Detail |
---|
public java.lang.String getName()
getName
in class JobState
public int getNoOfFiles()
getNoOfFiles
in class JobState
public boolean makeTransition()
makeTransition
in class JobState
private PhaseDef getDownloadPhaseDef()
Problem:
In a certain phase, the pre-phase downloads the OTIFF and PTIFF folders to the user and the post-phase
uploads the PTIFF and TXT folders from the user.
In order to download the job, we apply the pre-phase actions followed by the post-phase which results in
the PTIFF folder downloaded twice.
Resolution:
We need to mix the pre-phase defintion and the post-phase defintion and remove any duplicate nodes.
Note:
Since each folder has a "Name" and a "NewName" attribute, folders in the post-phase need to have
their "Name" and "NewName" swapped.
For instance if we are uploading a folder named "Client_PTIFF" to a folder named "Server_PTIFF", then
when downloading we need to download the folder "Server_PTIFF" to "Client_PTIFF".
The returned PhaseDef, if any, will have the following characteristics:
1) The pre-phase physical section doesn't have any repeated nodes, thus no folder is allowed twice.
2) It pre-phase doesn't contain any reflection or database sections.
3) The post-phase defintion will have the "Name" and "NewName" values swapped.
private int similarFolderIndex(FolderElement[] folders, FolderElement folder)
folders
- The folders to search in.folder
- The folder to search for.
public java.lang.String getErrorMessage()
JobState
getErrorMessage
in class JobState
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |