Package net.ontopia.persistence.proxy
Class RDBMSAccess
java.lang.Object
net.ontopia.persistence.proxy.RDBMSAccess
- All Implemented Interfaces:
StorageAccessIF
INTERNAL: A storage access implementation accessing relational
databases using JDBC.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected Connectionprotected booleanprotected Collection<FlushableIF>protected Map<Class<?>,ClassAccessIF> protected Stringprotected RDBMSMappingprotected booleanprotected RDBMSStorage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()INTERNAL: Aborts all changes performed in the transaction.voidclose()INTERNAL: Closes the storage access, which allows it to free its resources.voidcommit()INTERNAL: Commits the changes performed in the transaction.voidcreateObject(ObjectAccessIF oaccess, Object object) INTERNAL: Called by the transaction when it requests the new object to be created in the data repository.createQuery(String name, ObjectAccessIF oaccess, AccessRegistrarIF registrar) INTERNAL: Creates a query instance for the given transaction.createQuery(JDOQuery jdoquery, ObjectAccessIF oaccess, AccessRegistrarIF registrar, boolean lookup_identities) INTERNAL: Build a QueryIF from the specified JDO query instance.voiddeleteObject(ObjectAccessIF oaccess, Object object) INTERNAL: Called by the transaction when it requests the object to be deleted in the data repository.voidflush()INTERNAL: Called when the transaction requires the transaction changes to be stored by the storage access (i.e. written to the database).generateIdentity(Class<?> type) INTERNAL: Called by the application when it requests a new object identity for a given object type.INTERNAL: Returns the JDBC database connection used.protected ClassAccessIFgetHandler(Class<?> type) INTERNAL: Gets up the handler class that is used to manage objects of the given class.getId()INTERNAL: Gets the storage access id.getProperty(String property) INTERNAL: Gets the value of the specified property.INTERNAL: Returns the storage definition that the access uses.booleanINTERNAL: Returns true if the storage access is read-only.protected booleanloadField(AccessRegistrarIF registrar, IdentityIF identity, int field) INTERNAL: Requests the loading of the specified field for the given object identity.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.booleanloadObject(AccessRegistrarIF registrar, IdentityIF identity) INTERNAL: Check for the existence of the object identity in the data repository.protected voidneedsFlushing(FlushableIF handler) prepareStatement(String sql) voidstoreDirty(ObjectAccessIF oaccess, Object object) INTERNAL: Stores object fields that are dirty in the database.booleanvalidate()INTERNAL: Returns true if the storage access is valid.protected booleanvalidateConnection(Connection conn)
-
Field Details
-
debug
protected boolean debug -
id
-
readonly
protected boolean readonly -
storage
-
mapping
-
connection
-
closed
protected boolean closed -
handlers
-
batch_updates
protected boolean batch_updates -
flushable
-
-
Constructor Details
-
RDBMSAccess
-
-
Method Details
-
getId
Description copied from interface:StorageAccessIFINTERNAL: Gets the storage access id. This id is unique for a given StorageIF instance.- Specified by:
getIdin interfaceStorageAccessIF
-
getStorage
Description copied from interface:StorageAccessIFINTERNAL: Returns the storage definition that the access uses.- Specified by:
getStoragein interfaceStorageAccessIF
-
isReadOnly
public boolean isReadOnly()Description copied from interface:StorageAccessIFINTERNAL: Returns true if the storage access is read-only.- Specified by:
isReadOnlyin interfaceStorageAccessIF
-
getProperty
Description copied from interface:StorageAccessIFINTERNAL: Gets the value of the specified property.- Specified by:
getPropertyin interfaceStorageAccessIF
-
getConnection
INTERNAL: Returns the JDBC database connection used. It is important that this connection is neither closed, nor commited or rolled back. If this access has already been closed, a non-transactional read connection is requested from the storage. The connection is validated using validateConnection and renewed if not validated. -
prepareStatement
- Throws:
SQLException
-
isSQLException
-
getHandler
INTERNAL: Gets up the handler class that is used to manage objects of the given class. -
validate
public boolean validate()Description copied from interface:StorageAccessIFINTERNAL: Returns true if the storage access is valid.- Specified by:
validatein interfaceStorageAccessIF
-
validateConnection
-
commit
public void commit()Description copied from interface:StorageAccessIFINTERNAL: Commits the changes performed in the transaction.- Specified by:
commitin interfaceStorageAccessIF
-
abort
public void abort()Description copied from interface:StorageAccessIFINTERNAL: Aborts all changes performed in the transaction.- Specified by:
abortin interfaceStorageAccessIF
-
close
public void close()Description copied from interface:StorageAccessIFINTERNAL: Closes the storage access, which allows it to free its resources.- Specified by:
closein interfaceStorageAccessIF
-
flush
public void flush()Description copied from interface:StorageAccessIFINTERNAL: Called when the transaction requires the transaction changes to be stored by the storage access (i.e. written to the database).This 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.
- Specified by:
flushin interfaceStorageAccessIF
-
loadObject
Description copied from interface:StorageAccessIFINTERNAL: Check for the existence of the object identity in the data repository. An exception will be thrown if the object does not exist. If it exists the access registrar will be notified.- Specified by:
loadObjectin interfaceStorageAccessIF- Returns:
- true if object was found in the data store, false otherwise.
-
loadField
Description copied from interface:StorageAccessIFINTERNAL: Requests the loading of the specified field for the given object identity. An exception will be thrown if the object does not exist. If it exists the access registrar will be notified.- Specified by:
loadFieldin interfaceStorageAccessIF- Returns:
- The value loaded for the specific field. Note that if the field is a reference field the identity will be returned, not the actual object. This is because the storage system does not deal with persistent object instances directly.
-
loadFieldMultiple
public Object loadFieldMultiple(AccessRegistrarIF registrar, Collection<IdentityIF> identities, IdentityIF current, Class<?> type, int field) Description copied from interface:StorageAccessIFINTERNAL: Requests the loading of the specified field for all the given object identities. An exception will be thrown if the current object does not exist. If it exists the access registrar will be notified.- Specified by:
loadFieldMultiplein interfaceStorageAccessIF- Returns:
- The value loaded for the specific field. Note that if the field is a reference field the identity will be returned, not the actual object. This is because the storage system does not deal with persistent object instances directly.
-
createObject
Description copied from interface:StorageAccessIFINTERNAL: Called by the transaction when it requests the new object to be created in the data repository. The ObjectAccessIF object is used to access information about the object as needed.- Specified by:
createObjectin interfaceStorageAccessIF
-
deleteObject
Description copied from interface:StorageAccessIFINTERNAL: Called by the transaction when it requests the object to be deleted in the data repository.- Specified by:
deleteObjectin interfaceStorageAccessIF
-
storeDirty
Description copied from interface:StorageAccessIFINTERNAL: Stores object fields that are dirty in the database.- Specified by:
storeDirtyin interfaceStorageAccessIF
-
needsFlushing
-
createQuery
Description copied from interface:StorageAccessIFINTERNAL: Creates a query instance for the given transaction.- Specified by:
createQueryin interfaceStorageAccessIF
-
createQuery
public QueryIF createQuery(JDOQuery jdoquery, ObjectAccessIF oaccess, AccessRegistrarIF registrar, boolean lookup_identities) Description copied from interface:StorageAccessIFINTERNAL: Build a QueryIF from the specified JDO query instance.- Specified by:
createQueryin interfaceStorageAccessIF
-
generateIdentity
Description copied from interface:StorageAccessIFINTERNAL: Called by the application when it requests a new object identity for a given object type.- Specified by:
generateIdentityin interfaceStorageAccessIF
-