org.ow2.jonas.lib.ejb21
Class JMessageEndpoint

java.lang.Object
  extended by org.ow2.jonas.lib.ejb21.JMessageEndpoint
All Implemented Interfaces:
EJBContext, MessageDrivenContext

public class JMessageEndpoint
extends Object
implements MessageDrivenContext

Generic interposed class for Message Endpoints This class presents these interfaces, depending on object reached: MessageDrivenContext interface to the bean instance

Author:
Philippe Coq, Philippe Durieux, Christophe Ney (Easier Enhydra integration)

Field Summary
protected  JMdbEndpointFactory bf
           
protected  MessageDrivenBean mdb
           
protected  MessageEndpoint mep
           
protected  boolean released
           
protected  TransactionManager tm
           
protected  int txattr
           
protected  XAResource xar
           
 
Constructor Summary
JMessageEndpoint(JMdbEndpointFactory bf, MessageDrivenBean mdb)
          constructor
 
Method Summary
 void deliverTimeout(Timer timer)
          Deliver a timeout to the bean
 Identity getCallerIdentity()
          Deprecated. @exception java.lang.IllegalStateException always
 Principal getCallerPrincipal()
           
 EJBHome getEJBHome()
          Is disallowed.
 EJBLocalHome getEJBLocalHome()
          Is disallowed.
 Properties getEnvironment()
          Deprecated. Use the JNDI naming context java:comp/env instead.
 boolean getReleasedState()
           
 boolean getRollbackOnly()
          Tests if the transaction has been marked for rollback only.
 TimerService getTimerService()
          Get access to the EJB Timer Service.
 UserTransaction getUserTransaction()
          Obtains the transaction demarcation interface.
 XAResource getXAResource()
           
 boolean isCallerInRole(Identity role)
          Deprecated. @throws java.lang.IllegalStateException for message driven bean because there is no security context available
 boolean isCallerInRole(String roleLink)
          Test if the caller has a given role.
 Object lookup(String name)
          Lookup object with given name.
 void setProxy(MessageEndpoint mep)
           
 void setReleasedState(boolean state)
           
 void setRollbackOnly()
          Marks the current transaction for rollback.
 void setXAResource(XAResource xa)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bf

protected JMdbEndpointFactory bf

mdb

protected MessageDrivenBean mdb

mep

protected MessageEndpoint mep

txattr

protected int txattr

tm

protected TransactionManager tm

xar

protected XAResource xar

released

protected boolean released
Constructor Detail

JMessageEndpoint

public JMessageEndpoint(JMdbEndpointFactory bf,
                        MessageDrivenBean mdb)
constructor

Parameters:
bf - The MDB Endpoint Factory
mdb - The Message Driven Bean
Method Detail

setProxy

public void setProxy(MessageEndpoint mep)

getXAResource

public XAResource getXAResource()

setXAResource

public void setXAResource(XAResource xa)

getReleasedState

public boolean getReleasedState()

setReleasedState

public void setReleasedState(boolean state)

getTimerService

public TimerService getTimerService()
                             throws IllegalStateException
Get access to the EJB Timer Service.

Specified by:
getTimerService in interface EJBContext
Returns:
the EJB Timer Service
Throws:
IllegalStateException - Thrown if the instance is not allowed to use this method

getCallerIdentity

public Identity getCallerIdentity()
Deprecated. @exception java.lang.IllegalStateException always

Obtains the java.security.Identity of the caller. disallowed in messagedriven bean method because there is no security context

Specified by:
getCallerIdentity in interface EJBContext

getCallerPrincipal

public Principal getCallerPrincipal()
Specified by:
getCallerPrincipal in interface EJBContext
Returns:
the java.security.Principal that identifies the caller.
Throws:
IllegalStateException - if there is no principal

isCallerInRole

public boolean isCallerInRole(Identity role)
Deprecated. @throws java.lang.IllegalStateException for message driven bean because there is no security context available

Test if the caller has a given role.

Specified by:
isCallerInRole in interface EJBContext

isCallerInRole

public boolean isCallerInRole(String roleLink)
Test if the caller has a given role.

Specified by:
isCallerInRole in interface EJBContext
Throws:
IllegalStateException - for message driven bean because there is no security context available

setRollbackOnly

public void setRollbackOnly()
Marks the current transaction for rollback. Should be used only if the instance is associated with a transaction

Specified by:
setRollbackOnly in interface EJBContext
Throws:
IllegalStateException - if the instance is not associated with a transaction

getRollbackOnly

public boolean getRollbackOnly()
Tests if the transaction has been marked for rollback only.

Specified by:
getRollbackOnly in interface EJBContext
Returns:
True if transaction has been marked for rollback.

getEJBHome

public EJBHome getEJBHome()
Is disallowed. There is no home for message driven bean.

Specified by:
getEJBHome in interface EJBContext
Throws:
IllegalStateException - Always.

getEJBLocalHome

public EJBLocalHome getEJBLocalHome()
Is disallowed. There is no local home for message driven bean.

Specified by:
getEJBLocalHome in interface EJBContext
Throws:
IllegalStateException - Always.

getEnvironment

public Properties getEnvironment()
Deprecated. Use the JNDI naming context java:comp/env instead.

Specified by:
getEnvironment in interface EJBContext
Returns:
properties for the bean.

getUserTransaction

public UserTransaction getUserTransaction()
                                   throws IllegalStateException
Obtains the transaction demarcation interface.

Specified by:
getUserTransaction in interface EJBContext
Returns:
The UserTransaction interface that the enterprise bean instance can use for transaction demarcation.
Throws:
IllegalStateException - Thrown if the instance container does not make the UserTransaction interface available to the instance.

deliverTimeout

public void deliverTimeout(Timer timer)
Deliver a timeout to the bean

Parameters:
timer - timer whose expiration caused this notification.

lookup

public Object lookup(String name)
Lookup object with given name.

Specified by:
lookup in interface EJBContext
Parameters:
name - given name
Returns:
result of the lookup


Copyright © 2010 OW2 Consortium. All Rights Reserved.