Search in sources :

Example 66 with Validator

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

the class FileSystemOperations method deleteDirectory.

/**
     * Deletes a directory and all its content. <br/>
     * <b>Note: </b>It does nothing if the directory does not exist
     *
     * @param directoryPath the directory to work with
     */
@PublicAtsApi
public void deleteDirectory(@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.deleteDirectory(directoryPath, true);
    // log the result of the operation
    log.info("Successfully deleted a directory by the name of " + directoryPath + 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 67 with Validator

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

the class FileSystemOperations method createFile.

/**
     * Creates a file. The content is set by the user.
     *
     * @param filePath the file to work with
     * @param fileContent the text that will be parsed in the file 
     */
@PublicAtsApi
public void createFile(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, @Validate(name = "fileContent", type = ValidationType.NOT_NULL) String fileContent) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { filePath, fileContent });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    operations.createFile(filePath, fileContent);
    // log the result of the operation
    log.info("Successfully created file by the name of " + filePath + " with content " + fileContent);
}
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