1 45 package org.openejb.core.entity; 46 47 import org.openejb.RpcContainer; 48 import org.openejb.core.Operations; 49 import org.openejb.core.ThreadContext; 50 import org.openejb.core.ivm.EjbObjectProxyHandler; 51 52 59 public class EntityContext 60 extends org.openejb.core.CoreContext implements javax.ejb.EntityContext { 61 62 public void checkBeanState(byte methodCategory) throws IllegalStateException { 63 80 81 ThreadContext callContext = ThreadContext.getThreadContext(); 82 org.openejb.DeploymentInfo di = callContext.getDeploymentInfo(); 83 84 85 switch(callContext.getCurrentOperation()){ 86 case Operations.OP_SET_CONTEXT: 87 case Operations.OP_UNSET_CONTEXT: 88 100 if(methodCategory != EJBHOME_METHOD) 101 throw new IllegalStateException ("Invalid operation attempted"); 102 break; 103 case Operations.OP_CREATE: 104 case Operations.OP_FIND: 105 case Operations.OP_HOME: 106 118 if(methodCategory == EJBOBJECT_METHOD) 119 throw new IllegalStateException ("Invalid operation attempted"); 120 break; 121 case Operations.OP_ACTIVATE: 122 case Operations.OP_PASSIVATE: 123 135 if(methodCategory != EJBOBJECT_METHOD && methodCategory != EJBHOME_METHOD) 136 throw new IllegalStateException ("Invalid operation attempted"); 137 break; 138 139 case Operations.OP_POST_CREATE: 140 case Operations.OP_REMOVE: 141 case Operations.OP_LOAD: 142 case Operations.OP_STORE: 143 155 break; 156 157 } 158 159 } 160 161 protected EjbObjectProxyHandler newEjbObjectHandler(RpcContainer container, Object pk, Object depID){ 162 return new EntityEjbObjectHandler(container, pk, depID); 163 } 164 165 } | Popular Tags |