org.opends.server.tools.dsconfig
Class ArgumentExceptionFactory

java.lang.Object
  extended by org.opends.server.tools.dsconfig.ArgumentExceptionFactory

public final class ArgumentExceptionFactory
extends java.lang.Object

A utility class for converting various admin exception types into argument exceptions.


Method Summary
static CLIException adaptIllegalManagedObjectNameException(IllegalManagedObjectNameException e, AbstractManagedObjectDefinition<?,?> d)
          Creates a CLI exception from an illegal managed object name exception.
static ArgumentException adaptPropertyException(PropertyException e, AbstractManagedObjectDefinition<?,?> d)
          Creates an argument exception from a property exception.
static void displayManagedObjectDecodingException(ConsoleApplication app, ManagedObjectDecodingException e)
          Displays a table listing reasons why a managed object could not be decoded successfully.
static void displayMissingMandatoryPropertyException(ConsoleApplication app, MissingMandatoryPropertiesException e)
          Displays a table listing missing mandatory properties.
static void displayOperationRejectedException(ConsoleApplication app, OperationRejectedException e)
          Displays a table listing the reasons why an operation was rejected.
static ArgumentException incompatiblePropertyModification(java.lang.String arg)
          Creates an argument exception which should be used when a property modification argument is incompatible with a previous modification argument.
static ArgumentException missingBindPassword(java.lang.String bindDN)
          Creates an argument exception which should be used when the client has not specified a bind password.
static ArgumentException missingMandatoryNonInteractiveArgument(Argument arg)
          Creates an argument exception which should be used when an argument, which is mandatory when the application is non-interactive, has not been specified.
static ArgumentException missingNameInPropertyArgument(java.lang.String arg)
          Creates an argument exception which should be used when a property value argument is invalid because it does not a property name.
static ArgumentException missingNameInPropertyModification(java.lang.String arg)
          Creates an argument exception which should be used when a property modification argument is invalid because it does not a property name.
static ArgumentException missingSeparatorInPropertyArgument(java.lang.String arg)
          Creates an argument exception which should be used when a property value argument is invalid because it does not contain a separator between the property name and its value.
static ArgumentException missingSeparatorInPropertyModification(java.lang.String arg)
          Creates an argument exception which should be used when a property modification argument is invalid because it does not contain a separator between the property name and its value.
static ArgumentException missingValueInPropertyArgument(java.lang.String arg)
          Creates an argument exception which should be used when a property value argument is invalid because it does not a property value.
static ArgumentException missingValueInPropertyModification(java.lang.String arg)
          Creates an argument exception which should be used when a property modification argument is invalid because it does not a property value.
static ArgumentException unableToReadBindPasswordInteractively()
          Creates an argument exception which should be used when the bind password could not be read from the standard input because the application is non-interactive.
static ArgumentException unableToReadConnectionParameters(java.lang.Exception cause)
          Creates an argument exception which should be used when the connection parameters could not be read from the standard input.
static ArgumentException unableToResetMandatoryProperty(AbstractManagedObjectDefinition<?,?> d, java.lang.String name, java.lang.String setOption)
          Creates an argument exception which should be used when an attempt is made to reset a mandatory property that does not have any default values.
static ArgumentException unableToSetNamingProperty(AbstractManagedObjectDefinition<?,?> d, PropertyDefinition<?> pd)
          Creates an argument exception which should be used when an attempt is made to set the naming property for a managed object during creation.
static ArgumentException unknownCategory(java.lang.String categoryName)
          Creates an argument exception which should be used when a component category argument is not recognized.
static ArgumentException unknownProperty(AbstractManagedObjectDefinition<?,?> d, java.lang.String name)
          Creates an argument exception which should be used when a property name is not recognized.
static ArgumentException unknownProperty(java.lang.String name)
          Creates an argument exception which should be used when a property name is not recognized.
static ArgumentException unknownSubType(RelationDefinition<?,?> r, java.lang.String typeName, java.lang.String typeUsage)
          Creates an argument exception which should be used when a sub-type argument in a create-xxx sub-command is not recognized.
