File: SimpleClient.java

package info (click to toggle)
libdb-je-java 3.3.62-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 12,832 kB
  • ctags: 18,708
  • sloc: java: 149,906; xml: 1,980; makefile: 14; sh: 12
file content (35 lines) | stat: -rw-r--r-- 960 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package jca.simple;

import javax.naming.InitialContext;

import java.util.Hashtable;

public class SimpleClient {

    public static void main(String args[])
	throws Exception {

	final boolean OC4J = true;

	InitialContext iniCtx = null;
	Hashtable env = new Hashtable();
	if (OC4J) {
	    env.put("java.naming.factory.initial",
		    "com.evermind.server.ApplicationClientInitialContextFactory");
	    env.put("java.naming.provider.url","ormi://localhost:23791/Simple");
	    env.put("java.naming.security.principal","oc4jadmin");
	    env.put("java.naming.security.credentials","oc4jadmin");
	    iniCtx = new InitialContext(env);
	} else {
	    iniCtx = new InitialContext();
	}

	Object ref = iniCtx.lookup("SimpleBean");
	SimpleHome home = (SimpleHome) ref;
	Simple simple = home.create();
	System.out.println("Created Simple");
	simple.put(args[0], args[1]);
	System.out.println("Simple.get('" + args[0] + "') = " +
			   simple.get(args[0]));
    }
}