1 package org.jacorb.demo.sas; 2 3 import java.io.BufferedReader ; 4 import java.io.File ; 5 import java.io.FileReader ; 6 7 import org.jacorb.security.sas.GssUpContext; 8 import org.omg.CORBA.ORB ; 9 10 18 19 public class GssUpClient { 20 public static void main(String args[]) { 21 if (args.length != 3) { 22 System.out.println("Usage: java demo.sas.GssUpClient <ior_file> <username> <password>"); 23 System.exit(1); 24 } 25 26 try { 27 GssUpContext.setUsernamePassword(args[1], args[2]); 29 30 ORB orb = ORB.init(args, null); 32 33 File f = new File (args[0]); 35 if (!f.exists()) { 36 System.out.println("File " + args[0] + " does not exist."); 37 System.exit(-1); 38 } 39 if (f.isDirectory()) { 40 System.out.println("File " + args[0] + " is a directory."); 41 System.exit(-1); 42 } 43 BufferedReader br = new BufferedReader (new FileReader (f)); 44 org.omg.CORBA.Object obj = orb.string_to_object(br.readLine()); 45 br.close(); 46 SASDemo demo = SASDemoHelper.narrow(obj); 47 48 demo.printSAS(); 50 demo.printSAS(); 51 demo.printSAS(); 52 53 System.out.println("Call to server succeeded"); 54 } catch (Exception ex) { 55 ex.printStackTrace(); 56 } 57 } 58 } 59 | Popular Tags |