Create the InitialContext object.
if (env != null) {
if (env.get(S1ASCtxFactory.IIOP_ENDPOINTS_PROPERTY) != null) {
System.setProperty(S1ASCtxFactory.IIOP_ENDPOINTS_PROPERTY,
(String)env.get(S1ASCtxFactory.IIOP_ENDPOINTS_PROPERTY));
}
if (env.get(S1ASCtxFactory.LOAD_BALANCING_PROPERTY) != null) {
System.setProperty(S1ASCtxFactory.LOAD_BALANCING_PROPERTY,
(String)env.get(S1ASCtxFactory.LOAD_BALANCING_PROPERTY));
}
String LBPOLICY =
System.getProperty(S1ASCtxFactory.LOAD_BALANCING_PROPERTY);
String ENDPOINTS =
System.getProperty(S1ASCtxFactory.IIOP_ENDPOINTS_PROPERTY);
if ((LBPOLICY != null &&
!LBPOLICY.equals("")) ||
(ENDPOINTS != null &&
!ENDPOINTS.equals(""))) {
s1asCtxFactory = new S1ASCtxFactory();
return (s1asCtxFactory.getInitialContext(env));
}
}
if (_initializeOrbManager &&
(env == null ||
(env != null && env.get("java.naming.corba.orb") == null))) {
//javax.naming.InitialContext passes its own local Hashtable
//variable, so can't cast it to Properties.
Properties props = new Properties();
if (env != null) {
String host = (String)env.get("org.omg.CORBA.ORBInitialHost");
String port = (String)env.get("org.omg.CORBA.ORBInitialPort");
if (host != null) {
props.put("org.omg.CORBA.ORBInitialHost", host);
}
if (port != null) {
props.put("org.omg.CORBA.ORBInitialPort", port);
}
}
org.omg.CORBA.ORB orb = ORBManager.getORB(props) ;
if (defaultEnv != null)
defaultEnv.put("java.naming.corba.orb", orb ) ;
if (env != null)
env.put("java.naming.corba.orb", orb );
}
if (SerialContext.getSticky() != null) {
Context ctx = SerialContext.getStickyContext();
return ctx;
}
if (s1asCtxFactory != null) {
return (s1asCtxFactory.getInitialContext(env));
}
if (env != null) {
return new SerialContext(env);
} else {
return new SerialContext(defaultEnv);
}