1 5 package SOFA.SOFAnode.TR.Impl; 6 7 import java.net.InetAddress ; 8 import java.net.UnknownHostException ; 9 import java.rmi.RMISecurityManager ; 10 11 import SOFA.Connector.Reference; 12 import SOFA.SOFAnode.InOut.Impl.Browser; 13 import SOFA.SOFAnode.TR.Connector.TR2InOutConnector; 14 import SOFA.Util.VMProperties; 15 16 20 public class Main { 21 22 31 public static void main (String [] argv) { 32 33 if (System.getSecurityManager() == null) { 34 System.setSecurityManager(new RMISecurityManager ()); 35 } 36 String trDir = System.getProperty(VMProperties.TR_DIR, null); 37 if (trDir == null) { 38 System.out.println("The property '" + VMProperties.TR_DIR + "' has not been specified."); 39 System.exit(1); 40 } 41 try { 42 String sofaNodeName = System.getProperty(VMProperties.NODE_NAME); 43 44 if (sofaNodeName == null) { 45 try { 46 sofaNodeName = InetAddress.getLocalHost().getHostName(); 47 } catch (UnknownHostException e) { 48 System.err.println("Can't get the host name.\nSet the name to the property '" + VMProperties.NODE_NAME + "' when TR is being started."); 49 System.exit(1); 50 } 51 } 52 53 System.setProperty(VMProperties.NODE_NAME, sofaNodeName); 54 55 TRImpl tr = new TRImpl(trDir); 56 57 System.out.print("Registering TR...."); 58 Reference refTR = TR2InOutConnector.createSrv(tr).getSOFAReference(); 59 System.out.println("OK"); 60 System.out.println(refTR); 61 62 SOFA.SOFAnode.InOut.Impl.Main.runInOut(refTR, null); 64 } catch (Exception e) { 65 System.out.println("Exception " + e.getMessage()); 66 e.printStackTrace(); 67 } 68 if (argv.length == 1) { 69 new Browser(argv[0]); 70 } else 71 System.out.println("Running without client!!\n"); 72 } 73 } 74 | Popular Tags |