]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptor.java
Provide SlcAgentFactory in the core agent
[gpl/argeo-slc.git] / runtime / org.argeo.slc.specs / src / main / java / org / argeo / slc / execution / ExecutionFlowDescriptor.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
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 package org.argeo.slc.execution;
17
18 import java.io.Serializable;
19 import java.util.Map;
20
21 /**
22 *
23 * Implements both archetype and implementation of a given process.
24 *
25 * At specification time, <code>executionSpec</code> represents the spec of the
26 * parameters accepted by the process, with, among others: type, default value
27 * and, optionally, possible values for each parameter. Thus ExecutionSpec might
28 * be a huge object. Note that when marshalling only a reference to a specific
29 * ExecutionSpec is stored in the XML to optimize performance and avoid
30 * redundancy between various ExecutionFlowDesciptor that might have the same
31 * ExecutionSpec.
32 *
33 * At runtime, we build a RealizedFlow which references an
34 * ExecutionFlowDescriptor. As it happens AFTER marshalling / unmarshalling
35 * process, the ExecutionSpec is null but we manage to retrieve the
36 * ExecutionSpec and store it in the RealizedFlow, whereas set values of the
37 * parameters are stored in the <code>values</code> map.
38 *
39 * Generally, values object are either a <code>PrimitiveAccessor</code> or a
40 * <code>RefValue</code> but can be other objects.
41 */
42 public class ExecutionFlowDescriptor implements Serializable {
43 private static final long serialVersionUID = 7101944857038041216L;
44 private String name;
45 private String description;
46 private String path;
47 private Map<String, Object> values;
48 private ExecutionSpec executionSpec;
49
50 public ExecutionFlowDescriptor() {
51 }
52
53 public ExecutionFlowDescriptor(String name, Map<String, Object> values,
54 ExecutionSpec executionSpec) {
55 this.name = name;
56 this.values = values;
57 this.executionSpec = executionSpec;
58 }
59
60 public String getName() {
61 return name;
62 }
63
64 /**
65 * @deprecated will be removed in SLC 2.x, the path should be the part of
66 * the name with '/'
67 */
68 public String getPath() {
69 return path;
70 }
71
72 /**
73 * @deprecated will be removed in SLC 2.0, the path should be the part of
74 * the name with '/'
75 */
76 public void setPath(String path) {
77 this.path = path;
78 }
79
80 public Map<String, Object> getValues() {
81 return values;
82 }
83
84 public ExecutionSpec getExecutionSpec() {
85 return executionSpec;
86 }
87
88 public void setName(String name) {
89 this.name = name;
90 }
91
92 public void setValues(Map<String, Object> values) {
93 this.values = values;
94 }
95
96 public void setExecutionSpec(ExecutionSpec executionSpec) {
97 this.executionSpec = executionSpec;
98 }
99
100 public String getDescription() {
101 return description;
102 }
103
104 public void setDescription(String description) {
105 this.description = description;
106 }
107
108 @Override
109 public boolean equals(Object obj) {
110 if (obj instanceof ExecutionFlowDescriptor)
111 return name.equals(((ExecutionFlowDescriptor) obj).getName());
112 return false;
113 }
114
115 @Override
116 public int hashCode() {
117 return name.hashCode();
118 }
119
120 @Override
121 public String toString() {
122 return (path != null && !path.trim().equals("") ? path + "/" : "")
123 + name;
124 }
125
126 }