Hi All,
I have an EJB that implements EntityBean.
    public void setEntityContext( EntityContext ejbCtx ) throws RemoteException
    {
        this.ejbCtx = ejbCtx; //this.ejbCtx  is an EJBContext object.
    }

I am trying to print several values of the 'EntityContext' that is being passed 
<please see the code pasted at the end>.

Is this approach wrong? I am getting error while trying to print the values.
If I am not wrong does the EJB Container sets the EJB context while calling the 
setEntityContext method automatically??
Does JBoss AS provides the context to the EJB container, as the EJB container 
is managed by the JBoss AS?

Please suggest.


public void setEntityContext( EntityContext ejbCtx ) throws RemoteException
    {
        this.ejbCtx = ejbCtx;
       //Get the caller identity.
java.security.Identity identity = ejbCtx.getCallerIdentity();
System.out.println("identity for this ejb context is ::"+identity.toString());
       //Get the environment properties for the enterprise bean.
System.out.println("---EJB Properties STARTS---");
java.util.Properties pr= ejbCtx.getEnvironment();
Enumeration en= pr.propertyNames();
 while(en.hasMoreElements())
 {
   String key = en.nextElement().toString();
   String value = pr.getProperty(key,"---NONE---");
   System.out.println("KEY ::"+key+"-->VALUE ::"+value);
  }
 System.out.println("---EJB Properties ENDS---");
 System.out.println("---caller principal STARTS---");
 java.security.Principal principal=ejbCtx.getCallerPrincipal();
 System.out.println("Principal name is ::"+principal.getName());
 System.out.println("---caller principal ENDS---");
}




View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3931876#3931876

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3931876


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to