FileDocCategorySizeDatePackage
ImplLauncher.javaAPI DocExample1620Thu Nov 08 00:23:36 GMT 2001com.ora.rmibook.chapter22.applications

ImplLauncher

public class ImplLauncher extends Object

Fields Summary
Constructors Summary
Methods Summary
private static java.util.CollectiongetNameBalancePairs(java.lang.String[] args)

        int i;
        ArrayList returnValue = new ArrayList();

        for (i = 0; i < args.length; i += 2) {
            NameBalancePair nextNameBalancePair = new NameBalancePair();

            nextNameBalancePair.name = args[i];
            int cents = (new Integer(args[i + 1])).intValue();

            nextNameBalancePair.balance = new Money(cents);
            returnValue.add(nextNameBalancePair);
        }
        return returnValue;
    
private static voidlaunchServer(com.ora.rmibook.chapter22.applications.ImplLauncher$NameBalancePair serverDescription)

        try {
            Account_Impl newAccount = new Account_Impl(serverDescription.balance);

            Naming.rebind(serverDescription.name, newAccount);
            System.out.println("Account " + serverDescription.name + " successfully launched.");
        } catch (Exception e) {
            e.printStackTrace();
        }
    
public static voidmain(java.lang.String[] args)

        Collection nameBalancePairs = getNameBalancePairs(args);
        Iterator i = nameBalancePairs.iterator();

        while (i.hasNext()) {
            NameBalancePair nextNameBalancePair = (NameBalancePair) i.next();

            launchServer(nextNameBalancePair);
        }