Class LDAPSearch


public class LDAPSearch extends LDAPTool
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 Details

    • DSML_INTRO

      private static final String DSML_INTRO
      Internal variables
      See Also:
    • DSML_END

      private static final String DSML_END
      See Also:
    • DSML_RESULTS_INTRO

      private static final String DSML_RESULTS_INTRO
      See Also:
    • DSML_RESULTS_END

      private static final String 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

      private static String[] m_attrs
    • m_base

      private static String m_base
    • m_filter

      private static String m_filter
    • m_sep

      private static String m_sep
    • m_sort

      private static Vector<String> 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

      private static String m_searchVal
    • m_foldLine

      private static boolean m_foldLine
    • MAX_LINE

      private static final int MAX_LINE
      See Also:
    • m_pw

      private static PrintWriter m_pw
    • m_encoder

      private static MimeBase64Encoder m_encoder
    • m_printDSML

      private static boolean m_printDSML
  • Constructor Details

    • LDAPSearch

      public LDAPSearch()
  • Method Details

    • main

      public static void main(String[] args)
      This is the main function.
      Parameters:
      args - list of arguments
    • doUsage

      private static void doUsage()
      Prints usage.
    • extractParameters

      protected static void extractParameters(String[] args)
      This function is to extract specified parameters from the arguments list.
      Parameters:
      args - list of args
    • parseVlv

      private static void parseVlv(GetOpt options)
    • 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

      private static void printResults(LDAPSearchResults res)
      Print the result entries.
      Parameters:
      res - Search results
    • printString

      protected static void printString(String value)
    • isSchemaEntry

      protected static boolean isSchemaEntry(LDAPEntry entry)
    • showControls

      private static void showControls(LDAPControl[] controls)
      If there was a sort control returned, and the result code was not zero, show it.
      Parameters:
      controls - Any server controls returned.