001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.bankiiop.ejb;
023:
024: import java.rmi.*;
025: import javax.naming.*;
026: import javax.ejb.*;
027:
028: import org.jboss.test.util.ejb.SessionSupport;
029: import org.jboss.test.bankiiop.interfaces.*;
030:
031: /**
032: *
033: * @author Rickard Oberg
034: * @author $Author: dimitris@jboss.org $
035: * @version $Revision: 57211 $
036: */
037: public class BankBean extends SessionSupport {
038: // Constants -----------------------------------------------------
039:
040: // Attributes ----------------------------------------------------
041: static final String ID = "java:comp/env/id";
042: String id;
043:
044: // Static --------------------------------------------------------
045: static long nextAccountId = System.currentTimeMillis();
046: static long nextCustomerId = System.currentTimeMillis();
047:
048: // Constructors --------------------------------------------------
049:
050: // Public --------------------------------------------------------
051: public String getId() {
052: return id;
053: }
054:
055: public String createAccountId(Customer customer)
056: throws RemoteException {
057: return getId() + "." + customer.getName() + "."
058: + (nextAccountId++);
059: }
060:
061: public String createCustomerId() {
062: return getId() + "." + (nextCustomerId++);
063: }
064:
065: // SessionBean implementation ------------------------------------
066: public void setSessionContext(SessionContext context) {
067: super .setSessionContext(context);
068:
069: try {
070: id = (String) new InitialContext().lookup(ID);
071: } catch (Exception e) {
072: log.debug(e);
073: throw new EJBException(e);
074: }
075: }
076: }
077:
078: /*
079: * $Id: BankBean.java 57211 2006-09-26 12:39:46Z dimitris@jboss.org $
080: * Currently locked by:$Locker$
081: * Revision:
082: * $Log$
083: * Revision 1.1.26.2 2005/10/29 05:04:35 starksm
084: * Update the LGPL header
085: *
086: * Revision 1.1.26.1 2005/04/06 16:28:04 starksm
087: * Fix the license header
088: *
089: * Revision 1.1 2002/03/15 22:36:28 reverbel
090: * Initial version of the bank test for JBoss/IIOP.
091: *
092: * Revision 1.3 2002/02/15 06:15:50 user57
093: * o replaced most System.out usage with Log4j. should really introduce
094: * some base classes to make this mess more maintainable...
095: *
096: * Revision 1.2 2001/01/07 23:14:34 peter
097: * Trying to get JAAS to work within test suite.
098: *
099: * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
100: * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
101: *
102: *
103: *
104: */
|