1 7 8 package javax.naming.ldap; 9 10 import javax.naming.NamingException ; 11 import javax.naming.Context ; 12 13 import java.util.Hashtable ; 14 15 import com.sun.naming.internal.FactoryEnumeration; 16 import com.sun.naming.internal.ResourceManager; 17 18 19 35 36 public abstract class ControlFactory { 37 40 protected ControlFactory() { 41 } 42 43 78 public abstract Control getControlInstance(Control ctl) throws NamingException ; 79 80 117 public static Control getControlInstance(Control ctl, Context ctx, 118 Hashtable <?,?> env) 119 throws NamingException { 120 121 FactoryEnumeration factories = ResourceManager.getFactories( 124 LdapContext.CONTROL_FACTORIES, env, ctx); 125 126 if (factories == null) { 127 return ctl; 128 } 129 130 Control answer = null; 132 ControlFactory factory; 133 while (answer == null && factories.hasMore()) { 134 factory = (ControlFactory )factories.next(); 135 answer = factory.getControlInstance(ctl); 136 } 137 138 return (answer != null)? answer : ctl; 139 } 140 } 141 | Popular Tags |