com.bankframe.ejb
Class Server

java.lang.Object
  extended bycom.bankframe.ejb.Server

public class Server
extends java.lang.Object

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 java.lang.String ANONYMOUS_USER
           
static java.lang.String EJB_INITIALCONTEXTFACTORY
          Flag in BankframeResource.properties indicating initial context factory to use
static java.lang.String EJB_SERVER
          Flag in BankframeResource.properties indicating which ejb server to use
static java.lang.String ejbInitialContextFactory
           
static java.lang.String ejbServer
           
static java.lang.String HOME_CACHE
           
static java.lang.String JNDI_DEFAULT_PREFIX_VALUE
           
static java.lang.String JNDI_EJB_10
           
static java.lang.String JNDI_EJB_11
           
static java.lang.String JNDI_MODE_KEY
           
static java.lang.String JNDI_PREFIX
           
static java.lang.String jndiMode
           
static java.lang.String jndiPrefix
           
static java.lang.String USER_TOKEN
           
static java.lang.String USER_TOKEN_CLASS_NAME
           
 
Constructor Summary
Server()
           
 
Method Summary
static java.util.Enumeration enumFromVector(java.util.Vector v)
          This method creates an Enumeration from a Vector that is Serializable.
static java.lang.String getCurrentUserToken()
          This method returns the user token for the currently authenticated user.
static javax.naming.Context getInitialContext()
          This method creates an initial context for an anonymous user.
static java.lang.Object getObjectFromEnum(java.util.Enumeration enm, java.lang.Class narrowTo)
          This method retrieves a remote object from an enumeration, making sure it can be casted to the desired class.
 java.lang.Object lookup(javax.naming.Context ctx, java.lang.String jndiName, java.lang.Class beanHomeClass)
          This method looks up the EJB Home for the specified EJB.
static java.lang.Object lookup(javax.naming.Context ctx, java.lang.String jndiName, java.lang.Class beanHomeClass, java.lang.String userToken)
          Deprecated. The user token is no longer required when doing JNDI lookups
static java.lang.Object lookup(java.lang.String jndiName, java.lang.Class beanHomeClass)
          This method looks up the EJB Home for the specified EJB.
static java.lang.Object lookup(java.lang.String jndiName, java.lang.Class beanHomeClass, java.lang.String userToken)
          Deprecated. The user token is no longer required when doing JNDI lookups
