KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > security > ejb > UsefulStatelessSessionBean


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.test.security.ejb;
23
24 import java.rmi.RemoteException JavaDoc;
25
26 import javax.ejb.CreateException JavaDoc;
27 import javax.ejb.EJBException JavaDoc;
28 import javax.ejb.SessionBean JavaDoc;
29 import javax.ejb.SessionContext JavaDoc;
30
31 import org.jboss.logging.Logger;
32
33 //$Id: UsefulStatelessSessionBean.java 46074 2006-07-05 18:31:47Z asaldhana $
34

35 /**
36  * Stateless Session Bean testing declarative/programmatic security
37  * @author <a HREF="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
38  * @since Apr 20, 2006
39  * @version $Revision: 46074 $
40  */

41 public class UsefulStatelessSessionBean implements SessionBean JavaDoc
42 {
43    /** The serialVersionUID */
44    private static final long serialVersionUID = -6735401489611989066L;
45    static Logger log = Logger.getLogger(UsefulStatelessSessionBean.class);
46    private SessionContext JavaDoc sessionContext;
47    
48    public void setSessionContext(SessionContext JavaDoc ctx)
49    throws EJBException JavaDoc, RemoteException JavaDoc
50    {
51       this.sessionContext = ctx;
52    }
53
54    public void ejbCreate() throws CreateException JavaDoc
55    {
56       log.debug("ejbCreate() called");
57    }
58
59    public void ejbActivate()
60    {
61       log.debug("ejbActivate() called");
62    }
63
64    public void ejbPassivate()
65    {
66       log.debug("ejbPassivate() called");
67    }
68
69    public void ejbRemove()
70    {
71       log.debug("ejbRemove() called");
72    }
73    
74    //Check isCallerInRole
75
public boolean isCallerInRole(String JavaDoc rolename)
76    {
77       return this.sessionContext.isCallerInRole(rolename);
78    }
79 }
80
Popular Tags