KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > bankiiop > ejb > BankBean


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.bankiiop.ejb;
23
24 import java.rmi.*;
25 import javax.naming.*;
26 import javax.ejb.*;
27
28 import org.jboss.test.util.ejb.SessionSupport;
29 import org.jboss.test.bankiiop.interfaces.*;
30
31 /**
32  *
33  * @see <related>
34  * @author $Author: starksm $
35  * @version $Revision: 37406 $
36  */

37 public class BankBean
38    extends SessionSupport
39 {
40    // Constants -----------------------------------------------------
41

42    // Attributes ----------------------------------------------------
43
static final String JavaDoc ID = "java:comp/env/id";
44    String JavaDoc id;
45    
46    // Static --------------------------------------------------------
47
static long nextAccountId = System.currentTimeMillis();
48    static long nextCustomerId = System.currentTimeMillis();
49
50    // Constructors --------------------------------------------------
51

52    // Public --------------------------------------------------------
53
public String JavaDoc getId()
54    {
55       return id;
56    }
57    
58    public String JavaDoc createAccountId(Customer customer)
59       throws RemoteException
60    {
61       return getId()+"."+customer.getName()+"."+(nextAccountId++);
62    }
63    
64    public String JavaDoc createCustomerId()
65    {
66       return getId()+"."+(nextCustomerId++);
67    }
68    
69    // SessionBean implementation ------------------------------------
70
public void setSessionContext(SessionContext context)
71    {
72       super.setSessionContext(context);
73       
74       try
75       {
76          id = (String JavaDoc)new InitialContext().lookup(ID);
77       } catch (Exception JavaDoc e)
78       {
79          log.debug(e);
80          throw new EJBException(e);
81       }
82    }
83 }
84
85 /*
86  * $Id: BankBean.java 37406 2005-10-29 23:41:24Z starksm $
87  * Currently locked by:$Locker$
88  * Revision:
89  * $Log$
90  * Revision 1.2 2005/10/29 23:41:18 starksm
91  * Update the jboss LGPL headers
92  *
93  * Revision 1.1 2002/03/15 22:36:28 reverbel
94  * Initial version of the bank test for JBoss/IIOP.
95  *
96  * Revision 1.3 2002/02/15 06:15:50 user57
97  * o replaced most System.out usage with Log4j. should really introduce
98  * some base classes to make this mess more maintainable...
99  *
100  * Revision 1.2 2001/01/07 23:14:34 peter
101  * Trying to get JAAS to work within test suite.
102  *
103  * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
104  * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
105  *
106  *
107  *
108  */

109
Popular Tags