1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 }