]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/MapExecutionContext.java
Add failOnError property
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / MapExecutionContext.java
1 package org.argeo.slc.core.execution;
2
3 import java.util.Collections;
4 import java.util.Date;
5 import java.util.HashMap;
6 import java.util.Map;
7 import java.util.UUID;
8
9 import org.argeo.slc.execution.ExecutionContext;
10
11 public class MapExecutionContext implements ExecutionContext {
12 private final Map<String, Object> variables = Collections
13 .synchronizedMap(new HashMap<String, Object>());
14
15 private final String uuid;
16
17 public MapExecutionContext() {
18 uuid = UUID.randomUUID().toString();
19 variables.put(VAR_EXECUTION_CONTEXT_ID, uuid);
20 variables.put(VAR_EXECUTION_CONTEXT_CREATION_DATE, new Date());
21 }
22
23 public void setVariable(String key, Object value) {
24 variables.put(key, value);
25 }
26
27 public Object getVariable(String key) {
28 return variables.get(key);
29 }
30
31 public String getUuid() {
32 return uuid;
33 }
34
35 @Override
36 public boolean equals(Object obj) {
37 if (obj instanceof ExecutionContext)
38 return uuid.equals(((ExecutionContext) obj).getUuid());
39 return false;
40 }
41
42 @Override
43 public String toString() {
44 return getClass().getSimpleName()+"#"+uuid;
45 }
46
47 }