org.jboss.ejb
Class AllowedOperationsAssociation

java.lang.Object
  extended byorg.jboss.ejb.AllowedOperationsAssociation
All Implemented Interfaces:
AllowedOperationsFlags

public final class AllowedOperationsAssociation
extends Object
implements AllowedOperationsFlags

Associates the current thread with a stack of flags that indicate the callers current ejb method. According to the EJB2.1 spec not all context methods can be accessed at all times For example ctx.getPrimaryKey() should throw an IllegalStateException when called from within ejbCreate()

Version:
$Revision: 1.2 $
Author:
Thomas.Diesler@jboss.org

Field Summary
static HashMap methodMap
           
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Constructor Summary
AllowedOperationsAssociation()
           
 
Method Summary
static void assertAllowedIn(String ctxMethod, int flags)
          Throw an IllegalStateException if the current inMethodFlag does not match the given flags
static int peekInMethodFlag()
          Return th ecurrent inMethodFlag, or -1 if there is none
static void popInMethodFlag()
          Reset when the instance exits an ejb method
static void pushInMethodFlag(int inMethodFlag)
          Set when the instance enters an ejb method, reset on exit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methodMap

public static final HashMap methodMap
Constructor Detail

AllowedOperationsAssociation

public AllowedOperationsAssociation()
Method Detail

pushInMethodFlag

public static void pushInMethodFlag(int inMethodFlag)
Set when the instance enters an ejb method, reset on exit

Parameters:
inMethodFlag - one of the IN_METHOD contants or null

popInMethodFlag

public static void popInMethodFlag()
Reset when the instance exits an ejb method


peekInMethodFlag

public static int peekInMethodFlag()
Return th ecurrent inMethodFlag, or -1 if there is none


assertAllowedIn

public static void assertAllowedIn(String ctxMethod,
                                   int flags)
Throw an IllegalStateException if the current inMethodFlag does not match the given flags



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.