org.openmdx.base.ejb.gateway.spi
Class AbstractGateway_1Bean

java.lang.Object
  extended by org.openmdx.base.ejb.gateway.spi.AbstractGateway_1Bean
All Implemented Interfaces:
Serializable, EnterpriseBean, SessionBean

public abstract class AbstractGateway_1Bean
extends Object
implements SessionBean

Gateway_1 Session Bean

See Also:
Serialized Form

Field Summary
protected static int RETRY_WITH_CURRENT_CONTEXT
          Retry the same method invocation with the current context
protected static int RETRY_WITH_RESET_CONTEXT
          Retry the same method invocation with a reset context
protected static int TRY_WITH_CURRENT_CONTEXT
          Retry the same method invocation with the current context
protected static int TRY_WITH_RESET_CONTEXT
          Try the same method invocation with a reset context
 
Constructor Summary
AbstractGateway_1Bean()
           
 
Method Summary
protected  void create(Context beanContext)
          This method may be overriden by subclasses.
 void ejbActivate()
           
 void ejbCreate()
          This method corresponds to the create method in the home interface.
 void ejbPassivate()
           
 void ejbRemove()
           
protected abstract  ExecutionContext getExecutionContext()
          Retrieve the gateways's execution context
protected abstract  Hashtable<?,?> getExecutionEnvironment()
          Retrieve the executionEnvironment.
protected  SessionContext getSessionContext()
          Retrieve the sessionContext.
 Object invoke(Object proxy, Method method, Object[] args)
          Invocation
protected  boolean isRetriable(PrivilegedActionException privilegedActionException)
          This method defines the class' or sub-class' retry policy.
protected  Context newInitialContext()
          Create a new InitialContext
 Object newStatelessSessionBeanAccessor(Class<?> homeInterface, Class<?> remoteInterface, String id)
          Create a proxy for a stateless session bean
protected  Object newStatelessSessionBeanAccessor(Gateway_1_0Internal gateway, Class<?> homeInterface, Class<?> remoteInterface, String id)
          Internal session bean accessor factory
 void setSessionContext(SessionContext sessionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRY_WITH_CURRENT_CONTEXT

protected static final int TRY_WITH_CURRENT_CONTEXT
Retry the same method invocation with the current context

See Also:
Constant Field Values

RETRY_WITH_CURRENT_CONTEXT

protected static final int RETRY_WITH_CURRENT_CONTEXT
Retry the same method invocation with the current context

See Also:
Constant Field Values

TRY_WITH_RESET_CONTEXT

protected static final int TRY_WITH_RESET_CONTEXT
Try the same method invocation with a reset context

See Also:
Constant Field Values

RETRY_WITH_RESET_CONTEXT

protected static final int RETRY_WITH_RESET_CONTEXT
Retry the same method invocation with a reset context

See Also:
Constant Field Values
Constructor Detail

AbstractGateway_1Bean

public AbstractGateway_1Bean()
Method Detail

getSessionContext

protected final SessionContext getSessionContext()
Retrieve the sessionContext.

Returns:
the sessionContext's value

getExecutionContext

protected abstract ExecutionContext getExecutionContext()
Retrieve the gateways's execution context


getExecutionEnvironment

protected abstract Hashtable<?,?> getExecutionEnvironment()
Retrieve the executionEnvironment.

Returns:
the executionEnvironment's value

newInitialContext

protected Context newInitialContext()
                             throws NamingException
Create a new InitialContext

Returns:
the newly created InitialContext
Throws:
NamingException

setSessionContext

public void setSessionContext(SessionContext sessionContext)
                       throws EJBException,
                              RemoteException
Specified by:
setSessionContext in interface SessionBean
Throws:
EJBException
RemoteException

ejbCreate

public void ejbCreate()
               throws CreateException
This method corresponds to the create method in the home interface. The parameter sets of the two methods are identical. When the client calls create(), the container allocates an instance of the EJBean and calls ejbCreate().

Throws:
CreateException - if there is a problem creating the bean

create

protected void create(Context beanContext)
               throws CreateException
This method may be overriden by subclasses.

Parameters:
beanContext -
Throws:
CreateException - if there is a problem creating the bean

ejbRemove

public void ejbRemove()
               throws EJBException,
                      RemoteException
Specified by:
ejbRemove in interface SessionBean
Throws:
EJBException
RemoteException

ejbActivate

public void ejbActivate()
                 throws EJBException,
                        RemoteException
Specified by:
ejbActivate in interface SessionBean
Throws:
EJBException
RemoteException

ejbPassivate

public void ejbPassivate()
                  throws EJBException,
                         RemoteException
Specified by:
ejbPassivate in interface SessionBean
Throws:
EJBException
RemoteException

isRetriable

protected boolean isRetriable(PrivilegedActionException privilegedActionException)
This method defines the class' or sub-class' retry policy.

Returns:
true if the request should be retried once.

newStatelessSessionBeanAccessor

protected Object newStatelessSessionBeanAccessor(Gateway_1_0Internal gateway,
                                                 Class<?> homeInterface,
                                                 Class<?> remoteInterface,
                                                 String id)
                                          throws ServiceException
Internal session bean accessor factory

Throws:
ServiceException

newStatelessSessionBeanAccessor

public Object newStatelessSessionBeanAccessor(Class<?> homeInterface,
                                              Class<?> remoteInterface,
                                              String id)
                                       throws ServiceException
Create a proxy for a stateless session bean

Parameters:
homeInterface - the interface to lookup the delegate object
remoteInterface - the interface to be implemented by the proxy instance
id - The stateless session bean's id
Returns:
a proxy for the requested stateless session bean
Throws:
ServiceException - if accessor creation fails

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws PrivilegedActionException
Invocation

Attempts:

  1. Use current connection and EJB object
  2. Retrieve a new EJB object from its handle
  3. Reset the execution context and retrieve a new EJB object from its handle

Throws:
PrivilegedActionException


This software is published under the BSD license. Copyright © 2003-2008, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.