+ /*
+ * LIFECYCLE
+ */
+ public void init() {
+ try {
+ agentDescriptor = new SlcAgentDescriptor();
+ agentDescriptor.setUuid(initAgentUuid());
+ agentDescriptor.setHost(InetAddress.getLocalHost().getHostName());
+ } catch (UnknownHostException e) {
+ throw new SlcException("Unable to create agent descriptor.", e);
+ }
+ }
+
+ public void dispose() {
+
+ }
+
+ /**
+ * Called during initialization in order to determines the agent UUID. To be
+ * overridden. By default creates a new one per instance.
+ */
+ protected String initAgentUuid() {
+ return UUID.randomUUID().toString();
+ }
+
+ /*
+ * SLC AGENT
+ */
+ public void runSlcExecution(SlcExecution slcExecution) {
+ process(slcExecution);
+ }
+
+ public void process(ExecutionProcess process) {
+ ProcessThread processThread = createProcessThread(modulesManager,
+ process);
+ processThread.start();
+ }
+
+ /** Creates the thread which will coordinate the execution for this agent. */
+ protected ProcessThread createProcessThread(
+ ExecutionModulesManager modulesManager, ExecutionProcess process) {
+ if (!(process instanceof SlcExecution))
+ throw new SlcException("Unsupported process type "
+ + process.getClass());
+ ProcessThread processThread = new ProcessThread(modulesManager,
+ (SlcExecution) process);
+ return processThread;