From 82821f8a31e5f98c27dced51f1bba0fc6637d598 Mon Sep 17 00:00:00 2001 From: Constantin Date: Mon, 14 Jun 2010 11:27:05 +0200 Subject: changed build system of java/ folder from makefile to ant (big compilation time improvement) --- .../odmg/ClassNotPersistenceCapableException.java | 51 +++++++ java/src/org/odmg/DArray.java | 49 ++++++ java/src/org/odmg/DBag.java | 85 +++++++++++ java/src/org/odmg/DCollection.java | 86 +++++++++++ java/src/org/odmg/DList.java | 55 +++++++ java/src/org/odmg/DMap.java | 40 +++++ java/src/org/odmg/DSet.java | 110 ++++++++++++++ java/src/org/odmg/Database.java | 150 +++++++++++++++++++ java/src/org/odmg/DatabaseClosedException.java | 51 +++++++ java/src/org/odmg/DatabaseIsReadOnlyException.java | 53 +++++++ java/src/org/odmg/DatabaseNotFoundException.java | 53 +++++++ java/src/org/odmg/DatabaseOpenException.java | 51 +++++++ java/src/org/odmg/Implementation.java | 113 ++++++++++++++ java/src/org/odmg/LockNotGrantedException.java | 66 +++++++++ java/src/org/odmg/Makefile | 66 +++++++++ java/src/org/odmg/Makefile.dep | 0 java/src/org/odmg/NotImplementedException.java | 49 ++++++ java/src/org/odmg/ODMGException.java | 49 ++++++ java/src/org/odmg/ODMGRuntimeException.java | 50 +++++++ java/src/org/odmg/OQLQuery.java | 86 +++++++++++ java/src/org/odmg/ObjectDeletedException.java | 50 +++++++ java/src/org/odmg/ObjectNameNotFoundException.java | 74 +++++++++ .../src/org/odmg/ObjectNameNotUniqueException.java | 80 ++++++++++ .../src/org/odmg/ObjectNotPersistentException.java | 49 ++++++ java/src/org/odmg/QueryException.java | 50 +++++++ java/src/org/odmg/QueryInvalidException.java | 51 +++++++ .../odmg/QueryParameterCountInvalidException.java | 51 +++++++ .../odmg/QueryParameterTypeInvalidException.java | 51 +++++++ java/src/org/odmg/Transaction.java | 165 +++++++++++++++++++++ java/src/org/odmg/TransactionAbortedException.java | 52 +++++++ .../org/odmg/TransactionInProgressException.java | 51 +++++++ .../odmg/TransactionNotInProgressException.java | 53 +++++++ 32 files changed, 2090 insertions(+) create mode 100644 java/src/org/odmg/ClassNotPersistenceCapableException.java create mode 100644 java/src/org/odmg/DArray.java create mode 100644 java/src/org/odmg/DBag.java create mode 100644 java/src/org/odmg/DCollection.java create mode 100644 java/src/org/odmg/DList.java create mode 100644 java/src/org/odmg/DMap.java create mode 100644 java/src/org/odmg/DSet.java create mode 100644 java/src/org/odmg/Database.java create mode 100644 java/src/org/odmg/DatabaseClosedException.java create mode 100644 java/src/org/odmg/DatabaseIsReadOnlyException.java create mode 100644 java/src/org/odmg/DatabaseNotFoundException.java create mode 100644 java/src/org/odmg/DatabaseOpenException.java create mode 100644 java/src/org/odmg/Implementation.java create mode 100644 java/src/org/odmg/LockNotGrantedException.java create mode 100644 java/src/org/odmg/Makefile create mode 100644 java/src/org/odmg/Makefile.dep create mode 100644 java/src/org/odmg/NotImplementedException.java create mode 100644 java/src/org/odmg/ODMGException.java create mode 100644 java/src/org/odmg/ODMGRuntimeException.java create mode 100644 java/src/org/odmg/OQLQuery.java create mode 100644 java/src/org/odmg/ObjectDeletedException.java create mode 100644 java/src/org/odmg/ObjectNameNotFoundException.java create mode 100644 java/src/org/odmg/ObjectNameNotUniqueException.java create mode 100644 java/src/org/odmg/ObjectNotPersistentException.java create mode 100644 java/src/org/odmg/QueryException.java create mode 100644 java/src/org/odmg/QueryInvalidException.java create mode 100644 java/src/org/odmg/QueryParameterCountInvalidException.java create mode 100644 java/src/org/odmg/QueryParameterTypeInvalidException.java create mode 100644 java/src/org/odmg/Transaction.java create mode 100644 java/src/org/odmg/TransactionAbortedException.java create mode 100644 java/src/org/odmg/TransactionInProgressException.java create mode 100644 java/src/org/odmg/TransactionNotInProgressException.java (limited to 'java/src/org') diff --git a/java/src/org/odmg/ClassNotPersistenceCapableException.java b/java/src/org/odmg/ClassNotPersistenceCapableException.java new file mode 100644 index 0000000..4fe7110 --- /dev/null +++ b/java/src/org/odmg/ClassNotPersistenceCapableException.java @@ -0,0 +1,51 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ + +package org.odmg; + +/** +* This exception is thrown when the implementation cannot make an object persistent because of the type of the object. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class ClassNotPersistenceCapableException extends ODMGRuntimeException +{ + +/** +* Construct an instance of the exception. +*/ + public ClassNotPersistenceCapableException() + { + super(); + } + +/** +* Construct an instance of the exception. +* @param msg A string providing a description of the exception. +*/ + public ClassNotPersistenceCapableException(String msg) + { + super(msg); + } +} diff --git a/java/src/org/odmg/DArray.java b/java/src/org/odmg/DArray.java new file mode 100644 index 0000000..de03894 --- /dev/null +++ b/java/src/org/odmg/DArray.java @@ -0,0 +1,49 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; +import java.util.List; + +/** +* The interface that defines the operations of an ODMG array, +*
not yet available in RasDaMan.
+* Nearly all of its operations are defined by the JavaSoft List interface. +* All of the operations defined by the JavaSoft List +* interface are supported by an ODMG implementation of DArray, +* the exception UnsupportedOperationException is not thrown when a +* call is made to any of the List methods. +* An instance of a class implementing this interface can be obtained +* by calling the method Implementation.newDArray. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ +// @see java.lang.UnsupportedOperationException + +public interface DArray extends org.odmg.DCollection, java.util.List +{ +/** +* Resize the array to have newSize elements. +* @param newSize The new size of the array. +*/ + public void resize(int newSize); +} + diff --git a/java/src/org/odmg/DBag.java b/java/src/org/odmg/DBag.java new file mode 100644 index 0000000..5812c32 --- /dev/null +++ b/java/src/org/odmg/DBag.java @@ -0,0 +1,85 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This interface defines the operations associated with an ODMG bag collection. +* All of the operations defined by the JavaSoft Collection +* interface are supported by an ODMG implementation of DBag, +* the exception UnsupportedOperationException is not thrown when a +* call is made to any of the Collection methods. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ +// * @see java.lang.UnsupportedOperationException + +public interface DBag extends DCollection +{ +/** +* A new DBag instance is created that is the union of this object +* and otherBag. +* This method is similar to the addAll method in Collection, +* except that this method creates a new collection and addAll +* modifies the object to contain the result. +* @param otherBag The other bag to use in the union operation. +* @return A DBag instance that contains the union of this object +* and otherBag. +*/ +// * @see com.sun.java.util.collections.Collection#addAll + public DBag union(DBag otherBag); + +/** +* A new DBag instance is created that contains the intersection of +* this object and the DBag referenced by otherBag. +* This method is similar to the retainAll method in Collection, +* except that this method creates a new collection and retainAll +* modifies the object to contain the result. +* @param otherBag The other bag to use in creating the intersection. +* @return A DBag instance that contains the intersection of this +* object and otherBag. +*/ +// @see com.sun.java.util.collections.Collection#retainAll + public DBag intersection(DBag otherBag); + +/** +* A new DBag instance is created that contains the difference of +* this object and the DBag instance referenced by otherBag. +* This method is similar to the removeAll method in Collection, +* except that this method creates a new collection and removeAll +* modifies the object to contain the result. +* @param otherBag The other bag to use in creating the difference. +* @return A DBag instance that contains the elements of this object +* minus the elements in otherBag. +*/ +// * @see com.sun.java.util.collections.Collection#removeAll + public DBag difference(DBag otherBag); + +/** +* This method returns the number of occurrences of the object obj +* in the DBag collection. +* @param obj The value that may have elements in the collection. +* @return The number of occurrences of obj in this collection. +*/ + public int occurrences(Object obj); +} + diff --git a/java/src/org/odmg/DCollection.java b/java/src/org/odmg/DCollection.java new file mode 100644 index 0000000..82cd7a9 --- /dev/null +++ b/java/src/org/odmg/DCollection.java @@ -0,0 +1,86 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* The base interface for all ODMG collections. +* The ODMG collections are based on JavaSoft's collection interfaces. +* All of the operations defined by the JavaSoft Collection +* interface are supported by an ODMG implementation of DCollection; +* the exception UnsupportedOperationException is not thrown when a +* call is made to any of the Collection methods. +*