static ArgumentException unknownTypeForCategory(java.lang.String typeName, java.lang.String categoryName)
          Creates an argument exception which should be used when a managed object type argument is not associated with a category.
static CLIException wrongManagedObjectType(RelationDefinition<?,?> r, ManagedObjectDefinition<?,?> d, java.lang.String subcommandName)
          Creates a CLI exception which should be used when a managed object is retrieved but does not have the correct type appropriate for the associated sub-command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

adaptIllegalManagedObjectNameException

public static CLIException adaptIllegalManagedObjectNameException(IllegalManagedObjectNameException e,
                                                                  AbstractManagedObjectDefinition<?,?> d)
Creates a CLI exception from an illegal managed object name exception.

Parameters:
e - The illegal managed object name exception.
d - The managed object definition.
Returns:
Returns a CLI exception.

adaptPropertyException

public static ArgumentException adaptPropertyException(PropertyException e,
                                                       AbstractManagedObjectDefinition<?,?> d)
Creates an argument exception from a property exception.

Parameters:
e - The property exception.
d - The managed object definition.
Returns:
Returns an argument exception.

displayManagedObjectDecodingException

public static void displayManagedObjectDecodingException(ConsoleApplication app,
                                                         ManagedObjectDecodingException e)
Displays a table listing reasons why a managed object could not be decoded successfully.

Parameters:
app - The console application.
e - The managed object decoding exception.

displayMissingMandatoryPropertyException

public static void displayMissingMandatoryPropertyException(ConsoleApplication app,
                                                            MissingMandatoryPropertiesException e)
Displays a table listing missing mandatory properties.

Parameters:
app - The console application.
e - The missing mandatory property exception.

displayOperationRejectedException

public static void displayOperationRejectedException(ConsoleApplication app,
                                                     OperationRejectedException e)
Displays a table listing the reasons why an operation was rejected.

Parameters:
app - The console application.
e - The operation rejected exception.

incompatiblePropertyModification

public static ArgumentException incompatiblePropertyModification(java.lang.String arg)
Creates an argument exception which should be used when a property modification argument is incompatible with a previous modification argument.

Parameters:
arg - The incompatible argument.
Returns:
Returns an argument exception.

missingBindPassword

public static ArgumentException missingBindPassword(java.lang.String bindDN)
Creates an argument exception which should be used when the client has not specified a bind password.

Parameters:
bindDN - The name of the user requiring a password.
Returns:
Returns an argument exception.

missingMandatoryNonInteractiveArgument

public static ArgumentException missingMandatoryNonInteractiveArgument(Argument arg)
Creates an argument exception which should be used when an argument, which is mandatory when the application is non-interactive, has not been specified.

Parameters:
arg - The missing argument.
Returns:
Returns an argument exception.

missingNameInPropertyArgument

public static ArgumentException missingNameInPropertyArgument(java.lang.String arg)
Creates an argument exception which should be used when a property value argument is invalid because it does not a property name.

Parameters:
arg - The argument having the missing property name.
Returns:
Returns an argument exception.

missingNameInPropertyModification

public static ArgumentException missingNameInPropertyModification(java.lang.String arg)
Creates an argument exception which should be used when a property modification argument is invalid because it does not a property name.

Parameters:
arg - The argument having the missing property name.
Returns:
Returns an argument exception.

missingSeparatorInPropertyArgument

public static ArgumentException missingSeparatorInPropertyArgument(java.lang.String arg)
Creates an argument exception which should be used when a property value argument is invalid because it does not contain a separator between the property name and its value.

Parameters:
arg - The argument having a missing separator.
Returns:
Returns an argument exception.

missingSeparatorInPropertyModification

public static ArgumentException missingSeparatorInPropertyModification(java.lang.String arg)
Creates an argument exception which should be used when a property modification argument is invalid because it does not contain a separator between the property name and its value.

Parameters:
arg - The argument having a missing separator.
Returns:
Returns an argument exception.

