1
2
3
4
5
6 package net.kwfgrid.gworkflowdl.protocol.structure;
7
8 import net.kwfgrid.gworkflowdl.structure.*;
9 import net.kwfgrid.gworkflowdl.protocol.calls.*;
10 import net.kwfgrid.gworkflowdl.protocol.xml.GWDLNamespace;
11 import org.apache.log4j.Logger;
12
13 /***
14 * Protocol implementation of Operation.
15 */
16 public class ProtocolOperation extends AbstractChildObject implements Operation, GWDLNamespace {
17
18 static Logger logger = Logger.getLogger(ProtocolOperation.class);
19
20 /*** The namespace of this object. Used for event notification. */
21 public static final String NAMESPACE = GWDL_NS;
22 /*** The name of this object. Used for event notification. */
23 public static final String NAME = "operation";
24
25 protected Operation _delegate;
26
27 protected ProtocolOperation(Operation delegate) {
28 super();
29 _delegate = delegate;
30 }
31
32
33
34
35
36 public void set(Object object) {
37 if (object instanceof ProtocolOperationClass) {
38 getMethodCallStrategy().execute(new OperationSetOperationClass(this, (ProtocolOperationClass)object));
39 } else {
40 logger.warn("set() for object "+object+ " not supported.");
41 }
42 }
43
44 public void set(OperationClass operationClass) {
45 getMethodCallStrategy().execute(new OperationSetOperationClass(this, (ProtocolOperationClass)operationClass));
46 }
47
48 public void fromXML(String s) throws WorkflowFormatException, UnsupportedOperationException {
49
50 logger.warn("fromXML() not yet implemented.");
51 }
52
53
54
55
56
57 /***
58 This method is only to be used by the protocol.
59 */
60 public void __set(Object object) {
61 _delegate.set(object);
62
63 }
64
65 /***
66 This method is only to be used by the protocol.
67 */
68 public void __set(ProtocolOperationClass operationClass) {
69 ProtocolOperationClass old = (ProtocolOperationClass)_delegate.get();
70 _delegate.set(operationClass);
71 if (old!=null) {
72 old.setParent(null);
73 fireObjectRemoved(ProtocolOperationClass.NAMESPACE, ProtocolOperationClass.NAME, old);
74 }
75 if (operationClass!=null) {
76 operationClass.setParent(this);
77 fireObjectAdded(ProtocolOperationClass.NAMESPACE, ProtocolOperationClass.NAME, operationClass);
78 }
79 }
80
81 /***
82 This method is only to be used by the protocol.
83 */
84 public void __fromXML(String s) throws WorkflowFormatException {
85 _delegate.fromXML(s);
86
87 }
88
89
90
91
92
93 /***
94 * get operation object. Can be of class <code>Element</code> or <code>OperationClass</code>.
95 */
96 public Object get() {
97 return _delegate.get();
98 }
99
100 public int getAbstractionLevel() {
101 return _delegate.getAbstractionLevel();
102 }
103
104 public String toXML() {
105 return _delegate.toXML();
106 }
107
108 }