00001
00025 package org.objectweb.jonas.security.iiop;
00026
00027 import javax.naming.Context;
00028 import javax.naming.InitialContext;
00029 import javax.naming.NamingException;
00030 import javax.rmi.PortableRemoteObject;
00031
00032 import org.omg.CORBA.ORB;
00033
00034
00039 public class ORBHelper {
00040
00044 private static ORB orb = null;
00045
00046
00050 private ORBHelper() {
00051
00052 }
00053
00058 public static ORB getOrb() throws Csiv2InterceptorException {
00059 if (orb != null) {
00060 return orb;
00061 }
00062
00063
00064 Context ictx = null;
00065 try {
00066 ictx = new InitialContext();
00067 } catch (NamingException ne) {
00068 throw new Csiv2InterceptorException("Cannot instatiate InitialContext", ne);
00069 }
00070
00071 try {
00072 orb = (ORB) PortableRemoteObject.narrow(ictx.lookup("java:comp/ORB"), ORB.class);
00073 } catch (NamingException ne) {
00074 throw new Csiv2InterceptorException("Cannot lookup java:comp/ORB", ne);
00075 }
00076 return orb;
00077 }
00078
00079
00080 }