View Javadoc

1   /*
2    * $Id: ProtocolOperationCandidate.java 1309 2009-05-22 18:56:38Z andreas.hoheisel@first.fraunhofer.de $
3    *
4    * Copyright (c) 2008, Fraunhofer FIRST
5    * Fraunhofer Institute for Computer Architecture and Software Technology
6    * See http://www.first.fraunhofer.de and http://www.gridworkflow.org/gwes for more details.
7    */
8   package net.kwfgrid.gworkflowdl.protocol.structure;
9   
10  import net.kwfgrid.gworkflowdl.structure.OperationCandidate;
11  import net.kwfgrid.gworkflowdl.protocol.xml.OperationClassNamespace;
12  import net.kwfgrid.gworkflowdl.protocol.calls.*;
13  
14  /***
15   * @author Andreas Hoheisel
16   *         (<a href="http://www.andreas-hoheisel.de">www.andreas-hoheisel.de</a>)
17   * @version $Id: ProtocolOperationCandidate.java 1309 2009-05-22 18:56:38Z andreas.hoheisel@first.fraunhofer.de $
18   */
19  public class ProtocolOperationCandidate extends ProtocolChildOwls implements OperationCandidate, OperationClassNamespace {
20  
21      /*** The namespace of this object. Used for event notification. */
22      public static final String NAMESPACE = OPERATIONCLASS_NS;
23      /*** The name of the type of this object. Used for event notification. */
24      public static final String NAME_TYPE= "type";
25      /*** The name of the property of this object. Used for event notification. */
26      public static final String NAME_OPERATIONNAME = "operationName";
27      /*** The name of the property of this object. Used for event notification. */
28      public static final String NAME_RESOURCENAME = "resourceName";
29      /*** The name of the quality property of this object. Used for event notification. */
30      public static final String NAME_QUALITY = "quality";
31      /*** The name of the selected property of this object. Used for event notification. */
32      public static final String NAME_SELECTED = "selected";
33      /*** The name of the element */
34      public static final String NAME = "operationCandidate";
35  
36      protected OperationCandidate _delegate;
37  
38      protected ProtocolOperationCandidate(OperationCandidate delegate) {
39  	super(delegate);
40  	_delegate = delegate;
41      }
42  
43      /***
44       * Get the element name of this Operation Candidate.
45       * Implement this method in all classes that implement OperationCandidate.
46       * @return
47       */
48       public String getNAME() {
49           return NAME;
50       }
51  
52      /***
53       * Get the namespace of this owl implementation.
54       */
55      public String getOwlNamespace() {
56          return OPERATIONCLASS_NS;
57      }
58  
59      /***
60       * Get the name of this owl implementation.
61       */
62      public String getOwlName() {
63          return "owl";
64      }
65  
66      ///
67      /// Standard Set API
68      /// ....................................................................................................
69  
70      public void setType(String type) {
71          getMethodCallStrategy().execute(new OperationCandidateSetType(this, type));
72      }
73  
74      public void setOperationName(String name) {
75          getMethodCallStrategy().execute(new OperationCandidateSetOperationName(this, name));
76      }
77  
78      public void setResourceName(String name) {
79          getMethodCallStrategy().execute(new OperationCandidateSetResourceName(this, name));
80      }
81  
82      public void setQuality(float quality) {
83  	    getMethodCallStrategy().execute(new OperationCandidateSetQuality(this, quality));
84      }
85  
86      public void setSelected(boolean b) {
87      	getMethodCallStrategy().execute(new OperationCandidateSetSelected(this, b));
88      }
89  
90      public void setSelected() {
91          setSelected(true);
92      }
93  
94      ///
95      /// Set API called Protocol internally
96      /// ....................................................................................................
97  
98      /*** This method is only to be used by the protocol. */
99      public void __setType(String type) {
100         _delegate.setType(type);
101         firePropertyChanged(NAMESPACE, NAME_TYPE, type);
102     }
103 
104     /*** This method is only to be used by the protocol. */
105     public void __setOperationName(String name) {
106         _delegate.setOperationName(name);
107         firePropertyChanged(NAMESPACE, NAME_OPERATIONNAME, name);
108     }
109 
110     /*** This method is only to be used by the protocol. */
111     public void __setResourceName(String name) {
112         _delegate.setResourceName(name);
113         firePropertyChanged(NAMESPACE, NAME_RESOURCENAME, name);
114     }
115 
116     public void __setQuality(float quality) {
117         _delegate.setQuality(quality);
118         firePropertyChanged(NAMESPACE, NAME_QUALITY, new Float(quality));
119     }
120 
121     public void __setSelected(boolean b) {
122         _delegate.setSelected(b);
123         firePropertyChanged(NAMESPACE, NAME_SELECTED, new Boolean(b));
124     }
125 
126     ///
127     /// Get API
128     /// ....................................................................................................
129 
130     public String getType() {
131         return _delegate.getType();
132     }
133 
134     public String getOperationName() {
135         return _delegate.getOperationName();
136     }
137 
138     public String getResourceName() {
139         return _delegate.getResourceName();
140     }
141 
142     public float getQuality() {
143     	return _delegate.getQuality();
144     }
145 
146     public boolean isSelected() {
147         return _delegate.isSelected();
148     }
149 
150     public int getAbstractionLevel() {
151         return _delegate.getAbstractionLevel();
152     }
153     
154 }
155