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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations