summaryrefslogtreecommitdiffstats
path: root/java/org/odmg/Database.java
blob: 6edd15c259b06816a90996b72d5dca39540ac6e4 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
* This file is part of rasdaman community.
*
* Rasdaman community is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Rasdaman community is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with rasdaman community.  If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
rasdaman GmbH.
*
* For more information please see <http://www.rasdaman.org>
* or contact Peter Baumann via <baumann@rasdaman.com>.
*/
package org.odmg;

/**
* The interface for interacting with an ODMG database.
* Databases must be opened before starting any transactions that use the database
* and closed after ending these transactions.
* <P>
* A database application generally begins processing by accessing one or more
* critical objects and proceeding from there. These objects are root objects,
* because they lead to interconnected webs of other objects.
* The ability to name an object (using method <code>bind</code>) and
* retrieve it later by that name (using method <code>lookup</code> facilitates
* this start-up capability. A name is not explicitly defined as an attribute of
* an object. Naming an object also makes it persistent.
* <P>
* There is a single flat name scope per database; thus all names in a particular
* database are unique.
* @author	David Jordan (as Java Editor of the Object Data Management Group)
* @version ODMG 3.0
*/

public interface Database {
/**
* The database is not open.
*/
	public static final int NOT_OPEN = 0;

/**
* The database is opened for read-only access.
*/
	public static final int OPEN_READ_ONLY = 1;

/**
* The database is opened for reading and writing.
*/
	public static final int OPEN_READ_WRITE = 2;

/**
* The database is open for exclusive access.
*/
	public static final int OPEN_EXCLUSIVE = 3;

/**
* Open the named database with the specified access mode.
* Attempts to open a database when it has already been opened will result in
* the throwing of the exception <code>DatabaseOpenException</code>.
* A <code>DatabaseNotFoundException</code> is thrown if the database does not exist.
* Some implementations may throw additional exceptions that are also derived from
* <code>ODMGException</code>.
* @param	name	The name of the database.
* @param	accessMode	The access mode, which should be one of the static fields:
* <code>OPEN_READ_ONLY</code>, <code>OPEN_READ_WRITE</code>,
* or <code>OPEN_EXCLUSIVE</code>.
* @exception	ODMGException	The database could not be opened.
*/
	public	void		open(String name, int accessMode) throws ODMGException;

/**
* Close the database.
* After you have closed a database, further attempts to access objects in the
* database will cause the exception <code>DatabaseClosedException</code> to be thrown.
* Some implementations may throw additional exceptions that are also derived
* from <code>ODMGException</code>.
* @exception ODMGException Unable to close the database.
*/
	public	void		close() throws ODMGException;

/**
* Associate a name with an object and make it persistent,
* <BR><I> not yet available in RasDaMan. </BR></I>
* An object instance may be bound to more than one name.
* Binding a previously transient object to a name makes that object persistent.
* @param	object	The object to be named.
* @param	name	The name to be given to the object.
* @exception org.odmg.ObjectNameNotUniqueException
* If an attempt is made to bind a name to an object and that name is already bound
* to an object.
*/
	public	void		bind(Object object, String name) throws ObjectNameNotUniqueException;

/**
* Lookup an object via its name,
* <BR><I> not yet available in RasDaMan. </BR></I>
* @param	name	The name of an object.
* @return The object with that name.
* @exception	ObjectNameNotFoundException	There is no object with the specified name.
* @see	ObjectNameNotFoundException
*/
	public	Object		lookup(String name) throws ObjectNameNotFoundException;

/**
* Disassociate a name with an object,
* <BR><I> not yet available in RasDaMan. </BR></I>
* @param	name	The name of an object.
* @exception	ObjectNameNotFoundException	No object exists in the database with that name.
*/
	public	void		unbind(String name) throws ObjectNameNotFoundException;

/**
* Make a transient object durable in the database,
* <BR><I> not yet available in RasDaMan. </BR></I>
* It must be executed in the context of an open transaction.
* If the transaction in which this method is executed commits,
* then the object is made durable.
* If the transaction aborts,
* then the makePersistent operation is considered not to have been executed,
* and the target object is again transient.
* ClassNotPersistenceCapableException is thrown if the implementation cannot make
* the object persistent because of the type of the object.
* @param	object	The object to make persistent.
*/
  public	void		makePersistent(Object object);

/**
* Deletes an object from the database,
* <BR><I> not yet available in RasDaMan. </BR></I>
* It must be executed in the context of an open transaction.
* If the object is not persistent, then ObjectNotPersistent is thrown.
* If the transaction in which this method is executed commits,
* then the object is removed from the database.
* If the transaction aborts,
* then the deletePersistent operation is considered not to have been executed,
* and the target object is again in the database.
* @param	object	The object to delete.
*/
  public	void		deletePersistent(Object object);
}