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 java.lang.Object
implements ImplementationExt

Default implementation of the Implementation interface.

Version:
$Id: ImplementationImpl.java 365266 2005-12-31 18:51:59Z arminw $
Author:
Thomas Mahler, Matthew Baird, Armin Waibel

Method Summary
 Transaction currentTransaction()
          Get the current Transaction for the thread.
 org.apache.ojb.broker.util.configuration.Configurator getConfigurator()
          Gets the configurator.
 PBKey getCurrentPBKey()
           
 Database getDatabase(java.lang.Object obj)
          Returns the current used database or null.
 java.lang.String getObjectId(java.lang.Object obj)
          Get a String representation of the object's identifier.
 java.lang.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 isManaged()
           
 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.
 OQLQuery newOQLQuery()
          Create a new OQLQuery object.
 Transaction newTransaction()
          Create a Transaction object and associate it with the current thread.
 void setConfigurator(org.apache.ojb.broker.util.configuration.Configurator configurator)
          Sets the configurator.
 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 setManaged(boolean managed)
           
 void setOqlCollectionClass(java.lang.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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getTxManager

public OJBTxManager getTxManager()

getCurrentPBKey

public PBKey getCurrentPBKey()

getConfigurator

public org.apache.ojb.broker.util.configuration.Configurator getConfigurator()
Gets the configurator.

Returns:
Returns a Configurator

setConfigurator

public void setConfigurator(org.apache.ojb.broker.util.configuration.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 OQLQuery 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 java.lang.String getObjectId(java.lang.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(java.lang.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.

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 java.lang.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(java.lang.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'.


isManaged

public boolean isManaged()

setManaged

public void setManaged(boolean managed)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30