1 24 package fr.dyade.aaa.jndi2.soap; 25 26 import fr.dyade.aaa.jndi2.client.NamingContextFactory; 27 28 import javax.naming.CompositeName ; 29 import javax.naming.Context ; 30 import javax.naming.NamingException ; 31 32 import java.util.Hashtable ; 33 34 38 public class SoapExt_NamingContextFactory extends NamingContextFactory 39 { 40 48 public Context getInitialContext(Hashtable env) throws NamingException 49 { 50 String soapHost = (String ) env.get("java.naming.factory.soapservice.host"); 51 52 if (soapHost == null) 55 return super.getInitialContext(env); 56 57 int soapPort; 58 String jndiHost; 59 int jndiPort; 60 61 try { 62 Object soapPortObj = env.get("java.naming.factory.soapservice.port"); 63 soapPort = Integer.parseInt((String ) soapPortObj); 64 } 65 catch (Exception exc) { 66 NamingException nEx = 67 new NamingException ("Invalid java.naming.factory.soapservice.port" 68 + " parameter."); 69 nEx.setRootCause(exc); 70 throw nEx; 71 } 72 73 jndiHost = (String ) env.get("java.naming.factory.host"); 74 if (jndiHost == null) 75 throw new NamingException ("Missing java.naming.factory.host parameter."); 76 77 try { 78 Object jndiPortObj = env.get("java.naming.factory.port"); 79 jndiPort = Integer.parseInt((String ) jndiPortObj); 80 } 81 catch (Exception exc) { 82 NamingException nEx = 83 new NamingException ("Invalid java.naming.factory.port parameter."); 84 nEx.setRootCause(exc); 85 throw nEx; 86 } 87 88 return new SoapExt_NamingContextImpl(soapHost, soapPort, 89 jndiHost, jndiPort); 90 } 91 } 92 | Popular Tags |