FileDocCategorySizeDatePackage
AccountManagerImpl.javaAPI DocExample2245Thu Dec 15 21:44:32 GMT 2005com.oreilly.jent.rmi

AccountManagerImpl

public class AccountManagerImpl extends UnicastRemoteObject implements AccountManager
AccountManagerImpl: Sample implementation of the AccountManager interface. This simple example simply registers each account with the local registry, and does the lookup for the remote client when getAccount() is called.

Fields Summary
Constructors Summary
public AccountManagerImpl()

Methods Summary
public AccountgetAccount(java.lang.String name)

    Registry reg = LocateRegistry.getRegistry();
    Account a = null;
    try {
      a = (Account)reg.lookup(name);
    }
    catch (Exception e) {}
    return a;
  
public booleannewAccount(Account a)

    Registry reg = LocateRegistry.getRegistry();
    System.out.print("Registering new account...");
    reg.rebind(a.getName(), a);
    System.out.println("done.");
    return true;