public Object invoke(Invocation invocation) throws Throwable { try { AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT); return invocation.invokeNext(); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public void afterBegin() { if (notifySession) { try { AllowedOperationsAssociation.pushInMethodFlag(IN_AFTER_BEGIN); afterBegin.invoke(ctx.getInstance(), new Object[0]); } catch (Exception e) { log.error("failed to invoke afterBegin", e); } finally{ AllowedOperationsAssociation.popInMethodFlag(); } } }
public void storeEntity(EntityEnterpriseContext ctx) throws RemoteException { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_STORE); try { store.storeEntity(ctx); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public Object findEntity(Method finderMethod, Object[] args, EntityEnterpriseContext ctx, GenericEntityObjectFactory factory) throws Exception { try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_FIND); return store.findEntity(finderMethod, args, ctx, factory); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public void callTimeout(Timer timer) throws Exception { if (timeoutMethod == null) throw new EJBException("No method has been annotated with @Timeout"); Object[] args = { timer }; if(timeoutMethod.getParameterTypes().length == 0) args = null; AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT); try { localInvoke(timeoutMethod, args); } catch (Throwable throwable) { if (throwable instanceof Exception) throw (Exception) throwable; throw new RuntimeException(throwable); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
/** * find multiple entities */ public Collection findEntities(Method finderMethod, Object[] args, EntityEnterpriseContext ctx, GenericEntityObjectFactory factory) throws Exception { try { // return the finderResults so that the invoker layer can extend this back // giving the client an OO 'cursor' AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_FIND); return store.findEntities(finderMethod, args, ctx, factory); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
AllowedOperationsAssociation.pushInMethodFlag(IN_SET_SESSION_CONTEXT); ((SessionBean)instance).setSessionContext(ctx); AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_CREATE); Method ejbCreate = instance.getClass().getMethod("ejbCreate", new Class[0]); ejbCreate.invoke(instance, new Object[0]);
public StatefulSessionEnterpriseContext(Object instance, Container con) throws RemoteException { super(instance, con); ctx = new StatefulSessionContextImpl(); try { AllowedOperationsAssociation.pushInMethodFlag(IN_SET_SESSION_CONTEXT); ((SessionBean)instance).setSessionContext(ctx); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public EntityEnterpriseContext(Object instance, Container con) throws RemoteException { super(instance, con); ctx = new EntityContextImpl(); try { AllowedOperationsAssociation.pushInMethodFlag(IN_SET_ENTITY_CONTEXT); ((EntityBean)instance).setEntityContext(ctx); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public void beforeCompletion() { if( log.isTraceEnabled() ) log.trace("beforeCompletion called"); // lock the context the transaction is being commited (no need for sync) ctx.lock(); beforeCompletionInvoked = true; if (notifySession) { try { AllowedOperationsAssociation.pushInMethodFlag(IN_BEFORE_COMPLETION); container.pushENC(); beforeCompletion.invoke(ctx.getInstance(), new Object[0]); } catch (Exception e) { log.error("failed to invoke beforeCompletion", e); } finally { container.popENC(); AllowedOperationsAssociation.popInMethodFlag(); } } }
AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_LOAD); ejbLoad.invoke(ctx.getInstance(), EMPTY_OBJECT_ARRAY); } catch (IllegalAccessException e)
public void restoreTimerService(TimerService aTimerService) { if (aTimerService == null) { log.warn("TIMER SERVICE IS NOT INSTALLED"); return; } TimerServiceFacade timerService = (TimerServiceFacade) aTimerService; ClassLoader loader = null; // FIXME: A hack to circumvent the check in TimerServiceFacade // In AS itself (/EJB2) the container has an unsecured timer service association // see org.jboss.ejb.Container.getTimerService(Object pKey) AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsAssociation.IN_BUSINESS_METHOD); try { getEJBTimerService().restoreTimers(timerService.getContainerId(), loader); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public void invokePostConstruct(BeanContext<?> beanContext) { // FIXME: This is a dirty hack to notify AS EJBTimerService about what's going on AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsAssociation.IN_EJB_CREATE); try { this.pushContext(beanContext); invokeCallback(beanContext, PostConstruct.class); } finally { this.popContext(); AllowedOperationsAssociation.popInMethodFlag(); } }
protected void invokeLoad(EntityEnterpriseContext ctx) throws RemoteException { try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_LOAD); EntityBean eb = (EntityBean) ctx.getInstance(); eb.ejbLoad(); } catch(Exception e) { throwRemoteException(e); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public Object findEntity(Method finderMethod, Object[] args, EntityEnterpriseContext ctx, GenericEntityObjectFactory factory) throws Exception { try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_FIND); // call the finder method Object objectId = callFinderMethod(finderMethod, args, ctx); final Object cacheKey = ((EntityCache)con.getInstanceCache()).createCacheKey( objectId ); return factory.getEntityEJBObject(cacheKey); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public void removeEntity(EntityEnterpriseContext ctx) throws RemoteException, RemoveException { try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_REMOVE); EntityBean eb = (EntityBean) ctx.getInstance(); eb.ejbRemove(); } catch(Exception e) { if(e instanceof RemoveException) { // Rethrow exception throw (RemoveException) e; } else { throwRemoteException(e); } } finally { AllowedOperationsAssociation.popInMethodFlag(); } store.removeEntity(ctx); }
public void invokeEjbStore(EntityEnterpriseContext ctx) throws RemoteException AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_STORE);
public void passivateEntity(EntityEnterpriseContext ctx) throws RemoteException { try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_PASSIVATE); EntityBean eb = (EntityBean) ctx.getInstance(); eb.ejbPassivate(); } catch(Exception e) { throwRemoteException(e); } finally { AllowedOperationsAssociation.popInMethodFlag(); } store.passivateEntity(ctx); ctx.setEJBObject(null); ctx.setEJBLocalObject(null); }
public void remove(Invocation mi) throws RemoteException, RemoveException { // if the session is removed already then let the user know they have a problem StatefulSessionEnterpriseContext ctx = (StatefulSessionEnterpriseContext) mi.getEnterpriseContext(); if (ctx.getId() == null) { throw new RemoveException("SFSB has been removed already"); } // Remove from storage try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_REMOVE); getPersistenceManager().removeSession(ctx); } finally { AllowedOperationsAssociation.popInMethodFlag(); } // We signify "removed" with a null id ctx.setId(null); removeCount++; }
AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_HOME);