use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class InternalSystemMonitoringOperations method initializeMonitoring.
@Action(name = "Internal System Monitoring Operations Initialize Monitoring")
public void initializeMonitoring(@Parameter(name = "readings") List<FullReadingBean> readings, @Parameter(name = "startTimestamp") long startTimestamp, @Parameter(name = "pollInterval") int pollInterval) throws Exception {
monitoringAgent = new AtsSystemMonitoringAgent(startTimestamp, pollInterval);
Map<String, List<FullReadingBean>> readingsPerMonitor = new HashMap<String, List<FullReadingBean>>();
// load all the monitors and initialize them
for (FullReadingBean reading : readings) {
List<FullReadingBean> readingsForThisMonitor = readingsPerMonitor.get(reading.getMonitorName());
if (readingsForThisMonitor == null) {
readingsForThisMonitor = new ArrayList<FullReadingBean>();
readingsPerMonitor.put(reading.getMonitorName(), readingsForThisMonitor);
}
readingsForThisMonitor.add(reading);
}
for (String monitorClassName : readingsPerMonitor.keySet()) {
initializeMonitor(monitorClassName, readingsPerMonitor.get(monitorClassName), pollInterval);
}
}
use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class FileTransferActions method connect.
/**
* Do a connect
*
* @param protocol the transfer protocol to use
* @param port the remote port
* @param hostname the remote host
* @param username the user name
* @param password the user password
*/
@Action
public void connect(@Parameter(name = "protocol") String protocol, @Parameter(name = "port") int port, @Parameter(name = "hostname") String hostname, @Parameter(name = "username") String username, @Parameter(name = "password") String password) {
// make instance of the transfer client and do a connect
transferClient = new FileTransferClient(TransferProtocol.valueOf(protocol));
transferClient.setPort(port);
transferClient.connect(hostname, username, password);
}
use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class InternalProcessOperations method killProcess.
@Action(name = "Internal Process Operations kill Process")
public void killProcess(@Parameter(name = "internalProcessId") String internalProcessId) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.kill();
}
use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class InternalProcessOperations method startProcess.
/**
* @param internalProcessId internal process id (the unique id for the current LocalProcessExecutor)
* @param workDirectory the working directory. If null, the working directory of the current Java process will be used
* @param standardOutputFile the standard output file name. If null, the standard output will not be sent to a file
* @param errorOutputFile the error output file name. If null, the error output will not be sent to a file
* @param logStandardOutput whether to log the standard output
* @param logErrorOutput whether to log the error output
* @param waitForCompletion whether to wait for a process completion
*/
@Action(name = "Internal Process Operations start Process")
public void startProcess(@Parameter(name = "internalProcessId") String internalProcessId, @Parameter(name = "workDirectory") String workDirectory, @Parameter(name = "standardOutputFile") String standardOutputFile, @Parameter(name = "errorOutputFile") String errorOutputFile, @Parameter(name = "logStandardOutput") boolean logStandardOutput, @Parameter(name = "logErrorOutput") boolean logErrorOutput, @Parameter(name = "waitForCompletion") boolean waitForCompletion) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.setWorkDirectory(workDirectory);
processExecutor.setStandardOutputFile(standardOutputFile);
processExecutor.setErrorOutputFile(errorOutputFile);
processExecutor.setLogStandardOutput(logStandardOutput);
processExecutor.setLogErrorOutput(logErrorOutput);
processExecutor.execute(waitForCompletion);
}
use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class InternalProcessOperations method getEnvVariables.
@Action(name = "Internal Process Operations get Env Variables")
public Map<String, String> getEnvVariables(@Parameter(name = "internalProcessId") String internalProcessId) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
// some internal impl, not serializable
Map<String, String> mapInt = processExecutor.getEnvVariables();
// clone and serializable
HashMap<String, String> hMap = new HashMap<>(mapInt);
return hMap;
}
Aggregations