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 InternalFileSystemSnapshot method compare.
@Action
public void compare(@Parameter(name = "thisInternalProcessId") String thisInternalProcessId, @Parameter(name = "thatInternalProcessId") String thatInternalProcessId) {
LocalFileSystemSnapshot thisLocalFileSystemSnapshot = (LocalFileSystemSnapshot) dataRepo.getObject(OBJECT_KEY_PREFIX + thisInternalProcessId);
LocalFileSystemSnapshot thatLocalFileSystemSnapshot = (LocalFileSystemSnapshot) dataRepo.getObject(OBJECT_KEY_PREFIX + thatInternalProcessId);
thisLocalFileSystemSnapshot.compare(thatLocalFileSystemSnapshot);
}
use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class InternalProcessOperations method killProcessAndItsChildren.
@Action(name = "Internal Process Operations kill Process And Its Children")
public void killProcessAndItsChildren(@Parameter(name = "internalProcessId") String internalProcessId) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.killAll();
}
use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class ActionClassGenerator method generateStub.
private String generateStub(String componentName, Class<?> actionClass, String targetActionClassPackage, String originalTargetPackage, Map<String, String> actionJavadocMap) {
try {
log.info("Generating stub for action class '" + actionClass.getCanonicalName() + "'");
//first we need to generate the method definitions
StringBuilder methodsDefinition = new StringBuilder();
StringBuilder publicConstants = new StringBuilder();
Method[] actionClassMethods = actionClass.getMethods();
for (Method actionClassMethod : actionClassMethods) {
if (isAnActionClass(actionClassMethod)) {
Action actionAnnotation = actionClassMethod.getAnnotation(Action.class);
TemplateAction templateActionAnnotation = actionClassMethod.getAnnotation(TemplateAction.class);
String actionName;
if (actionAnnotation != null) {
actionName = actionAnnotation.name();
} else {
actionName = templateActionAnnotation.name();
}
// if the 'name' attribute is empty, generate an action method name
if (StringUtils.isNullOrEmpty(actionName)) {
actionName = ActionMethod.buildActionMethodName(actionClassMethod);
}
// check if this is a transfer action and it has the necessary return type
if (actionAnnotation != null && actionAnnotation.transferUnit().length() > 0 && actionClassMethod.getReturnType() != Long.class) {
throw new BuildException("Action '" + actionName + "' has a declared transfer unit, but the return type is not Long");
}
String actionJavaDoc = actionJavadocMap.get(actionName);
//first append the action javadoc (if any)
if (actionJavaDoc != null) {
methodsDefinition.append(actionJavaDoc);
}
//then process the method body and append it
String actionDefinition = generateActionDefinition(actionName, actionClassMethod);
methodsDefinition.append(actionDefinition);
//get any enum constants
publicConstants.append(generateEnumConstants(actionClassMethod));
}
}
//generate the public constants
publicConstants.append(generateConstantsDefinition(actionClass));
ClassTemplateProcessor classProcessor;
if (customTemplates.containsKey(actionClass.getName())) {
//use the custom template supplied
classProcessor = new ClassTemplateProcessor(new File(customTemplates.get(actionClass.getName())), originalSourcePackage, originalTargetPackage, targetActionClassPackage, actionClass, componentName, methodsDefinition.toString(), publicConstants.toString());
} else {
//use default template
classProcessor = new ClassTemplateProcessor(originalSourcePackage, originalTargetPackage, targetActionClassPackage, actionClass, componentName, methodsDefinition.toString(), publicConstants.toString());
}
return classProcessor.processTemplate();
} catch (Exception e) {
throw new BuildException(e);
}
}
use of com.axway.ats.agent.core.model.Action in project ats-framework by Axway.
the class InternalProcessOperations method appendToEnvVariable.
@Action(name = "Internal Process Operations append To Env Variable")
public void appendToEnvVariable(@Parameter(name = "internalProcessId") String internalProcessId, @Parameter(name = "variableName") String variableName, @Parameter(name = "variableValueToAppend") String variableValueToAppend) {
LocalProcessExecutor processExecutor = (LocalProcessExecutor) dataRepo.getObject(OBJECT_KEY_PREFIX + internalProcessId);
processExecutor.appendToEnvVariable(variableName, variableValueToAppend);
}
Aggregations