public void postAttach(Object pc,Object detachedPC) { if (detachedPC instanceof AttachCallback) { ((AttachCallback) pc).jdoPostAttach(detachedPC); } Iterator iter = listeners.iterator(); while (iter.hasNext()) { LifecycleListenerForClass listener = (LifecycleListenerForClass) iter.next(); if (listener.forClass(pc.getClass()) && listener.getListener() instanceof AttachLifecycleListener) { ((AttachLifecycleListener)listener.getListener()).postAttach(new InstanceLifecycleEvent(pc, InstanceLifecycleEvent.ATTACH, detachedPC)); } } }
public void preAttach(Object pc) { Iterator iter = listeners.iterator(); while (iter.hasNext()) { LifecycleListenerForClass listener = (LifecycleListenerForClass) iter.next(); if (listener.forClass(pc.getClass()) && listener.getListener() instanceof AttachLifecycleListener) { ((AttachLifecycleListener)listener.getListener()).preAttach(new InstanceLifecycleEvent(pc, InstanceLifecycleEvent.ATTACH, null)); } } if (pc instanceof AttachCallback) { ((AttachCallback) pc).jdoPreAttach(); } }
/** * Callback before the object is attached. * @param pc The Object */ public void preAttach(Object pc) { for (LifecycleListenerForClass listener : getListenersWorkingCopy()) { if (listener.forClass(pc.getClass()) && listener.getListener() instanceof AttachLifecycleListener) { ((AttachLifecycleListener)listener.getListener()).preAttach(new InstanceLifecycleEvent(pc, InstanceLifecycleEvent.ATTACH, null)); } } if (pc instanceof AttachCallback) { try { ((AttachCallback) pc).jdoPreAttach(); } catch (Exception e) { throw new JDOUserCallbackException(Localiser.msg("025001", "jdoPreAttach"), e); } } }
/** * Callback after the object is attached. * @param pc The attached Object * @param detachedPC The detached object */ public void postAttach(Object pc,Object detachedPC) { if (pc instanceof AttachCallback) { try { ((AttachCallback) pc).jdoPostAttach(detachedPC); } catch (Exception e) { throw new JDOUserCallbackException(Localiser.msg("025001", "jdoPostAttach"), e); } } for (LifecycleListenerForClass listener : getListenersWorkingCopy()) { if (listener.forClass(pc.getClass()) && listener.getListener() instanceof AttachLifecycleListener) { ((AttachLifecycleListener)listener.getListener()).postAttach(new InstanceLifecycleEvent(pc, InstanceLifecycleEvent.ATTACH, detachedPC)); } } }