use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class FileSystemOperations method setFileUID.
/**
* Set the UID of a file or directory
*
* @param filePath the file to work with
* @param uid the UID number
*/
@PublicAtsApi
public void setFileUID(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, @Validate(name = "uid", type = ValidationType.NUMBER_POSITIVE) long uid) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath, uid });
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.setFileUID(filePath, uid);
// log the result of the operation
log.debug("Successfully set the UID '" + uid + "' of " + filePath + getHostDescriptionSuffix());
}
use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class FileSystemOperations method createDirectory.
/**
* Creates a directory
*
* @param directoryName the name of the new directory
*/
@PublicAtsApi
public void createDirectory(@Validate(name = "directoryName", type = ValidationType.STRING_NOT_EMPTY) String directoryName) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { directoryName });
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.createDirectory(directoryName);
// log the result of the operation
log.info("Successfully created directory by the name of " + directoryName + getHostDescriptionSuffix());
}
use of com.axway.ats.common.PublicAtsApi 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 userId the identification number of the user this file should belong to
* @param groupId the identification number of the group this file should belong to
* @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, @Validate(name = "userId", type = ValidationType.NUMBER_POSITIVE) int userId, @Validate(name = "groupId", type = ValidationType.NUMBER_POSITIVE) int groupId, EndOfLineStyle eolStyle, boolean randomContent) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath, size, userId, groupId, null, randomContent });
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.createFile(filePath, size, userId, groupId, randomContent, eolStyle);
// log the result of the operation
String message = new StringBuilder().append("Successfully created file by the name of ").append(filePath).append(" with size ").append(size).append(" and UID/GID ").append(userId).append("/").append(groupId).toString();
log.info(message);
}
use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class FileSystemOperations method getFileOwner.
/**
* Get the owner of a file or directory
*
* @param filePath the file to work with
* @return the owner
*/
@PublicAtsApi
public String getFileOwner(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath });
String result = null;
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
result = operations.getFileOwner(filePath);
// log the result of the operation
log.debug("Successfully got the owner of " + filePath + getHostDescriptionSuffix());
return result;
}
use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.
the class FileSystemOperations method createBinaryFile.
/**
* Creates a binary file. The content of the file is a byte sequence. The bytes
* themselves are either fixed sequence, or randomly generated, depending on the
* value of the randomContent parameter.
* </br>File's UID and GID will the ones of the system user which started the remote ATS agent.
*
* @param filePath the file to work with
* @param size the size of the generated file
* @param randomContent if true the method would generate a file with a random content
*/
@PublicAtsApi
public void createBinaryFile(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, @Validate(name = "size", type = ValidationType.NUMBER_POSITIVE) long size, boolean randomContent) {
// validate input parameters
new Validator().validateMethodParameters(new Object[] { filePath, size, randomContent });
// execute action
IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
operations.createBinaryFile(filePath, size, randomContent);
// log the result of the operation
String message = new StringBuilder().append("Successfully created binary file by the name of ").append(filePath).append(" with size ").append(size).toString();
log.info(message);
}
Aggregations