org.opends.server.tools.dsconfig
Class LDAPManagementContextFactory

java.lang.Object
  extended by org.opends.server.tools.dsconfig.LDAPManagementContextFactory
All Implemented Interfaces:
ManagementContextFactory

public final class LDAPManagementContextFactory
extends java.lang.Object
implements ManagementContextFactory

An LDAP management context factory.


Constructor Summary
LDAPManagementContextFactory()
          Creates a new LDAP management context factory.
 
Method Summary
 void close()
          Closes this management context.
 CommandBuilder getContextCommandBuilder()
          Returns the command builder that provides the equivalent arguments in interactive mode to get the management context.
 ManagementContext getManagementContext(ConsoleApplication app)
          Gets the management context which sub-commands should use in order to manage the directory server.
 ManagementContext getManagementContext(ConsoleApplication app, LDAPConnectionConsoleInteraction ci)
          Gets the management context which sub-commands should use in order to manage the directory server.
 void registerGlobalArguments(SubCommandArgumentParser parser)
          Initializes this management context factory using the provided parser.
 void validateGlobalArguments()
          Validates any global arguments passed to the application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPManagementContextFactory

public LDAPManagementContextFactory()
Creates a new LDAP management context factory.

Method Detail

getManagementContext

public ManagementContext getManagementContext(ConsoleApplication app)
                                       throws ArgumentException,
                                              ClientException
Gets the management context which sub-commands should use in order to manage the directory server. Implementations can use the application instance for retrieving passwords interactively.

Specified by:
getManagementContext in interface ManagementContextFactory
Parameters:
app - The application instance.
Returns:
Returns the management context which sub-commands should use in order to manage the directory server.
Throws:
ArgumentException - If a management context related argument could not be parsed successfully.
ClientException - If the management context could not be created.

close

public void close()
Closes this management context.

Specified by:
close in interface ManagementContextFactory

getContextCommandBuilder

public CommandBuilder getContextCommandBuilder()
Returns the command builder that provides the equivalent arguments in interactive mode to get the management context.

Specified by:
getContextCommandBuilder in interface ManagementContextFactory
Returns:
the command builder that provides the equivalent arguments in interactive mode to get the management context.

getManagementContext

public ManagementContext getManagementContext(ConsoleApplication app,
                                              LDAPConnectionConsoleInteraction ci)
                                       throws ArgumentException,
                                              ClientException
Gets the management context which sub-commands should use in order to manage the directory server. Implementations can use the application instance for retrieving passwords interactively.

Parameters:
app - The application instance.
ci - the LDAPConsoleInteraction object to be used. The code assumes that the LDAPConsoleInteraction has already been run.
Returns:
Returns the management context which sub-commands should use in order to manage the directory server.
Throws:
ArgumentException - If a management context related argument could not be parsed successfully.
ClientException - If the management context could not be created.

registerGlobalArguments

public void registerGlobalArguments(SubCommandArgumentParser parser)
                             throws ArgumentException
Initializes this management context factory using the provided parser. The management context factory can register global options with the parser if required.

Specified by:
registerGlobalArguments in interface ManagementContextFactory
Parameters:
parser - The application sub-command argument parser.
Throws:
ArgumentException - If the factory failed to register its required global options.

validateGlobalArguments

public void validateGlobalArguments()
                             throws ArgumentException
Validates any global arguments passed to the application. Implementations of this method should check that the values passed to their global arguments are valid and are not incompatible with each other.

Specified by:
validateGlobalArguments in interface ManagementContextFactory
Throws:
ArgumentException - If the global arguments are invalid for some reason.