2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.slc
.execution
;
18 import java
.io
.Serializable
;
19 import java
.util
.HashMap
;
22 import org
.argeo
.slc
.BasicNameVersion
;
23 import org
.argeo
.slc
.NameVersion
;
25 /** A fully configured execution flow, ready to be executed. */
26 public class RealizedFlow
implements Serializable
{
27 private static final long serialVersionUID
= 1L;
29 private String moduleName
;
30 private String moduleVersion
;
31 private ExecutionFlowDescriptor flowDescriptor
;
33 public String
getModuleName() {
37 public void setModuleName(String moduleName
) {
38 this.moduleName
= moduleName
;
41 public NameVersion
getModuleNameVersion() {
42 return new BasicNameVersion(getModuleName(), getModuleVersion());
45 public String
getModuleVersion() {
49 public void setModuleVersion(String moduleVersion
) {
50 this.moduleVersion
= moduleVersion
;
53 public ExecutionFlowDescriptor
getFlowDescriptor() {
54 return flowDescriptor
;
57 public void setFlowDescriptor(ExecutionFlowDescriptor flowDescriptor
) {
58 this.flowDescriptor
= flowDescriptor
;
61 /** Create a simple realized flow */
62 public static RealizedFlow
create(String module
, String version
,
63 String flowName
, Map
<String
, String
> args
) {
64 final RealizedFlow realizedFlow
= new RealizedFlow();
65 realizedFlow
.setModuleName(module
);
66 // TODO deal with version
69 realizedFlow
.setModuleVersion(version
);
70 ExecutionFlowDescriptor efd
= new ExecutionFlowDescriptor();
71 efd
.setName(flowName
);
74 if (args
!= null && args
.size() > 0) {
75 Map
<String
, Object
> values
= new HashMap
<String
, Object
>();
76 for (String key
: args
.keySet()) {
77 String value
= args
.get(key
);
78 values
.put(key
, value
);
80 efd
.setValues(values
);
83 realizedFlow
.setFlowDescriptor(efd
);