use of org.cristalise.kernel.entity.imports.ImportAgent in project kernel by cristal-ise.
the class CreateNewAgent method runActivityLogic.
@Override
protected String runActivityLogic(AgentPath agent, ItemPath item, int transitionID, String requestData, Object locker) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, ObjectAlreadyExistsException {
try {
ImportAgent newAgent = (ImportAgent) Gateway.getMarshaller().unmarshall(requestData);
newAgent.create(agent, true);
newAgent.setPassword("REDACTED");
return Gateway.getMarshaller().marshall(newAgent);
} catch (MarshalException | ValidationException | IOException | MappingException e) {
Logger.error(e);
throw new InvalidDataException("CreateNewAgent: Couldn't unmarshall new Agent: " + requestData);
}
}
use of org.cristalise.kernel.entity.imports.ImportAgent in project kernel by cristal-ise.
the class Module method importAgents.
/**
* @param systemAgent
* @param reset
* @throws Exception
*/
private void importAgents(AgentProxy systemAgent, boolean reset) throws Exception {
for (ImportAgent thisAgent : imports.getAgents()) {
if (Bootstrap.shutdown)
return;
try {
Gateway.getLookup().getAgentPath(thisAgent.name);
Logger.msg(3, "Module.importAgents() - Agent '" + thisAgent.name + "' found.");
continue;
} catch (ObjectNotFoundException ex) {
}
Logger.msg("Module.importAgents() - Agent '" + thisAgent.name + "' not found. Creating.");
addItemToContents(thisAgent.create(systemAgent.getPath(), reset));
}
}
Aggregations