// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.rmi.*;
import java.util.*;

import javax.ejb.*;
import javax.naming.*;
import javax.rmi.*;

import test.*;

public class TestCMR {
    public static void main(String[] args) {
        System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
        System.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces");
        System.setProperty("java.naming.provider.url", "localhost:1099");
        try {
            Context ctx = new InitialContext();
            Object temp = ctx.lookup("Lookup");
            LookupHome home = (LookupHome) PortableRemoteObject.narrow(temp, LookupHome.class);
            Lookup bean = home.create();
            HashMap hm;
            hm = bean.lookup();
            System.out.println(hm);
            bean.add(7, "Lamborghini", "1,5");
            hm = bean.lookup();
            System.out.println(hm);
        } catch (ClassCastException e) {
            e.printStackTrace();
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (NamingException e) {
            e.printStackTrace();
        } catch (CreateException e) {
            e.printStackTrace();
        }
    }
}
