org.objectweb.jac.aspects.persistence
Class PostgresStorage

java.lang.Object
  extended byorg.objectweb.jac.aspects.persistence.SQLStorage
      extended byorg.objectweb.jac.aspects.persistence.PostgresStorage
All Implemented Interfaces:
Serializable, Storage

public class PostgresStorage
extends SQLStorage

Implements the storage to store within a PostgreSQL database.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.objectweb.jac.aspects.persistence.SQLStorage
SQLStorage.InvalidStorageException
 
Field Summary
 
Fields inherited from class org.objectweb.jac.aspects.persistence.SQLStorage
db, id
 
Constructor Summary
PostgresStorage(PersistenceAC ac, String database, String user, String password)
          Creates a new storage for a PostgreSQL database.
 
Method Summary
protected  void doUpdates()
           
protected  boolean ensureSequenceExists(String sequence)
           
protected  String[] getClassNames()
           
protected  String getClassSeqName(String className)
           
 long getCurrVal(String sequence)
           
 Map getNameCounters()
          Gets the name counters used to generate new names.
 long getNextVal(String sequence)
          Returns the next value of a sequence
protected  boolean hasSequence(String name)
           
protected  boolean hasTable(String name)
          Tells wether a table with a given name exists
 String newName(String className)
          Generate a new name for an instance.
 void updateNameCounters(Map counters)
          Sets the name counters used to generate new names.
 
Methods inherited from class org.objectweb.jac.aspects.persistence.SQLStorage
addSlashes, addToList, addToList, addToSet, bindOIDToName, checkStorage, clearList, clearMap, clearSet, close, collectionContains, commit, createObject, deleteName, deleteObject, execute, executeQuery, executeSilent, executeUpdate, getClassID, getCollectionID, getCollectionValues, getField, getFields, getFromMap, getId, getIndexInList, getInt, getInternalIndexInList, getLastIndexInList, getList, getList, getListItem, getListSize, getLong, getMap, getMap, getMapSize, getNameFromOID, getObjects, getObjects, getOID, getOIDFromName, getRootObjects, getSet, getSet, getSetSize, listContains, mapContainsKey, mapContainsValue, putInMap, removeField, removeFromList, removeFromList, removeFromMap, removeFromSet, rollback, setConnection, setContains, setField, setId, setListItem, startTransaction, updateField, updateJacNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgresStorage

public PostgresStorage(PersistenceAC ac,
                       String database,
                       String user,
                       String password)
                throws SQLException,
                       Exception
Creates a new storage for a PostgreSQL database.

Parameters:
database - the database. It may take on eof the following form:
user - the user name
password - the password for this user
Method Detail

getClassNames

protected String[] getClassNames()
                          throws Exception
Throws:
Exception

doUpdates

protected void doUpdates()
                  throws Exception,
                         SQLException
Throws:
Exception
SQLException

getNextVal

public long getNextVal(String sequence)
                throws Exception
Description copied from class: SQLStorage
Returns the next value of a sequence

Specified by:
getNextVal in class SQLStorage
Throws:
Exception

getCurrVal

public long getCurrVal(String sequence)
                throws Exception
Throws:
Exception

ensureSequenceExists

protected boolean ensureSequenceExists(String sequence)
                                throws Exception
Throws:
Exception

newName

public String newName(String className)
               throws Exception
Description copied from interface: Storage
Generate a new name for an instance.

Specified by:
newName in interface Storage
Specified by:
newName in class SQLStorage
Throws:
Exception

getNameCounters

public Map getNameCounters()
                    throws Exception
Description copied from interface: Storage
Gets the name counters used to generate new names.

Specified by:
getNameCounters in interface Storage
Specified by:
getNameCounters in class SQLStorage
Throws:
Exception

getClassSeqName

protected String getClassSeqName(String className)

hasTable

protected boolean hasTable(String name)
                    throws SQLException
Description copied from class: SQLStorage
Tells wether a table with a given name exists

Specified by:
hasTable in class SQLStorage
Throws:
SQLException

hasSequence

protected boolean hasSequence(String name)
                       throws Exception
Throws:
Exception

updateNameCounters

public void updateNameCounters(Map counters)
                        throws Exception
Description copied from interface: Storage
Sets the name counters used to generate new names.

Specified by:
updateNameCounters in interface Storage
Specified by:
updateNameCounters in class SQLStorage
Throws:
Exception