src/java.corba/share/classes/org/omg/CORBA/ORB.java

Print this page




 157  * initialized with the default Java IDL implementation.
 158  * <PRE>
 159  *    ORB orb = ORB.init(myApplet, null);
 160  * </PRE>
 161  * <P>
 162  * An application or applet can be initialized in one or more ORBs.
 163  * ORB initialization is a bootstrap call into the CORBA world.
 164  *
 165  *
 166  * @implNote
 167  * When a singleton ORB is configured via the system property,
 168  * or orb.properties, it will be
 169  * located, and loaded via the system class loader.
 170  * Thus, where appropriate, it is necessary that
 171  * the classes for this alternative ORBSingleton are available on the application's class path.
 172  * It should be noted that the singleton ORB is system wide.
 173  *
 174  * When a per-application ORB is created via the 2-arg init methods,
 175  * then it will be located using the thread context class loader.
 176  *






 177  * @since   JDK1.2
 178  */
 179 abstract public class ORB {
 180 
 181     //
 182     // This is the ORB implementation used when nothing else is specified.
 183     // Whoever provides this class customizes this string to
 184     // point at their ORB implementation.
 185     //
 186     private static final String ORBClassKey = "org.omg.CORBA.ORBClass";
 187     private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass";
 188 
 189     // check that access to the class is not restricted by the security manager.
 190     private static void checkPackageAccess(String name) {
 191         SecurityManager s = System.getSecurityManager();
 192         if (s != null) {
 193             String cname = name.replace('/', '.');
 194             if (cname.startsWith("[")) {
 195                 int b = cname.lastIndexOf('[') + 2;
 196                 if (b > 1 && b < cname.length()) {


 254 
 255                         return props ;
 256                     } catch (Exception exc) {
 257                         return null ;
 258                     }
 259                 }
 260 
 261                 public java.lang.Object run() {
 262                     String userHome = System.getProperty("user.home");
 263                     String fileName = userHome + File.separator +
 264                         "orb.properties" ;
 265                     Properties props = getFileProperties( fileName ) ;
 266 
 267                     if (props != null) {
 268                         String value = props.getProperty( name ) ;
 269                         if (value != null)
 270                             return value ;
 271                     }
 272 
 273                     String javaHome = System.getProperty("java.home");
 274                     fileName = javaHome + File.separator
 275                         + "lib" + File.separator + "orb.properties";
 276                     props = getFileProperties( fileName ) ;
 277 














 278                     if (props == null)
 279                         return null ;
 280                     else
 281                         return props.getProperty( name ) ;
 282                 }
 283             }
 284         );
 285 
 286         return propValue;
 287     }
 288 
 289     /**
 290      * Returns the {@code ORB} singleton object. This method always returns the
 291      * same ORB instance, which is an instance of the class described by the
 292      * {@code org.omg.CORBA.ORBSingletonClass} system property.
 293      * <P>
 294      * This no-argument version of the method {@code init} is used primarily
 295      * as a factory for {@code TypeCode} objects, which are used by
 296      * {@code Helper} classes to implement the method {@code type}.
 297      * It is also used to create {@code Any} objects that are used to
 298      * describe {@code union} labels (as part of creating a
 299      * {@code TypeCode} object for a {@code union}).
 300      * <P>
 301      * This method is not intended to be used by applets, and in the event




 157  * initialized with the default Java&nbsp;IDL implementation.
 158  * <PRE>
 159  *    ORB orb = ORB.init(myApplet, null);
 160  * </PRE>
 161  * <P>
 162  * An application or applet can be initialized in one or more ORBs.
 163  * ORB initialization is a bootstrap call into the CORBA world.
 164  *
 165  *
 166  * @implNote
 167  * When a singleton ORB is configured via the system property,
 168  * or orb.properties, it will be
 169  * located, and loaded via the system class loader.
 170  * Thus, where appropriate, it is necessary that
 171  * the classes for this alternative ORBSingleton are available on the application's class path.
 172  * It should be noted that the singleton ORB is system wide.
 173  *
 174  * When a per-application ORB is created via the 2-arg init methods,
 175  * then it will be located using the thread context class loader.
 176  * 
 177  * The IDL to Java Language OMG specification documents the ${java.home}/lib directory as the location,
 178  * in the Java run-time image, to search for orb.properties.
 179  * This location is not intended for user editable configuration files.
 180  * Therefore, the implementation first checks the ${java.home}/conf directory for orb.properties,
 181  * and thereafter the ${java.home}/lib directory.
 182  *
 183  * @since   JDK1.2
 184  */
 185 abstract public class ORB {
 186 
 187     //
 188     // This is the ORB implementation used when nothing else is specified.
 189     // Whoever provides this class customizes this string to
 190     // point at their ORB implementation.
 191     //
 192     private static final String ORBClassKey = "org.omg.CORBA.ORBClass";
 193     private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass";
 194 
 195     // check that access to the class is not restricted by the security manager.
 196     private static void checkPackageAccess(String name) {
 197         SecurityManager s = System.getSecurityManager();
 198         if (s != null) {
 199             String cname = name.replace('/', '.');
 200             if (cname.startsWith("[")) {
 201                 int b = cname.lastIndexOf('[') + 2;
 202                 if (b > 1 && b < cname.length()) {


 260 
 261                         return props ;
 262                     } catch (Exception exc) {
 263                         return null ;
 264                     }
 265                 }
 266 
 267                 public java.lang.Object run() {
 268                     String userHome = System.getProperty("user.home");
 269                     String fileName = userHome + File.separator +
 270                         "orb.properties" ;
 271                     Properties props = getFileProperties( fileName ) ;
 272 
 273                     if (props != null) {
 274                         String value = props.getProperty( name ) ;
 275                         if (value != null)
 276                             return value ;
 277                     }
 278 
 279                     String javaHome = System.getProperty("java.home");



 280 
 281                     fileName = javaHome + File.separator + "conf"
 282                             + File.separator + "orb.properties";
 283                     props = getFileProperties(fileName);
 284 
 285                     if (props != null) {
 286                         String value = props.getProperty(name);
 287                         if (value != null)
 288                             return value;
 289                     }
 290 
 291                     fileName = javaHome + File.separator + "lib"
 292                             + File.separator + "orb.properties";
 293                     props = getFileProperties(fileName);
 294 
 295                     if (props == null)
 296                         return null;
 297                     else
 298                         return props.getProperty(name);
 299                 }
 300             }
 301         );
 302 
 303         return propValue;
 304     }
 305 
 306     /**
 307      * Returns the {@code ORB} singleton object. This method always returns the
 308      * same ORB instance, which is an instance of the class described by the
 309      * {@code org.omg.CORBA.ORBSingletonClass} system property.
 310      * <P>
 311      * This no-argument version of the method {@code init} is used primarily
 312      * as a factory for {@code TypeCode} objects, which are used by
 313      * {@code Helper} classes to implement the method {@code type}.
 314      * It is also used to create {@code Any} objects that are used to
 315      * describe {@code union} labels (as part of creating a
 316      * {@code TypeCode} object for a {@code union}).
 317      * <P>
 318      * This method is not intended to be used by applets, and in the event