missingValueInPropertyArgument

public static ArgumentException missingValueInPropertyArgument(java.lang.String arg)
Creates an argument exception which should be used when a property value argument is invalid because it does not a property value.

Parameters:
arg - The argument having the missing property value.
Returns:
Returns an argument exception.

missingValueInPropertyModification

public static ArgumentException missingValueInPropertyModification(java.lang.String arg)
Creates an argument exception which should be used when a property modification argument is invalid because it does not a property value.

Parameters:
arg - The argument having the missing property value.
Returns:
Returns an argument exception.

unableToReadConnectionParameters

public static ArgumentException unableToReadConnectionParameters(java.lang.Exception cause)
Creates an argument exception which should be used when the connection parameters could not be read from the standard input.

Parameters:
cause - The reason why the connection parameters could not be read.
Returns:
Returns an argument exception.

unableToReadBindPasswordInteractively

public static ArgumentException unableToReadBindPasswordInteractively()
Creates an argument exception which should be used when the bind password could not be read from the standard input because the application is non-interactive.

Returns:
Returns an argument exception.

unableToResetMandatoryProperty

public static ArgumentException unableToResetMandatoryProperty(AbstractManagedObjectDefinition<?,?> d,
                                                               java.lang.String name,
                                                               java.lang.String setOption)
Creates an argument exception which should be used when an attempt is made to reset a mandatory property that does not have any default values.

Parameters:
d - The managed object definition.
name - The name of the mandatory property.
setOption - The name of the option which should be used to set the property's values.
Returns:
Returns an argument exception.

unableToSetNamingProperty

public static ArgumentException unableToSetNamingProperty(AbstractManagedObjectDefinition<?,?> d,
                                                          PropertyDefinition<?> pd)
Creates an argument exception which should be used when an attempt is made to set the naming property for a managed object during creation.

Parameters:
d - The managed object definition.
pd - The naming property definition.
Returns:
Returns an argument exception.

unknownCategory

public static ArgumentException unknownCategory(java.lang.String categoryName)
Creates an argument exception which should be used when a component category argument is not recognized.

Parameters:
categoryName - The unrecognized component category.
Returns:
Returns an argument exception.

unknownProperty

public static ArgumentException unknownProperty(AbstractManagedObjectDefinition<?,?> d,
                                                java.lang.String name)
Creates an argument exception which should be used when a property name is not recognized.

Parameters:
d - The managed object definition.
name - The unrecognized property name.
Returns:
Returns an argument exception.

unknownProperty

public static ArgumentException unknownProperty(java.lang.String name)
Creates an argument exception which should be used when a property name is not recognized.

Parameters:
name - The unrecognized property name.
Returns:
Returns an argument exception.

unknownSubType

public static ArgumentException unknownSubType(RelationDefinition<?,?> r,
                                               java.lang.String typeName,
                                               java.lang.String typeUsage)
Creates an argument exception which should be used when a sub-type argument in a create-xxx sub-command is not recognized.

Parameters:
r - The relation definition.
typeName - The unrecognized property sub-type.
typeUsage - A usage string describing the allowed sub-types.
Returns:
Returns an argument exception.

unknownTypeForCategory

public static ArgumentException unknownTypeForCategory(java.lang.String typeName,
                                                       java.lang.String categoryName)
Creates an argument exception which should be used when a managed object type argument is not associated with a category.

Parameters:
categoryName - The component category.
typeName - The unrecognized component type.
Returns:
Returns an argument exception.

wrongManagedObjectType

public static CLIException wrongManagedObjectType(RelationDefinition<?,?> r,
                                                  ManagedObjectDefinition<?,?> d,
                                                  java.lang.String subcommandName)
Creates a CLI exception which should be used when a managed object is retrieved but does not have the correct type appropriate for the associated sub-command.

Parameters:
r - The relation definition.
d - The definition of the managed object that was retrieved.
subcommandName - the sub-command name.
Returns:
Returns a CLI exception.