/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.objectweb.jonas.jtests.beans.bank;

import java.rmi.RemoteException;

import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.ejb.EJBObject;

/**
 * Manager remote interface
 * @author Philippe Durieux
 */
public interface Manager extends EJBObject {

    /**
     * create a set of Accounts
     * @param nb nb of Accounts created.
     */
    public void createAll(int nb) throws RemoteException, CreateException;

    /**
     * create an account, and set rollback only
     */
    public void createRollbackOnly(int i) throws RemoteException, CreateException;
    
    /**
     * reinit all created accounts to their initial value.
     */
    public void reinitAll() throws RemoteException;

    /**
     * Remove an Account
     * @param d1 num of the Account.
     */
    public void delAccount(int d1) throws RemoteException, RemoveException;

    /**
     * Check all existing Accounts
     * @return true if all are OK.
     */
    public boolean checkAll() throws RemoteException;

    /**
     * Check an existing Account
     * @param a num of the Account.
     * @return true if OK.
     */
    public boolean checkAccount(int a) throws RemoteException;

    /**
     * read balance for this Account
     * @param a num of the Account.
     * @return balance
     */
    public int readBalance(int a) throws RemoteException;

    /**
     * read balance for last accessed Account
     * @return balance
     */
    public int readBalance() throws RemoteException;

    /**
     * read balance for this Account, in a transaction.
     * @param a num of the Account.
     * @return balance
     */
    public int readBalanceTx(int a) throws RemoteException;

    /**
     * move form an Account to another one.
     * @param d num of the debit Account.
     * @param c num of the credit Account.
     * @param v value to be moved
     * @param d delay in second for the operation.
     */
    public void move(int d, int c, int v, int delay) throws RemoteException;
}
