1 package org
.argeo
.slc
.core
.execution
.tasks
;
3 import java
.lang
.reflect
.Method
;
6 import org
.argeo
.slc
.SlcException
;
7 import org
.argeo
.slc
.deploy
.DeployedSystem
;
8 import org
.argeo
.slc
.deploy
.DeployedSystemManager
;
9 import org
.argeo
.slc
.execution
.Executable
;
10 import org
.argeo
.slc
.process
.SlcExecution
;
11 import org
.argeo
.slc
.process
.SlcExecutionRelated
;
12 import org
.argeo
.slc
.process
.SlcExecutionStep
;
13 import org
.argeo
.slc
.structure
.StructureRegistry
;
15 public class SlcManagerTask
implements Executable
, SlcExecutionRelated
{
17 private String slcExecutionUuid
;
18 private String slcExecutionStepUuid
;
20 private String action
;
21 private DeployedSystemManager
<DeployedSystem
> manager
;
23 public final void execute() {
24 uuid
= UUID
.randomUUID().toString();
25 executeActions(StructureRegistry
.ALL
);
28 protected void executeActions(String mode
) {
30 Method method
= manager
.getClass().getMethod(action
, null);
31 method
.invoke(manager
, null);
32 } catch (Exception e
) {
33 throw new SlcException("Cannot execute action " + action
34 + " for manager " + manager
, e
);
38 public void setAction(String action
) {
42 public void setManager(DeployedSystemManager
<DeployedSystem
> manager
) {
43 this.manager
= manager
;
46 public String
getUuid() {
50 public void setUuid(String uuid
) {
54 public String
getSlcExecutionUuid() {
55 return slcExecutionUuid
;
58 public void setSlcExecutionUuid(String slcExecutionUuid
) {
59 this.slcExecutionUuid
= slcExecutionUuid
;
62 public String
getSlcExecutionStepUuid() {
63 return slcExecutionStepUuid
;
66 public void setSlcExecutionStepUuid(String slcExecutionStepUuid
) {
67 this.slcExecutionStepUuid
= slcExecutionStepUuid
;
70 public void notifySlcExecution(SlcExecution slcExecution
) {
71 if (slcExecution
!= null) {
72 slcExecutionUuid
= slcExecution
.getUuid();
73 SlcExecutionStep step
= slcExecution
.currentStep();
75 slcExecutionStepUuid
= step
.getUuid();