+* DCollection contains methods used to perform queries on the collection. +* The OQL query predicate is given as a string with the syntax of the +* where clause of OQL. The predefined OQL variable this +* is used inside the predicate to denote the current element of the collection. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ +// * @see com.sun.java.util.collections.UnsupportedOperationException + +public interface DCollection extends java.util.Collection +{ +/** +* Selects the single element of the collection for which the provided OQL query +* predicate is true, +*
not yet available in RasDaMan.
+* @param predicate An OQL boolean query predicate. +* @return The element that evaluates to true for the predicate. If no element +* evaluates to true, null is returned. +* @exception QueryInvalidException The query predicate is invalid. +*/ + public Object selectElement(String predicate) throws QueryInvalidException; + +/** +* Access all of the elements of the collection that evaluate to true for the +* provided query predicate, +*
not yet available in RasDaMan.
+* @param predicate An OQL boolean query predicate. +* @return An iterator used to iterate over the elements that evaluated true for the predicate. +* @exception QueryInvalidException The query predicate is invalid. +*/ + public java.util.Iterator select(String predicate) throws QueryInvalidException; + +/** +* Evaluate the boolean query predicate for each element of the collection and +* return a new collection that contains each element that evaluated to true, +*
not yet available in RasDaMan.
+* @param predicate An OQL boolean query predicate. +* @return A new collection containing the elements that evaluated true for the predicate. +* @exception QueryInvalidException The query predicate is invalid. +*/ + public DCollection query(String predicate) throws QueryInvalidException; + +/** +* Determines whether there is an element of the collection that evaluates to true +* for the predicate, +*
not yet available in RasDaMan.
+* @param predicate An OQL boolean query predicate. +* @return True if there is an element of the collection that evaluates to true +* for the predicate, otherwise false. +* @exception QueryInvalidException The query predicate is invalid. +*/ + public boolean existsElement(String predicate) throws QueryInvalidException; +} + diff --git a/java/src/org/odmg/DList.java b/java/src/org/odmg/DList.java new file mode 100644 index 0000000..fbbc8b9 --- /dev/null +++ b/java/src/org/odmg/DList.java @@ -0,0 +1,55 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* The ODMG List collection. +* A DList collection is an ordered collection that provides +* efficient insertion and removal of elements at arbitrary positions in the +* list, but it also supports indexed access. The beginning index value is 0. +* When an element is added at a given position in the list, the index of all +* subsequent elements is increased by 1. Similarly, when an element is removed +* from the list, the index of all subsequent elements is decreased by 1. +*

