Package org.serviceconnector.util
Class FileUtility
java.lang.Object
org.serviceconnector.util.FileUtility
The Class FileUtility.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbelongsToDate(File file, Date date) Check if give file belongs to current date (day)static FileCtxcreatePIDfileAndLock(String fileNameFull) Create file containing the PID.static voiddeleteFile(String fileNameFull) Delete file.static booleanExists.static StringGets the log path.static booleanisFileLocked(String filename) Checks if is file locked.static URLLocate.static URLlocateFromAbsolutePath(String resourceName) Locate from absolute path.static URLlocateFromCurrentClasspath(String resourceName) Locate from current classpath.static booleanNot exists.static booleannotExistsOrUnlocked(String filename) Not exists or unlocked.static voidreadFileToWriter(String filePath, Writer writer) Read file to writer.static voidwaitExists(String filename, int nrSeconds) static voidwaitExistsAndLocked(String filename, int nrSeconds) static voidwaitNotExistsOrUnlocked(String filename, int nrSeconds)
-
Method Details
-
exists
Exists.- Parameters:
filename- the filename- Returns:
- true if the given file exists
-
belongsToDate
Check if give file belongs to current date (day)- Parameters:
file-date-- Returns:
-
isFileLocked
Checks if is file locked.- Parameters:
filename- the filename- Returns:
- true, if is file locked
-
locate
Locate.- Parameters:
resourceName- the resource name- Returns:
- the uRL
-
locateFromAbsolutePath
Locate from absolute path.- Parameters:
resourceName- the resource name- Returns:
- the uRL
-
locateFromCurrentClasspath
Locate from current classpath.- Parameters:
resourceName- the resource name- Returns:
- the uRL
-
notExists
Not exists.- Parameters:
filename- the filename- Returns:
- true if the given file does not exist
-
notExistsOrUnlocked
Not exists or unlocked.- Parameters:
filename- the filename- Returns:
- true if the given file does not exist
-
waitExists
- Parameters:
filename- to look fornrSeconds- to wait (check is done in 1 second interval)- Throws:
Exception- if the file does not exist after the given time
-
waitExistsAndLocked
- Parameters:
filename- to look fornrSeconds- to wait (check is done in 1 second interval)- Throws:
Exception- if the file does not exist after the given time
-
waitNotExistsOrUnlocked
- Parameters:
filename- to look fornrSeconds- to wait (check is done in 1 second interval)- Throws:
Exception- if the file still exists after the given time
-
createPIDfileAndLock
Create file containing the PID. Is used for testing purpose to verify that process is running properly.- Parameters:
fileNameFull- the file name full- Returns:
- the file ctx
- Throws:
Exception- the exception
-
deleteFile
Delete file. Catch all possible errors- Parameters:
fileNameFull- the file name full
-
getLogPath
Gets the log path.- Returns:
- directory configured for appender in the current logback configuration file
- Throws:
SCMPValidatorException- the sCMP validator exception
-
readFileToWriter
Read file to writer.- Parameters:
filePath- the file pathwriter- the writer- Throws:
IOException- Signals that an I/O exception has occurred.
-