use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.
the class EnvironmentCleanupClient method restoreFrom.
/**
* Restore the component environment from a specific folder using a specific environment configuration
*
* @param componentName the name of the component
* @param environmentName the name of the environment configuration
* @param folderPath the backup folder to use for restore
* @throws AgentException
*/
@PublicAtsApi
public void restoreFrom(String componentName, String environmentName, String folderPath) throws AgentException {
log.info("Executing restore for component '" + componentName + "' using environment '" + environmentName + "' from folder '" + folderPath + "'");
if (atsAgent.equals(LOCAL_JVM)) {
LocalExecutor localExecutor = new LocalExecutor();
localExecutor.restore(componentName, environmentName, folderPath);
} else {
RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
remoteExecutor.restore(componentName, environmentName, folderPath);
}
log.info("Finished executing restore for component '" + componentName + "' using environment '" + environmentName + "' from folder '" + folderPath + "'");
}
use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.
the class EnvironmentCleanupClient method restore.
/**
* Restore the environment for given component with a specific environment configuration
*
* @param componentName the name of the component
* @param environmentName the name of the environment configuration
* @throws AgentException
*/
@PublicAtsApi
public void restore(String componentName, String environmentName) throws AgentException {
log.info("Executing restore for component '" + componentName + "' using environment configuration '" + environmentName + "'");
if (atsAgent.equals(LOCAL_JVM)) {
LocalExecutor localExecutor = new LocalExecutor();
localExecutor.restore(componentName, environmentName, null);
} else {
RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
remoteExecutor.restore(componentName, environmentName, null);
}
log.info("Finished executing restore for component '" + componentName + "' using environment configuration '" + environmentName + "'");
}
use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.
the class EnvironmentCleanupClient method backupAllComponents.
/**
* Create backup for all registered components
*
* @throws AgentException
*/
@PublicAtsApi
public void backupAllComponents() throws AgentException {
log.info("Executing backup for all registered components");
if (atsAgent.equals(LOCAL_JVM)) {
LocalExecutor localExecutor = new LocalExecutor();
localExecutor.backupAll(null);
} else {
RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
remoteExecutor.backupAll(null);
}
log.info("Finished executing backup for all registered components");
}
use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.
the class EnvironmentCleanupClient method backupTo.
/**
* Create backup for given component to specific backup folder
*
* @param componentName the name of the component
* @param environmentName the name of the environment configuration
* @param folderPath backup folder path
* @throws AgentException
*/
@PublicAtsApi
public void backupTo(String componentName, String folderPath) throws AgentException {
log.info("Executing backup for component '" + componentName + "' to folder '" + folderPath + "'");
if (atsAgent.equals(LOCAL_JVM)) {
LocalExecutor localExecutor = new LocalExecutor();
localExecutor.backup(componentName, null, folderPath);
} else {
RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
remoteExecutor.backup(componentName, null, folderPath);
}
log.info("Finished executing backup for component '" + componentName + "' to folder '" + folderPath + "'");
}
use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.
the class AgentConfigurationClient method isComponentLoaded.
/**
* Tells if an Agent component is loaded, so its actions can be called.
* This method will wait for the specified timeout period until the wanted condition is met.
*
* @param componentName the name of the component
* @param timeout maximum timeout (in seconds) to wait for the component to be loaded.
* @return whether it is available
*/
@PublicAtsApi
public boolean isComponentLoaded(String componentName, int timeout) throws AgentException {
// construct an action request
ActionRequest actionRequest = new ActionRequest(componentName, "fake action name", new Object[] {});
AbstractClientExecutor executor;
if (atsAgent.equals(LOCAL_JVM)) {
executor = new LocalExecutor();
} else {
executor = new RemoteExecutor(atsAgent, false);
}
long startTimestamp = System.currentTimeMillis();
while (true) {
if (executor.isComponentLoaded(actionRequest)) {
// it is loaded
return true;
} else if (System.currentTimeMillis() - startTimestamp > timeout * 1000) {
// not loaded for the whole timeout
return false;
} else {
// not loaded, but we will check again
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
}
Aggregations