org.apache.jdo.impl.state
Class PersistentNewFlushed

java.lang.Object
  extended byorg.apache.jdo.impl.state.LifeCycleState
      extended byorg.apache.jdo.impl.state.PersistentNew
          extended byorg.apache.jdo.impl.state.PersistentNewFlushed
Direct Known Subclasses:
AutoPersistentNewFlushed

class PersistentNewFlushed
extends PersistentNew

This class represents PersistentNewFlushed state specific state transitions as requested by StateManagerImpl. This state differs from PersistentNew state as the correspondinfg instance has been flushed to a datastore.

Author:
Marina Vatkina

Field Summary
protected static int AP_NEW
          Constants to specify the life cycle state type
protected static int AP_NEW_FLUSHED
          Constants to specify the life cycle state type
protected static int AP_NEW_FLUSHED_DIRTY
          Constants to specify the life cycle state type
protected static int AP_PENDING
          Constants to specify the life cycle state type
protected static int HOLLOW
          Constants to specify the life cycle state type
protected  boolean isAutoPersistent
           
protected  boolean isBeforeImageUpdatable
           
protected  boolean isDeleted
           
protected  boolean isDirty
           
protected  boolean isFlushed
           
protected  boolean isNavigable
           
protected  boolean isNew
           
protected  boolean isPersistent
           
protected  boolean isRefreshable
           
protected  boolean isStored
           
protected  boolean isTransactional
           
protected static I18NHelper msg
          I18N message handler
protected  boolean needMerge
           
protected static int P_CLEAN
          Constants to specify the life cycle state type
protected static int P_CLEAN_TX
          Constants to specify the life cycle state type
protected static int P_DELETED
          Constants to specify the life cycle state type
protected static int P_DELETED_FLUSHED
          Constants to specify the life cycle state type
protected static int P_DIRTY
          Constants to specify the life cycle state type
protected static int P_DIRTY_FLUSHED
          Constants to specify the life cycle state type
protected static int P_NEW
          Constants to specify the life cycle state type
protected static int P_NEW_DELETED
          Constants to specify the life cycle state type
protected static int P_NEW_FLUSHED
          Constants to specify the life cycle state type
protected static int P_NEW_FLUSHED_DELETED
          Constants to specify the life cycle state type
protected static int P_NEW_FLUSHED_DIRTY
          Constants to specify the life cycle state type
protected static int P_NON_TX
          Constants to specify the life cycle state type
protected  int stateType
           
protected static int T_CLEAN
          Constants to specify the life cycle state type
protected static int T_DIRTY
          Constants to specify the life cycle state type
protected static int TOTAL
          Constants to specify the life cycle state type
protected static int TRANSIENT
          Constants to specify the life cycle state type
 
Constructor Summary
protected PersistentNewFlushed()
           
 
Method Summary
protected  void assertTransaction(boolean transactionActive)
          Asserts that current transaction is active.
protected  LifeCycleState changeState(int newStateType)
          Changes Life Cycle State.
protected  LifeCycleState flush(java.util.BitSet loadedFields, java.util.BitSet dirtyFields, StoreManager srm, StateManagerImpl sm)
          This is a no-op.
protected static LifeCycleState getLifeCycleState(int state)
          Returns the LifeCycleState for the state constant.
protected static void initLifeCycleState()
          Initialises the objects.
protected  boolean isAutoPersistent()
          Return whether the object state is persistent by reachabilty only.
protected  boolean isBeforeImageUpdatable()
          Return whether the beforeImage can be updated.
protected  boolean isDeleted()
          Return whether the state represents a deleted object.
protected  boolean isDirty()
          Return whether the object state is dirty, that is, the object has been changed (created, updated, deleted) in this Tx.
protected  boolean isFlushed()
          Return whether the object has been flushed to the datastore.
protected  boolean isNavigable()
          Return whether the object can dynamically navigate to fields that are not present.
protected  boolean isNew()
          Return whether the state represents a newly created object.
protected  boolean isPersistent()
          Return whether the object state is persistent.
protected  boolean isRefreshable()
          Return whether the object can be refreshed from the datastore.
protected  boolean isStored()
          Return whether the object is stored in the datastore.
protected  boolean isTransactional()
          Return whether the object state is transactional.
