FileDocCategorySizeDatePackage
BasicAccountFactory_Impl.javaAPI DocExample1101Thu Nov 08 00:23:06 GMT 2001com.ora.rmibook.chapter17.basic.factory

BasicAccountFactory_Impl.java

package com.ora.rmibook.chapter17.basic.factory;


import com.ora.rmibook.chapter17.basic.valueobjects.*;
import com.ora.rmibook.chapter17.basic.*;
import java.rmi.server.*;
import java.rmi.*;
import java.util.*;


public class BasicAccountFactory_Impl extends BasicFactory_Impl {
    public BasicAccountFactory_Impl() throws RemoteException {
    }

    protected HashMap createServers() {
        HashMap returnValue = new HashMap();

        returnValue.put("Bob", getAccount("Bob", 10000));
        returnValue.put("Alex", getAccount("Alex", 8400));
        returnValue.put("Trish", getAccount("Trish", 18700));
        returnValue.put("Pat", getAccount("Pat", 122100));
        returnValue.put("David", getAccount("David", 3100));
        returnValue.put("Mary", getAccount("Mary", 95200));
        return returnValue;
    }

    private Account getAccount(String name, int cents) {
        try {
            return new Account_Impl(new Money(cents));
        } catch (Exception e) {
            System.out.println(e);
        }
        return null;
    }
}