/* * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.corba.se.impl.naming.cosnaming; import java.util.Properties; import java.net.InetAddress; import org.omg.CORBA.ORB; import org.omg.CosNaming.NamingContext; import com.sun.corba.se.spi.logging.CORBALogDomains; import com.sun.corba.se.impl.naming.cosnaming.TransientNameService; import com.sun.corba.se.impl.orbutil.ORBConstants; import com.sun.corba.se.impl.orbutil.CorbaResourceUtil; import com.sun.corba.se.impl.logging.NamingSystemException; /** * Class TransientNameServer is a standalone application which * implements a transient name service. It uses the TransientNameService * class for the name service implementation, and the BootstrapServer * for implementing bootstrapping, i.e., to get the initial NamingContext. *

* The BootstrapServer uses a Properties object specify the initial service * object references supported; such as Properties object is created containing * only a "NameService" entry together with the stringified object reference * for the initial NamingContext. The BootstrapServer's listening port * is set by first checking the supplied arguments to the name server * (-ORBInitialPort), and if not set, defaults to the standard port number. * The BootstrapServer is created supplying the Properties object, using no * external File object for storage, and the derived initial port number. * @see TransientNameService * @see BootstrapServer */ public class TransientNameServer { static private boolean debug = false ; static NamingSystemException wrapper = NamingSystemException.get( CORBALogDomains.NAMING ) ; static public void trace( String msg ) { if (debug) System.out.println( msg ) ; } static public void initDebug( String[] args ) { // If debug was compiled to be true for testing purposes, // don't change it. if (debug) return ; for (int ctr=0; ctr 0 ) { initialPort = java.lang.Integer.parseInt(ips); // -Dorg.omg.CORBA.ORBInitialPort=0 is invalid if( initialPort == 0 ) { orbInitialPort0 = true; throw wrapper.transientNameServerBadPort() ; } } String hostName = System.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ; if( hostName != null ) { invalidHostOption = true; throw wrapper.transientNameServerBadHost() ; } } catch (java.lang.NumberFormatException e) { // do nothing } // Let arguments override for (int i=0;i