public class CollectorFileUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DA_DATA_DIRECTORY
Properties to indicate the location of the data directory
|
static int |
DA_DEFAULT_REMOTE_FTP_TIMEOUT |
static java.lang.String |
DA_DOWNLOAD_FILE
Property to indicate whether to download data file through ftp/sftp from
the EMS.
|
static java.lang.String |
DA_GZ_EXTENSION |
static java.lang.String |
DA_MASK_CREDENTIALS
Properties to indicate whether or not to mask the login credentials
|
static java.lang.String |
DA_MOVED_DATA_DIRECTORY
Properties to indicate the location where the xml files to be moved
|
static java.lang.String |
DA_POST_PROCESS_FLAG
Properties to indicate what to do after processing the xml files.
|
static java.lang.String |
DA_REMOTE_FTP_DIR |
static java.lang.String |
DA_REMOTE_FTP_FILE |
static java.lang.String |
DA_REMOTE_FTP_HOST |
static java.lang.String |
DA_REMOTE_FTP_PASSWORD |
static java.lang.String |
DA_REMOTE_FTP_PORT |
static java.lang.String |
DA_REMOTE_FTP_TIMEOUT |
static java.lang.String |
DA_REMOTE_FTP_USER |
static java.lang.String |
DA_TAR_EXTENSION |
static java.lang.String |
DA_USE_SECURE_CONNECTION |
Constructor and Description |
---|
CollectorFileUtils(java.util.Properties properties,
java.lang.String defaultDataDir,
java.lang.String defaultMovedLoc) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup(java.lang.String dirName,
java.io.File fullFilename)
Performs cleanup of a given file, based on the
DataAcquisition.postProcessFlag parameter
|
java.util.Map<java.lang.String,java.lang.Long> |
download(java.util.Map<java.lang.String,java.lang.Long> fileMtimeMap)
Performs the checking before fetching the file from remote location.
|
boolean |
downloadDataFile()
Determines whether the collector needs to download the data file from the
EMS
|
void |
extractFiles(java.io.File file,
java.lang.String dirName)
Perform extraction on an array of files
|
static java.io.File |
getDirectory(java.lang.String strPath,
java.lang.String strRelativeDir)
Returns the File instance for the specified directory
|
static java.io.File |
getFile(java.lang.String strPath,
java.lang.String strRelativeDir)
Returns the File instance for the specified file
|
static java.io.File |
getFile(java.lang.String strDirectory,
java.lang.String strFile,
java.lang.String strRelativeDir)
Returns the File instance for the specified directory
|
boolean |
hasNewDownloadedFile()
Return true if there are some new file downloaded previously
|
public static final java.lang.String DA_MASK_CREDENTIALS
public static final java.lang.String DA_DOWNLOAD_FILE
public static final java.lang.String DA_REMOTE_FTP_HOST
public static final java.lang.String DA_REMOTE_FTP_USER
public static final java.lang.String DA_REMOTE_FTP_PASSWORD
public static final java.lang.String DA_USE_SECURE_CONNECTION
public static final java.lang.String DA_REMOTE_FTP_PORT
public static final java.lang.String DA_REMOTE_FTP_TIMEOUT
public static final java.lang.String DA_REMOTE_FTP_DIR
public static final java.lang.String DA_REMOTE_FTP_FILE
public static final java.lang.String DA_GZ_EXTENSION
public static final java.lang.String DA_TAR_EXTENSION
public static final int DA_DEFAULT_REMOTE_FTP_TIMEOUT
public static final java.lang.String DA_DATA_DIRECTORY
public static final java.lang.String DA_MOVED_DATA_DIRECTORY
public static final java.lang.String DA_POST_PROCESS_FLAG
public CollectorFileUtils(java.util.Properties properties, java.lang.String defaultDataDir, java.lang.String defaultMovedLoc)
public boolean downloadDataFile()
public boolean hasNewDownloadedFile()
public java.util.Map<java.lang.String,java.lang.Long> download(java.util.Map<java.lang.String,java.lang.Long> fileMtimeMap)
fileMtimeMap
- - file modified date time map from previous discoverypublic void extractFiles(java.io.File file, java.lang.String dirName)
file
- Tar/Compressed filesdirName
- Directory location of the filespublic void cleanup(java.lang.String dirName, java.io.File fullFilename)
dirName
- Directory name of the file to be cleaned-upfullFilename
- Full file name to be cleaned-uppublic static java.io.File getDirectory(java.lang.String strPath, java.lang.String strRelativeDir) throws CollectorException
strPath
- Directory pathstrRelativeDir
- Relative directory to construct the directory absolute path.
This parameter is optional if it is certain that the directory
path is absolute.CollectorException
public static java.io.File getFile(java.lang.String strPath, java.lang.String strRelativeDir) throws CollectorException
strPath
- File pathstrRelativeDir
- Relative directory to construct the file absolute path. This
parameter is optional if it is certain that the file path is
absolute.CollectorException
public static java.io.File getFile(java.lang.String strDirectory, java.lang.String strFile, java.lang.String strRelativeDir) throws CollectorException
strDirectory
- Directory pathstrFile
- File name only, this should not be the absolute path to the
file.strRelativeDir
- Relative directory to construct the file absolute path. This
parameter is optional if it is certain that the file path is
absolute.CollectorException