|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bibalex.daf.entities.phase.PhysicalElement org.bibalex.daf.entities.phase.FileElement
public class FileElement
Represents the file definition within the physical section of a phase.
The FileElement capabilities are not limited to parsing XML and converting it to an object.
The following are also included:
1) Count the number of the files that match the definition in a given folder. See getFilesCount()
.
2) Copy the files that match the defintion form a given folder to another. See uploadFiles()
and downloadFiles()
.
3) Get the number of modified files after a given date. See getModifiedFilesCount()
Field Summary | |
---|---|
boolean |
checkName
The 'CheckName' property of the element. |
java.lang.String |
checkPattern
The 'CheckPattern' of the element. |
java.lang.String |
compare
The 'Compare' property of the element. |
java.lang.String |
count
The 'Count' property of the element. |
java.lang.String |
name
The 'Name' property of the element. |
boolean |
toDestination
The 'ToDestination' property of the element. |
java.lang.String |
type
The 'Type' property of the element. |
Constructor Summary | |
---|---|
FileElement()
Creates a new instance of FileElement. |
|
FileElement(org.w3c.dom.Node node)
Creates a new instance of FileElement. |
|
FileElement(java.lang.String nodeRep)
Creates a new instance of FileElement. |
|
FileElement(java.lang.String name,
java.lang.String type,
java.lang.String count,
boolean toDestination,
java.lang.String compare,
boolean checkName,
java.lang.String chekPattern)
Creates a new instance of FileElement. |
Method Summary | |
---|---|
private void |
createElementFromNode(org.w3c.dom.Node node)
Creates the file element by supplying its XmlNode represenation. |
boolean |
downloadFiles(java.lang.String source,
java.lang.String destination,
FileHandler handler)
Download the files that match this definition from the source folder to the destination folder. |
int |
getFilesCount(java.lang.String path,
FileHandler handler,
java.lang.String jobName)
Gets the number of files within the given folder that match the FileElement. |
int |
getModifiedFilesCount(java.lang.String path,
FileHandler handler,
java.util.Date startDate)
Gets the number of the files, macthing the defintion, modified after startDate within the given folder. |
private boolean |
isValidFileName(java.lang.String fileName,
java.lang.String jobName)
Determines if the given file name is valid or not. A valid file name is the one matching the 'CheckPattern' attribute. |
void |
makeReadOnly(java.lang.String path,
FileHandler handler)
Tries to make the given files, matching the definition, read only. |
java.lang.String |
toString()
Returns the string representation of this object. |
java.lang.String |
toXmlString()
Returns a String representing the FileElement in xml format. |
boolean |
uploadFiles(java.lang.String source,
java.lang.String destination,
FileHandler handler)
Upload the files that match this definition from the source folder to the destination folder. |
Methods inherited from class org.bibalex.daf.entities.phase.PhysicalElement |
---|
createElement |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.String name
public boolean toDestination
public java.lang.String type
public java.lang.String count
public java.lang.String compare
public boolean checkName
public java.lang.String checkPattern
Constructor Detail |
---|
public FileElement(java.lang.String name, java.lang.String type, java.lang.String count, boolean toDestination, java.lang.String compare, boolean checkName, java.lang.String chekPattern)
name
- The 'Name' property of the element.toDestination
- The 'ToDestination' property of the element.type
- The 'Type' property of the element.count
- The 'Count' property of the element.compare
- The 'Compare' property of the element.checkName
- The 'CheckName' property of the element.chekPattern
- The 'CheckPattern' property of the element.public FileElement()
public FileElement(org.w3c.dom.Node node) throws PhaseDefinitionException
node
- The Xml Node representing this element.
PhaseDefinitionException
- If the given node couldn't be parsed.public FileElement(java.lang.String nodeRep) throws PhaseDefinitionException
nodeRep
- The Xml String representing this element.
PhaseDefinitionException
- If the given String couldn't be parsed.Method Detail |
---|
private void createElementFromNode(org.w3c.dom.Node node) throws PhaseDefinitionException
node
- The Xml Node representing this element.
PhaseDefinitionException
- If the node name is not 'File' or attributes are missing.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toXmlString()
toXmlString
in class PhysicalElement
public int getFilesCount(java.lang.String path, FileHandler handler, java.lang.String jobName)
path
- The path of the folder containing the files.handler
- The handler to get the count of files.jobName
- The name of the job. It is used to validate the file names.
private boolean isValidFileName(java.lang.String fileName, java.lang.String jobName)
fileName
- The name of the file including the extension.jobName
- The name of the job folder.public boolean downloadFiles(java.lang.String source, java.lang.String destination, FileHandler handler)
source
- The complete path of the source folder to download the files from.destination
- The complete path of the destination folder to download the files to.handler
- The FileHandler used to download the files.
public boolean uploadFiles(java.lang.String source, java.lang.String destination, FileHandler handler)
source
- The complete path of the source folder to uplaod the files from.destination
- The complete path of the destination folder to upload the files to.handler
- The FileHandler used to upload the files.
public int getModifiedFilesCount(java.lang.String path, FileHandler handler, java.util.Date startDate)
path
- The path of the folder containing the files.handler
- The handler to get the count of files.startDate
- The date to count the files modified after it. This parameter can be null.
public void makeReadOnly(java.lang.String path, FileHandler handler)
path
- The path of the folder containing the files.handler
- The FileHandler used to get the files.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |