KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > net > hello > server > HelloBean


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7  
8 package org.jboss.test.net.hello.server;
9
10 import javax.ejb.EJBException;
11
12 import org.jboss.test.util.ejb.SessionSupport;
13
14 import org.jboss.test.net.hello.HelloData;
15
16 /**
17  * The typical Hello Session Bean this time
18  * as a web-service.
19  * @author jung
20  * @version $Revision: 1.1 $
21  * @ejb.bean name="Hello"
22  * display-name="Hello World Bean"
23  * type="Stateless"
24  * view-type="remote"
25  * jndi-name="hello/Hello"
26  * @ejb.interface remote-class="org.jboss.test.net.hello.Hello" extends="javax.ejb.EJBObject"
27  * @ejb.home remote-class="org.jboss.test.net.hello.HelloHome" extends="javax.ejb.EJBHome"
28  * @ejb.transaction type="Required"
29  * @jboss-net.web-service urn="Hello"
30  */

31
32 public class HelloBean
33    extends SessionSupport implements javax.ejb.SessionBean
34 {
35    /**
36     * @jboss-net.web-method
37     * @ejb.interface-method view-type="remote"
38     */

39    
40    public String hello(String name)
41    {
42       return "Hello "+name+"!";
43    }
44
45    /*
46     * @ejb.interface-method view-type="remote"
47    public Hello helloHello(Hello hello)
48    {
49       return hello;
50    }*/

51
52    /**
53     * @jboss-net.web-method
54     * @ejb.interface-method view-type="remote"
55     */

56
57    public String howdy(HelloData name)
58    {
59       return "Howdy "+name.getName()+"!";
60    }
61
62    public void throwException()
63    {
64       throw new EJBException("Something went wrong");
65    }
66 }
67
Popular Tags