*/
@SuppressWarnings("unchecked")
private void invokeCallback(final Object pc, final Class callbackClass)
{
final ObjectManager om = ((AbstractPersistenceManager) ((PersistenceCapable) pc).jdoGetPersistenceManager()).getObjectManager();
final ClassLoaderResolver clr = om.getClassLoaderResolver();
AbstractClassMetaData acmd = om.getOMFContext().getMetaDataManager().getMetaDataForClass(pc.getClass(), clr);
try
{
if (!acmd.isExcludeDefaultListeners())
{
// Global listeners for all classes
List<EventListenerMetaData> listenerMetaData = om.getMetaDataManager().getListeners();
if (listenerMetaData != null && listenerMetaData.size() > 0)
{
// Files have listeners so go through them in the same order
Iterator<EventListenerMetaData> listenerIter = listenerMetaData.iterator();
while (listenerIter.hasNext())
{
EventListenerMetaData elmd = listenerIter.next();
Class listenerClass = clr.classForName(elmd.getClassName());
String methodName = elmd.getMethodNameForCallbackClass(callbackClass.getName());
if (methodName != null)
{
// Separate listener class taking the PC object as input
Object listener = listenerClass.newInstance();
invokeCallbackMethod(listener, methodName, pc, clr);
}
}
}
}
// Class listeners for this class
List<String> entityMethodsToInvoke = null;
while (acmd != null)
{
List<EventListenerMetaData> listenerMetaData = acmd.getListeners();
if (listenerMetaData != null && listenerMetaData.size() > 0)
{
// Class has listeners so go through them in the same order
Iterator<EventListenerMetaData> listenerIter = listenerMetaData.iterator();
while (listenerIter.hasNext())
{
EventListenerMetaData elmd = listenerIter.next();
Class listenerClass = clr.classForName(elmd.getClassName());
String methodName = elmd.getMethodNameForCallbackClass(callbackClass.getName());
if (methodName != null)
{
if (elmd.getClassName().equals(acmd.getFullClassName()))
{