Class DocGeneratorSubCommandHandler
- java.lang.Object
-
- org.forgerock.opendj.config.dsconfig.DocGeneratorSubCommandHandler
-
- All Implemented Interfaces:
Comparable<org.forgerock.opendj.config.dsconfig.SubCommandHandler>
public final class DocGeneratorSubCommandHandler extends Object
Adds a hidden sub-command to write generated reference documentation for thedsconfig
command.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(org.forgerock.opendj.config.dsconfig.SubCommandHandler o)
static DocGeneratorSubCommandHandler
create(com.forgerock.opendj.cli.ArgumentParser parser, String commandName, String extension)
Creates a new doc generation sub-command.boolean
equals(Object obj)
com.forgerock.opendj.cli.CommandBuilder
getCommandBuilder()
Gets the command builder associated with this handler.protected com.forgerock.opendj.cli.MenuResult<ManagedObject<?>>
getManagedObject(DsConfig tool, ManagementContext context, ManagedObjectPath<?,?> path, List<String> args)
Get the managed object referenced by the provided managed object path.com.forgerock.opendj.cli.SubCommand
getSubCommand()
Gets the sub-command associated with this handler.Set<Tag>
getTags()
Gets the tags associated with this sub-command handler.protected com.forgerock.opendj.util.DurationUnit
getTimeUnit()
Gets the optional time unit that the user requested.int
hashCode()
com.forgerock.opendj.cli.MenuResult<Integer>
run(DsConfig app, ManagementContextFactory factory)
Run this sub-command handler.String
toString()
Get the string representation of this sub-command handler.
-
-
-
Method Detail
-
getSubCommand
public com.forgerock.opendj.cli.SubCommand getSubCommand()
Gets the sub-command associated with this handler.- Returns:
- Returns the sub-command associated with this handler.
-
run
public com.forgerock.opendj.cli.MenuResult<Integer> run(DsConfig app, ManagementContextFactory factory) throws com.forgerock.opendj.cli.ClientException
Run this sub-command handler.- Parameters:
app
- The tool.factory
- The LDAP management context factory context factory.- Returns:
- Returns a
MenuResult.success()
containing zero if the sub-command completed successfully or non-zero if it did not, orMenuResult.quit()
, orMenuResult.cancel()
, if the sub-command was run interactively and the user chose to quit or cancel. - Throws:
com.forgerock.opendj.cli.ClientException
- If the management context could not be created.
-
create
public static DocGeneratorSubCommandHandler create(com.forgerock.opendj.cli.ArgumentParser parser, String commandName, String extension)
Creates a new doc generation sub-command.- Parameters:
parser
- The sub-command argument parser.commandName
- The name of the command.extension
- The file extension for generated files.- Returns:
- a new doc generation sub-command.
-
compareTo
public final int compareTo(org.forgerock.opendj.config.dsconfig.SubCommandHandler o)
- Specified by:
compareTo
in interfaceComparable<org.forgerock.opendj.config.dsconfig.SubCommandHandler>
-
getCommandBuilder
public final com.forgerock.opendj.cli.CommandBuilder getCommandBuilder()
Gets the command builder associated with this handler. The method should be called after callingrun()
method.- Returns:
- Returns the sub-command associated with this handler.
-
getTags
public final Set<Tag> getTags()
Gets the tags associated with this sub-command handler.- Returns:
- Returns the tags associated with this sub-command handler.
-
toString
public final String toString()
Get the string representation of this sub-command handler.The string representation is simply the sub-command's name.
-
getManagedObject
protected final com.forgerock.opendj.cli.MenuResult<ManagedObject<?>> getManagedObject(DsConfig tool, ManagementContext context, ManagedObjectPath<?,?> path, List<String> args) throws com.forgerock.opendj.cli.ClientException, DefinitionDecodingException, ManagedObjectDecodingException, ConcurrentModificationException, ManagedObjectNotFoundException, LdapException
Get the managed object referenced by the provided managed object path.- Parameters:
tool
- The tool.context
- The management context.path
- The managed object path.args
- The list of managed object names required by the path.- Returns:
- Returns a
MenuResult.success()
containing the managed object referenced by the provided managed object path, orMenuResult.quit()
, orMenuResult.cancel()
, if the sub-command was run interactively and the user chose to quit or cancel. - Throws:
DefinitionDecodingException
- If the managed object was found but its type could not be determined.ManagedObjectDecodingException
- If the managed object was found but one or more of its properties could not be decoded.ManagedObjectNotFoundException
- If the requested managed object could not be found on the server.ConcurrentModificationException
- If this managed object has been removed from the server by another client.AuthorizationException
- If the server refuses to retrieve the managed object because the client does not have the correct privileges.com.forgerock.opendj.cli.ClientException
- If one of the naming arguments referenced a managed object of the wrong type.LdapException
- If any other error occurs.
-
getTimeUnit
protected final com.forgerock.opendj.util.DurationUnit getTimeUnit() throws com.forgerock.opendj.cli.ArgumentException
Gets the optional time unit that the user requested.- Returns:
- Returns the time unit that the user requested, or
null
if no time unit was specified. - Throws:
com.forgerock.opendj.cli.ArgumentException
- If the user specified an invalid time unit.
-
-