Search in sources :

Example 1 with EJBTimerServiceWrapper

use of com.sun.ejb.containers.EJBTimerServiceWrapper in project Payara by payara.

the class EjbNamingReferenceManagerImpl method getEJBContextObject.

public Object getEJBContextObject(String contextType) {
    ComponentInvocation currentInv = invMgr.getCurrentInvocation();
    if (currentInv == null) {
        throw new IllegalStateException("no current invocation");
    } else if (currentInv.getInvocationType() != ComponentInvocation.ComponentInvocationType.EJB_INVOCATION) {
        throw new IllegalStateException("Illegal invocation type for EJB Context : " + currentInv.getInvocationType());
    }
    EjbInvocation ejbInv = (EjbInvocation) currentInv;
    Object returnObject = ejbInv.context;
    if (contextType.equals("javax.ejb.TimerService")) {
        if (EJBTimerService.getEJBTimerService() == null) {
            throw new IllegalStateException("EJB Timer Service not " + "available");
        }
        returnObject = new EJBTimerServiceWrapper(EJBTimerService.getEJBTimerService(), (EJBContextImpl) ejbInv.context);
    }
    return returnObject;
}
Also used : ComponentInvocation(org.glassfish.api.invocation.ComponentInvocation) EJBContextImpl(com.sun.ejb.containers.EJBContextImpl) EJBTimerServiceWrapper(com.sun.ejb.containers.EJBTimerServiceWrapper)

Aggregations

EJBContextImpl (com.sun.ejb.containers.EJBContextImpl)1 EJBTimerServiceWrapper (com.sun.ejb.containers.EJBTimerServiceWrapper)1 ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)1