org.apache.ojb.odmg
Class ImplementationImpl

java.lang.Object
  extended by org.apache.ojb.odmg.ImplementationImpl
All Implemented Interfaces:
ImplementationExt, Implementation
Direct Known Subclasses:
ImplementationJTAImpl

public class ImplementationImpl
extends Object
implements ImplementationExt

Default implementation of the Implementation interface.

Version:
$Id: ImplementationImpl.java,v 1.1 2007-08-24 22:17:37 ewestfal Exp $
Author:
Thomas Mahler, Matthew Baird, Armin Waibel

Constructor Summary
protected ImplementationImpl()
          private Constructor: use static factory method getInstance() to obtain an instance
 
Method Summary
 Transaction currentTransaction()
          Get the current Transaction for the thread.
 Configurator getConfigurator()
          Gets the configurator.
protected  DatabaseImpl getCurrentDatabase()
           
 PBKey getCurrentPBKey()
           
 Database getDatabase(Object obj)
          Returns the current used database or null.
protected  LockManager getLockManager()
           
 String getObjectId(Object obj)
          Get a String representation of the object's identifier.
 Class getOqlCollectionClass()
          The used collection type class returned by OQL queries.
 OJBTxManager getTxManager()
           
 boolean hasOpenTransaction()
           
 boolean isImpliciteWriteLocks()
          Is true when implicite write locks are enabled.
 boolean isImplicitLocking()
          Returns true if the global implicit locking is enabled for this Implementation instance, else false.
 boolean isOrdering()
          Returns true if OJB's ordering algorithm is enabled.
 DArray newDArray()
          Create a new DArray object.
 Database newDatabase()
          Create a new Database object.
 DBag newDBag()
          Create a new DBag object.
 DList newDList()
          Create a new DList object.
 DMap newDMap()
          Create a new DMap object.
 DSet newDSet()
          Create a new DSet object.
 EnhancedOQLQuery newOQLQuery()
          Create a new OQLQuery object.
 Transaction newTransaction()
          Create a Transaction object and associate it with the current thread.
protected  void registerOpenDatabase(DatabaseImpl newDB)
          Register opened database via the PBKey.
 void setConfigurator(Configurator configurator)
          Sets the configurator.
protected  void setCurrentDatabase(DatabaseImpl curDB)
           
 void setImpliciteWriteLocks(boolean impliciteWriteLocks)
          If the OJB implicit locking feature (see TransactionExt.setImplicitLocking(boolean)) is enabled, this define the lock type of all implicit locked objects.
 void setImplicitLocking(boolean value)
          Note: Method behavior changed between version 1.0.3 and 1.0.4.
 void setImplicitLockingBackward(boolean implicitLockingBackward)
          Deprecated. is only for backward compatibility with older versions (before 1.0.4) and will be removed in future versions.
 void setOqlCollectionClass(Class oqlCollectionClass)
          Set the used collection type class returned by OQL queries.
 void setOrdering(boolean ordering)
          Disable/enable OJB's ordering algorithm when insert, update, delete a bunch of objects within a transaction.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImplementationImpl

protected ImplementationImpl()
private Constructor: use static factory method getInstance() to obtain an instance

Method Detail

getTxManager

public OJBTxManager getTxManager()

getLockManager

protected LockManager getLockManager()

setCurrentDatabase

protected void setCurrentDatabase(DatabaseImpl curDB)

getCurrentDatabase

protected DatabaseImpl getCurrentDatabase()

getCurrentPBKey

public PBKey getCurrentPBKey()

getConfigurator

public Configurator getConfigurator()
Gets the configurator.

Returns:
Returns a Configurator

setConfigurator

public void setConfigurator(Configurator configurator)
Sets the configurator.

Parameters:
configurator - The configurator to set

newTransaction

public Transaction newTransaction()
Create a Transaction object and associate it with the current thread.

Specified by:
newTransaction in interface Implementation
Returns:
The newly created Transaction instance.
See Also:
Transaction

currentTransaction

public Transaction currentTransaction()
Get the current Transaction for the thread.

Specified by:
currentTransaction in interface Implementation
Returns:
The current Transaction object or null if there is none.
See Also:
Transaction

hasOpenTransaction

public boolean hasOpenTransaction()

newDatabase

public Database newDatabase()
Create a new Database object.

Specified by:
newDatabase in interface Implementation
Returns:
The new Database object.
See Also:
Database

newOQLQuery

public EnhancedOQLQuery newOQLQuery()
Create a new OQLQuery object.

Specified by:
newOQLQuery in interface Implementation
Returns:
The new OQLQuery object.
See Also:
OQLQuery

newDList

public DList newDList()
Create a new DList object.

Specified by:
newDList in interface Implementation
Returns:
The new DList object.
See Also:
DList

newDBag

public DBag newDBag()
Create a new DBag object.

Specified by:
newDBag in interface Implementation
Returns:
The new DBag object.
See Also:
DBag

newDSet

public DSet newDSet()
Create a new DSet object.

Specified by:
newDSet in interface Implementation
Returns:
The new DSet object.
See Also:
DSet

