/*
 * JBoss, the OpenSource EJB server
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.ejb3.test.stateless;

import javax.annotation.Resource;
import javax.annotation.security.RolesAllowed;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.Remote;
import javax.naming.NamingException;
import javax.annotation.security.RolesAllowed;
import org.jboss.annotation.security.SecurityDomain;
import org.jboss.logging.Logger;
import org.jboss.annotation.security.SecurityDomain;

/**
 * @author <a href="mailto:bdecoste@jboss.com">William DeCoste</a>
 * @version $Revision: 1.5.2.4 $
 */
@Stateless
@SecurityDomain("other")
@Remote(CheckedStateless.class)
public class CheckedStatelessBean implements CheckedStateless
{
   private static final Logger log = Logger.getLogger(CheckedStatelessBean.class);
   
   @Resource
   SessionContext sessionContext;
   
   @RolesAllowed("allowed")
   public int method(int i) throws NamingException
   {
      return i;
   }
   
   @RolesAllowed("allowed")
   public String getCallerPrincipal()
   {
      return sessionContext.getCallerPrincipal().getName();
   }
}
