org.eyedb
Class Database

java.lang.Object
  extended by org.eyedb.Object
      extended by org.eyedb.Instance
          extended by org.eyedb.Agregat
              extended by org.eyedb.Struct
                  extended by org.eyedb.Database

public class Database
extends Struct

This class is used to open a database and to perform operations on it.

For instance :

 Database db = new Database("mydatabase");

 try {
   db.open(conn, Database.DBRead);
 } catch(Exception e) {
   System.err.println(e);
   System.exit(1);
 }
 


Field Summary
static int DBRead
          use the flag DBRead to open the database in ReadOnly mode
static int DBReadAdmin
          use the flag DBAdmin to open the database in ReadOnly Admin mode
static int DBRSRead
          use the flag DBSRead to open the database in ReadWrite mode
static int DBRW
          use the flag DBRW to open the database in ReadWrite mode
static int DBRWAdmin
          use the flag DBAdmin to open the database in ReadWrite Admin mode
 
Fields inherited from class org.eyedb.Struct
idbclass
 
Fields inherited from class org.eyedb.Object
CMTimeTrace, CompOidTrace, ContentsTrace, CTimeTrace, MTimeTrace, NativeTrace, PointerTrace
 
Constructor Summary
Database(int dbid)
          constructs a database from a database identifier.
Database(int dbid, java.lang.String dbmfile)
          constructs a database from a dbid and a DBMFILE.
Database(java.lang.String dbname)
          constructs a database from a name.
Database(java.lang.String dbname, java.lang.String dbmfile)
          constructs a database from a name and a DBMFILE.
 
Method Summary
 void close()
          close the database
 Connection getConnection()
          returns the connection associated with this database
 Datafile getDatafile(short id)
           
 Datafile getDatafile(short id, boolean fetch)
           
 Datafile getDatafile(short id, boolean fetch, java.lang.String userauth, java.lang.String passwdauth)
           
 Datafile getDatafile(java.lang.String name)
           
 Datafile getDatafile(java.lang.String name, boolean fetch)
           
 Datafile getDatafile(java.lang.String name, boolean fetch, java.lang.String userauth, java.lang.String passwdauth)
           
 Datafile[] getDatafiles()
           
 Datafile[] getDatafiles(boolean fetch)
           
 Datafile[] getDatafiles(boolean fetch, java.lang.String userauth, java.lang.String passwdauth)
           
 Dataspace getDataspace(short id)
           
 Dataspace getDataspace(short id, boolean fetch)
           
 Dataspace getDataspace(short id, boolean fetch, java.lang.String user, java.lang.String passwd)
           
 Dataspace getDataspace(java.lang.String name)
           
 Dataspace getDataspace(java.lang.String name, boolean fetch)
           
 Dataspace getDataspace(java.lang.String name, boolean fetch, java.lang.String userauth, java.lang.String passwdauth)
           
 Dataspace[] getDataspaces()
           
 Dataspace[] getDataspaces(boolean fetch)
           
 Dataspace[] getDataspaces(boolean fetch, java.lang.String user, java.lang.String passwd)
           
 int getDbid()
          returns the database identifier
 java.lang.String getDBMFile()
          returns the DBMFILE associated with this database
 Dataspace getDefaultDataspace()
           
 TransactionParams getDefaultTransactionParams()
           
 int getFlags()
          returns the opening flags
 TransactionParams getGlobalDefaultTransactionParams()
           
 DatabaseInfoDescription getInfo()
           
 DatabaseInfoDescription getInfo(Connection conn, java.lang.String userauth, java.lang.String passwdauth)
           
 DatabaseInfoDescription getInfo(java.lang.String userauth, java.lang.String passwdauth)
           
 java.lang.String getName()
          returns the database name
 Class getObjectClass(Oid oid)
           
 ObjectLocationArray getObjectsLocations(OidArray oid_arr)
           
 Schema getSchema()
          returns the schema associated with this database
 int getUid()
           
 java.lang.String getUserAuth()
          returns the user associated with this database
 int getVersion()
          returns the database version
 boolean isInTransaction()
           
 Object loadObject(Oid oid)
           
 Object loadObject(Oid oid, int lockmode, RecMode rcm)
           
 Object loadObject(Oid oid, RecMode rcm)
           
 Object loadObjectRealize(Oid oid, int lockmode, RecMode rcm)
          load an object from its oid (Object IDentifier) and according to the recursive mode rcm
 void moveObjects(ObjectArray obj_array, Dataspace dataspace)
           
 void moveObjects(OidArray oid_arr, Dataspace dataspace)
           
 void open(Connection conn, int flags)
          open a database.
 void open(Connection conn, int flags, java.lang.String userauth, java.lang.String passwdauth)
          open a database.
 void removeObject(Oid oid)
           
 void setDefaultDataspace(Dataspace dataspace)
           
 void setDefaultTransactionParams(TransactionParams default_params)
           
