1 25 26 package org.objectweb.jonas.jtests.clients.init; 27 28 29 import javax.rmi.PortableRemoteObject ; 30 import javax.naming.InitialContext ; 31 import javax.naming.Context ; 32 import org.objectweb.jonas.jtests.ftables.DBEnvHome; 33 import org.objectweb.jonas.jtests.ftables.DBEnv; 34 36 public class I_tables { 37 38 39 public static void main(String args[]) { 40 41 Context initialContext = null; 42 try { 43 initialContext = new InitialContext (); 44 } catch (Exception e) { 45 System.err.println("Cannot get initial context for JNDI: " + e); 46 System.exit(2); 47 } 48 49 DBEnvHome home = null; 51 try { 52 home = (DBEnvHome)PortableRemoteObject.narrow(initialContext.lookup("ftablesDBEnvHome"), DBEnvHome.class); 53 } catch (Exception e) { 54 System.err.println( "Cannot lookup DBEnvHome: " + e); 55 System.exit(2); 56 } 57 DBEnv t1 = null; 59 try { 60 System.out.println("Create a bean tables"); 61 t1 = home.create(); 62 } catch (Exception e) { 63 System.err.println("Cannot create tables Bean: " + e); 64 System.exit(2); 65 } 66 67 for (int argn = 0; argn < args.length; argn++) { 69 String filename = args[argn]; 70 try { 72 t1.initTable(filename); 73 74 } catch (Exception e) { 75 System.err.println("Cannot create tables Bean: " + e); 76 System.exit(2); 77 78 } 79 80 } 81 } 82 } 83 | Popular Tags |