1 45 package org.openejb.core.stateful; 46 47 import javax.xml.rpc.handler.MessageContext ; 48 49 import org.openejb.RpcContainer; 50 import org.openejb.core.Operations; 51 import org.openejb.core.ThreadContext; 52 import org.openejb.core.ivm.EjbObjectProxyHandler; 53 54 62 public class StatefulContext 63 extends org.openejb.core.CoreContext implements javax.ejb.SessionContext { 64 public void checkBeanState(byte methodCategory) throws IllegalStateException { 65 83 ThreadContext callContext = ThreadContext.getThreadContext(); 84 85 switch(callContext.getCurrentOperation()){ 86 case Operations.OP_SET_CONTEXT: 87 99 if(methodCategory != EJBHOME_METHOD) 100 throw new IllegalStateException ("Invalid operation attempted"); 101 break; 102 case Operations.OP_CREATE: 103 case Operations.OP_REMOVE: 104 case Operations.OP_ACTIVATE: 105 case Operations.OP_PASSIVATE: 106 case Operations.OP_AFTER_COMPLETION: 107 119 if(methodCategory == ROLLBACK_METHOD) 120 throw new IllegalStateException ("Invalid operation attempted"); 121 else 122 break; 123 case Operations.OP_BUSINESS: 124 case Operations.OP_AFTER_BEGIN: 125 case Operations.OP_BEFORE_COMPLETION: 126 138 break; 139 } 140 141 } 142 143 protected EjbObjectProxyHandler newEjbObjectHandler(RpcContainer container, Object pk, Object depID){ 144 return new StatefulEjbObjectHandler(container, pk, depID); 145 } 146 147 public MessageContext getMessageContext() { 148 return null; } 150 151 } | Popular Tags |