org.apache.ojb.broker.core
Class IdentityFactoryImpl

java.lang.Object
  extended by org.apache.ojb.broker.core.IdentityFactoryImpl
All Implemented Interfaces:
IdentityFactory, PBListener, PBStateListener

public class IdentityFactoryImpl
extends java.lang.Object
implements IdentityFactory, PBStateListener

Version:
$Id: IdentityFactoryImpl.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Armin Waibel
See Also:
IdentityFactory

Constructor Summary
IdentityFactoryImpl(PersistenceBroker broker)
           
 
Method Summary
 void afterBegin(PBStateEvent event)
          Called after a transaction was started.
 void afterCommit(PBStateEvent event)
          Called after a transaction was comitted.
 void afterOpen(PBStateEvent event)
          Called after the PersistenceBroker instance was obtained from the pool.
 void afterRollback(PBStateEvent event)
          Called after a transaction was rolled back.
 void beforeBegin(PBStateEvent event)
          Called before a transaction was started.
 void beforeClose(PBStateEvent event)
          Called before the PersistenceBroker instance will be returned to the pool.
 void beforeCommit(PBStateEvent event)
          Called before a transaction will be comitted.
 void beforeRollback(PBStateEvent event)
          Called before a transaction will be rolled back.
 Identity buildIdentity(java.lang.Class realClass, java.lang.Class topLevelClass, java.lang.Object[] pkValues)
          Create a new Identity object based on given arguments - NOTE: There will be no check to resolve the order of the PK values.
 Identity buildIdentity(java.lang.Class realClass, java.lang.Class topLevelClass, java.lang.String[] pkFieldNames, java.lang.Object[] pkValues)
          Build a unique Identity for the given primary key values (composite PK's) of a persistence capable object.
 Identity buildIdentity(ClassDescriptor cld, java.lang.Object obj)
          Build a unique Identity for the given persistence capable object.
 Identity buildIdentity(java.lang.Class realClass, java.lang.Object pkValue)
          Convenience method for persistent objects with single primary key.
 Identity buildIdentity(java.lang.Class realClass, java.lang.String[] pkFieldNames, java.lang.Object[] pkValues)
          Convenience shortcut method for IdentityFactory.buildIdentity(java.lang.Class, java.lang.Class, java.lang.String[], java.lang.Object[]).
 Identity buildIdentity(java.lang.Object obj)
          Build a unique Identity for the given persistence capable object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityFactoryImpl

public IdentityFactoryImpl(PersistenceBroker broker)
Method Detail

buildIdentity

public Identity buildIdentity(java.lang.Object obj)
Description copied from interface: IdentityFactory
Build a unique Identity for the given persistence capable object.

Specified by:
buildIdentity in interface IdentityFactory
Parameters:
obj - The object to build the Identity for
Returns:
The new Identity object
See Also:
IdentityFactory.buildIdentity(Object)

buildIdentity

public Identity buildIdentity(ClassDescriptor cld,
                              java.lang.Object obj)
Description copied from interface: IdentityFactory
Build a unique Identity for the given persistence capable object.

Specified by:
buildIdentity in interface IdentityFactory
Parameters:
cld - The ClassDescriptor of the object
obj - The object to build the Identity for
Returns:
The new Identity object.
See Also:
IdentityFactory.buildIdentity(Object)

buildIdentity

public Identity buildIdentity(java.lang.Class realClass,
                              java.lang.Class topLevelClass,
                              java.lang.String[] pkFieldNames,
                              java.lang.Object[] pkValues)
Description copied from interface: IdentityFactory
Build a unique Identity for the given primary key values (composite PK's) of a persistence capable object.

Specified by:
buildIdentity in interface IdentityFactory
Parameters:
realClass - The class of the associated object
topLevelClass - The top-level class of the associated object
pkFieldNames - The field names of the PK fields
pkValues - The PK values
Returns:
The new Identity object
See Also:
IdentityFactory.buildIdentity(Class, Class, String[], Object[])

buildIdentity

public Identity buildIdentity(java.lang.Class realClass,
                              java.lang.String[] pkFieldNames,
                              java.lang.Object[] pkValues)
Description copied from interface: IdentityFactory
Convenience shortcut method for IdentityFactory.buildIdentity(java.lang.Class, java.lang.Class, java.lang.String[], java.lang.Object[]).

Specified by:
buildIdentity in interface IdentityFactory
Parameters:
realClass - The class of the associated object
pkFieldNames - The field names of the PK fields
pkValues - The PK values
Returns:
The new Identity object
See Also:
IdentityFactory.buildIdentity(Class, String[], Object[])

buildIdentity

public Identity buildIdentity(java.lang.Class realClass,
                              java.lang.Class topLevelClass,
                              java.lang.Object[] pkValues)
Description copied from interface: IdentityFactory
Create a new Identity object based on given arguments - NOTE: There will be no check to resolve the order of the PK values. This method expect the correct order based on the declaration of the FieldDescriptor in the mapping file.

Specified by:
buildIdentity in interface IdentityFactory
Parameters:
realClass - The class of the associated object
topLevelClass - The top-level class of the associated object
pkValues - The PK values
Returns:
The new Identity object
See Also:
IdentityFactory.buildIdentity(Class, String[], Object[])

buildIdentity

public Identity buildIdentity(java.lang.Class realClass,
                              java.lang.Object pkValue)
Description copied from interface: IdentityFactory
Convenience method for persistent objects with single primary key. NOTE: Do not use for objects with composed PK!

Specified by:
buildIdentity in interface IdentityFactory
Parameters:
realClass - The class of the associated object
pkValue - The PK value
Returns:
The new Identity object
See Also:
IdentityFactory.buildIdentity(Class, Object)

afterBegin

public void afterBegin(PBStateEvent event)
Description copied from interface: PBStateListener
Called after a transaction was started.

Specified by:
afterBegin in interface PBStateListener
Parameters:
event - The event object

afterCommit

public void afterCommit(PBStateEvent event)
Description copied from interface: PBStateListener
Called after a transaction was comitted.

Specified by:
afterCommit in interface PBStateListener
Parameters:
event - The event object

afterRollback

public void afterRollback(PBStateEvent event)
Description copied from interface: PBStateListener
Called after a transaction was rolled back.

Specified by:
afterRollback in interface PBStateListener
Parameters:
event - The event object

beforeClose

public void beforeClose(PBStateEvent event)
Description copied from interface: PBStateListener
Called before the PersistenceBroker instance will be returned to the pool.

Specified by:
beforeClose in interface PBStateListener
Parameters:
event - The event object

beforeRollback

public void beforeRollback(PBStateEvent event)
Description copied from interface: PBStateListener
Called before a transaction will be rolled back.

Specified by:
beforeRollback in interface PBStateListener
Parameters:
event - The event object

afterOpen

public void afterOpen(PBStateEvent event)
Description copied from interface: PBStateListener
Called after the PersistenceBroker instance was obtained from the pool.

Specified by:
afterOpen in interface PBStateListener
Parameters:
event - The event object

beforeBegin

public void beforeBegin(PBStateEvent event)
Description copied from interface: PBStateListener
Called before a transaction was started.

Specified by:
beforeBegin in interface PBStateListener
Parameters:
event - The event object

beforeCommit

public void beforeCommit(PBStateEvent event)
Description copied from interface: PBStateListener
Called before a transaction will be comitted.

Specified by:
beforeCommit in interface PBStateListener
Parameters:
event - The event 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