View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
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  
12  /***
13   * Protocol implementation of Edge.
14   */
15  public class ProtocolEdge extends AbstractChildObject implements Edge, GWDLNamespace {
16      /*** The namespace of this object. Used for event notification. */
17      public static final String NAMESPACE = GWDL_NS;
18      /*** The name of this object if it is an read edge. Used for event notification. */
19      public static final String NAME_READPLACE = "readPlace";
20      /*** The name of this object if it is an input edge. Used for event notification. */
21      public static final String NAME_INPUTPLACE = "inputPlace";
22      /*** The name of this object if it is a write edge. Used for event notification. */
23      public static final String NAME_WRITEPLACE = "writePlace";
24      /*** The name of this object if it is an output edge. Used for event notification. */
25      public static final String NAME_OUTPUTPLACE = "outputPlace";
26      /*** The namespace of the properties of this object. Used for event notification. */
27      public static final String NAMESPACE_PROPERTIES = GWDL_ATTRIBUTE_NS;
28      /*** The name of the edge-expression of this object. Used for event notification. */
29      public static final String NAME_EDGEEXPRESSION = "edgeExpression";
30      /*** The name of the place-id of this object. Used for event notification. */
31      public static final String NAME_PLACEID = "placeID";
32      
33      protected Edge _delegate;
34  
35      protected ProtocolEdge(Edge delegate) {
36  	super();
37  	_delegate = delegate;
38      }
39      
40      /// 
41      /// Standard Set API
42      /// ....................................................................................................
43  
44      public void setPlace(Place p) { 
45  	getMethodCallStrategy().execute(new EdgeSetPlace(this, (ProtocolPlace)p));
46      }
47  
48      public void setExpression(String ex) { 
49  	getMethodCallStrategy().execute(new EdgeSetExpression(this, ex));
50      }
51  
52      ///
53      /// Set API called Protocol internally
54      /// ....................................................................................................
55      
56      /***
57         This method is only to be used by the protocol.        
58       */
59      public void __setPlace(ProtocolPlace p) { 
60  	_delegate.setPlace(p);
61  	firePropertyChanged(NAMESPACE_PROPERTIES, NAME_PLACEID, p==null?null:p.getID());
62      }
63  
64      /***
65         This method is only to be used by the protocol.        
66       */
67      public void __setExpression(String ex) { 
68  	_delegate.setExpression(ex);
69  	firePropertyChanged(NAMESPACE_PROPERTIES, NAME_EDGEEXPRESSION, ex);
70      }
71  
72      /// 
73      /// Get API
74      /// ....................................................................................................
75  
76      public Place getPlace() { 
77  	return _delegate.getPlace();
78      }
79  
80      public String getPlaceID() { 
81  	return _delegate.getPlaceID();
82      }
83  
84      public String getExpression() { 
85  	return _delegate.getExpression();
86      }
87  }