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  
24  /*
25   * @(#)AgentContext.java 1.00
26   */
27  
28  package zeus.actors;
29  
30  import zeus.actors.factories.*;
31  import java.util.*;
32  import zeus.util.*;
33  import zeus.concepts.*;
34  import zeus.rete.ReteEngine;
35  import zeus.actors.rtn.*;
36  import zeus.agents.ZeusExternal;
37  import zeus.agents.BasicAgent;
38  import zeus.agents.BasicAgentUI;
39  import zeus.actors.intrays.*;
40  
41  
42  /***
43      Every agent must have an implementor of this intereface, or they 
44      probably won't work.<p>
45      The implementors of this interface should be thought of as being directories
46      of object references which can be accessed from various parts of the agent to get
47      at the other parts. <p> 
48      Numerous doubts have been expressed about this strategy, because it promotes tight coupleing 
49      between the components of the agent, but moving away from it seems likely to be an extensive 
50      peice of work, so it was decided (who am I kidding? I decided) that it would be a good 
51      idea to refactor this as an interface to at least promote the possibilitiy that different 
52      component sets could be added/used. <p> 
53      @see zeus.actors.ZeusAgentContext
54      @author Simon Thompson 
55      @since 1.1
56   
57   */
58  
59  public interface AgentContext 
60  {
61    
62    public void setFacilitators( Vector input );
63    
64    
65    public void addFacilitator(String agent);
66    
67    
68    public void removeFacilitator(String agent);
69  
70  
71    public void setNameservers(Vector input);
72    
73    
74    public void addNameserver(Address address);
75    
76    
77    public void removeNameserver(String address) ;
78    
79    /*** 
80      set the addressBook for this agent
81      */
82    public void set(AddressBook addressBook);
83    
84    
85    public void set(ProtocolDb protocolDb);
86  
87  
88    public void set(MailBox mbox);
89  
90  
91    public void set(MsgHandler msgHandler);
92  
93  
94    public void set(Engine engine);
95  
96  
97    public void set(ReteEngine reteEngine);
98  
99  
100   public void set(ExecutionMonitor monitor);
101 
102   public void set(Planner planner);
103 
104 
105   public void set(OrganisationDb db);
106 
107 
108   public void set(TaskDb taskDb);
109 
110 
111   public void set(ResourceDb resourceDb);
112 
113 
114   public void set(OntologyDb ontologyDb) ;
115 
116  /***
117     set a reference to the agent object into this context object
118     */
119   public void set(BasicAgent agent) ;
120   
121 
122   public void set(BasicAgentUI agentUI);
123   
124    /***
125      the ZeusExternal is the user defined part of the agent that is 
126      called by the agent class when it is run
127      */
128   public void set(ZeusExternal zeusExternal);
129 
130     
131     
132   
133 
134   public void set(ExternalDb externalDb);
135 
136     /***
137          setting the clock is a vital activity for a Zeus agent, basically by getting a Clock that 
138          is set to the Agency time (provided by the ANServer) the agent are able to co-ordinate 
139          their actions 
140          */
141   public void set(Clock clock);
142   
143   
144 
145 
146   public double           now();             
147   public Time             currentTime();
148   public Time             time(long ctm);
149   public long             getClockStep();
150   
151   public String           newId();
152   public String           newId(String tag);
153 
154     /***
155          return the type of agent, originally one of "Nameserver", "Facilitator", "Visualiser",
156       "DbProxy" or "Agent" */
157   public String           whatami();
158   
159   /*** 
160     return the name of the agent
161     */
162   public String           whoami();
163 
164    
165   public Hashtable        queryTable();
166   public Vector           facilitators();
167   public Vector           nameservers();
168   public AddressBook      AddressBook();
169   public MailBox          MailBox();
170   public MsgHandler       MsgHandler();
171   public ReteEngine       ReteEngine();
172   public Engine           Engine() ;
173   public ExecutionMonitor ExecutionMonitor() ;
174   public Planner          Planner() ;
175   public OrganisationDb   OrganisationDb();
176   public TaskDb           TaskDb()  ;
177   public ResourceDb       ResourceDb();
178   public OntologyDb       OntologyDb() ;
179   public ExternalDb       ExternalDb();
180   public ProtocolDb       ProtocolDb() ;
181   public ZeusExternal     ZeusExternal() ;
182   public BasicAgentUI     AgentUI();
183   public BasicAgent       Agent() ;
184   public GenSym           GenSym();
185   public Clock            Clock() ;
186 
187 
188   public Hashtable        getQueryTable(); 
189   public Vector           getFacilitators();
190   public Vector           getNameservers();
191   public AddressBook      getAddressBook();
192   public MailBox          getMailBox();
193   public MsgHandler       getMsgHandler();
194   public ReteEngine       getReteEngine();
195   public Engine           getEngine();
196   public ExecutionMonitor getExecutionMonitor();
197   public Planner          getPlanner();
198   public OrganisationDb   getOrganisationDb();
199   public TaskDb           getTaskDb();
200   public ResourceDb       getResourceDb();
201   public OntologyDb       getOntologyDb();
202   public ExternalDb       getExternalDb();
203   public ProtocolDb       getProtocolDb();
204   public ZeusExternal     getZeusExternal();
205   public BasicAgentUI     getAgentUI();
206   public BasicAgent       getAgent();
207   public GenSym           getGenSym();
208   public Clock            getClock();
209   public TransportFactory getTransportFactory(); 
210   
211   
212   public boolean getSharePlan();
213   public boolean getExecuteEarliest(); 
214   
215   public double getAddressBookRefresh(); 
216   public double getAddressTimeout ();   
217   public double getReplanPeriod (); 
218   public double getRegistrationTimeout(); 
219   public double getFacilitatorTimeout(); 
220   public double getAcceptTimeout(); 
221   public double getFacilitatorRefresh(); 
222   
223   public void setSharePlan(boolean share_plan);
224   public void setExecuteEarliest(boolean execute_earliest); 
225   
226   public void setAddressBookRefresh(double val); 
227   public void setAddressTimeout (double val);   
228   public void setReplanPeriod (double val); 
229   public void setRegistrationTimeout(double val); 
230   public void setFacilitatorTimeout(double val); 
231   public void setAcceptTimeout(double val); 
232   public void setFacilitatorRefresh(double val); 
233   
234   
235   public InTray getInTray(); 
236   
237   /***
238    *  whereAmI should return the deployed address of the agent - 
239    *probably implemented as a TCP/IP address ....
240    *would be better implemented from a config file
241    */
242   public String whereAmI(); 
243   
244  
245 
246 }