Search in sources :

Example 51 with Validator

use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.

the class FileSystemOperations method setFileGID.

/**
     * Set the GID of a file or directory
     *
     * @param filePath the file to work with
     * @param gid the GID number
     */
@PublicAtsApi
public void setFileGID(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, @Validate(name = "gid", type = ValidationType.NUMBER_POSITIVE) long gid) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { filePath, gid });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    operations.setFileGID(filePath, gid);
    // log the result of the operation
    log.debug("Successfully set the GID '" + gid + "' of " + filePath + getHostDescriptionSuffix());
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 52 with Validator

use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.

the class FileSystemOperations method createDirectory.

/**
     * Creates a directory on with a specific user and group id
     *
     * @param directoryName the name of the new directory
     * @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
     */
@PublicAtsApi
public void createDirectory(@Validate(name = "directoryName", type = ValidationType.STRING_NOT_EMPTY) String directoryName, @Validate(name = "userId", type = ValidationType.NUMBER_POSITIVE) int userId, @Validate(name = "groupId", type = ValidationType.NUMBER_POSITIVE) int groupId) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { directoryName, userId, groupId });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    operations.createDirectory(directoryName, userId, groupId);
    // log the result of the operation
    log.info("Successfully created directory by the name of " + directoryName + getHostDescriptionSuffix());
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 53 with Validator

use of com.axway.ats.core.validation.Validator 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");
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 54 with Validator

use of com.axway.ats.core.validation.Validator 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;
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 55 with Validator

use of com.axway.ats.core.validation.Validator 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;
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

Validator (com.axway.ats.core.validation.Validator)67 PublicAtsApi (com.axway.ats.common.PublicAtsApi)66 IFileSystemOperations (com.axway.ats.core.filesystem.model.IFileSystemOperations)45 LocalFileSystemOperations (com.axway.ats.core.filesystem.LocalFileSystemOperations)6 ISystemOperations (com.axway.ats.core.system.model.ISystemOperations)4 FullReadingBean (com.axway.ats.common.performance.monitor.beans.FullReadingBean)3 MachineDescriptionOperations (com.axway.ats.agent.components.monitoring.operations.clients.MachineDescriptionOperations)1 InternalProcessOperations (com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations)1 AgentException (com.axway.ats.agent.core.exceptions.AgentException)1 FileMatchInfo (com.axway.ats.common.filesystem.FileMatchInfo)1 ProcessExecutorException (com.axway.ats.common.process.ProcessExecutorException)1 DbAccessFactory (com.axway.ats.log.autodb.DbAccessFactory)1 DbWriteAccess (com.axway.ats.log.autodb.DbWriteAccess)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1