+* All of the operations defined by the JavaSoft List +* interface are supported by an ODMG implementation of DList, +* the exception UnsupportedOperationException is not thrown when a +* call is made to any of the List methods. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ +// * @see com.sun.java.util.collections.UnsupportedOperationException + +public interface DList extends DCollection, java.util.List { +/** +* Creates a new DList object that contains the contents of this +* DList object concatenated +* with the contents of the otherList object. +* @param otherList The list whose elements are placed at the end of the list +* returned by this method. +* @return A new DList that is the concatenation of this list and +* the list referenced by otherList. +*/ + public DList concat(DList otherList); +} + diff --git a/java/src/org/odmg/DMap.java b/java/src/org/odmg/DMap.java new file mode 100644 index 0000000..0e99017 --- /dev/null +++ b/java/src/org/odmg/DMap.java @@ -0,0 +1,40 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* The ODMG Map collection interface, +*
not yet available in RasDaMan.
+* All of the operations defined by the JavaSoft Map +* interface are supported by an ODMG implementation of DMap, +* the exception UnsupportedOperationException is not thrown when a +* call is made to any of the Map methods. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ +// * @see com.sun.java.util.collections.UnsupportedOperationException + +public interface DMap extends java.util.Map { + +} + diff --git a/java/src/org/odmg/DSet.java b/java/src/org/odmg/DSet.java new file mode 100644 index 0000000..bcad44c --- /dev/null +++ b/java/src/org/odmg/DSet.java @@ -0,0 +1,110 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* The ODMG Set collection interface. +* A DSet object is an unordered collection that does not support +* multiple elements with the same value. An implementation typically is very +* efficient at determining whether the collection contains a particular value. +*

+* All of the operations defined by the JavaSoft Set +* interface are supported by an ODMG implementation of DSet, +* the exception UnsupportedOperationException is not thrown when a +* call is made to any of the Set methods. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ +// * @see java.lang.UnsupportedOperationException + +public interface DSet extends DCollection, java.util.Set +{ + +/** +* Create a new DSet object that is the set union of this +* DSet object and the set referenced by otherSet, +*
not yet available in RasDaMan.
+* @param otherSet The other set to be used in the union operation. +* @return A newly created DSet instance that contains the union of the two sets. +*/ + public DSet union(DSet otherSet); + +/** +* Create a new DSet object that is the set intersection of this +* DSet object and the set referenced by otherSet, +*
not yet available in RasDaMan.
+* @param otherSet The other set to be used in the intersection operation. +* @return A newly created DSet instance that contains the +* intersection of the two sets. +*/ + public DSet intersection(DSet otherSet); + +/** +* Create a new DSet object that contains the elements of this +* collection minus the elements in otherSet, +*
not yet available in RasDaMan.
+* @param otherSet A set containing elements that should not be in the result set. +* @return A newly created DSet instance that contains the elements +* of this set minus those elements in otherSet. +*/ + public DSet difference(DSet otherSet); + +/** +* Determine whether this set is a subset of the set referenced by otherSet, +*
not yet available in RasDaMan.
+* @param otherSet Another set. +* @return True if this set is a subset of the set referenced by otherSet, +* otherwise false. +*/ + public boolean subsetOf(DSet otherSet); + +/** +* Determine whether this set is a proper subset of the set referenced by +* otherSet, +*
not yet available in RasDaMan.
+* @param otherSet Another set. +* @return True if this set is a proper subset of the set referenced by +* otherSet, otherwise false. +*/ + public boolean properSubsetOf(DSet otherSet); + +/** +* Determine whether this set is a superset of the set referenced by otherSet, +*
not yet available in RasDaMan.
+* @param otherSet Another set. +* @return True if this set is a superset of the set referenced by otherSet, +* otherwise false. +*/ + public boolean supersetOf(DSet otherSet); + +/** +* Determine whether this set is a proper superset of the set referenced by +* otherSet, +*
not yet available in RasDaMan.
+* @param otherSet Another set. +* @return True if this set is a proper superset of the set referenced by +* otherSet, otherwise false. +*/ + public boolean properSupersetOf(DSet otherSet); +} + diff --git a/java/src/org/odmg/Database.java b/java/src/org/odmg/Database.java new file mode 100644 index 0000000..6edd15c --- /dev/null +++ b/java/src/org/odmg/Database.java @@ -0,0 +1,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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +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. +*

