de.scheisseichfindemalkeinen.database
Class DB

java.lang.Object
  extended by de.scheisseichfindemalkeinen.database.DB

public abstract class DB
extends java.lang.Object

Class for the connections to the databases As database db4o is used, which makes it easy to store the Pic- and Keyword-Objects.


Field Summary
static int DB_DOWNLOADS
          Index of the downloads-db
static int DB_KEYWORDS
          Index of the keywords-db
 
Constructor Summary
DB()
           
 
Method Summary
static void addObject(java.lang.Object object, int iDB)
          Adds an object to the database For updates of objects you should also use this method, because update and add is exactly the same
static void addObjects(java.util.Vector<java.lang.Object> objects, int iDB)
          Adds multiple object to the database For updates of objects you should also use this method, because update and add is exactly the same
static void closeDatabase(int iDB)
          Close the database (without commit!)
static void commit(int iDB)
          Write data to the database-file
static void defrag(int iDB)
          Defragments the database
static void deleteObject(java.lang.Object object, int iDB)
          Deletes an object from the database
static void deleteObjects(java.util.Vector<java.lang.Object> objects, int iDB)
          Deletes multiple objects from the database
static java.lang.String getDatabasePath(int iDB)
          Returns the path to the database
static com.db4o.ObjectSet getObjects(java.lang.Class cl, int iDB)
          Reads out object from the database which are instances of the given class
static void openDatabase(int iDB)
          Open a database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DB_DOWNLOADS

public static final int DB_DOWNLOADS
Index of the downloads-db

See Also:
Constant Field Values

DB_KEYWORDS

public static final int DB_KEYWORDS
Index of the keywords-db

See Also:
Constant Field Values
Constructor Detail

DB

public DB()
Method Detail

openDatabase

public static void openDatabase(int iDB)
Open a database

Parameters:
iDB - Index of the database

closeDatabase

public static void closeDatabase(int iDB)
Close the database (without commit!)

Parameters:
iDB - Index of the database

getDatabasePath

public static java.lang.String getDatabasePath(int iDB)
Returns the path to the database

Parameters:
iDB - Index of the database
Returns:
Path to the database

addObject

public static void addObject(java.lang.Object object,
                             int iDB)
Adds an object to the database For updates of objects you should also use this method, because update and add is exactly the same

Parameters:
object - The object
iDB - Index of the database

addObjects

public static void addObjects(java.util.Vector<java.lang.Object> objects,
                              int iDB)
Adds multiple object to the database For updates of objects you should also use this method, because update and add is exactly the same

Parameters:
objects - Objects
iDB - Index of the database

deleteObject

public static void deleteObject(java.lang.Object object,
                                int iDB)
Deletes an object from the database

Parameters:
object - the object
iDB - Index of the database

deleteObjects

public static void deleteObjects(java.util.Vector<java.lang.Object> objects,
                                 int iDB)
Deletes multiple objects from the database

Parameters:
objects - The object
iDB - Index of the database

getObjects

public static com.db4o.ObjectSet getObjects(java.lang.Class cl,
                                            int iDB)
Reads out object from the database which are instances of the given class

Parameters:
cl - The Class
iDB - Index of the database
Returns:
ObjectSet containing the objects

commit

public static void commit(int iDB)
Write data to the database-file

Parameters:
iDB - Index of database

defrag

public static void defrag(int iDB)
Defragments the database

Parameters:
iDB - Index of the database