FileDocCategorySizeDatePackage
ImplLauncher.javaAPI DocExample1738Thu Nov 08 00:23:42 GMT 2001com.ora.rmibook.chapter23.corbaaccounts.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.chapter23.corbaaccounts.applications.ImplLauncher$NameBalancePair serverDescription)

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

            OrbSetup.bindAccountServer(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);
        }
        (new JFrame("Dispatcher Server")).show();  //hack to keep JVM alive
        //because JavaIDL uses Daemon threads