|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bibalex.daf.entities.phase.PhaseAction org.bibalex.daf.entities.phase.PhysicalAction
public class PhysicalAction
Responsible for applying the physical actions associted with a phase.
Field Summary | |
---|---|
private ActionContext |
context
The context of the action, i.e. |
private PhysicalDef |
definition
Holds the PhysicalDef that will be used when applying the action. |
private java.lang.String |
destinationParent
The destination of the job folder excluding the folder name. |
private FileHandler |
handler
The FileHandler used to create and copy files and folders. |
private java.lang.String |
jobFolder
Holds the name of the job folder. |
private int |
noOfFiles
Holds the number of files affected by the action. |
private java.lang.String |
sourceParent
The source of the job folder excluding the folder name. |
private java.util.Date |
startDate
The date at which the job started with the user. |
Constructor Summary | |
---|---|
PhysicalAction(PhysicalDef definition,
FileHandler handler,
java.lang.String source,
java.lang.String jobFolder,
java.lang.String destination,
ActionContext context,
java.util.Date startDate)
Create a new instance of PhysicalAction. |
Method Summary | |
---|---|
void |
applyAction()
Applies the action. |
private boolean |
copyFiles(java.lang.String source,
FileElement file,
java.lang.String destination)
Copies the files from source to destination. Note: The context determines whether the files will be uploaded or downloaded. |
private boolean |
copyFolder(java.lang.String source,
FolderElement folder,
java.lang.String destination)
Creates the folder then uploads or downloads it. |
private boolean |
createFolder(java.lang.String parentFolder,
java.lang.String folderName,
FileHandler handler)
Creates the folder at the given parent folder. |
int |
getNoOfFiles()
Gets the number of files affected by the action. |
private void |
manageFolder(FolderElement folder,
java.lang.String source,
java.lang.String destination)
Applies the action to the given folder. |
private void |
manageRoot(FolderElement root,
java.lang.String source,
java.lang.String destination)
Manages the root separately because it is a special case. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private PhysicalDef definition
private FileHandler handler
private java.lang.String sourceParent
private java.lang.String destinationParent
private java.lang.String jobFolder
private ActionContext context
private int noOfFiles
private java.util.Date startDate
Constructor Detail |
---|
public PhysicalAction(PhysicalDef definition, FileHandler handler, java.lang.String source, java.lang.String jobFolder, java.lang.String destination, ActionContext context, java.util.Date startDate)
definition
- The PhysicalDef to be applied.handler
- The FileHandler used to create and copy files and folders.
It should be an FTP implementation since files and folders are copied between the server and the local workstation.source
- The source of the job folder excluding the name of the folder. It can be a local or FTP path.destination
- The destination of the job folder excluding the name of the folder. It can be a local or FTP path.jobFolder
- The name of the job folder.context
- The context of the action.startDate
- The start date.Method Detail |
---|
public void applyAction() throws PhaseActionException
applyAction
in class PhaseAction
PhaseActionException
- If the action fails.private void manageRoot(FolderElement root, java.lang.String source, java.lang.String destination) throws PhaseActionException
root
- A FolderElement representing the root which this the job folder.source
- The physical folder that represents the source folder containing the job folder.destination
- The physical folder that represents the destination folder that will contain the job folder.
PhaseActionException
- If a folder couldn't be managed.private void manageFolder(FolderElement folder, java.lang.String source, java.lang.String destination) throws PhaseActionException
folder
- The FolderElement whose subfolders and subfiles are being examined.source
- The source of the parent of the given folder. Concatenate the 'folder.name' to get the full path.destination
- The destination of the parent of the given folder. Concatenate the 'folder.newName' to get the full path.
PhaseActionException
- If a folder couldn't be managed.private boolean copyFiles(java.lang.String source, FileElement file, java.lang.String destination)
source
- The source folder.file
- The FileElement to be copied.destination
- The destination folder.
private boolean copyFolder(java.lang.String source, FolderElement folder, java.lang.String destination)
source
- The source path of the parent of the given folder. This could be a remote or a local path.folder
- The folder being copied.destination
- The destination path of the parent of the given folder. This could be a remote or a local path.
Files will be read only if they are copied from the server to the local workstation only.
private boolean createFolder(java.lang.String parentFolder, java.lang.String folderName, FileHandler handler)
parentFolder
- The parent folder.folderName
- The folder to createhandler
- The handler to use
public int getNoOfFiles()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |