Package edu.vt.middleware.ldap
Class LdapCli
- java.lang.Object
-
- edu.vt.middleware.ldap.AbstractCli
-
- edu.vt.middleware.ldap.LdapCli
-
public class LdapCli extends AbstractCli
Command line interface for ldap operations.- Version:
- $Revision: 1330 $
- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
OPT_QUERY
Option for ldap query.-
Fields inherited from class edu.vt.middleware.ldap.AbstractCli
logger, OPT_DSMLV1, OPT_DSMLV2, OPT_HELP, OPT_TRACE, OPT_USE_PROPERTIES, options, opts, outputDsmlv1, outputDsmlv2
-
-
Constructor Summary
Constructors Constructor Description LdapCli()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
dispatch(org.apache.commons.cli.CommandLine line)
Dispatch command line data to the handler that can perform the operation requested on the command line.protected java.lang.String
getCommandName()
Gets the name of the command for which this class provides a CLI interface.protected LdapConfig
initLdapConfig(org.apache.commons.cli.CommandLine line)
Initialize an LdapConfig with command line options.protected void
initOptions()
Initialize CLI options.static void
main(java.lang.String[] args)
CLI entry point method.protected void
search(LdapConfig config, java.lang.String filter, java.lang.String[] attrs)
Executes the ldap search operation.-
Methods inherited from class edu.vt.middleware.ldap.AbstractCli
getArgs, initLdapProperties, initOptions, performAction, printExamples, printHelp
-
-
-
-
Field Detail
-
OPT_QUERY
protected static final java.lang.String OPT_QUERY
Option for ldap query.- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
CLI entry point method.- Parameters:
args
- Command line arguments.
-
initOptions
protected void initOptions()
Initialize CLI options.- Specified by:
initOptions
in classAbstractCli
-
initLdapConfig
protected LdapConfig initLdapConfig(org.apache.commons.cli.CommandLine line) throws java.lang.Exception
Initialize an LdapConfig with command line options.- Parameters:
line
- Parsed command line arguments container.- Returns:
LdapConfig
that has been initialized- Throws:
java.lang.Exception
- On errors thrown by handler.
-
dispatch
protected void dispatch(org.apache.commons.cli.CommandLine line) throws java.lang.Exception
Dispatch command line data to the handler that can perform the operation requested on the command line.- Specified by:
dispatch
in classAbstractCli
- Parameters:
line
- Parsed command line arguments container.- Throws:
java.lang.Exception
- On errors thrown by handler.
-
search
protected void search(LdapConfig config, java.lang.String filter, java.lang.String[] attrs) throws java.lang.Exception
Executes the ldap search operation.- Parameters:
config
- Ldap configuration.filter
- Ldap filter to search on.attrs
- Ldap attributes to return.- Throws:
java.lang.Exception
- On errors.
-
getCommandName
protected java.lang.String getCommandName()
Gets the name of the command for which this class provides a CLI interface.- Specified by:
getCommandName
in classAbstractCli
- Returns:
- Name of CLI command.
-
-