01: /*
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id:
23: * --------------------------------------------------------------------------
24: */
25:
26: package org.objectweb.jonas.jtests.clients.init;
27:
28: import javax.rmi.PortableRemoteObject;
29: import javax.naming.InitialContext;
30: import javax.naming.Context;
31: import org.objectweb.jonas.jtests.ftables.DBEnvHome;
32: import org.objectweb.jonas.jtests.ftables.DBEnv;
33:
34: /**
35: */
36: public class I_tables {
37:
38: public static void main(String args[]) {
39:
40: Context initialContext = null;
41: try {
42: initialContext = new InitialContext();
43: } catch (Exception e) {
44: System.err.println("Cannot get initial context for JNDI: "
45: + e);
46: System.exit(2);
47: }
48:
49: // Connecting to DBEnvHome thru JNDI
50: DBEnvHome home = null;
51: try {
52: home = (DBEnvHome) PortableRemoteObject.narrow(
53: initialContext.lookup("ftablesDBEnvHome"),
54: DBEnvHome.class);
55: } catch (Exception e) {
56: System.err.println("Cannot lookup DBEnvHome: " + e);
57: System.exit(2);
58: }
59: // tables Bean creation
60: DBEnv t1 = null;
61: try {
62: System.out.println("Create a bean tables");
63: t1 = home.create();
64: } catch (Exception e) {
65: System.err.println("Cannot create tables Bean: " + e);
66: System.exit(2);
67: }
68:
69: // Get args
70: for (int argn = 0; argn < args.length; argn++) {
71: String filename = args[argn];
72: // init tables
73: try {
74: t1.initTable(filename);
75:
76: } catch (Exception e) {
77: System.err.println("Cannot create tables Bean: " + e);
78: System.exit(2);
79:
80: }
81:
82: }
83: }
84: }
|