public class RDBMSAccess extends Object implements StorageAccessIF
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
batch_updates |
protected boolean |
closed |
protected Connection |
connection |
protected boolean |
debug |
protected Collection<FlushableIF> |
flushable |
protected Map<Class<?>,ClassAccessIF> |
handlers |
protected String |
id |
protected RDBMSMapping |
mapping |
protected boolean |
readonly |
protected RDBMSStorage |
storage |
| Constructor and Description |
|---|
RDBMSAccess(String id,
RDBMSStorage storage,
boolean readonly) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
INTERNAL: Aborts all changes performed in the transaction.
|
void |
close()
INTERNAL: Closes the storage access, which allows it to free its
resources.
|
void |
commit()
INTERNAL: Commits the changes performed in the transaction.
|
void |
createObject(ObjectAccessIF oaccess,
Object object)
INTERNAL: Called by the transaction when it requests the new
object to be created in the data repository.
|
QueryIF |
createQuery(JDOQuery jdoquery,
ObjectAccessIF oaccess,
AccessRegistrarIF registrar,
boolean lookup_identities)
INTERNAL: Build a QueryIF from the specified JDO query instance.
|
QueryIF |
createQuery(String name,
ObjectAccessIF oaccess,
AccessRegistrarIF registrar)
INTERNAL: Creates a query instance for the given transaction.
|
void |
deleteObject(ObjectAccessIF oaccess,
Object object)
INTERNAL: Called by the transaction when it requests the
object to be deleted in the data repository.
|
void |
flush()
INTERNAL: Called when the transaction requires the transaction
changes to be stored by the storage access (i.e.
|
IdentityIF |
generateIdentity(Class<?> type)
INTERNAL: Called by the application when it requests a new object
identity for a given object type.
|
Connection |
getConnection()
INTERNAL: Returns the JDBC database connection used.
|
protected ClassAccessIF |
getHandler(Class<?> type)
INTERNAL: Gets up the handler class that is used to manage
objects of the given class.
|
String |
getId()
INTERNAL: Gets the storage access id.
|
String |
getProperty(String property)
INTERNAL: Gets the value of the specified property.
|
StorageIF |
getStorage()
INTERNAL: Returns the storage definition that the access uses.
|
boolean |
isReadOnly()
INTERNAL: Returns true if the storage access is read-only.
|
protected boolean |
isSQLException(Throwable e) |
Object |
loadField(AccessRegistrarIF registrar,
IdentityIF identity,
int field)
INTERNAL: Requests the loading of the specified field for the
given object identity.
|
Object |
loadFieldMultiple(AccessRegistrarIF registrar,
Collection<IdentityIF> identities,
IdentityIF current,
Class<?> type,
int field)
INTERNAL: Requests the loading of the specified field for all the
given object identities.
|
boolean |
loadObject(AccessRegistrarIF registrar,
IdentityIF identity)
INTERNAL: Check for the existence of the object identity in the
data repository.
|
protected void |
needsFlushing(FlushableIF handler) |
PreparedStatement |
prepareStatement(String sql) |
void |
storeDirty(ObjectAccessIF oaccess,
Object object)
INTERNAL: Stores object fields that are dirty in the database.
|
boolean |
validate()
INTERNAL: Returns true if the storage access is valid.
|
protected boolean |
validateConnection(Connection conn) |
protected boolean debug
protected String id
protected boolean readonly
protected RDBMSStorage storage
protected RDBMSMapping mapping
protected Connection connection
protected boolean closed
protected Map<Class<?>,ClassAccessIF> handlers
protected boolean batch_updates
protected Collection<FlushableIF> flushable
public RDBMSAccess(String id, RDBMSStorage storage, boolean readonly)
public String getId()
StorageAccessIFgetId in interface StorageAccessIFpublic StorageIF getStorage()
StorageAccessIFgetStorage in interface StorageAccessIFpublic boolean isReadOnly()
StorageAccessIFisReadOnly in interface StorageAccessIFpublic String getProperty(String property)
StorageAccessIFgetProperty in interface StorageAccessIFpublic Connection getConnection()
public PreparedStatement prepareStatement(String sql) throws SQLException
SQLExceptionprotected boolean isSQLException(Throwable e)
protected ClassAccessIF getHandler(Class<?> type)
public boolean validate()
StorageAccessIFvalidate in interface StorageAccessIFprotected boolean validateConnection(Connection conn)
public void commit()
StorageAccessIFcommit in interface StorageAccessIFpublic void abort()
StorageAccessIFabort in interface StorageAccessIFpublic void close()
StorageAccessIFclose in interface StorageAccessIFpublic void flush()
StorageAccessIFThis method exists mainly to allow storage access implementations to optimize its communication with data repositories. An example of this is writing transaction changes in batches to improve performance.
Note that the transaction will always call this method at the end of its store method. It will do this so that it is sure that the changes will be visible inside the data repository.
flush in interface StorageAccessIFpublic boolean loadObject(AccessRegistrarIF registrar, IdentityIF identity)
StorageAccessIFloadObject in interface StorageAccessIFpublic Object loadField(AccessRegistrarIF registrar, IdentityIF identity, int field)
StorageAccessIFloadField in interface StorageAccessIFpublic Object loadFieldMultiple(AccessRegistrarIF registrar, Collection<IdentityIF> identities, IdentityIF current, Class<?> type, int field)
StorageAccessIFloadFieldMultiple in interface StorageAccessIFpublic void createObject(ObjectAccessIF oaccess, Object object)
StorageAccessIFcreateObject in interface StorageAccessIFpublic void deleteObject(ObjectAccessIF oaccess, Object object)
StorageAccessIFdeleteObject in interface StorageAccessIFpublic void storeDirty(ObjectAccessIF oaccess, Object object)
StorageAccessIFstoreDirty in interface StorageAccessIFprotected void needsFlushing(FlushableIF handler)
public QueryIF createQuery(String name, ObjectAccessIF oaccess, AccessRegistrarIF registrar)
StorageAccessIFcreateQuery in interface StorageAccessIFpublic QueryIF createQuery(JDOQuery jdoquery, ObjectAccessIF oaccess, AccessRegistrarIF registrar, boolean lookup_identities)
StorageAccessIFcreateQuery in interface StorageAccessIFpublic IdentityIF generateIdentity(Class<?> type)
StorageAccessIFgenerateIdentity in interface StorageAccessIF