static void setGlobalDefaultTransactionParams(TransactionParams default_params)
           
 void transactionAbort()
          aborts the current transaction
 void transactionBegin()
          begins a transaction using Root.ReadWriteSharedTRMode as transaction mode and Root.WriteOnCommit as writing mode
 void transactionBegin(TransactionParams params)
          begins a transaction using trmode transaction mode and Root.WriteOnCommit as writing mode
 void transactionCommit()
          commits the current transaction
 
Methods inherited from class org.eyedb.Instance
realize, traceRealize
 
Methods inherited from class org.eyedb.Object
getClass, getCTime, getDatabase, getDataspace, getDataspace, getIDR, getIDRSize, getLocation, getMasterObject, getMTime, getOid, getRefCount, getUserData, isGRTObject, loadPerform, move, realize, remove, setClass, setDatabase, setDataspace, setIDR, setMasterObject, setOid, setUserData, store, store, trace, trace, trace, trace, tracePdata, userInitialize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBRead

public static final int DBRead
use the flag DBRead to open the database in ReadOnly mode

See Also:
Constant Field Values

DBRW

public static final int DBRW
use the flag DBRW to open the database in ReadWrite mode

See Also:
Constant Field Values

DBRSRead

public static final int DBRSRead
use the flag DBSRead to open the database in ReadWrite mode

See Also:
Constant Field Values

DBReadAdmin

public static final int DBReadAdmin
use the flag DBAdmin to open the database in ReadOnly Admin mode

See Also:
Constant Field Values

DBRWAdmin

public static final int DBRWAdmin
use the flag DBAdmin to open the database in ReadWrite Admin mode

See Also:
Constant Field Values
Constructor Detail

Database

public Database(java.lang.String dbname)
constructs a database from a name.
this constructor does not open the database, only a runtime object is created.

Parameters:
dbname - The database name

Database

public Database(int dbid)
constructs a database from a database identifier.
this constructor does not open the database, only a runtime object is created.

Parameters:
dbid - The database identifier

Database

public Database(java.lang.String dbname,
                java.lang.String dbmfile)
constructs a database from a name and a DBMFILE.
this constructor does not open the database, only a runtime object is created.

Parameters:
dbname - The database name
dbmfile - The DBM (Database Manager) file

Database

public Database(int dbid,
                java.lang.String dbmfile)
constructs a database from a dbid and a DBMFILE.
this constructor does not open the database, only a runtime object is created.

Parameters:
dbid - The database identifier
dbmfile - The DBM (Database Manager) file
Method Detail

open

public void open(Connection conn,
                 int flags,
                 java.lang.String userauth,
                 java.lang.String passwdauth)
          throws Exception
open a database.

Parameters:
conn - The Connection
flags - The opening flags : DBRW or DBRead
userauth - The User authentication
passwdauth - The Password authentication
Throws:
DatabaseOpeningException
Exception

open

public void open(Connection conn,
                 int flags)
          throws Exception
open a database.

Parameters:
conn - The Connection
flags - The opening flags : DBRW or DBRead
Throws:
DatabaseOpeningException
Exception

transactionBegin

public void transactionBegin()
                      throws Exception
begins a transaction using Root.ReadWriteSharedTRMode as transaction mode and Root.WriteOnCommit as writing mode

Parameters:
None -
Throws:
TransactionException
Exception
See Also:
Root.DefaultTRMode, Root.ReadWriteSharedTRMode, Root.WriteExclusiveTRMode, Root.ReadWriteExclusiveTRMode, Root.DefaultWRMode, Root.WriteOnCommit, Root.WriteImmediate

transactionBegin

public void transactionBegin(TransactionParams params)
                      throws Exception
begins a transaction using trmode transaction mode and Root.WriteOnCommit as writing mode

Parameters:
None -
Throws:
TransactionException
Exception
See Also:
Root.DefaultTRMode, Root.ReadWriteSharedTRMode, Root.WriteExclusiveTRMode, Root.ReadWriteExclusiveTRMode, Root.DefaultWRMode, Root.WriteOnCommit, Root.WriteImmediate

transactionCommit

public void transactionCommit()
                       throws Exception
commits the current transaction

Parameters:
None -
Throws:
TransactionException - is thrown if no transaction is in course
Exception

transactionAbort

public void transactionAbort()
                      throws Exception
aborts the current transaction

Parameters:
None -
Throws:
TransactionException - is thrown if no transaction is in course
Exception

isInTransaction

public boolean isInTransaction()
Parameters:
None -
Returns:
true if in transaction, false otherwise

close

public void close()
           throws Exception
close the database

Parameters:
None -
Throws:
DatabaseClosingException - is thrown is the database is not opened
Exception

loadObjectRealize

public Object loadObjectRealize(Oid oid,
                                int lockmode,
                                RecMode rcm)
                         throws Exception
load an object from its oid (Object IDentifier) and according to the recursive mode rcm

Parameters:
oid - The OID of the object to load
rcm - The Recursive Mode to be used
Returns:
The Object
Throws:
Exception

loadObject

public Object loadObject(Oid oid,
                         int lockmode,
                         RecMode rcm)
                  throws Exception
