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
.util
.ArrayList
;
19 import java
.util
.List
;
22 import org
.argeo
.slc
.SlcException
;
23 import org
.argeo
.slc
.deploy
.ModuleDescriptor
;
25 /** Describes the information required to launch a flow */
26 public class ExecutionModuleDescriptor
extends ModuleDescriptor
{
27 /** Metadata header identifying an SLC execution module */
28 public final static String SLC_EXECUTION_MODULE
= "SLC-ExecutionModule";
30 private static final long serialVersionUID
= -2394473464513029512L;
31 private List
<ExecutionSpec
> executionSpecs
= new ArrayList
<ExecutionSpec
>();
32 private List
<ExecutionFlowDescriptor
> executionFlows
= new ArrayList
<ExecutionFlowDescriptor
>();
34 public List
<ExecutionSpec
> getExecutionSpecs() {
35 return executionSpecs
;
38 public List
<ExecutionFlowDescriptor
> getExecutionFlows() {
39 return executionFlows
;
43 * Returns a new {@link ExecutionModuleDescriptor} that can be used to build
44 * a {@link RealizedFlow}.
46 public ExecutionFlowDescriptor
cloneFlowDescriptor(String name
) {
47 ExecutionFlowDescriptor res
= null;
48 for (ExecutionFlowDescriptor efd
: executionFlows
) {
49 if (efd
.getName().equals(name
)
50 || ("/" + efd
.getName()).equals(name
)) {
52 res
= (ExecutionFlowDescriptor
) efd
.clone();
53 } catch (CloneNotSupportedException e
) {
54 throw new SlcException("Cannot clone " + efd
, e
);
59 throw new SlcException("Flow " + name
+ " not found.");
63 public RealizedFlow
asRealizedFlow(String flow
, Map
<String
, Object
> values
) {
64 RealizedFlow realizedFlow
= new RealizedFlow();
65 realizedFlow
.setFlowDescriptor(cloneFlowDescriptor(flow
));
66 realizedFlow
.setModuleName(getName());
67 realizedFlow
.setModuleVersion(getVersion());
68 realizedFlow
.getFlowDescriptor().getValues().putAll(values
);
72 public void setExecutionSpecs(List
<ExecutionSpec
> executionSpecs
) {
73 this.executionSpecs
= executionSpecs
;
76 public void setExecutionFlows(List
<ExecutionFlowDescriptor
> executionFlows
) {
77 this.executionFlows
= executionFlows
;