use of com.axway.ats.core.filesystem.model.IFileSystemOperations in project ats-framework by Axway.
the class FileSystemOperations method unlockFile.
/**
* Unlock file already locked with {@link #lockFile(String) lockFile()} method
*
* @param fileName file name
*/
@PublicAtsApi
public void unlockFile(@Validate(name = "fileName", type = ValidationType.STRING_NOT_EMPTY) String fileName) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { fileName });
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.unlockFile(fileName);
// log the result of the operation
log.info("File '" + fileName + "'" + getHostDescriptionSuffix() + " is successfully unlocked");
}
use of com.axway.ats.core.filesystem.model.IFileSystemOperations in project ats-framework by Axway.
the class FileSystemOperations method getFileGID.
/**
* Get the GID of a file or directory
*
* @param filePath the file to work with
* @return the GID number
*/
@PublicAtsApi
public long getFileGID(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath });
long gid = -1L;
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
gid = operations.getFileGID(filePath);
// log the result of the operation
log.debug("Successfully got the GID of " + filePath + getHostDescriptionSuffix());
return gid;
}
use of com.axway.ats.core.filesystem.model.IFileSystemOperations in project ats-framework by Axway.
the class FileSystemOperations method getFileModificationTime.
/**
* Get the last modification time for a specified file
*
* @param filePath the file to work with
* @param modificationTime the modification time to set as a timestamp in milliseconds
*/
@PublicAtsApi
public long getFileModificationTime(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath });
long lastModificationTime = -1l;
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
lastModificationTime = operations.getFileModificationTime(filePath);
// log the result of the operation
log.info("Successfully get the last modification timestamp of file '" + filePath + "'" + getHostDescriptionSuffix());
return lastModificationTime;
}
use of com.axway.ats.core.filesystem.model.IFileSystemOperations in project ats-framework by Axway.
the class FileSystemOperations method deleteDirectoryContent.
/**
* Deletes all directory's content, but does not touch the directory itself<br/>
* <b>Note: </b>It does nothing if the directory does not exist
*
* @param directoryPath the directory to work with
*/
@PublicAtsApi
public void deleteDirectoryContent(@Validate(name = "directoryPath", type = ValidationType.STRING_NOT_EMPTY) String directoryPath) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { directoryPath });
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.purgeDirectoryContents(directoryPath);
// log the result of the operation
log.info("Successfully deleted the content of directory by the name of " + directoryPath + getHostDescriptionSuffix());
}
use of com.axway.ats.core.filesystem.model.IFileSystemOperations in project ats-framework by Axway.
the class FileSystemOperations method createFile.
/**
* Creates a file. The content of the file is the letters of the English alphabet.
* The letters themselves are either alphabetically sorted, or randomly generated,
* depending on the value of the randomContent parameter.
*
* @param filePath the file to work with
* @param size the size of the generated file
* @param eolStyle the EOL style for this file. If null it uses the EOL style of the current system
* @param randomContent if true the method would generate a file with a random content
*/
@PublicAtsApi
public void createFile(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, @Validate(name = "size", type = ValidationType.NUMBER_POSITIVE) long size, EndOfLineStyle eolStyle, boolean randomContent) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath, size, null, randomContent });
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.createFile(filePath, size, randomContent, eolStyle);
// log the result of the operation
log.info("Successfully created file by the name of " + filePath + " with size " + size);
}
Aggregations