Search in sources :

Example 6 with RemoteExecutor

use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.

the class ActionClient method executeAction.

/**
     * Execute the given action
     *
     * @param actionName
     *            name of the action
     * @param arguments
     *            arguments for the action
     * @return result of the action execution
     * @throws AgentException
     *             if exception occurs during action execution
     */
protected Object executeAction(String actionName, Object[] arguments) throws AgentException {
    // construct an action request
    ActionRequest actionRequest = new ActionRequest(component, actionName, arguments);
    // the returned result
    Object result = null;
    // Check if we are queuing - in this case all actions will be routed to the queue
    // The exception is when we are sending command to the Monitoring Service
    ActionQueue actionQueue = ActionQueue.getCurrentInstance();
    if (!actionQueue.isInQueueMode() || component.equals(SystemMonitorDefinitions.ATS_SYSTEM_MONITORING_COMPONENT_NAME)) {
        if (atsAgent.equals(LOCAL_JVM)) {
            LocalExecutor localExecutor = new LocalExecutor();
            result = localExecutor.executeAction(actionRequest);
        } else {
            RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
            result = remoteExecutor.executeAction(actionRequest);
        }
    } else {
        actionQueue.addActionRequest(actionRequest);
    }
    return result;
}
Also used : ActionRequest(com.axway.ats.agent.core.action.ActionRequest) RemoteExecutor(com.axway.ats.agent.webapp.client.executors.RemoteExecutor) LocalExecutor(com.axway.ats.agent.webapp.client.executors.LocalExecutor)

Example 7 with RemoteExecutor

use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.

the class EnvironmentCleanupClient method restoreAllComponents.

/**
     * Restore the environment for all components with a specific environment configuration
     * Keep in mind that all the components must have environment configuration with this name
     *
     * @throws AgentException
     */
@PublicAtsApi
public void restoreAllComponents(String environmentName) throws AgentException {
    log.info("Executing cleanup for all registered components using environment configuration '" + environmentName + "'");
    if (atsAgent.equals(LOCAL_JVM)) {
        LocalExecutor localExecutor = new LocalExecutor();
        localExecutor.restoreAll(environmentName);
    } else {
        RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
        remoteExecutor.restoreAll(environmentName);
    }
    log.info("Finished executing cleanup for all registered components using environment configuration '" + environmentName + "'");
}
Also used : RemoteExecutor(com.axway.ats.agent.webapp.client.executors.RemoteExecutor) LocalExecutor(com.axway.ats.agent.webapp.client.executors.LocalExecutor) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 8 with RemoteExecutor

use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.

the class EnvironmentCleanupClient method backup.

/**
     * Create backup 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 backup(String componentName, String environmentName) throws AgentException {
    log.info("Executing backup for component '" + componentName + "' using environment '" + environmentName + "'");
    if (atsAgent.equals(LOCAL_JVM)) {
        LocalExecutor localExecutor = new LocalExecutor();
        localExecutor.backup(componentName, environmentName, null);
    } else {
        RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
        remoteExecutor.backup(componentName, environmentName, null);
    }
    log.info("Finished executing backup for component '" + componentName + "' using environment '" + environmentName + "'");
}
Also used : RemoteExecutor(com.axway.ats.agent.webapp.client.executors.RemoteExecutor) LocalExecutor(com.axway.ats.agent.webapp.client.executors.LocalExecutor) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 9 with RemoteExecutor

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 with a specific environment configuration
     * Keep in mind that all the components must have environment configuration with this name
     *
     * @param environmentName the name of the environment configuration
     * @throws AgentException
     */
@PublicAtsApi
public void backupAllComponents(String environmentName) throws AgentException {
    log.info("Executing backup for all registered components using environment configuration '" + environmentName + "'");
    if (atsAgent.equals(LOCAL_JVM)) {
        LocalExecutor localExecutor = new LocalExecutor();
        localExecutor.backupAll(environmentName);
    } else {
        RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
        remoteExecutor.backupAll(environmentName);
    }
    log.info("Finished executing backup for all registered components using environment configuration '" + environmentName + "'");
}
Also used : RemoteExecutor(com.axway.ats.agent.webapp.client.executors.RemoteExecutor) LocalExecutor(com.axway.ats.agent.webapp.client.executors.LocalExecutor) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 10 with RemoteExecutor

use of com.axway.ats.agent.webapp.client.executors.RemoteExecutor in project ats-framework by Axway.

the class EnvironmentCleanupClient method restoreAllComponents.

/**
     * Restore the environment for all components
     *
     * @throws AgentException
     */
@PublicAtsApi
public void restoreAllComponents() throws AgentException {
    log.info("Executing restore for all registered components");
    if (atsAgent.equals(LOCAL_JVM)) {
        LocalExecutor localExecutor = new LocalExecutor();
        localExecutor.restoreAll(null);
    } else {
        RemoteExecutor remoteExecutor = new RemoteExecutor(atsAgent);
        remoteExecutor.restoreAll(null);
    }
    log.info("Finished executing restore for all registered components");
}
Also used : RemoteExecutor(com.axway.ats.agent.webapp.client.executors.RemoteExecutor) LocalExecutor(com.axway.ats.agent.webapp.client.executors.LocalExecutor) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

LocalExecutor (com.axway.ats.agent.webapp.client.executors.LocalExecutor)10 RemoteExecutor (com.axway.ats.agent.webapp.client.executors.RemoteExecutor)10 PublicAtsApi (com.axway.ats.common.PublicAtsApi)9 ActionRequest (com.axway.ats.agent.core.action.ActionRequest)2 AbstractClientExecutor (com.axway.ats.agent.webapp.client.executors.AbstractClientExecutor)1