+* 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 bind) and +* retrieve it later by that name (using method lookup facilitates +* this start-up capability. A name is not explicitly defined as an attribute of +* an object. Naming an object also makes it persistent. +*

+* 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 DatabaseOpenException. +* A DatabaseNotFoundException is thrown if the database does not exist. +* Some implementations may throw additional exceptions that are also derived from +* ODMGException. +* @param name The name of the database. +* @param accessMode The access mode, which should be one of the static fields: +* OPEN_READ_ONLY, OPEN_READ_WRITE, +* or OPEN_EXCLUSIVE. +* @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 DatabaseClosedException to be thrown. +* Some implementations may throw additional exceptions that are also derived +* from ODMGException. +* @exception ODMGException Unable to close the database. +*/ + public void close() throws ODMGException; + +/** +* Associate a name with an object and make it persistent, +*
not yet available in RasDaMan.
+* 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, +*
not yet available in RasDaMan.
+* @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, +*
not yet available in RasDaMan.
+* @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, +*
not yet available in RasDaMan.
+* 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, +*
not yet available in RasDaMan.
+* 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); +} + diff --git a/java/src/org/odmg/DatabaseClosedException.java b/java/src/org/odmg/DatabaseClosedException.java new file mode 100644 index 0000000..134e53c --- /dev/null +++ b/java/src/org/odmg/DatabaseClosedException.java @@ -0,0 +1,51 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when an attempt is made to call a method +* on a Database that has been closed or has not been opened. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see org.odmg.Database +*/ + +public class DatabaseClosedException extends ODMGRuntimeException +{ +/** +* Construct an instance of the exception without a message. +*/ + public DatabaseClosedException() + { + super(); + } +/** +* Construct an instance of the exception with the provided message. +* @param msg A message indicating why the exception occurred. +*/ + public DatabaseClosedException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/DatabaseIsReadOnlyException.java b/java/src/org/odmg/DatabaseIsReadOnlyException.java new file mode 100644 index 0000000..4640372 --- /dev/null +++ b/java/src/org/odmg/DatabaseIsReadOnlyException.java @@ -0,0 +1,53 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when a call has been made that modifies +* a database that is open in read-only mode. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see org.odmg.Database +* @see org.odmg.ODMGRuntimeException +*/ + +public class DatabaseIsReadOnlyException extends ODMGRuntimeException +{ +/** +* Construct an instance of the exception without a message. +*/ + public DatabaseIsReadOnlyException() + { + super(); + } + +/** +* Construct an instance of the exception with a descriptive message. +* @param msg A message indicating why the exception occurred. +*/ + public DatabaseIsReadOnlyException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/DatabaseNotFoundException.java b/java/src/org/odmg/DatabaseNotFoundException.java new file mode 100644 index 0000000..0151685 --- /dev/null +++ b/java/src/org/odmg/DatabaseNotFoundException.java @@ -0,0 +1,53 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when attempting to open a database that does not exist. +* This could be caused by the name provided to Database.open being incorrect. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see org.odmg.Database#open +*/ + +public class DatabaseNotFoundException extends ODMGException +{ +/** +* Construct an instance of the exception. +*/ + public DatabaseNotFoundException() + { + super(); + } + + +/** +* Construct an instance of the exception with a descriptive message. +* @param msg A message indicating why the exception occurred. +*/ + public DatabaseNotFoundException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/DatabaseOpenException.java b/java/src/org/odmg/DatabaseOpenException.java new file mode 100644 index 0000000..f34238a --- /dev/null +++ b/java/src/org/odmg/DatabaseOpenException.java @@ -0,0 +1,51 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when attempting to open a database that is already open. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see org.odmg.Database#open +*/ + +public class DatabaseOpenException extends ODMGException +{ +/** +* Construct an instance of the exception. +*/ + public DatabaseOpenException() + { + super(); + } + +/** +* Construct an instance of the exception with a descriptive message. +* @param msg A message indicating why the exception occurred. +*/ + public DatabaseOpenException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/Implementation.java b/java/src/org/odmg/Implementation.java new file mode 100644 index 0000000..f2d2e6f --- /dev/null +++ b/java/src/org/odmg/Implementation.java @@ -0,0 +1,113 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* The factory interface for a particular ODMG implementation. +* Each ODMG implementation will have a class that implements this interface. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public interface Implementation { +/** +* Create a Transaction object and associate it with the current thread. +* @return The newly created Transaction instance. +* @see org.odmg.Transaction +*/ + public Transaction newTransaction(); + +/** +* Get the current Transaction for the thread. +* @return The current Transaction object or null if there is none. +* @see org.odmg.Transaction +*/ + public Transaction currentTransaction(); + +/** +* Create a new Database object. +* @return The new Database object. +* @see org.odmg.Database +*/ + public Database newDatabase(); + +/** +* Create a new OQLQuery object. +* @return The new OQLQuery object. +* @see org.odmg.OQLQuery +*/ + public OQLQuery newOQLQuery(); + +/** +* Create a new DList object. +* @return The new DList object. +* @see org.odmg.DList +*/ + public DList newDList(); + +/** +* Create a new DBag object. +* @return The new DBag object. +* @see org.odmg.DBag +*/ + public DBag newDBag(); + +/** +* Create a new DSet object. +* @return The new DSet object. +* @see org.odmg.DSet +*/ + public DSet newDSet(); + +/** +* Create a new DArray object, +*
not yet available in RasDaMan.
+* @return The new DArray object. +* @see org.odmg.DArray +*/ + public DArray newDArray(); + +/** +* Create a new DMap object, +*
not yet available in RasDaMan.
+* @return The new DMap object. +* @see org.odmg.DMap +*/ + public DMap newDMap(); + +/** +* Get a String representation of the object's identifier. +* @param obj The object whose identifier is being accessed. +* @return The object's identifier in the form of a String +*/ + public String getObjectId(Object obj); + +/** +* Get the Database that contains the object obj, +*
not yet available in RasDaMan.
+* @param obj The object. +* @return The Database that contains the object. +*/ + public Database getDatabase(Object obj); +} + diff --git a/java/src/org/odmg/LockNotGrantedException.java b/java/src/org/odmg/LockNotGrantedException.java new file mode 100644 index 0000000..4287d2c --- /dev/null +++ b/java/src/org/odmg/LockNotGrantedException.java @@ -0,0 +1,66 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown if a lock could not be granted on an object. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class LockNotGrantedException extends ODMGRuntimeException +{ +/** +* Construct an instance of the exception. +*/ + public LockNotGrantedException() + { + super(); + } + +/** +* Construct an instance of the exception with a descriptive message. +* @param msg A description of the exception. +*/ + public LockNotGrantedException(String msg) + { + super(msg); + } +/* + private Object o; + private int m; +* +* Construct an instance of the exception. +* @param obj The object that the application was trying to acquire a lock on. +* @param mode The lock mode that the application was attempting to acquire. +* @see org.odmg.Transaction#lock +* + public LockNotGrantedException(Object obj, int mode) + { + super(); + o = obj; + m = mode; + } +*/ +} + diff --git a/java/src/org/odmg/Makefile b/java/src/org/odmg/Makefile new file mode 100644 index 0000000..a50c9b4 --- /dev/null +++ b/java/src/org/odmg/Makefile @@ -0,0 +1,66 @@ +# -*-Makefile-*- (for Emacs) +# +# 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 . +# +# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +# rasdaman GmbH. +# +# For more information please see +# or contact Peter Baumann via . # Top Level makefile. This points to the various modules that have to be build +# and/or deployed +# +# MAKEFILE FOR: +# package RasJ +# +# COMMENTS: +# +################################################################## +######################### Definitions ############################ + +# standard include with general options +include $(RMANBASE)/Makefile.inc + +# directory where HTML documentation is created +DOCDIR := $(DOCBASE)/java/org + +########################### Targets ############################## + +SRCS = DArray.java DatabaseOpenException.java ObjectNotPersistentException.java \ + DBag.java Implementation.java QueryException.java DCollection.java \ + LockNotGrantedException.java QueryInvalidException.java \ + DList.java NotImplementedException.java QueryParameterCountInvalidException.java \ + DMap.java ODMGException.java QueryParameterTypeInvalidException.java \ + DSet.java ODMGRuntimeException.java Transaction.java Database.java \ + OQLQuery.java TransactionAbortedException.java DatabaseClosedException.java \ + ObjectDeletedException.java TransactionInProgressException.java \ + DatabaseIsReadOnlyException.java DatabaseNotFoundException.java ObjectNameNotFoundException.java \ + TransactionNotInProgressException.java +OBJS = ${SRCS:%.java=%.class} +MISCCLEAN = *.class + +########################### Targets ############################## + +# compile everything +.PHONY : all +all: $(OBJS) + + +# delete all files +empty: + -rm -f $(SRCS) $(MISCCLEAN) + +# general rules +include $(RMANBASE)/Makefile.rel diff --git a/java/src/org/odmg/Makefile.dep b/java/src/org/odmg/Makefile.dep new file mode 100644 index 0000000..e69de29 diff --git a/java/src/org/odmg/NotImplementedException.java b/java/src/org/odmg/NotImplementedException.java new file mode 100644 index 0000000..db90b14 --- /dev/null +++ b/java/src/org/odmg/NotImplementedException.java @@ -0,0 +1,49 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ + +package org.odmg; +/** +* This exception is thrown when an implementation does not support an operation. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class NotImplementedException extends ODMGRuntimeException +{ +/** +* Construct an instance of the exception. +*/ + public NotImplementedException() + { + super(); + } + +/** +* Construct an instance of the exception. +* @param msg A string providing a description of the exception. +*/ + public NotImplementedException(String msg) + { + super(msg); + } +} diff --git a/java/src/org/odmg/ODMGException.java b/java/src/org/odmg/ODMGException.java new file mode 100644 index 0000000..866bec5 --- /dev/null +++ b/java/src/org/odmg/ODMGException.java @@ -0,0 +1,49 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This is the base class for all exceptions thrown by an ODMG implementation. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class ODMGException extends Exception { +/** +* Construct an ODMGException object without an error message. +*/ + public ODMGException() + { + super(); + } +/** +* Construct an ODMGException object with an error message. +* @param msg The error message associated with this exception. +*/ + + public ODMGException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/ODMGRuntimeException.java b/java/src/org/odmg/ODMGRuntimeException.java new file mode 100644 index 0000000..c124d00 --- /dev/null +++ b/java/src/org/odmg/ODMGRuntimeException.java @@ -0,0 +1,50 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This is the base class for all RuntimeExceptions thrown by an ODMG implementation. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class ODMGRuntimeException extends RuntimeException { + +/** +* Construct an instance of the exception. +*/ + public ODMGRuntimeException() + { + super(); + } + +/** +* Construct an instance of the exception with the specified message. +* @param msg The message associated with the exception. +*/ + public ODMGRuntimeException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/OQLQuery.java b/java/src/org/odmg/OQLQuery.java new file mode 100644 index 0000000..9d09c4f --- /dev/null +++ b/java/src/org/odmg/OQLQuery.java @@ -0,0 +1,86 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* The interface to an OQL query object. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public interface OQLQuery { + +/** +* Create an OQL query from the string parameter. +* In order to execute a query, an OQLQuery object must be created +* by calling Implementation.newOQLQuery, then calling the +* create method with the query string. +* The create method might throw QueryInvalidException +* if the query could not be compiled properly. Some implementations may not want +* to compile the query before execute is called. In this case +* QueryInvalidException is thrown when execute is called. +* @param query An OQL query. +* @exception QueryInvalidException The query syntax is invalid. +*/ + public void create(String query) throws QueryInvalidException; + +/** +* Bind a parameter to the query. +* A parameter is denoted in the query string passed to create by $i, +* where i is the rank of the parameter, beginning with 1. +* The parameters are set consecutively by calling this method bind. +* The ith variable is set by the ith call to the bind method. +* If any of the $i are not set by a call to bind at the point +* execute is called, QueryParameterCountInvalidException is thrown. +* The parameters must be objects, and the result is an Object. +* Objects must be used instead of primitive types (Integer instead +* of int) for passing the parameters. +*

+* If the parameter is of the wrong type, +* QueryParameterTypeInvalidException is thrown. +* After executing a query, the parameter list is reset. +* @param parameter A value to be substituted for a query parameter. +* @exception QueryParameterCountInvalidException The number of calls to +* bind has exceeded the number of parameters in the query. +* @exception QueryParameterTypeInvalidException The type of the parameter does +* not correspond with the type of the parameter in the query. +*/ + public void bind(Object parameter) throws QueryParameterCountInvalidException, + QueryParameterTypeInvalidException; + +/** +* Execute the query. +* After executing a query, the parameter list is reset. +* Some implementations may throw additional exceptions that are also derived +* from ODMGException. +* @return The object that represents the result of the query. +* The returned data, whatever its OQL type, is encapsulated into an object. +* For instance, when OQL returns an integer, the result is put into an +* Integer object. When OQL returns a collection (literal or object), +* the result is always a Java collection object of the same kind +* (for instance, a DList). +* @exception QueryException An exception has occurred while executing the query. +*/ + public Object execute() throws QueryException; +} + diff --git a/java/src/org/odmg/ObjectDeletedException.java b/java/src/org/odmg/ObjectDeletedException.java new file mode 100644 index 0000000..dfdcc6c --- /dev/null +++ b/java/src/org/odmg/ObjectDeletedException.java @@ -0,0 +1,50 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when accessing an object that was deleted. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class ObjectDeletedException extends ODMGRuntimeException +{ + +/** +* Construct an instance of the exception. +*/ + public ObjectDeletedException() + { + super(); + } + +/** +* Construct an instance of the exception. +* @param msg A string providing a description of the exception. +*/ + public ObjectDeletedException(String msg) + { + super(msg); + } +} diff --git a/java/src/org/odmg/ObjectNameNotFoundException.java b/java/src/org/odmg/ObjectNameNotFoundException.java new file mode 100644 index 0000000..a0f4e01 --- /dev/null +++ b/java/src/org/odmg/ObjectNameNotFoundException.java @@ -0,0 +1,74 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* An attempt to get a object via its name using Database.lookup +* and the name is not associated with an object in the database. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see org.odmg.Database#lookup +*/ + +public class ObjectNameNotFoundException extends ODMGException +{ +/** +* Construct an instance of the exception. +*/ + public ObjectNameNotFoundException() + { + super(); + } + +/** +* Construct an instance of the exception with a descriptive message. +* @param msg A message describing the exception. +*/ + public ObjectNameNotFoundException(String msg) + { + super(msg); + } +/* + private String n; + +* Construct an instance of the exception. +* @param name The name passed to Database.lookup that is not associated with +* any object in the database. + + public ObjectNameNotFoundException(String name) + { + super(); + n = name; + } + + +* Access the name that is not bound to any object in the database. +* @return The name that was passed to Database.lookup. + + public String getName() + { + return n; + } +*/ +} + diff --git a/java/src/org/odmg/ObjectNameNotUniqueException.java b/java/src/org/odmg/ObjectNameNotUniqueException.java new file mode 100644 index 0000000..8d18ae7 --- /dev/null +++ b/java/src/org/odmg/ObjectNameNotUniqueException.java @@ -0,0 +1,80 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when attempting to bind a name to an object +* when the name is already bound to another object. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see org.odmg.Database#bind +*/ + +public class ObjectNameNotUniqueException extends ODMGException +{ +/** +* Construct an instance of the exception. +*/ + public ObjectNameNotUniqueException() + { + super(); + } + +/** +* Construct an instance of the exception with a descriptive message. +* @param msg A message containing a description of the exception. +*/ + public ObjectNameNotUniqueException(String msg) + { + super(msg); + } +/* + private Object o; + private String n; + public ObjectNameNotUniqueException(Object obj, String name) + { + super(); + o = obj; + n = name; + } + + +* Get the object that was passed to Database.bind. +* @return The object that was being bound to a name. + + public Object getObject() + { + return o; + } + + +* Get the name that is not unique. +* @return The name that is already associated with another object. + + public String getName() + { + return n; + } +*/ +} + diff --git a/java/src/org/odmg/ObjectNotPersistentException.java b/java/src/org/odmg/ObjectNotPersistentException.java new file mode 100644 index 0000000..15dbfdf --- /dev/null +++ b/java/src/org/odmg/ObjectNotPersistentException.java @@ -0,0 +1,49 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when deleting an object that is not persistent. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class ObjectNotPersistentException extends ODMGRuntimeException { + +/** +* Construct an instance of the exception. +*/ + public ObjectNotPersistentException() + { + super(); + } + +/** +* Construct an instance of the exception. +* @param msg A string providing a description of the exception. +*/ + public ObjectNotPersistentException(String msg) + { + super(msg); + } +} diff --git a/java/src/org/odmg/QueryException.java b/java/src/org/odmg/QueryException.java new file mode 100644 index 0000000..ab7a855 --- /dev/null +++ b/java/src/org/odmg/QueryException.java @@ -0,0 +1,50 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This is the base class for all exceptions associated with queries. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class QueryException extends ODMGException { +/** +* Constructs an instance of the exception. +*/ + public QueryException() + { + super(); + } + +/** +* Constructs an instance of the exception with a message indicating the reason +* for the exception. +* @param msg A message indicating the reason for the exception. +*/ + public QueryException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/QueryInvalidException.java b/java/src/org/odmg/QueryInvalidException.java new file mode 100644 index 0000000..25ea648 --- /dev/null +++ b/java/src/org/odmg/QueryInvalidException.java @@ -0,0 +1,51 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown if the query is not a valid OQL query. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class QueryInvalidException extends QueryException +{ +/** +* Construct an instance of the exception. +*/ + public QueryInvalidException() + { + super(); + } + +/** +* Construct an instance of the exception. +* @param msg A string indicating why the OQLQuery instance does not +* represent a valid OQL query. +*/ + public QueryInvalidException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/QueryParameterCountInvalidException.java b/java/src/org/odmg/QueryParameterCountInvalidException.java new file mode 100644 index 0000000..c14fc47 --- /dev/null +++ b/java/src/org/odmg/QueryParameterCountInvalidException.java @@ -0,0 +1,51 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when the number of bound parameters for a query +* does not match the number of placeholders. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class QueryParameterCountInvalidException extends QueryException +{ +/** +* Construct an instance of the exception. +*/ + public QueryParameterCountInvalidException() + { + super(); + } + +/** +* Construct an instance of the exception with a message. +* @param msg A message indicating why the exception has been thrown. +*/ + public QueryParameterCountInvalidException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/QueryParameterTypeInvalidException.java b/java/src/org/odmg/QueryParameterTypeInvalidException.java new file mode 100644 index 0000000..7ce81ea --- /dev/null +++ b/java/src/org/odmg/QueryParameterTypeInvalidException.java @@ -0,0 +1,51 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when the type of a query parameter +* is not compatible with the expected type. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class QueryParameterTypeInvalidException extends QueryException +{ +/** +* Construct an instance of the exception. +*/ + public QueryParameterTypeInvalidException() + { + super(); + } + +/** +* Construct an instance of the exception with a message. +* @param msg The message explaining details of the exception. +*/ + public QueryParameterTypeInvalidException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/Transaction.java b/java/src/org/odmg/Transaction.java new file mode 100644 index 0000000..41560b1 --- /dev/null +++ b/java/src/org/odmg/Transaction.java @@ -0,0 +1,165 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This interfaces provides the operations necessary to perform database transactions. +* All access, creation, and modification of persistent objects and their fields +* must be done within a transaction. Before performing any database operations, +* a thread must explicitly create a transaction object or associate itself with +* an existing transaction object (by calling join), +* and that transaction must be open (through a call to begin). +* All subsequent operations by the thread, including reads, writes, and lock +* acquisitions, are done under the thread's current transaction. +*

+* A thread may only operate on its current transaction. For example, +* a TransactionNotInProgressException is thrown if a thread attempts +* to begin, commit, checkpoint, or abort a transaction prior to joining itself +* to that transaction. +*

+* A transaction is either open or closed. A transaction is open if a call +* has been made to begin, but no call has been made to commit or +* abort. Once commit or abort is called, +* the transaction is closed. The method isOpen can be called to +* determine the state of the transaction. +*

+* Read locks are implicitly obtained on objects as they are accessed. +* Write locks are implicitly obtained as objects are modified. +* Transaction objects are transient, they cannot be stored in the database. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see TransactionNotInProgressException +*/ + +public interface Transaction { +/** +* Attach the caller's thread to this Transaction and detach the thread +* from any former Transaction the thread may have been associated with, +*
not yet available in rasdaman.
+*/ + public void join(); + +/** +* Detach the caller's thread from this Transaction, but do not attach +* the thread to another Transaction, +*
not yet available in rasdaman.
+*/ + public void leave(); + +/** +* Start a transaction. +* Calling begin multiple times on the same transaction object, +* without an intervening call to commit or abort, +* causes the exception TransactionInProgressException to be thrown +* on the second and subsequent calls. Operations executed before a transaction +* has been opened, or before reopening after a transaction is aborted or committed, +* have undefined results; +* these may throw a TransactionNotInProgressException exception. +*/ + public void begin(); + +/** +* Determine whether the transaction is open or not. +* A transaction is open if a call has been made to begin, +* but a subsequent call to either commit or abort +* has not been made. +* @return True if the transaction is open, otherwise false. +*/ + public boolean isOpen(); + +/** +* Commit and close the transaction. +* Calling commit commits to the database all persistent object +* modifications within the transaction and releases any locks held by the transaction. +* A persistent object modification is an update of any field of an existing +* persistent object, or an update or creation of a new named object in the database. +* If a persistent object modification results in a reference from an existing +* persistent object to a transient object, the transient object is moved to the +* database, and all references to it updated accordingly. Note that the act of +* moving a transient object to the database may create still more persistent +* references to transient objects, so its referents must be examined and moved as well. +* This process continues until the database contains no references to transient objects, +* a condition that is guaranteed as part of transaction commit. +* Committing a transaction does not remove from memory transient objects created +* during the transaction +*/ + public void commit(); + +/** +* Abort and close the transaction. +* Calling abort abandons all persistent object modifications and releases the +* associated locks. +* Aborting a transaction does not restore the state of modified transient objects +*/ + public void abort(); + +/** +* Commit the transaction, but reopen the transaction, retaining all locks. +* Calling checkpoint commits persistent object modifications made +* within the transaction since the last checkpoint to the database. +* The transaction retains all locks it held on those objects at the time the +* checkpoint was invoked. +*/ + public void checkpoint(); + +/** +* Read lock mode. +*/ + public static final int READ = 1; + +/** +* Upgrade lock mode. +*/ + public static final int UPGRADE = 2; + +/** +* Write lock mode. +*/ + public static final int WRITE = 4; + +/** +* Upgrade the lock on the given object to the given lock mode, +*
not yet available in rasdaman.
+* The call has no effect if the object's current lock is already at or above +* that level of lock mode. +* @param obj The object to acquire a lock on. +* @param lockMode The lock mode to acquire. The lock modes are READ, +* UPGRADE, and WRITE. +* @exception LockNotGrantedException Is thrown if the given lock mode could not be acquired. +*/ + public void lock(Object obj, int lockMode) + throws LockNotGrantedException; +/** +* Upgrade the lock on the given object to the given lock mode, +*
not yet available in rasdaman.
+* Method tryLock is the same as lock except it returns +* a boolean indicating whether the lock was granted instead of generating an exception. +* @param obj The object to acquire a lock on. +* @param lockMode The lock mode to acquire. The lock modes are READ, +* UPGRADE, and WRITE. +* @return True if the lock has been acquired, otherwise false. +*/ + public boolean tryLock(Object obj, int lockMode); + +} + diff --git a/java/src/org/odmg/TransactionAbortedException.java b/java/src/org/odmg/TransactionAbortedException.java new file mode 100644 index 0000000..0a1d0d3 --- /dev/null +++ b/java/src/org/odmg/TransactionAbortedException.java @@ -0,0 +1,52 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when the database asynchronously and explicitly +* aborts the user's transaction due to some failure, the user's data is reset +* just as if the user had directly called Transaction.abort. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class TransactionAbortedException extends ODMGRuntimeException +{ +/** +* Constructs an instance of the exception. +*/ + public TransactionAbortedException() + { + super(); + } + +/** +* Constructs an instance of the exception with the provided message. +* @param msg The message that describes the exception. +*/ + public TransactionAbortedException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/TransactionInProgressException.java b/java/src/org/odmg/TransactionInProgressException.java new file mode 100644 index 0000000..1d1f908 --- /dev/null +++ b/java/src/org/odmg/TransactionInProgressException.java @@ -0,0 +1,51 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when a call has been made to a method that +* should not be called when a transaction is in progress. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +*/ + +public class TransactionInProgressException extends ODMGRuntimeException +{ +/** +* Constructs an instance of the exception. +*/ + public TransactionInProgressException() + { + super(); + } + +/** +* Constructs an instance of the exception with the provided message. +* @param msg The message explaining the exception. +*/ + public TransactionInProgressException(String msg) + { + super(msg); + } +} + diff --git a/java/src/org/odmg/TransactionNotInProgressException.java b/java/src/org/odmg/TransactionNotInProgressException.java new file mode 100644 index 0000000..9770671 --- /dev/null +++ b/java/src/org/odmg/TransactionNotInProgressException.java @@ -0,0 +1,53 @@ +/* +* 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 . +* +* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / +rasdaman GmbH. +* +* For more information please see +* or contact Peter Baumann via . +*/ +package org.odmg; + +/** +* This exception is thrown when attempting to perform an operation that +* must be performed when there is a transaction is in progress, but no +* such transaction is in progress. +* @author David Jordan (as Java Editor of the Object Data Management Group) +* @version ODMG 3.0 +* @see ODMGRuntimeException +*/ + +public class TransactionNotInProgressException extends ODMGRuntimeException +{ +/** +* Constructs an instance of the exception. +*/ + public TransactionNotInProgressException() + { + super(); + } + +/** +* Constructs an instance of the exception with the provided message. +* @param msg A message that describes the exception. +*/ + public TransactionNotInProgressException(String msg) + { + super(msg); + } +} + -- cgit