Throws:
Exception

loadObject

public Object loadObject(Oid oid,
                         RecMode rcm)
                  throws Exception
Throws:
Exception

loadObject

public Object loadObject(Oid oid)
                  throws Exception
Throws:
Exception

removeObject

public void removeObject(Oid oid)
                  throws Exception
Throws:
Exception

getSchema

public Schema getSchema()
returns the schema associated with this database


getConnection

public Connection getConnection()
returns the connection associated with this database


getName

public java.lang.String getName()
returns the database name


getDbid

public int getDbid()
returns the database identifier


getVersion

public int getVersion()
returns the database version


getFlags

public int getFlags()
returns the opening flags


getDBMFile

public java.lang.String getDBMFile()
returns the DBMFILE associated with this database


getUserAuth

public java.lang.String getUserAuth()
returns the user associated with this database


getUid

public int getUid()

getObjectClass

public Class getObjectClass(Oid oid)
                     throws Exception
Throws:
Exception

getDatafiles

public Datafile[] getDatafiles()
                        throws Exception
Throws:
Exception

getDatafiles

public Datafile[] getDatafiles(boolean fetch)
                        throws Exception
Throws:
Exception

getDatafiles

public Datafile[] getDatafiles(boolean fetch,
                               java.lang.String userauth,
                               java.lang.String passwdauth)
                        throws Exception
Throws:
Exception

getDatafile

public Datafile getDatafile(short id)
                     throws Exception
Throws:
Exception

getDatafile

public Datafile getDatafile(short id,
                            boolean fetch)
                     throws Exception
Throws:
Exception

getDatafile

public Datafile getDatafile(short id,
                            boolean fetch,
                            java.lang.String userauth,
                            java.lang.String passwdauth)
                     throws Exception
Throws:
Exception

getDatafile

public Datafile getDatafile(java.lang.String name)
                     throws Exception
Throws:
Exception

getDatafile

public Datafile getDatafile(java.lang.String name,
                            boolean fetch)
                     throws Exception
Throws:
Exception

getDatafile

public Datafile getDatafile(java.lang.String name,
                            boolean fetch,
                            java.lang.String userauth,
                            java.lang.String passwdauth)
                     throws Exception
Throws:
Exception

moveObjects

public void moveObjects(OidArray oid_arr,
                        Dataspace dataspace)
                 throws Exception
Throws:
Exception

moveObjects

public void moveObjects(ObjectArray obj_array,
                        Dataspace dataspace)
                 throws Exception
Throws:
Exception

getDataspaces

public Dataspace[] getDataspaces()
                          throws Exception
Throws:
Exception

getDataspaces

public Dataspace[] getDataspaces(boolean fetch)
                          throws Exception
Throws:
Exception

getDataspaces

public Dataspace[] getDataspaces(boolean fetch,
                                 java.lang.String user,
                                 java.lang.String passwd)
                          throws Exception
Throws:
Exception

getDataspace

public Dataspace getDataspace(short id)
                       throws Exception
Throws:
Exception

getDataspace

public Dataspace getDataspace(short id,
                              boolean fetch)
                       throws Exception
Throws:
Exception

getDataspace

public Dataspace getDataspace(short id,
                              boolean fetch,
                              java.lang.String user,
                              java.lang.String passwd)
                       throws Exception
Throws:
Exception

getDataspace

public Dataspace getDataspace(java.lang.String name)
                       throws Exception
Throws:
Exception

getDataspace

public Dataspace getDataspace(java.lang.String name,
                              boolean fetch)
                       throws Exception
Throws:
Exception

getDataspace

public Dataspace getDataspace(java.lang.String name,
                              boolean fetch,
                              java.lang.String userauth,
                              java.lang.String passwdauth)
                       throws Exception
Throws:
Exception

getDefaultDataspace

public Dataspace getDefaultDataspace()
                              throws Exception
Throws:
Exception

setDefaultDataspace

public void setDefaultDataspace(Dataspace dataspace)
                         throws Exception
Throws:
Exception

setDefaultTransactionParams

public void setDefaultTransactionParams(TransactionParams default_params)

getDefaultTransactionParams

public TransactionParams getDefaultTransactionParams()

setGlobalDefaultTransactionParams

public static void setGlobalDefaultTransactionParams(TransactionParams default_params)

getGlobalDefaultTransactionParams

public TransactionParams getGlobalDefaultTransactionParams()

getInfo

public DatabaseInfoDescription getInfo()
                                throws Exception
Throws:
Exception

getInfo

public DatabaseInfoDescription getInfo(Connection conn,
                                       java.lang.String userauth,
                                       java.lang.String passwdauth)
                                throws Exception
Throws:
Exception

getInfo

public DatabaseInfoDescription getInfo(java.lang.String userauth,
                                       java.lang.String passwdauth)
                                throws Exception
Throws:
Exception

getObjectsLocations

public ObjectLocationArray getObjectsLocations(OidArray oid_arr)
                                        throws Exception
Throws:
Exception