1:
37:
38:
39: package ;
40:
41: import ;
42:
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48:
49:
53: public class InitialLdapContext
54: extends InitialDirContext
55: implements LdapContext
56: {
57: public InitialLdapContext ()
58: throws NamingException
59: {
60: this (null, null);
61: }
62:
63: public InitialLdapContext (Hashtable<?, ?> environment,
64: Control[] connControls)
65: throws NamingException
66: {
67: super (false);
68:
69: Hashtable<Object, Object> myenv = null;
70: if (connControls != null)
71: {
72: if (environment == null)
73: myenv = new Hashtable<Object, Object> ();
74: else
75: myenv = (Hashtable<Object, Object>) environment.clone ();
76: myenv.put ("java.naming.ldap.control.connect",
77: connControls);
78: }
79:
80: init (myenv);
81: }
82:
83: private LdapContext getDefaultInitLdapCtx ()
84: throws NamingException
85: {
86: Context c = getDefaultInitCtx ();
87: if (c == null)
88: throw new NoInitialContextException ();
89: else if (! (c instanceof LdapContext))
90: throw new NotContextException ();
91: return (LdapContext) c;
92: }
93:
94: public ExtendedResponse extendedOperation (ExtendedRequest request)
95: throws NamingException
96: {
97: return getDefaultInitLdapCtx ().extendedOperation (request);
98: }
99:
100: public Control[] getConnectControls ()
101: throws NamingException
102: {
103: return getDefaultInitLdapCtx ().getConnectControls ();
104: }
105:
106: public Control[] getRequestControls ()
107: throws NamingException
108: {
109: return getDefaultInitLdapCtx ().getRequestControls ();
110: }
111:
112: public Control[] getResponseControls ()
113: throws NamingException
114: {
115: return getDefaultInitLdapCtx ().getResponseControls ();
116: }
117:
118: public LdapContext newInstance (Control[] reqControls)
119: throws NamingException
120: {
121: return getDefaultInitLdapCtx ().newInstance (reqControls);
122: }
123:
124: public void reconnect (Control[] connControls)
125: throws NamingException
126: {
127: getDefaultInitLdapCtx ().reconnect (connControls);
128: }
129:
130: public void setRequestControls (Control[] reqControls)
131: throws NamingException
132: {
133: getDefaultInitLdapCtx ().setRequestControls (reqControls);
134: }
135: }