public class AppUpdater
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
cvAppBaseDir
Deployed application base directory (in local file system)
|
protected static java.util.Properties |
cvConfig
Configuration properties loaded from AppUpdater.properties
|
protected static java.util.ArrayList<java.lang.String> |
cvExclude
Collection of excluded files/directories as specified in the properties file
|
protected static org.apache.commons.net.ftp.FTPClient |
cvFTP
FTP client for interaction with the FTP server
|
protected static java.lang.String |
cvFTPBaseDir
Base (starting) directory of the FTP site containing "master" files
|
static boolean |
cvPrompt
Flag determines if user will be prompted for each copy operation.
|
protected static java.text.SimpleDateFormat |
dateFormatter
Format timestamps for readability
|
static java.lang.String |
FILE_SEP
Constant to hold the directory separator character of the local machine.
|
| Constructor and Description |
|---|
AppUpdater() |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
checkPath(java.io.File chkFile)
Check the entire path of the given file and create needed parent directories.
|
protected static void |
disconnect()
Log out and disconnect from the FTP server.
|
protected static void |
download(org.apache.commons.net.ftp.FTPFile ftpFile,
java.io.File localFile)
Download a file from the FTP server after confirming action by prompting
the user.
|
protected static boolean |
isASCII(java.io.File file)
Based on file extension, determine if file is binary or text(ascii).
|
protected static boolean |
logIn(java.lang.String user,
java.lang.String password,
java.lang.String host)
Log in to the FTP server.
|
static void |
main(java.lang.String[] args)
Main entry point from the command line.
|
protected static void |
processDir(java.lang.String relativeDir)
Process a directory.
|
protected static void |
processFile(java.lang.String relativeDir,
org.apache.commons.net.ftp.FTPFile ftpFile)
Process a directory.
|
protected static java.lang.String |
prompt(java.lang.String promptStr)
Prompt the user and get the user's response.
|
protected static org.apache.commons.net.ftp.FTPClient cvFTP
protected static java.lang.String cvFTPBaseDir
protected static java.lang.String cvAppBaseDir
protected static java.text.SimpleDateFormat dateFormatter
protected static java.util.Properties cvConfig
protected static java.util.ArrayList<java.lang.String> cvExclude
public static final java.lang.String FILE_SEP
public static boolean cvPrompt
public static void main(java.lang.String[] args)
args - (String[]) Command line arguments. Ignored.protected static void processDir(java.lang.String relativeDir)
throws java.lang.Exception
relativeDir - (String) Relative (from the base) directory to process.java.lang.Exceptionprotected static void processFile(java.lang.String relativeDir,
org.apache.commons.net.ftp.FTPFile ftpFile)
throws java.lang.Exception
relativeDir - (String) Relative (from the base) directory to process.ftpFile - (FTPFile) File information from the FTP server.java.lang.Exceptionprotected static void download(org.apache.commons.net.ftp.FTPFile ftpFile,
java.io.File localFile)
throws java.lang.Exception
ftpFile - (FTPFile) File information from the FTP server.localFile - (File) The destination local file.java.lang.Exceptionprotected static boolean isASCII(java.io.File file)
file - (File) The file.true if the file is a text based type.protected static boolean logIn(java.lang.String user,
java.lang.String password,
java.lang.String host)
user - (String) User id.password - (String) Password.host - (String) Host name of the FTP server.true If success.protected static void disconnect()
protected static java.lang.String prompt(java.lang.String promptStr)
promptStr - (String) The prompt.protected static boolean checkPath(java.io.File chkFile)
chkFile - (File) File whose parent directories to confirm.