1 22 package org.objectweb.petals.util; 23 24 import javax.naming.Context ; 25 import javax.naming.NameClassPair ; 26 import javax.naming.NamingEnumeration ; 27 import javax.naming.NamingException ; 28 29 34 public final class JNDIUtil { 35 36 private JNDIUtil() { 37 38 } 39 40 52 public static boolean isBound(Context parentContext, 53 String childContextName, String name) { 54 boolean test = false; 55 try { 56 NamingEnumeration <NameClassPair > namingEnumeration = parentContext 57 .list(childContextName); 58 while (namingEnumeration.hasMoreElements()) { 59 NameClassPair classPair = (NameClassPair ) namingEnumeration 60 .next(); 61 if (classPair.getName().equals(name)) { 62 return true; 63 } 64 } 65 } catch (NamingException e) { 66 return false; 67 } 68 return test; 69 } 70 } 71 | Popular Tags |