public class DescriptorEventManager extends CoreDescriptorEventManager<DescriptorEvent> implements java.lang.Cloneable, java.io.Serializable
Purpose: The event manager allows for a descriptor to specify that an object should be notified when a EclipseLink event occurs. It also determines how the object will be notified. To specify an event a method name can be registered to be called on the object when the event occurs. Events can be used to extend the EclipseLink reading and writing behavior.
These events include:
ClassDescriptor
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
AboutToDeleteEvent |
static int |
AboutToInsertEvent |
static int |
AboutToUpdateEvent |
protected java.util.Vector |
defaultEventListeners |
protected ClassDescriptor |
descriptor |
protected java.util.List<SerializableDescriptorEventHolder> |
descriptorEventHolders |
protected DescriptorEventListener |
entityEventListener |
protected java.util.Vector |
entityEventManagers |
protected java.util.Vector |
entityListenerEventListeners |
protected java.util.Vector |
entityListenerEventManagers |
protected java.util.Vector |
eventListeners |
protected java.util.Vector |
eventMethods |
protected java.util.Vector |
eventSelectors |
protected boolean |
excludeDefaultListeners |
protected boolean |
excludeSuperclassListeners |
protected boolean |
hasAnyEventListeners
PERF: Cache if any events listener exist.
|
protected java.util.List<DescriptorEventListener> |
internalListeners
Listeners that are fired after all other listeners are fired
|
protected static int |
NumberOfEvents |
static int |
PostBuildEvent |
static int |
PostCloneEvent |
static int |
PostDeleteEvent |
static int |
PostInsertEvent |
static int |
PostMergeEvent |
static int |
PostRefreshEvent |
static int |
PostUpdateEvent |
static int |
PostWriteEvent |
static int |
PreDeleteEvent |
static int |
PreInsertEvent |
static int |
PrePersistEvent |
static int |
PreRemoveEvent |
static int |
PreUpdateEvent |
static int |
PreUpdateWithChangesEvent |
static int |
PreWriteEvent |
Constructor and Description |
---|
DescriptorEventManager()
INTERNAL:
Returns a new DescriptorEventManager for the specified ClassDescriptor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDefaultEventListener(DescriptorEventListener listener)
PUBLIC:
EJB 3.0 support for default listeners.
|
void |
addEntityListenerEventListener(DescriptorEventListener listener)
PUBLIC:
EJB 3.0 support for lifecycle callback events defined on an entity
listener class.
|
void |
addEntityListenerHolder(SerializableDescriptorEventHolder holder)
INTERNAL:
|
void |
addInternalListener(DescriptorEventListener listener)
INTERNAL:
|
void |
addListener(DescriptorEventListener listener)
PUBLIC:
Listener objects can be registered with the event manager to be notified
when an event occurs on any instance of the descriptor's class.
|
java.lang.Object |
clone()
INTERNAL:
Clone the manager and its private parts.
|
boolean |
excludeDefaultListeners()
INTERNAL:
EJB 3.0 support.
|
boolean |
excludeSuperclassListeners()
INTERNAL:
EJB 3.0 support.
|
void |
executeEvent(DescriptorEvent event)
INTERNAL:
Execute the given selector with the event as argument.
|
protected java.lang.reflect.Method |
findMethod(int selector)
Find the method corresponding to the event selector.
|
java.lang.String |
getAboutToDeleteSelector()
INTERNAL:
bug 251180 - Missing method org.eclipse.persistence.descriptors.DescriptorEventManager#setAboutToDeleteSelector
|
java.lang.String |
getAboutToInsertSelector()
INTERNAL:
|
java.lang.String |
getAboutToUpdateSelector()
INTERNAL:
|
java.util.Vector |
getDefaultEventListeners()
INTERNAL:
EJB 3.0 support.
|
protected ClassDescriptor |
getDescriptor()
INTERNAL:
|
java.util.List<SerializableDescriptorEventHolder> |
getDescriptorEventHolders()
INTERNAL:
used by JPA project caching to store DescriptorEventListener representations that can build the underlying
DescriptorEventListener and add it to the EventManager.
|
DescriptorEventListener |
getEntityEventListener()
INTERNAL:
EJB 3.0 support.
|
java.util.Vector |
getEntityListenerEventListeners()
INTERNAL:
EJB 3.0 support.
|
java.util.Vector |
getEventListeners()
PUBLIC:
Returns the Listener objects that have been added.
|
protected java.util.Vector |
getEventMethods() |
protected java.util.Vector |
getEventSelectors() |
java.lang.String |
getPostBuildSelector()
PUBLIC:
The name of the method called after an object is built
|
java.lang.String |
getPostCloneSelector()
PUBLIC:
The name of the method called after an object is cloned
|
java.lang.String |
getPostDeleteSelector()
PUBLIC:
The name of the method called after an object is deleted
|
java.lang.String |
getPostInsertSelector()
PUBLIC:
The name of the method called after an object is inserted
|
java.lang.String |
getPostMergeSelector()
PUBLIC:
The name of the method called after an object is merged
|
java.lang.String |
getPostRefreshSelector()
PUBLIC:
The name of the method called after an object is refreshed
|
java.lang.String |
getPostUpdateSelector()
PUBLIC:
The name of the method called after an object is updated
|
java.lang.String |
getPostWriteSelector()
PUBLIC:
The name of the method called after an object is written
|
java.lang.String |
getPreDeleteSelector()
PUBLIC:
The name of the method called before an object is deleted
|
java.lang.String |
getPreInsertSelector()
PUBLIC:
The name of the method called before an object is inserted
|
java.lang.String |
getPrePersistSelector()
PUBLIC:
The name of the method called before the create operation is applied to an object
|
java.lang.String |
getPreRemoveSelector()
PUBLIC:
The name of the method called before the remove operation is applied to an object
|
java.lang.String |
getPreUpdateSelector()
PUBLIC:
The name of the method called before an object is updated
|
java.lang.String |
getPreWriteSelector()
PUBLIC:
The name of the method called before an object is written
|
boolean |
hasAnyEventListeners()
INTERNAL:
Return if the event manager has any event listeners, or event methods.
|
protected boolean |
hasAnyListeners() |
boolean |
hasDefaultEventListeners()
INTERNAL:
This method will return true, if this event manager has default listeners
and does not exclude them.
|
boolean |
hasEntityEventListener()
INTERNAL:
EJB 3.0 support.
|
boolean |
hasEntityListenerEventListeners()
INTERNAL:
EJB 3.0 support.
|
boolean |
hasInternalEventListeners()
INTERNAL:
Internal event support.
|
void |
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Configure inherited selectors.
|
protected void |
initializeEJB30EventManagers()
INTERNAL:
EJB 3.0 support.
|
protected void |
notifyEJB30Listeners(DescriptorEvent event)
INTERNAL:
Notify the EJB 3.0 event listeners.
|
protected void |
notifyListener(DescriptorEventListener listener,
DescriptorEvent event)
INTERNAL:
Big ugly case statement to notify listeners.
|
void |
notifyListeners(DescriptorEvent event)
INTERNAL:
Notify the event listeners.
|
void |
processDescriptorEventHolders(org.eclipse.persistence.internal.sessions.AbstractSession session,
java.lang.ClassLoader classLoader)
INTERNAL:
This method was added to allow JPA project caching so that DescriptorEventListeners could be
serialized and re-added to the EventManager using a SerializableDescriptorEventHolder.
|
void |
remoteInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Used to initialize a remote DescriptorEventManager.
|
void |
removeListener(DescriptorEventListener listener)
PUBLIC:
Remove a event listener.
|
void |
setAboutToDeleteSelector(java.lang.String aboutToDeleteSelector)
PUBLIC:
A method can be registered to be called when an object's row it about to
be inserted.
|
void |
setAboutToInsertSelector(java.lang.String aboutToInsertSelector)
PUBLIC:
A method can be registered to be called when an object's row it about to
be inserted.
|
void |
setAboutToUpdateSelector(java.lang.String aboutToUpdateSelector)
PUBLIC:
A method can be registered to be called when an object's row it about to
be updated.
|
void |
setDescriptor(ClassDescriptor descriptor)
INTERNAL:
Set the descriptor.
|
void |
setDescriptorEventHolders(java.util.List<SerializableDescriptorEventHolder> descriptorEventHolders)
INTERNAL:
used by JPA project caching to store DescriptorEventListener representations that can build the underlying
DescriptorEventListener and add it to the EventManager.
|
void |
setEntityEventListener(DescriptorEventListener listener)
PUBLIC:
EJB 3.0 support for lifecycle callback events defined on an entity class.
|
protected void |
setEventListeners(java.util.Vector eventListeners) |
protected void |
setEventMethods(java.util.Vector eventMethods) |
protected void |
setEventSelectors(java.util.Vector eventSelectors) |
void |
setExcludeDefaultListeners(boolean excludeDefaultListeners)
INTERNAL:
EJB 3.0 support.
|
void |
setExcludeSuperclassListeners(boolean excludeSuperclassListeners)
INTERNAL:
EJB 3.0 support.
|
protected void |
setHasAnyEventListeners(boolean hasAnyEventListeners)
INTERNAL:
Set if the event manager has any event listeners, or event methods.
|
void |
setPostBuildSelector(java.lang.String postBuildSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
built from the database.
|
void |
setPostCloneSelector(java.lang.String postCloneSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
cloned into a unit of work.
|
void |
setPostDeleteSelector(java.lang.String postDeleteSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
deleted from the database.
|
void |
setPostInsertSelector(java.lang.String postInsertSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
inserted into the database.
|
void |
setPostMergeSelector(java.lang.String postMergeSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
merge from a unit of work.
|
void |
setPostRefreshSelector(java.lang.String postRefreshSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
refreshed from the database.
|
void |
setPostUpdateSelector(java.lang.String postUpdateSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
updated into the database.
|
void |
setPostWriteSelector(java.lang.String postWriteSelector)
PUBLIC:
A method can be registered to be called on a object that has just been
written to the database.
|
void |
setPreDeleteSelector(java.lang.String preDeleteSelector)
PUBLIC:
A method can be registered to be called on a object that is going to be
deleted from the database.
|
void |
setPreInsertSelector(java.lang.String preInsertSelector)
PUBLIC:
A method can be registered to be called on a object that is going to be
inserted into the database.
|
void |
setPrePersistSelector(java.lang.String prePersistSelector)
PUBLIC:
A method can be registered to be called on a object when that object has
the create operation applied to it.
|
void |
setPreRemoveSelector(java.lang.String preRemoveSelector)
PUBLIC:
A method can be registered to be called on a object when that object has
the remove operation applied to it.
|
void |
setPreUpdateSelector(java.lang.String preUpdateSelector)
PUBLIC:
A method can be registered to be called on a object that is going to be
updated into the database.
|
void |
setPreWriteSelector(java.lang.String preWriteSelector)
PUBLIC:
A method can be registered to be called on a object that is going to be
written to the database.
|
protected ClassDescriptor descriptor
protected java.util.Vector eventSelectors
protected transient java.util.Vector eventMethods
protected transient java.util.Vector eventListeners
protected transient java.util.Vector defaultEventListeners
protected transient java.util.Vector entityListenerEventListeners
protected transient DescriptorEventListener entityEventListener
protected transient java.util.List<DescriptorEventListener> internalListeners
protected transient java.util.Vector entityEventManagers
protected transient java.util.Vector entityListenerEventManagers
protected boolean excludeDefaultListeners
protected boolean excludeSuperclassListeners
protected java.util.List<SerializableDescriptorEventHolder> descriptorEventHolders
protected boolean hasAnyEventListeners
public static final int PreWriteEvent
public static final int PostWriteEvent
public static final int PreDeleteEvent
public static final int PostDeleteEvent
public static final int PreInsertEvent
public static final int PostInsertEvent
public static final int PreUpdateEvent
public static final int PostUpdateEvent
public static final int PostBuildEvent
public static final int PostRefreshEvent
public static final int PostCloneEvent
public static final int PostMergeEvent
public static final int AboutToInsertEvent
public static final int AboutToUpdateEvent
public static final int AboutToDeleteEvent
public static final int PrePersistEvent
public static final int PreRemoveEvent
public static final int PreUpdateWithChangesEvent
protected static final int NumberOfEvents
public DescriptorEventManager()
public void addDefaultEventListener(DescriptorEventListener listener)
public void addEntityListenerEventListener(DescriptorEventListener listener)
public void addListener(DescriptorEventListener listener)
public void addInternalListener(DescriptorEventListener listener)
public void addEntityListenerHolder(SerializableDescriptorEventHolder holder)
public java.lang.Object clone()
clone
in class java.lang.Object
public void processDescriptorEventHolders(org.eclipse.persistence.internal.sessions.AbstractSession session, java.lang.ClassLoader classLoader)
classLoader
- public boolean excludeDefaultListeners()
public boolean excludeSuperclassListeners()
public void executeEvent(DescriptorEvent event) throws DescriptorException
executeEvent
in class CoreDescriptorEventManager<DescriptorEvent>
DescriptorException
- - the method cannot be found or executedprotected java.lang.reflect.Method findMethod(int selector) throws DescriptorException
DescriptorException
public java.lang.String getAboutToDeleteSelector()
public java.lang.String getAboutToInsertSelector()
public java.lang.String getAboutToUpdateSelector()
public java.util.Vector getDefaultEventListeners()
protected ClassDescriptor getDescriptor()
public java.util.List<SerializableDescriptorEventHolder> getDescriptorEventHolders()
public void setDescriptorEventHolders(java.util.List<SerializableDescriptorEventHolder> descriptorEventHolders)
public DescriptorEventListener getEntityEventListener()
public java.util.Vector getEntityListenerEventListeners()
public java.util.Vector getEventListeners()
addListener(DescriptorEventListener)
protected java.util.Vector getEventMethods()
protected java.util.Vector getEventSelectors()
public java.lang.String getPostBuildSelector()
public java.lang.String getPostCloneSelector()
public java.lang.String getPostDeleteSelector()
public java.lang.String getPostInsertSelector()
public java.lang.String getPostMergeSelector()
public java.lang.String getPostRefreshSelector()
public java.lang.String getPostUpdateSelector()
public java.lang.String getPostWriteSelector()
public java.lang.String getPrePersistSelector()
public java.lang.String getPreDeleteSelector()
public java.lang.String getPreInsertSelector()
public java.lang.String getPreRemoveSelector()
public java.lang.String getPreUpdateSelector()
public java.lang.String getPreWriteSelector()
public boolean hasAnyEventListeners()
hasAnyEventListeners
in class CoreDescriptorEventManager<DescriptorEvent>
protected boolean hasAnyListeners()
public boolean hasDefaultEventListeners()
public boolean hasEntityEventListener()
public boolean hasInternalEventListeners()
public boolean hasEntityListenerEventListeners()
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
protected void initializeEJB30EventManagers()
protected void notifyEJB30Listeners(DescriptorEvent event)
protected void notifyListener(DescriptorEventListener listener, DescriptorEvent event) throws DescriptorException
DescriptorException
public void notifyListeners(DescriptorEvent event)
public void remoteInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
public void removeListener(DescriptorEventListener listener)
public void setAboutToDeleteSelector(java.lang.String aboutToDeleteSelector)
public void setAboutToInsertSelector(java.lang.String aboutToInsertSelector)
public void setAboutToUpdateSelector(java.lang.String aboutToUpdateSelector)
public void setDescriptor(ClassDescriptor descriptor)
public void setEntityEventListener(DescriptorEventListener listener)
protected void setEventListeners(java.util.Vector eventListeners)
protected void setEventMethods(java.util.Vector eventMethods)
protected void setEventSelectors(java.util.Vector eventSelectors)
public void setExcludeDefaultListeners(boolean excludeDefaultListeners)
public void setExcludeSuperclassListeners(boolean excludeSuperclassListeners)
protected void setHasAnyEventListeners(boolean hasAnyEventListeners)
public void setPostBuildSelector(java.lang.String postBuildSelector)
public void setPostCloneSelector(java.lang.String postCloneSelector)
public void setPostDeleteSelector(java.lang.String postDeleteSelector)
public void setPostInsertSelector(java.lang.String postInsertSelector)
public void setPostMergeSelector(java.lang.String postMergeSelector)
public void setPostRefreshSelector(java.lang.String postRefreshSelector)
public void setPostUpdateSelector(java.lang.String postUpdateSelector)
public void setPostWriteSelector(java.lang.String postWriteSelector)
public void setPreDeleteSelector(java.lang.String preDeleteSelector)
public void setPreInsertSelector(java.lang.String preInsertSelector)
public void setPrePersistSelector(java.lang.String prePersistSelector)
public void setPreRemoveSelector(java.lang.String preRemoveSelector)
public void setPreUpdateSelector(java.lang.String preUpdateSelector)
public void setPreWriteSelector(java.lang.String preWriteSelector)