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   * @(#)ExternalDb.java 1.00
24   */
25  
26  package zeus.actors;
27  
28  import java.util.*;
29  import zeus.util.*;
30  import zeus.concepts.*;
31  
32  /*** 
33   * If an agent needs a resource it will first examine its local resource
34   * database, and if the necessary {@link Fact} is not present it then will consult its
35   * external resource database (if it has one).  These external resource databases 
36   * are linked to Zeus agents through this interface class, allowing the
37   * developer to encapsulate an external system like a database in a way that 
38   * can still be accessed by the agent. <p>
39   * Details on how to use this interface are provided in Section 6 of the
40   * Zeus Application Realisation Guide.
41   <EM> ISSUES </EM> We are likely to want to connect more than one external interface
42   to each agent - this interface doesn't provide for that so we need to do something 
43   about it .....
44   */
45  
46  public interface ExternalDb
47  {
48     /*** A configuration method, used to associate the external resource with
49         its owner agent. */
50     public abstract void        set(AgentContext context);
51  
52  
53     /*** Implements a membership	operation, returning true if the fact parameter
54         currently exists within the external resource */
55     public abstract boolean     contains(Fact f1);
56  
57  
58     /*** Implements an insertion operation, returning true if the fact parameter
59         was successfully inserted. Whether duplicates are permitted is at the
60         discretion of the external resource that implements this service. */
61     public abstract boolean     put(Fact f1);
62  
63  
64     /*** Implements a retrieval operation that returns the fact matching the 
65         the parameter; this is assumed to be destructive */
66     public abstract Fact        remove(Fact f1);
67  
68  
69     /*** Implements a query operation that should return an enumeration of all
70         facts that match the parameter; this is not assumed to be destructive */
71     public abstract Enumeration all(Fact f1);
72  }