View Javadoc

1   /*
2   Wotonomy: OpenStep design patterns for pure Java applications.
3   Copyright (C) 2000 Michael Powers
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, see http://www.gnu.org
17  */
18  
19  package net.wotonomy.datastore;
20  
21  import java.util.List;
22  import java.util.Observer;
23  
24  public interface DataView extends List
25  {
26  //    public void newQuery( String aProperty, Object beginKey, Object endKey );
27  //    public void addQuery( String aProperty, Object beginKey, Object endKey );
28  //    public void removeQuery( String aProperty, Object beginKey, Object endKey );
29  //    public void retainQuery( String aProperty, Object beginKey, Object endKey );
30  
31  	/***
32  	* This method is called to notify the DataView
33  	* that one of its objects has been modified and
34  	* should be updated when the view is committed.
35  	*/
36  	public void update(Object o);
37  
38  	/***
39  	* This method is called commit all changes to
40  	* the DataView to its data store.  The list
41  	* elements may be refreshed from the datastore,
42  	* although the list itself should remain unchanged.
43  	* @return True if the commit was successful, 
44  	* otherwise false.
45  	*/
46  	public boolean commit();
47  
48  	/***
49  	* Called to add the specified observer to the
50  	* list of observers that should receive notifications
51  	* when the view if modified.  DataViews notify
52  	* when objects are added, updated, or deleted,
53  	* passing the affected object as the parameter
54  	* to the Observer's notify method.
55  	* @param o The observer to add.
56  	*/
57      public void addObserver(Observer o);
58  
59  	/***
60  	* Called to remove the specified observer from the
61  	* list of observers that should receive notifications
62  	* when the view if modified.
63  	* @param o The observer to delete.
64  	*/
65      public void deleteObserver(Observer o);
66  
67  	/***
68  	* Called to clear the list of observers that should 
69  	* receive notifications when the view if modified.
70  	*/
71      public void deleteObservers();
72  
73  	/***
74  	* Returns the key for the specified object.
75      * If the object is not in the view, returns null.
76  	*/
77      public DataKey getKeyForObject( Object anObject );
78  
79  	/***
80  	* Returns the object for the specified key.
81      * If the key is not in the view, returns null.
82  	*/
83      public Object getObjectForKey( DataKey aKey );
84  }
85  
86  /*
87   * $Log$
88   * Revision 1.2  2006/02/19 16:26:19  cgruber
89   * Move non-unit-test code to tests project
90   * Fix up code to work with proper imports
91   * Fix maven dependencies.
92   *
93   * Revision 1.1  2006/02/16 13:18:56  cgruber
94   * Check in all sources in eclipse-friendly maven-enabled packages.
95   *
96   * Revision 1.2  2001/02/15 21:12:41  mpowers
97   * Added accessors for key throughout the api.  This breaks compatibility.
98   * insertObject now returns the permanent key for the newly created object.
99   * The old way returned a copy of the object which was an additional read
100  * that was often ignored.  Now you can read it only if you need it.
101  * Furthermore, there was not other way of getting the permanent key.
102  *
103  * Revision 1.1.1.1  2000/12/21 15:47:05  mpowers
104  * Contributing wotonomy.
105  *
106  * Revision 1.2  2000/12/20 16:25:36  michael
107  * Added log to all files.
108  *
109  *
110  */
111