KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > sequence > WoSesSL


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: WoSesSL.java,v 1.2 2005/04/22 07:43:55 durieuxp Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.beans.sequence;
27
28 import java.rmi.RemoteException JavaDoc;
29
30 import javax.ejb.CreateException JavaDoc;
31 import javax.ejb.EJBException JavaDoc;
32 import javax.ejb.SessionBean JavaDoc;
33 import javax.ejb.SessionContext JavaDoc;
34 import javax.naming.InitialContext JavaDoc;
35 import javax.naming.NamingException JavaDoc;
36
37
38 /**
39  * This class is WoSesSL seesion bean.
40  *
41  * This bean is stateless.
42  *
43  */

44 public class WoSesSL implements SessionBean JavaDoc {
45
46     private String JavaDoc className = "WoSesSL";
47     private WoHomeLocal woHome;
48     private SequenceSesHome sequenceSesHome;
49     /**
50      * Method ejbCreate
51      *
52      *
53      * @throws CreateException
54      *
55      */

56     public void ejbCreate() throws CreateException JavaDoc {
57     }
58     /**
59      * Method schedule
60      * @param assId
61      * @param qty
62      * @return Woid
63      * @exception EJBException if there is a system failure
64      */

65     public Integer JavaDoc schedule(String JavaDoc assId, int qty) {
66
67
68         WoLocal wo;
69         Integer JavaDoc woId = null;
70
71         try {
72             wo = woHome.create(assId, qty);
73             woId = wo.getId();
74
75         } catch( CreateException JavaDoc e ) {
76             throw new EJBException JavaDoc("Unable to create " + e);
77         } catch( EJBException JavaDoc e ) {
78             e.printStackTrace();
79             throw new EJBException JavaDoc(e);
80         }
81         return woId;
82     }
83     
84
85     /**
86      * Constructor WoSesSL
87      *
88      *
89      */

90     public WoSesSL() {
91     }
92
93     /**
94      * Method ejbRemove
95      *
96      *
97      */

98     public void ejbRemove() {
99     }
100
101     /**
102      * Method ejbActivate
103      *
104      *
105      */

106     public void ejbActivate() {
107     }
108
109     /**
110      * Method ejbPassivate
111      *
112      *
113      */

114     public void ejbPassivate() {
115     }
116
117     /**
118      * Method setSessionContext
119      *
120      *
121      * @param sc
122      *
123      */

124     public void setSessionContext(SessionContext JavaDoc sc) {
125
126         InitialContext JavaDoc initCtx;
127
128         try {
129             initCtx = new InitialContext JavaDoc();
130             woHome = (WoHomeLocal) initCtx.lookup("java:comp/env/ejb/WoLocalHome");
131             sequenceSesHome =
132                 (SequenceSesHome) javax.rmi.PortableRemoteObject.narrow(
133                                                                        initCtx.lookup("SequencesHome"),
134                                                                        SequenceSesHome.class);
135         } catch( NamingException JavaDoc e ) {
136             e.printStackTrace();
137
138             throw new EJBException JavaDoc(e);
139         }
140
141     }
142 }
143
144
Popular Tags