static java.lang.Object lookup(java.lang.String jndiName, java.lang.Class beanHomeClass, java.lang.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(java.lang.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

USER_TOKEN

public static final java.lang.String USER_TOKEN
See Also:
Constant Field Values

ANONYMOUS_USER

public static final java.lang.String ANONYMOUS_USER
See Also:
Constant Field Values

USER_TOKEN_CLASS_NAME

public static final java.lang.String USER_TOKEN_CLASS_NAME
See Also:
Constant Field Values

JNDI_MODE_KEY

public static final java.lang.String JNDI_MODE_KEY
See Also:
Constant Field Values

JNDI_EJB_10

public static final java.lang.String JNDI_EJB_10
See Also:
Constant Field Values

JNDI_EJB_11

public static final java.lang.String JNDI_EJB_11
See Also:
Constant Field Values

JNDI_PREFIX

public static final java.lang.String JNDI_PREFIX
See Also:
Constant Field Values

JNDI_DEFAULT_PREFIX_VALUE

public static final java.lang.String JNDI_DEFAULT_PREFIX_VALUE
See Also:
Constant Field Values

HOME_CACHE

public static final java.lang.String HOME_CACHE
See Also:
Constant Field Values

EJB_INITIALCONTEXTFACTORY

public static final java.lang.String EJB_INITIALCONTEXTFACTORY
Flag in BankframeResource.properties indicating initial context factory to use

See Also:
Constant Field Values

EJB_SERVER

public static final java.lang.String EJB_SERVER
Flag in BankframeResource.properties indicating which ejb server to use

See Also:
Constant Field Values

ejbInitialContextFactory

public static final java.lang.String ejbInitialContextFactory

ejbServer

public static final java.lang.String ejbServer

jndiMode

public static final java.lang.String jndiMode

jndiPrefix

public static final java.lang.String jndiPrefix
Constructor Detail

Server

public Server()
Method Detail

enumFromVector

public static java.util.Enumeration enumFromVector(java.util.Vector v)
This method creates an Enumeration from a Vector that is Serializable.

Parameters:
v - the vector to enumerate
Returns:
an enumeration instance

setCurrentUserToken

public static void setCurrentUserToken(java.lang.String token)
This method sets the user token for the current thread

Parameters:
token -

getCurrentUserToken

public static java.lang.String getCurrentUserToken()
This method returns the user token for the currently authenticated user.

Returns:
the current user token

getInitialContext

public static javax.naming.Context getInitialContext()
                                              throws javax.naming.NamingException
This method creates an initial context for an anonymous user.

Returns:
the context created
Throws:
javax.naming.NamingException

getObjectFromEnum

public static java.lang.Object getObjectFromEnum(java.util.Enumeration enm,
                                                 java.lang.Class narrowTo)
                                          throws java.lang.ClassCastException
This method retrieves a remote object from an enumeration, making sure it can be casted to the desired class.

Parameters:
narrowTo - is the Class type to narrow to.
Returns:
a remote object
Throws:
java.lang.ClassCastException - if the enumeration element can not be narrowed to the specified class type

lookup

public static java.lang.Object lookup(java.lang.String jndiName,
                                      java.lang.Class beanHomeClass)
                               throws ProcessingErrorException
This method looks up the EJB Home for the specified EJB.

Parameters:
jndiName - The EJB's JNDI name
beanHomeClass - The Home class that the returned object should be narrowed to
Returns:
the home interface
Throws:
ProcessingErrorException - if the lookup request fails

lookup

public static java.lang.Object lookup(java.lang.String jndiName,
                                      java.lang.Class beanHomeClass,
                                      java.lang.String userToken)
                               throws ProcessingErrorException
Deprecated. The user token is no longer required when doing JNDI lookups

This method looks up the EJB Home for the specified EJB using the specified userToken.

Parameters:
jndiName - The EJB's JNDI name
beanHomeClass - The home class that the returned object should be narrowed to
userToken - The user token to authenticate as
Returns:
The home interface
Throws:
ProcessingErrorException - if the lookup request fails

lookup

public static java.lang.Object lookup(java.lang.String jndiName,
                                      java.lang.Class beanHomeClass,
                                      java.lang.String userToken,
                                      boolean forceCreate)
                               throws ProcessingErrorException
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

This method looks up the EJB Home for the specified EJB using the specified userToken.

Parameters:
jndiName - The EJB's JNDI name
beanHomeClass - The Home class that the returned object should be narrowed to
userToken - The user token to authenticate as
forceCreate - Create a new context true/false
Returns:
The home interface
Throws:
ProcessingErrorException - if the lookup request fails

lookup

public java.lang.Object lookup(javax.naming.Context ctx,
                               java.lang.String jndiName,
                               java.lang.Class beanHomeClass)
                        throws ProcessingErrorException
This method looks up the EJB Home for the specified EJB.

Parameters:
ctx - The initial context to use
jndiName - The EJB's JNDI name
beanHomeClass - The Home class that the returned object should be narrowed to
Returns:
the home interface
Throws:
ProcessingErrorException - if the lookup request fails

lookup

public static java.lang.Object lookup(javax.naming.Context ctx,
                                      java.lang.String jndiName,
                                      java.lang.Class beanHomeClass,
                                      java.lang.String userToken)
                               throws ProcessingErrorException
Deprecated. The user token is no longer required when doing JNDI lookups

This method looks up the EJB Home for the specified EJB.

Parameters:
ctx - The initial context to use
jndiName - The EJB's JNDI name
beanHomeClass - The Home class that the returned object should be narrowed to
userToken - The user token
Returns:
the home interface
Throws:
ProcessingErrorException - if the lookup request fails


Copyright © 2005, 2007, Oracle. All rights reserved.