Class LDAPSearch
java.lang.Object
LDAPTool
LDAPSearch
Execute Search operations through the LDAP client interface.
This class is implemented based on the LDAP class library.
usage : java LDAPSearch -b baseDN [options] filter [attributes...] for example : java LDAPSearch -b "c=us" -h ds.internic.net -p 389 "(objectClass=*)" note: '-' or '/' is used to distinct the option field. e.g. -a -b /c /d parameter -e parameter filter: Any string in RFC1558 specification. e.g. "(objectClass=*)" attributes: {0..n} All the string parameters follows with the filter. e.g. filter attrsA attrsB attrsC
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
Internal variablesprivate static final String
private static final String
private static int
private static String[]
private static boolean
private static String
private static int
private static int
private static int
private static MimeBase64Encoder
private static String
private static boolean
private static int
private static boolean
private static PrintWriter
private static int
private static String
private static String
private static int
private static boolean
private static boolean
private static int
private static int
private static final int
private static int
Fields inherited from class LDAPTool
m_binddn, m_client, m_debugLevel, m_hopLimit, m_justShow, m_ldaphost, m_ldapport, m_ordinary, m_passwd, m_proxyControl, m_referrals, m_verbose, m_version
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
dosearch()
This class-method is used to call the LDAP Search Operation with the specified options, parameters, filters and/or attributes.private static void
doUsage()
Prints usage.protected static void
extractParameters
(String[] args) This function is to extract specified parameters from the arguments list.protected static boolean
isSchemaEntry
(LDAPEntry entry) static void
This is the main function.private static void
private static void
Print the result entries.protected static void
printString
(String value) private static void
showControls
(LDAPControl[] controls) If there was a sort control returned, and the result code was not zero, show it.Methods inherited from class LDAPTool
extractParameters, setDefaultReferralCredentials
-
Field Details
-
DSML_INTRO
Internal variables- See Also:
-
DSML_END
- See Also:
-
DSML_RESULTS_INTRO
- See Also:
-
DSML_RESULTS_END
- See Also:
-
m_attrsonly
private static boolean m_attrsonly -
m_deref
private static int m_deref -
m_scope
private static int m_scope -
m_sizelimit
private static int m_sizelimit -
m_timelimit
private static int m_timelimit -
verbose
private static int verbose -
m_attrs
-
m_base
-
m_filter
-
m_sep
-
m_sort
-
m_sortOnServer
private static boolean m_sortOnServer -
m_tempFiles
private static boolean m_tempFiles -
m_beforeCount
private static int m_beforeCount -
m_afterCount
private static int m_afterCount -
m_index
private static int m_index -
m_count
private static int m_count -
m_vlvTokens
private static int m_vlvTokens -
m_searchVal
-
m_foldLine
private static boolean m_foldLine -
MAX_LINE
private static final int MAX_LINE- See Also:
-
m_pw
-
m_encoder
-
m_printDSML
private static boolean m_printDSML
-
-
Constructor Details
-
LDAPSearch
public LDAPSearch()
-
-
Method Details
-
main
This is the main function.- Parameters:
args
- list of arguments
-
doUsage
private static void doUsage()Prints usage. -
extractParameters
This function is to extract specified parameters from the arguments list.- Parameters:
args
- list of args
-
parseVlv
-
dosearch
private static void dosearch()This class-method is used to call the LDAP Search Operation with the specified options, parameters, filters and/or attributes. -
printResults
Print the result entries.- Parameters:
res
- Search results
-
printString
-
isSchemaEntry
-
showControls
If there was a sort control returned, and the result code was not zero, show it.- Parameters:
controls
- Any server controls returned.
-