class EasyBak extends Object implements ZipWatcher
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="http://warp2.webarts.bc.ca/xml/FancyXmlTreeViewer.xsl" type="text/xsl"?> <EasyBakPlan> <Archive filename="easyBak.zip" /> <ArchiveLocation type="ftp" user="yourFtpUsername" pass="yourpassword" server="10.0.0.250" path="/private/bak" /> <BackupFile filename="/usr/local/export/home/tgutwin/testdir" recurse="true" /> </EasyBakPlan>
Modifier and Type | Field and Description |
---|---|
private String |
archivePass_
The archive ftp server password, as read from the config file.
|
private String |
archivePath_
The archive path for saving the archive to, as read from the config file.
|
private String |
archiveServer_
The archive servername(ip address), as read from the config file.
|
private String |
archiveType_
The archive type, as read from the config file.
|
private String |
archiveUser_
The archive ftp server user name, as read from the config file.
|
static String |
CONFIG_FILENAME
The default config filename.
|
private String |
datedArchive_
The should we add the date to the archivename.
|
protected static boolean |
deliveryInProcess_
A thread mutex to signal that the zip file delivery is still inprocess.
|
private Vector |
excludes_
The filenames to EXclude in the archive as read from the config file.
|
private Vector |
inFilenames_
The filenames to include in the archive as read from the config file.
|
(package private) static OutputStream |
infoOutStream_
Archive Log file that lives with the final zip file.
|
private String |
labelArchive_
The should we add the currentworkstation name to the archivename.
|
private static String |
logOutFileName_
The log output name.
|
private long |
maxZipSize_
The MAX size of the archive zip files in Mb.
|
private String |
outFileName_
The archive name to zip to, as read from the config file.
|
static String |
SYSTEM_FILE_SEPERATOR
Constant holding the users file seperator ("/" or "\").
|
static String |
SYSTEM_LINE_SEPERATOR
Constant holding the users line seperator.
|
private boolean |
validatingXsd_
Flags if validating docs when read in.
|
(package private) boolean |
zipDirectToLocalArchive_
Flag specifying if the zip will go directly to the final local archive
location.
|
private Document |
zipPlanDoc_
The XML Plan Document.
|
Constructor and Description |
---|
EasyBak()
Constructor for the EasyBak object that uses the default config filename.
|
EasyBak(String configName)
Constructor for the EasyBak object that uses the default config filename.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
checkDeliveryConnection()
Checks that the specified archive location is present and accessible.
|
private void |
deliverZipToArchiveLocation(String filename)
Takes a completed zip file and sends/moves it to the specified archive
location for this instance.
|
private void |
doBak()
Abstracts the actual zipping of the files.
|
private void |
logInfo(String logEntry)
Sends a string message to the infoOutStream_.
|
static void |
main(String[] args)
The main program for the EasyBak class.
|
void |
nextZipDone(String filename,
boolean completed)
Implementation of ZipWatcher.
|
private Document |
readWithSAX(String filename)
Reads the input config file with a SAX processor using dom4j.
|
private boolean |
readZipConfig()
Reads the DEFAULT config XML file and parses the required data.
|
private boolean |
readZipConfig(String configFilename)
Reads the passed in config XML file and parses the required data.
|
private void |
waitForDeliveryToFinish()
Blocks the current thread until the FTP Delivery is finished.
|
private void |
watchFTPActive(Thread watchThread)
In a separate thread, watch the ftp thread and change the deliveryInProcess_ flag to false when done.
|
public static final String SYSTEM_FILE_SEPERATOR
public static final String SYSTEM_LINE_SEPERATOR
public static final String CONFIG_FILENAME
private Document zipPlanDoc_
private boolean validatingXsd_
private String archiveServer_
private String archiveType_
private String archiveUser_
private String archivePass_
private String archivePath_
private String outFileName_
private String datedArchive_
private String labelArchive_
private Vector inFilenames_
private Vector excludes_
private static String logOutFileName_
private long maxZipSize_
boolean zipDirectToLocalArchive_
protected static boolean deliveryInProcess_
static OutputStream infoOutStream_
public EasyBak()
public static void main(String[] args)
args
- The command line argumentsprivate void doBak()
public void nextZipDone(String filename, boolean completed)
nextZipDone
in interface ZipWatcher
filename
- Description of the Parametercompleted
- Description of the Parameterprivate void watchFTPActive(Thread watchThread)
private void waitForDeliveryToFinish()
private boolean checkDeliveryConnection()
private void logInfo(String logEntry)
the
- message to sendprivate void deliverZipToArchiveLocation(String filename)
filename
- Zip Filename to sendprivate boolean readZipConfig()
private boolean readZipConfig(String configFilename)
configFilename
- Description of the Parameterprivate Document readWithSAX(String filename)
filename
- The XML config file to readWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses