|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bankframe.ejb.Server
public class Server
This class provides utility methods for obtaining EJB Home references, and for
manipulating remote objects and enumerations.
This class can cache EJB Home interfaces if the ejb.cacheHomes=true
setting is specified in
BankframeResource.properties
.
If homes caching is defined then the Homes cache must be configured in BankframeResource.properties
as follows:
cache.homesCache.class=com.bankframe.services.cache.GenericCache
cache.homesCache.policy=com.bankframe.services.cache.LruCachePolicy
cache.homesCache.policy.maxSize=100
cache.homesCache.policy.thrashAmount=10
Nested Class Summary | |
---|---|
static interface |
Server.UserToken
Deprecated. This interface is no longer required as an alternative method is used to cache the user token |
Field Summary | |
---|---|
static String |
ANONYMOUS_USER
|
static String |
EJB_INITIALCONTEXTFACTORY
Flag in BankframeResource.properties indicating initial context factory to use |
static String |
EJB_SERVER
Flag in BankframeResource.properties indicating which ejb server to use |
static String |
ejbInitialContextFactory
|
static String |
ejbServer
|
static String |
HOME_CACHE
|
static String |
JNDI_DEFAULT_PREFIX_VALUE
|
static String |
JNDI_EJB_10
|
static String |
JNDI_EJB_11
|
static String |
JNDI_MODE_KEY
|
static String |
JNDI_PREFIX
|
static String |
jndiMode
|
static String |
jndiPrefix
|
static String |
USER_TOKEN
|
static String |
USER_TOKEN_CLASS_NAME
|
Constructor Summary | |
---|---|
Server()
|
Method Summary | |
---|---|
static Enumeration |
enumFromVector(Vector v)
This method creates an Enumeration from a Vector that is Serializable. |
static String |
getCurrentUserToken()
This method returns the user token for the currently authenticated user. |
static Context |
getInitialContext()
This method creates an initial context for an anonymous user. |
static Object |
getObjectFromEnum(Enumeration enm,
Class narrowTo)
This method retrieves a remote object from an enumeration, making sure it can be casted to the desired class. |
Object |
lookup(Context ctx,
String jndiName,
Class beanHomeClass)
This method looks up the EJB Home for the specified EJB. |
static Object |
lookup(Context ctx,
String jndiName,
Class beanHomeClass,
String userToken)
Deprecated. The user token is no longer required when doing JNDI lookups |
static Object |
lookup(String jndiName,
Class beanHomeClass)
This method looks up the EJB Home for the specified EJB. |
static Object |
lookup(String jndiName,
Class beanHomeClass,
String userToken)
Deprecated. The user token is no longer required when doing JNDI lookups |
static Object |
lookup(String jndiName,
Class beanHomeClass,
String userToken,
boolean forceCreate)
Deprecated. The user token is no longer required when doing JNDI lookups, A single initial context is shared between all threads, therefore there is no longer any way to force creation of a new context |
static void |
setCurrentUserToken(String token)
This method sets the user token for the current thread |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String USER_TOKEN
public static final String ANONYMOUS_USER
public static final String USER_TOKEN_CLASS_NAME
public static final String JNDI_MODE_KEY
public static final String JNDI_EJB_10
public static final String JNDI_EJB_11
public static final String JNDI_PREFIX
public static final String JNDI_DEFAULT_PREFIX_VALUE
public static final String HOME_CACHE
public static final String EJB_INITIALCONTEXTFACTORY
public static final String EJB_SERVER
public static final String ejbInitialContextFactory
public static final String ejbServer
public static final String jndiMode
public static final String jndiPrefix
Constructor Detail |
---|
public Server()
Method Detail |
---|
public static Enumeration enumFromVector(Vector v)
v
- the vector to enumerate
public static void setCurrentUserToken(String token)
token
- public static String getCurrentUserToken()
public static Context getInitialContext() throws NamingException
NamingException
public static Object getObjectFromEnum(Enumeration enm, Class narrowTo) throws ClassCastException
enm
- Enumeration object.narrowTo
- is the Class type to narrow to.
ClassCastException
- if the enumeration element can not be narrowed to the specified class typepublic static Object lookup(String jndiName, Class beanHomeClass) throws ProcessingErrorException
jndiName
- The EJB's JNDI namebeanHomeClass
- The Home class that the returned object should be narrowed to
ProcessingErrorException
- if the lookup request failspublic static Object lookup(String jndiName, Class beanHomeClass, String userToken) throws ProcessingErrorException
jndiName
- The EJB's JNDI namebeanHomeClass
- The home class that the returned object should be narrowed touserToken
- The user token to authenticate as
ProcessingErrorException
- if the lookup request failspublic static Object lookup(String jndiName, Class beanHomeClass, String userToken, boolean forceCreate) throws ProcessingErrorException
jndiName
- The EJB's JNDI namebeanHomeClass
- The Home class that the returned object should be narrowed touserToken
- The user token to authenticate asforceCreate
- Create a new context true/false
ProcessingErrorException
- if the lookup request failspublic Object lookup(Context ctx, String jndiName, Class beanHomeClass) throws ProcessingErrorException
ctx
- The initial context to usejndiName
- The EJB's JNDI namebeanHomeClass
- The Home class that the returned object should be narrowed to
ProcessingErrorException
- if the lookup request failspublic static Object lookup(Context ctx, String jndiName, Class beanHomeClass, String userToken) throws ProcessingErrorException
ctx
- The initial context to usejndiName
- The EJB's JNDI namebeanHomeClass
- The Home class that the returned object should be narrowed touserToken
- The user token
ProcessingErrorException
- if the lookup request fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |