Search in sources :

Example 46 with Validator

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

the class RegistryOperations method deleteKey.

/**
     * Delete a registry key
     *
     * @param keyPath path to the key
     * @param keyName name of the key
     */
@PublicAtsApi
public void deleteKey(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName });
    registryOperationsImpl.deleteKey(rootKey, keyPath, keyName);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 47 with Validator

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

the class FileTransferClient method setPort.

// -------------------- SETTINGS ------------------
/**
     * Sets a new port for the {@link FileTransferClient} to use<br>
     * <br>
     * If no port is set via this method then the default one for the currently
     * set protocol is used
     *
     * @param port
     *            the port to use
     */
@PublicAtsApi
public void setPort(@Validate(name = "port", type = ValidationType.NUMBER_PORT_NUMBER) int port) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { port });
    this.client.setCustomPort(port);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 48 with Validator

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

the class FileTransferClient method downloadFile.

/**
     * Download a file from the specified directory and with the specified file
     * name
     *
     * @param localDir
     *            the local directory to download the file to
     * @param localFile
     *            the local file that will be created
     * @param remoteDir
     *            the remote directory to download from
     * @param remoteFile
     *            the remote file to download
     */
@PublicAtsApi
public void downloadFile(@Validate(name = "localFile", type = ValidationType.STRING_NOT_EMPTY) String localFile, @Validate(name = "localDir", type = ValidationType.STRING_NOT_EMPTY) String localDir, @Validate(name = "remoteDir", type = ValidationType.STRING_NOT_EMPTY) String remoteDir, @Validate(name = "remoteFile", type = ValidationType.STRING_NOT_EMPTY) String remoteFile) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { localFile, localDir, remoteDir, remoteFile });
    // upload the file itself
    this.client.downloadFile(IoUtils.normalizeDirPath(localDir) + localFile, remoteDir, remoteFile);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 49 with Validator

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

the class FileTransferClient method startUploadAndPause.

/**
     * Starts an upload in a different thread and then pauses it
     * and waits to be resumed by {@link resumePausedTransfer}.
     *
     * <p><b>Only one upload should be started and paused. Other transfers with the same object
     * should be done only after this one is resumed.</b></p>
     *
     * @param localFile
     *            the local file to upload
     * @param remoteDir
     *            the remote directory to upload the file to
     * @param remoteFile
     *            the remote file name that the file should have
     */
@PublicAtsApi
public void startUploadAndPause(@Validate(name = "localFile", type = ValidationType.STRING_NOT_EMPTY) String localFile, @Validate(name = "remoteDir", type = ValidationType.STRING_NOT_EMPTY) String remoteDir, @Validate(name = "remoteFile", type = ValidationType.STRING_NOT_EMPTY) String remoteFile) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { localFile, remoteDir, remoteFile });
    this.client.startUploadAndPause(localFile, remoteDir, remoteFile);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 50 with Validator

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

the class FileSystemOperations method readFile.

/**
     * Reads the file content<br/>
     * <b>NOTE:</b> This method should be used for relatively small files as it loads the whole file in the memory
     *
     * @param filePathh the file to work with
     * @param fileEncoding the file encoding. If null the default encoding will be used
     * @return the file content
     */
@PublicAtsApi
public String readFile(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, String fileEncoding) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { filePath, fileEncoding });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    return operations.readFile(filePath, fileEncoding);
}
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