newDArray

public DArray newDArray()
Create a new DArray object.

Specified by:
newDArray in interface Implementation
Returns:
The new DArray object.
See Also:
DArray

newDMap

public DMap newDMap()
Create a new DMap object.

Specified by:
newDMap in interface Implementation
Returns:
The new DMap object.
See Also:
DMap

getObjectId

public String getObjectId(Object obj)
Get a String representation of the object's identifier. OJB returns the serialized Identity of the object.

Specified by:
getObjectId in interface Implementation
Parameters:
obj - The object whose identifier is being accessed.
Returns:
The object's identifier in the form of a String

getDatabase

public Database getDatabase(Object obj)
Returns the current used database or null.

Specified by:
getDatabase in interface Implementation
Parameters:
obj - The object.
Returns:
The Database that contains the object.

registerOpenDatabase

protected void registerOpenDatabase(DatabaseImpl newDB)
Register opened database via the PBKey.


setImplicitLocking

public void setImplicitLocking(boolean value)
Note: Method behavior changed between version 1.0.3 and 1.0.4. Now this method is used to set the global property implicit locking, use method TransactionExt.setImplicitLocking(boolean) to set the property for a running transaction.

Specified by:
setImplicitLocking in interface ImplementationExt
Parameters:
value - If set true implicit locking is enabled, if false, implicit locking is disabled.
See Also:
ImplementationExt.setImplicitLocking(boolean)

isImplicitLocking

public boolean isImplicitLocking()
Description copied from interface: ImplementationExt
Returns true if the global implicit locking is enabled for this Implementation instance, else false.
Important: The returned value is the global used setting for all Transaction.lock(Object, int) calls.
However it's possible to set this value only for the current used Transaction using TransactionExt.setImplicitLocking(boolean) and to detect the implicit locking state of the used transaction instance call TransactionExt.isImplicitLocking().

Specified by:
isImplicitLocking in interface ImplementationExt
Returns:
true if the global property implicit lockingtrue is enabled.
See Also:
ImplementationExt.isImplicitLocking()

getOqlCollectionClass

public Class getOqlCollectionClass()
Description copied from interface: ImplementationExt
The used collection type class returned by OQL queries.

Specified by:
getOqlCollectionClass in interface ImplementationExt
Returns:
The collection class type
See Also:
ImplementationExt.getOqlCollectionClass()

setOqlCollectionClass

public void setOqlCollectionClass(Class oqlCollectionClass)
Description copied from interface: ImplementationExt
Set the used collection type class returned by OQL queries.

NOTE: Each specified class must implement interface ManageableCollection to work proper with OJB.

Specified by:
setOqlCollectionClass in interface ImplementationExt
Parameters:
oqlCollectionClass - The collection class used in OQL queries.
See Also:
ImplementationExt.setOqlCollectionClass(Class)

setImpliciteWriteLocks

public void setImpliciteWriteLocks(boolean impliciteWriteLocks)
Description copied from interface: ImplementationExt
If the OJB implicit locking feature (see TransactionExt.setImplicitLocking(boolean)) is enabled, this define the lock type of all implicit locked objects.

If set to true, acquiring a write-lock on a given object x implies write locks on all implicit locked objects.
If set to false, in any case implicit read-locks are acquired. Acquiring a read- or write lock on x thus allways results in implicit read-locks on all associated objects.

Specified by:
setImpliciteWriteLocks in interface ImplementationExt
Parameters:
impliciteWriteLocks - If true implicit write locks will enabled.
See Also:
ImplementationExt.setImpliciteWriteLocks(boolean)

isImpliciteWriteLocks

public boolean isImpliciteWriteLocks()
Description copied from interface: ImplementationExt
Is true when implicite write locks are enabled.

Specified by:
isImpliciteWriteLocks in interface ImplementationExt
Returns:
true when implicit write locks are enabled.
See Also:
ImplementationExt.isImpliciteWriteLocks()

isOrdering

public boolean isOrdering()
Description copied from interface: ImplementationExt
Returns true if OJB's ordering algorithm is enabled.

Specified by:
isOrdering in interface ImplementationExt
See Also:
ImplementationExt.setOrdering(boolean)

setOrdering

public void setOrdering(boolean ordering)
Description copied from interface: ImplementationExt
Disable/enable OJB's ordering algorithm when insert, update, delete a bunch of objects within a transaction. The ordering algorithm try to calculate the correct order of the modified/new persistent objects to prevent problems on commit of the transaction.
If the used databases support 'deferred checks' it's recommended to use this feature and to disable OJB's object ordering.

However it's possible to set this value only for the current used Transaction using TransactionExt.setOrdering(boolean)

Specified by:
setOrdering in interface ImplementationExt
Parameters:
ordering - If true OJB's ordering algorithm is used.

setImplicitLockingBackward

public void setImplicitLockingBackward(boolean implicitLockingBackward)
Deprecated. is only for backward compatibility with older versions (before 1.0.4) and will be removed in future versions.

Allow to use method setImplicitLocking(boolean) in the same way as before version 1.0.4 - if set 'true', recommended setting is 'false'.


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.