Class ArgumentExceptionFactory


  • public final class ArgumentExceptionFactory
    extends Object
    A utility class for converting various admin exception types into argument exceptions.
    • Method Detail

      • adaptIllegalManagedObjectNameException

        public static com.forgerock.opendj.cli.ClientException adaptIllegalManagedObjectNameException​(IllegalManagedObjectNameException e,
                                                                                                      AbstractManagedObjectDefinition<?,​?> d)
        Creates a ClientException exception from an illegal managed object name exception.
        Parameters:
        e - The illegal managed object name exception.
        d - The managed object definition.
        Returns:
        Returns a ClientException exception.
      • adaptPropertyException

        public static com.forgerock.opendj.cli.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​(com.forgerock.opendj.cli.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​(com.forgerock.opendj.cli.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​(com.forgerock.opendj.cli.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 com.forgerock.opendj.cli.ArgumentException incompatiblePropertyModification​(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 com.forgerock.opendj.cli.ArgumentException missingBindPassword​(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.
      • missingBindPassword

        public static com.forgerock.opendj.cli.ArgumentException missingBindPassword​(char[] 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 com.forgerock.opendj.cli.ArgumentException missingMandatoryNonInteractiveArgument​(com.forgerock.opendj.cli.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 com.forgerock.opendj.cli.ArgumentException missingNameInPropertyArgument​(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 com.forgerock.opendj.cli.ArgumentException missingNameInPropertyModification​(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 com.forgerock.opendj.cli.ArgumentException missingSeparatorInPropertyArgument​(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 com.forgerock.opendj.cli.ArgumentException missingSeparatorInPropertyModification​(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 com.forgerock.opendj.cli.ArgumentException missingValueInPropertyArgument​(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 com.forgerock.opendj.cli.ArgumentException missingValueInPropertyModification​(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 com.forgerock.opendj.cli.ArgumentException unableToReadConnectionParameters​(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 com.forgerock.opendj.cli.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 com.forgerock.opendj.cli.ArgumentException unableToResetMandatoryProperty​(AbstractManagedObjectDefinition<?,​?> d,
                                                                                                String name,
                                                                                                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.
      • unableToResetPropertyWithValue

        public static com.forgerock.opendj.cli.ArgumentException unableToResetPropertyWithValue​(String name,
                                                                                                String resetOption)
        Creates an argument exception which should be used when an attempt is made to reset a property with a value.
        Parameters:
        name - The name of the mandatory property.
        resetOption - The name of the option which should be used to reset the property's values.
        Returns:
        Returns an argument exception.
      • unableToSetNamingProperty

        public static com.forgerock.opendj.cli.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 com.forgerock.opendj.cli.ArgumentException unknownCategory​(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 com.forgerock.opendj.cli.ArgumentException unknownProperty​(AbstractManagedObjectDefinition<?,​?> d,
                                                                                 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 com.forgerock.opendj.cli.ArgumentException unknownProperty​(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 com.forgerock.opendj.cli.ArgumentException unknownSubType​(RelationDefinition<?,​?> r,
                                                                                String typeName,
                                                                                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 com.forgerock.opendj.cli.ArgumentException unknownTypeForCategory​(String typeName,
                                                                                        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.
      • unknownValueForMultiValuedProperty

        public static com.forgerock.opendj.cli.ArgumentException unknownValueForMultiValuedProperty​(String value,
                                                                                                    String propertyName)
        Creates an argument exception which should be used when a multi-valued property does not contain a given value.
        Parameters:
        value - The property value.
        propertyName - The property name.
        Returns:
        Returns an argument exception.
      • unknownValueForChildComponent

        public static com.forgerock.opendj.cli.ArgumentException unknownValueForChildComponent​(String componentName)
        Creates an argument exception which should be used when a child component does not exist.
        Parameters:
        componentName - The component name.
        Returns:
        Returns an argument exception.
      • wrongManagedObjectType

        public static com.forgerock.opendj.cli.ClientException wrongManagedObjectType​(RelationDefinition<?,​?> r,
                                                                                      ManagedObjectDefinition<?,​?> d,
                                                                                      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 Client exception.