View Javadoc

1              /*
2   * The contents of this file are subject to the BT "ZEUS" Open Source
3   * Licence (L77741), Version 1.0 (the "Licence"); you may not use this file
4   * except in compliance with the Licence. You may obtain a copy of the Licence
5   * from $ZEUS_INSTALL/licence.html or alternatively from
6   * http://www.labs.bt.com/projects/agents/zeus/licence.htm
7   *
8   * Except as stated in Clause 7 of the Licence, software distributed under the
9   * Licence is distributed WITHOUT WARRANTY OF ANY KIND, either express or
10  * implied. See the Licence for the specific language governing rights and
11  * limitations under the Licence.
12  *
13  * The Original Code is within the package zeus.*.
14  * The Initial Developer of the Original Code is British Telecommunications
15  * public limited company, whose registered office is at 81 Newgate Street,
16  * London, EC1A 7AJ, England. Portions created by British Telecommunications
17  * public limited company are Copyright 1996-9. All Rights Reserved.
18  *
19  * THIS NOTICE MUST BE INCLUDED ON ANY COPY OF THIS FILE
20  */
21  
22  
23  package zeus.concepts;
24  
25  
26  /***
27      this class is used to construct and store content if the FIPA Agent Management
28      ontology that is either to be passed to, or from the DF
29      */
30  public class FIPA_DF_Management_Content {
31  
32    private FIPA_AID_Address implementor = null;
33    private DF_Description subject = null;
34    private boolean type = false;
35    private String action = null;
36    private String result = null;
37    private String context = null;
38    private String outputType = null;
39  
40    public String getSubjectName () {
41      if (implementor != null )
42          return (implementor.getName());
43      else
44          return null;
45          }
46  
47    /***
48      provides debug access to the values
49      */
50     public String getImplementor () {
51      if (implementor != null) {
52          return this.implementor.toString();}
53          else return ("NULL");
54     }
55  
56  
57    /***
58      provides debug access to the values
59      */
60     public String getSubject() {
61      if (subject != null) {
62          return this.subject.toString(); }
63          else return ("NULL");
64  
65     }
66  
67  
68    /***
69      provides debug access to the values
70      */
71    public String getAction () {
72      if (action != null) {
73          return this.action; }
74          else return ("NULL");
75    }
76  
77  
78    /***
79      provides debug access to the values
80      */
81    public String getType () {
82        if (type) return ("TRUE");
83          else
84              return ("FALSE");
85    }
86  
87  
88    /***
89      provides debug access to the values
90      */
91    public String getResult() {
92      if (result != null) {
93         return this.result;}
94         else
95          return ("NULL");
96    }
97  
98  
99    /***
100     provides debug access to the values
101     */
102   public String getContext () {
103     if (context != null) {
104      return this.context;}
105      else
106         return ("NULL");
107   }
108 
109 
110   /***
111     provides debug access to the values
112     */
113   public String getOutputType() {
114     if (outputType != null) {
115         return this.outputType; }
116         else
117             return ("NULL");
118 
119   }
120 
121 
122  public DF_Description getDescription () {
123   return (subject);
124  }
125 
126 
127     public FIPA_AID_Address getAddress() {
128         return (subject.getName());
129     }
130 
131 
132 
133 
134   public void setContext (String context) {
135     this.context = context;
136   }
137 
138 
139   /***
140     use this to set the name of the agent that is expected to
141     carry out the action
142     */
143   public void setImplementor (FIPA_AID_Address addr) {
144     implementor = addr;
145   }
146 
147 
148   /***
149     this is used to set the df-agent-description element of the management content
150     */
151   public void setSubject (DF_Description desc) {
152     subject = desc;
153   }
154 
155 
156   /***
157     I can't remember what this is for
158     */
159   public void setType (boolean in) {
160     type = in;
161   }
162 
163   /***
164    ie. register...
165    */
166   public void setAction (String act) {
167     action = act;
168   }
169 
170 
171   /***
172     if this passed back as a result of a request then it might be "true" or "false" or
173     some more meaningful string
174     */
175   public void setResult (String val) {
176     result = val;
177   }
178 
179 
180 /***
181     if this passed back as a result of a request then it might be "true" or "false" or
182     some more meaningful string
183     */
184   public void setResult (boolean res) {
185     if (res) result = new String("true");
186     else result = new String ("false");
187   }
188 
189 
190   public void setOutputType (String outType) {
191     this.outputType = outType;
192   }
193 
194   public String toString () {
195 
196    String retVal = new String ();
197     if (result!=null) {
198         retVal += "(" ;
199         if (outputType != null) retVal += outputType; }
200     if (context != null ) {
201         retVal += "(" + context;  }
202     if (type)
203         retVal += "(done ";
204     if (implementor != null )
205         retVal += "(" + implementor.toFIPAString() + ")";
206     if (action!=null) {
207         retVal += action +" ";
208     if (subject != null)
209         retVal += subject.toString();
210     retVal += ")";
211     }
212     if (result!=null)
213         retVal += result+")";
214     if (context != null )
215         retVal += ")";
216     retVal +=")";
217     debug (retVal);
218     return (retVal);
219   }
220 
221 
222   public void debug (String str) {
223    // System.out.println("FIPA_DF_Management_Content : "+ str);
224   }
225 
226 
227   }
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 
238 
239 
240