/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Extract components of an LDAP URL.
*
* The format of an LDAP URL is defined in RFC 2255 as follows:
*
* ldapurl = scheme "://" [hostport] ["/"
* [dn ["?" [attributes] ["?" [scope]
* ["?" [filter] ["?" extensions]]]]]]
* scheme = "ldap"
* attributes = attrdesc *("," attrdesc)
* scope = "base" / "one" / "sub"
* dn = distinguishedName from Section 3 of [1]
* hostport = hostport from Section 5 of RFC 1738 [5]
* attrdesc = AttributeDescription from Section 4.1.5 of [2]
* filter = filter from Section 4 of [4]
* extensions = extension *("," extension)
* extension = ["!"] extype ["=" exvalue]
* extype = token / xtoken
* exvalue = LDAPString from section 4.1.2 of [2]
* token = oid from section 4.1 of [3]
* xtoken = ("X-" / "x-") token
*
* For example,
*
* ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US
* ldap://host.com:6666/o=IMC,c=US??sub?(cn=Babs%20Jensen)
*
* This class also supports ldaps URLs.
*/
private boolean useSsl = false;
/**
* Creates an LdapURL object from an LDAP URL string.
*/
super();
try {
}
parsePathAndQuery(); // DN, attributes, scope, filter, extensions
} catch (MalformedURLException e) {
ne.setRootCause(e);
throw ne;
} catch (UnsupportedEncodingException e) {
ne.setRootCause(e);
throw ne;
}
}
/**
* Returns true if the URL is an LDAPS URL.
*/
public boolean useSsl() {
return useSsl;
}
/**
* Returns the LDAP URL's distinguished name.
*/
return DN;
}
/**
* Returns the LDAP URL's attributes.
*/
return attributes;
}
/**
* Returns the LDAP URL's scope.
*/
return scope;
}
/**
* Returns the LDAP URL's filter.
*/
return filter;
}
/**
* Returns the LDAP URL's extensions.
*/
return extensions;
}
/**
* Given a space-separated list of LDAP URLs, returns an array of strings.
*/
int i = 0; // next available index in urls
while (st.hasMoreTokens()) {
}
return trimmed;
}
/**
* Derermines whether an LDAP URL has query components.
*/
}
/*
* Assembles an LDAP or LDAPS URL string from its components.
* If "host" is an IPv6 literal, it may optionally include delimiting
* brackets.
*/
{
try {
h = "[" + h + "]"; // IPv6 literal
}
} catch (UnsupportedEncodingException e) {
// UTF8 should always be supported
throw new IllegalStateException("UTF-8 encoding unavailable");
}
}
/*
* Parses the path and query components of an URL and sets this
* object's fields accordingly.
*/
// path begins with a '/' or is empty
return;
}
}
// query begins with a '?' or is null
return;
}
if (qmark2 < 0) {
return;
} else if (qmark2 != 1) {
}
if (qmark3 < 0) {
return;
}
if (qmark4 < 0) {
} else {
}
}
}
}
}
/*
public static void main(String[] args) throws Exception {
LdapURL url = new LdapURL(args[0]);
System.out.println("Example LDAP URL: " + url.toString());
System.out.println(" scheme: " + url.getScheme());
System.out.println(" host: " + url.getHost());
System.out.println(" port: " + url.getPort());
System.out.println(" DN: " + url.getDN());
System.out.println(" attrs: " + url.getAttributes());
System.out.println(" scope: " + url.getScope());
System.out.println(" filter: " + url.getFilter());
System.out.println(" extens: " + url.getExtensions());
System.out.println("");
}
*/
}