protected  boolean needMerge()
          Return whether the merge is needed.
protected  int stateType()
          Returns the type of the life cycle state as an int.
 java.lang.String toString()
           
protected  LifeCycleState transitionCommit(boolean retainValues, StateManagerImpl sm)
          Transitions LifeCycleState on commit.
protected  LifeCycleState transitionDeletePersistent(StateManagerImpl sm)
          Transitions LifeCycleState on call to deletePersistent
protected  LifeCycleState transitionEvict(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to evict an instance.
protected  LifeCycleState transitionFromAutoPersistent(StateManagerImpl sm)
          Transitions LifeCycleState to transient for AutoPersistent instance that is not referenced anymore (persistence-by-reachability)
protected  LifeCycleState transitionMakeNontransactional(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to makeNontransactional
protected  LifeCycleState transitionMakePersistent(StateManagerImpl sm)
          Transitions LifeCycleState on call to makePersistent
protected  LifeCycleState transitionMakeTransactional(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to makeTransactional
protected  LifeCycleState transitionMakeTransient(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to makeTransient.
protected  LifeCycleState transitionReadField(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to read a field.
protected  LifeCycleState transitionRefresh(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to refresh an instance.
protected  LifeCycleState transitionReload(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to reload an instance.
protected  LifeCycleState transitionReplace(StateManagerImpl sm, javax.jdo.Transaction tx, int[] fields, FieldManager fieldManager)
          Transitions the lifecycle state as if the instance is retrieved from the datastore, but use the specified field values instead of loading them from the datastore.
protected  LifeCycleState transitionRetrieve(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to retrieve an instance.
protected  LifeCycleState transitionRollback(boolean restoreValues, StateManagerImpl sm)
          This implementation differs from a generic version from the LifeCycleState as the state transitions to transient.
protected  LifeCycleState transitionToAutoPersistent(StateManagerImpl sm)
          Transitions LifeCycleState as a result of call to makePersistent of a referencing instance (persistence-by-reachability)
protected  LifeCycleState transitionWriteField(StateManagerImpl sm, javax.jdo.Transaction tx)
          Transitions LifeCycleState on call to write a field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

msg

protected static final I18NHelper msg
I18N message handler


isPersistent

protected boolean isPersistent

isTransactional

protected boolean isTransactional

isDirty

protected boolean isDirty

isNew

protected boolean isNew

isDeleted

protected boolean isDeleted

isNavigable

protected boolean isNavigable

isRefreshable

protected boolean isRefreshable

isBeforeImageUpdatable

protected boolean isBeforeImageUpdatable

isFlushed

protected boolean isFlushed

isAutoPersistent

protected boolean isAutoPersistent

isStored

protected boolean isStored

needMerge

protected boolean needMerge

stateType

protected int stateType

TRANSIENT

protected static final int TRANSIENT
Constants to specify the life cycle state type

See Also:
Constant Field Values

HOLLOW

protected static final int HOLLOW
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_NON_TX

protected static final int P_NON_TX
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_CLEAN

protected static final int P_CLEAN
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_CLEAN_TX

protected static final int P_CLEAN_TX
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_DIRTY

protected static final int P_DIRTY
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_DIRTY_FLUSHED

protected static final int P_DIRTY_FLUSHED
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_NEW

protected static final int P_NEW
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_NEW_FLUSHED

protected static final int P_NEW_FLUSHED
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_NEW_FLUSHED_DELETED

protected static final int P_NEW_FLUSHED_DELETED
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_NEW_FLUSHED_DIRTY

protected static final int P_NEW_FLUSHED_DIRTY
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_NEW_DELETED

protected static final int P_NEW_DELETED
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_DELETED

protected static final int P_DELETED
Constants to specify the life cycle state type

See Also:
Constant Field Values

P_DELETED_FLUSHED

protected static final int P_DELETED_FLUSHED
Constants to specify the life cycle state type

See Also:
Constant Field Values

T_CLEAN

protected static final int T_CLEAN
Constants to specify the life cycle state type

See Also:
Constant Field Values

T_DIRTY

protected static final int T_DIRTY
Constants to specify the life cycle state type

See Also:
Constant Field Values

AP_NEW

protected static final int AP_NEW
Constants to specify the life cycle state type

See Also:
Constant Field Values

AP_NEW_FLUSHED

protected static final int AP_NEW_FLUSHED
Constants to specify the life cycle state type

See Also:
Constant Field Values

AP_NEW_FLUSHED_DIRTY

protected static final int AP_NEW_FLUSHED_DIRTY
Constants to specify the life cycle state type

See Also:
Constant Field Values

AP_PENDING

protected static final int AP_PENDING
Constants to specify the life cycle state type

See Also:
Constant Field Values

TOTAL

protected static final int TOTAL
Constants to specify the life cycle state type

See Also:
Constant Field Values
Constructor Detail

PersistentNewFlushed

protected PersistentNewFlushed()
Method Detail

transitionDeletePersistent

protected LifeCycleState transitionDeletePersistent(StateManagerImpl sm)
Description copied from class: LifeCycleState
Transitions LifeCycleState on call to deletePersistent

Overrides:
transitionDeletePersistent in class PersistentNew
See Also:
LifeCycleState.transitionDeletePersistent(StateManagerImpl sm)

transitionWriteField

protected LifeCycleState transitionWriteField(StateManagerImpl sm,
                                              javax.jdo.Transaction tx)
Description copied from class: LifeCycleState
Transitions LifeCycleState on call to write a field.

Overrides:
transitionWriteField in class LifeCycleState
Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
LifeCycleState.transitionWriteField(StateManagerImpl sm, Transaction tx)

flush

protected LifeCycleState flush(java.util.BitSet loadedFields,
                               java.util.BitSet dirtyFields,
                               StoreManager srm,
                               StateManagerImpl sm)
This is a no-op.

Overrides:
flush in class PersistentNew
See Also:
LifeCycleState.flush(BitSet loadedFields, BitSet dirtyFields, StoreManager srm, StateManagerImpl sm)

transitionCommit

protected LifeCycleState transitionCommit(boolean retainValues,
                                          StateManagerImpl sm)
Description copied from class: LifeCycleState
Transitions LifeCycleState on commit. Called by TransactionImpl.afterCompletion.

Overrides:
transitionCommit in class LifeCycleState
Parameters:
retainValues - the value of the flag in the Transaction instance associated with the hashing PersistenceManager
sm - StateManagerImpl requested the transition.
Returns:
new LifeCycleState.
See Also:
LifeCycleState.transitionCommit(boolean retainValues, StateManagerImpl sm)

transitionRollback

protected LifeCycleState transitionRollback(boolean restoreValues,
                                            StateManagerImpl sm)
This implementation differs from a generic version from the LifeCycleState as the state transitions to transient.

Overrides:
transitionRollback in class LifeCycleState
Parameters:
restoreValues - the value of the flag in the Transaction instance associated with the hashing PersistenceManager
sm - StateManagerImpl requested the transition.
Returns:
new LifeCycleState.
See Also:
LifeCycleState.transitionRollback(boolean restoreValues, StateManagerImpl sm)

initLifeCycleState

protected static void initLifeCycleState()
Initialises the objects. This class implements the "state pattern".


getLifeCycleState

protected static LifeCycleState getLifeCycleState(int state)
Returns the LifeCycleState for the state constant.

Parameters:
state - the state type as integer
Returns:
the type as LifeCycleState object

stateType

protected int stateType()
Returns the type of the life cycle state as an int.

Returns:
the type of this life cycle state as an int.

transitionMakeTransient

protected LifeCycleState transitionMakeTransient(StateManagerImpl sm,
                                                 javax.jdo.Transaction tx)
Transitions LifeCycleState on call to makeTransient.

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
PersistenceManager.makeTransient(Object pc)

transitionMakeTransactional

protected LifeCycleState transitionMakeTransactional(StateManagerImpl sm,
                                                     javax.jdo.Transaction tx)
Transitions LifeCycleState on call to makeTransactional

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
PersistenceManager.makeTransactional(Object pc)

transitionMakeNontransactional

protected LifeCycleState transitionMakeNontransactional(StateManagerImpl sm,
                                                        javax.jdo.Transaction tx)
Transitions LifeCycleState on call to makeNontransactional

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
PersistenceManager.makeNontransactional(Object pc)

transitionMakePersistent

protected LifeCycleState transitionMakePersistent(StateManagerImpl sm)
Transitions LifeCycleState on call to makePersistent

Parameters:
sm - StateManagerImpl requested the transition.
Returns:
new LifeCycleState.
See Also:
PersistenceManager.makePersistent(Object pc)

transitionToAutoPersistent

protected LifeCycleState transitionToAutoPersistent(StateManagerImpl sm)
Transitions LifeCycleState as a result of call to makePersistent of a referencing instance (persistence-by-reachability)

Parameters:
sm - StateManagerImpl requested the transition.
Returns:
new LifeCycleState.
See Also:
PersistenceManager.makePersistent(Object pc)

transitionFromAutoPersistent

protected LifeCycleState transitionFromAutoPersistent(StateManagerImpl sm)
Transitions LifeCycleState to transient for AutoPersistent instance that is not referenced anymore (persistence-by-reachability)

Parameters:
sm - StateManagerImpl requested the transition.
Returns:
new LifeCycleState.
See Also:
PersistenceManager.makePersistent(Object pc)

transitionEvict

protected LifeCycleState transitionEvict(StateManagerImpl sm,
                                         javax.jdo.Transaction tx)
Transitions LifeCycleState on call to evict an instance.

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
PersistenceManager.evict(Object pc)

transitionRefresh

protected LifeCycleState transitionRefresh(StateManagerImpl sm,
                                           javax.jdo.Transaction tx)
Transitions LifeCycleState on call to refresh an instance.

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
PersistenceManager.refresh(Object pc)

transitionRetrieve

protected LifeCycleState transitionRetrieve(StateManagerImpl sm,
                                            javax.jdo.Transaction tx)
Transitions LifeCycleState on call to retrieve an instance.

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
PersistenceManager.retrieve(Object pc)

transitionReplace

protected LifeCycleState transitionReplace(StateManagerImpl sm,
                                           javax.jdo.Transaction tx,
                                           int[] fields,
                                           FieldManager fieldManager)
Transitions the lifecycle state as if the instance is retrieved from the datastore, but use the specified field values instead of loading them from the datastore.

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
fields - Indicates which fields should be replaced in the PC.
fieldManager - FieldManager from which the field's value should be
Returns:
new LifeCycleState.

transitionReload

protected LifeCycleState transitionReload(StateManagerImpl sm,
                                          javax.jdo.Transaction tx)
Transitions LifeCycleState on call to reload an instance. This is the result of a request to validate non-transactional instance.

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.
See Also:
PersistenceManager.getObjectById(Object oid, boolean validate)

transitionReadField

protected LifeCycleState transitionReadField(StateManagerImpl sm,
                                             javax.jdo.Transaction tx)
Transitions LifeCycleState on call to read a field.

Parameters:
sm - StateManagerImpl requested the transition.
tx - Transaction associated with the hashing PersistenceManager
Returns:
new LifeCycleState.

assertTransaction

protected void assertTransaction(boolean transactionActive)
Asserts that current transaction is active.

Parameters:
transactionActive - true if the current transaction is active
Throws:
javax.jdo.JDOUserException - if transaction is not active

isPersistent

protected boolean isPersistent()
Return whether the object state is persistent.


isTransactional

protected boolean isTransactional()
Return whether the object state is transactional.


isDirty

protected boolean isDirty()
Return whether the object state is dirty, that is, the object has been changed (created, updated, deleted) in this Tx.


isNew

protected boolean isNew()
Return whether the state represents a newly created object.


isDeleted

protected boolean isDeleted()
Return whether the state represents a deleted object.


isNavigable

protected boolean isNavigable()
Return whether the object can dynamically navigate to fields that are not present.


isRefreshable

protected boolean isRefreshable()
Return whether the object can be refreshed from the datastore.


isBeforeImageUpdatable

protected boolean isBeforeImageUpdatable()
Return whether the beforeImage can be updated.


isFlushed

protected boolean isFlushed()
Return whether the object has been flushed to the datastore.


isAutoPersistent

protected boolean isAutoPersistent()
Return whether the object state is persistent by reachabilty only.


isStored

protected boolean isStored()
Return whether the object is stored in the datastore.


needMerge

protected boolean needMerge()
Return whether the merge is needed.


changeState

protected LifeCycleState changeState(int newStateType)
Changes Life Cycle State.

Returns:
new LifeCycleState.

toString

public java.lang.String toString()