]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/tasks/SlcManager.java
Reduce log verbosity
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / tasks / SlcManager.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.argeo.slc.core.execution.tasks;
18
19 import java.lang.reflect.Method;
20 import java.util.UUID;
21
22 import org.argeo.slc.SlcException;
23 import org.argeo.slc.deploy.DeployedSystem;
24 import org.argeo.slc.deploy.DeployedSystemManager;
25 import org.argeo.slc.process.SlcExecution;
26 import org.argeo.slc.process.SlcExecutionRelated;
27 import org.argeo.slc.process.SlcExecutionStep;
28 import org.argeo.slc.structure.StructureRegistry;
29
30 /** Use {@link MethodCall} instead. */
31 @Deprecated
32 public class SlcManager implements Runnable, SlcExecutionRelated {
33 private String uuid;
34 private String slcExecutionUuid;
35 private String slcExecutionStepUuid;
36
37 private String action;
38 private DeployedSystemManager<DeployedSystem> manager;
39
40 public final void run() {
41 uuid = UUID.randomUUID().toString();
42 executeActions(StructureRegistry.ALL);
43 }
44
45 protected void executeActions(String mode) {
46 try {
47 Class<?>[] argClasses = null;
48 Method method = manager.getClass().getMethod(action, argClasses);
49 Object[] argObjects = null;
50 method.invoke(manager, argObjects);
51 } catch (Exception e) {
52 throw new SlcException("Cannot execute action " + action
53 + " for manager " + manager, e);
54 }
55 }
56
57 public void setAction(String action) {
58 this.action = action;
59 }
60
61 public void setManager(DeployedSystemManager<DeployedSystem> manager) {
62 this.manager = manager;
63 }
64
65 public String getUuid() {
66 return uuid;
67 }
68
69 public void setUuid(String uuid) {
70 this.uuid = uuid;
71 }
72
73 public String getSlcExecutionUuid() {
74 return slcExecutionUuid;
75 }
76
77 public void setSlcExecutionUuid(String slcExecutionUuid) {
78 this.slcExecutionUuid = slcExecutionUuid;
79 }
80
81 public String getSlcExecutionStepUuid() {
82 return slcExecutionStepUuid;
83 }
84
85 public void setSlcExecutionStepUuid(String slcExecutionStepUuid) {
86 this.slcExecutionStepUuid = slcExecutionStepUuid;
87 }
88
89 public void notifySlcExecution(SlcExecution slcExecution) {
90 if (slcExecution != null) {
91 slcExecutionUuid = slcExecution.getUuid();
92 SlcExecutionStep step = slcExecution.currentStep();
93 if (step != null) {
94 slcExecutionStepUuid = step.getUuid();
95 }
96 }
97 }
98 }