org.apache.openjpa.validation
Class ValidatingLifecycleEventManager

java.lang.Object
  extended by org.apache.openjpa.event.LifecycleEventManager
      extended by org.apache.openjpa.validation.ValidatingLifecycleEventManager
All Implemented Interfaces:
Serializable, CallbackModes, Configurable

public class ValidatingLifecycleEventManager
extends LifecycleEventManager
implements Configurable

An extension of LifecycleEventManager which adds validation capabilities for specific lifecycle events. Validation occurs after firing all lifecycle events and callbacks.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openjpa.event.LifecycleEventManager
LifecycleEventManager.ListenerAdapter, LifecycleEventManager.ListenerList
 
Field Summary
protected  boolean _validationEnabled
           
 
Fields inherited from interface org.apache.openjpa.event.CallbackModes
CALLBACK_FAIL_FAST, CALLBACK_IGNORE, CALLBACK_LOG, CALLBACK_RETHROW, CALLBACK_ROLLBACK
 
Constructor Summary
ValidatingLifecycleEventManager()
          Constructor which accepts a reference to the validator to use.
 
Method Summary
 void endConfiguration()
          Invoked upon completion of bean property configuration for this object.
 Exception[] fireEvent(Object source, ClassMetaData meta, int type)
          Fire lifecycle event to all registered listeners without an argument.
 Exception[] fireEvent(Object source, Object related, ClassMetaData meta, int type)
          Fire lifecycle event to all registered listeners.
 boolean hasDeleteListeners(Object source, ClassMetaData meta)
          Return whether there are listeners or callbacks for the given source.
 boolean hasPersistListeners(Object source, ClassMetaData meta)
          Return whether there are listeners or callbacks for the given source.
 boolean hasUpdateListeners(Object source, ClassMetaData meta)
          Return whether there are listeners or callbacks for the given source.
 boolean isActive(ClassMetaData meta)
          Whether this LifeCycleEventManager has had at least one listener or callback registered.
 boolean isValidationEnabled()
           
 void setConfiguration(Configuration conf)
          Invoked prior to setting bean properties.
 boolean setValidationEnabled(boolean enabled)
           
 void startConfiguration()
          Invoked before bean property configuration is begun on this object.
 
Methods inherited from class org.apache.openjpa.event.LifecycleEventManager
addListener, hasAttachListeners, hasClearListeners, hasDetachListeners, hasDirtyListeners, hasLoadListeners, hasStoreListeners, isFailFast, removeListener, setFailFast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_validationEnabled

protected boolean _validationEnabled
Constructor Detail

ValidatingLifecycleEventManager

public ValidatingLifecycleEventManager()
Constructor which accepts a reference to the validator to use. If null, no validation will occur.

Parameters:
validator -
Method Detail

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.

Specified by:
endConfiguration in interface Configurable

setConfiguration

public void setConfiguration(Configuration conf)
Description copied from interface: Configurable
Invoked prior to setting bean properties.

Specified by:
setConfiguration in interface Configurable

startConfiguration

public void startConfiguration()
Description copied from interface: Configurable
Invoked before bean property configuration is begun on this object.

Specified by:
startConfiguration in interface Configurable

hasUpdateListeners

public boolean hasUpdateListeners(Object source,
                                  ClassMetaData meta)
Description copied from class: LifecycleEventManager
Return whether there are listeners or callbacks for the given source.

Overrides:
hasUpdateListeners in class LifecycleEventManager

hasPersistListeners

public boolean hasPersistListeners(Object source,
                                   ClassMetaData meta)
Description copied from class: LifecycleEventManager
Return whether there are listeners or callbacks for the given source.

Overrides:
hasPersistListeners in class LifecycleEventManager

hasDeleteListeners

public boolean hasDeleteListeners(Object source,
                                  ClassMetaData meta)
Description copied from class: LifecycleEventManager
Return whether there are listeners or callbacks for the given source.

Overrides:
hasDeleteListeners in class LifecycleEventManager

fireEvent

public Exception[] fireEvent(Object source,
                             ClassMetaData meta,
                             int type)
Description copied from class: LifecycleEventManager
Fire lifecycle event to all registered listeners without an argument.

Overrides:
fireEvent in class LifecycleEventManager

fireEvent

public Exception[] fireEvent(Object source,
                             Object related,
                             ClassMetaData meta,
                             int type)
Description copied from class: LifecycleEventManager
Fire lifecycle event to all registered listeners.

Overrides:
fireEvent in class LifecycleEventManager

isActive

public boolean isActive(ClassMetaData meta)
Whether this LifeCycleEventManager has had at least one listener or callback registered. Used for a quick test when firing events.

Overrides:
isActive in class LifecycleEventManager
Returns:
boolean

isValidationEnabled

public boolean isValidationEnabled()

setValidationEnabled

public boolean setValidationEnabled(boolean enabled)


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.