Class AbstractExceptionFactory<T extends Exception>

java.lang.Object
com.lexmark.saperion.exceptions.mappings.AbstractExceptionFactory<T>
Type Parameters:
T - the exception type supported by the factory
All Implemented Interfaces:
ExceptionFactory<T>
Direct Known Subclasses:
ApplicationExceptionFactory, RuntimeExceptionFactory, SystemExceptionFactory

public abstract class AbstractExceptionFactory<T extends Exception> extends Object implements ExceptionFactory<T>
Base implementation of an exception factory. Exception factories provide the basic functionality to instantiate ECM Service exceptions based on a server fault. Server faults are representations of server errors that are send over the wire. An exception factory instantiates the ECM Service exceptions based on the server fault error code and the factory's internal exception mapping. Only if the factory has an exception mapping for the server error code it can instantiate the appropriate exception for a server fault. Concrete exception factories must implement the getExceptionMappings() method. This method returns all exception mappings registered with this factory.
Author:
owaeldrich
  • Constructor Details

    • AbstractExceptionFactory

      public AbstractExceptionFactory()
  • Method Details

    • createException

      public T createException(com.lexmark.saperion.exceptions.ErrorType fault, Throwable cause)
      Description copied from interface: ExceptionFactory
      This method creates a new exception instance for the given server fault.
      Specified by:
      createException in interface ExceptionFactory<T extends Exception>
      Parameters:
      fault - the server error representation
      cause - the exception cause
      Returns:
      the exception instance for the given server error
    • getSupportedErrors

      public Set<com.lexmark.saperion.exceptions.ErrorCodeType> getSupportedErrors()
      Returns the supported error codes for this factory instance.
      Returns:
      the factory's supported error codes
    • supports

      public boolean supports(com.lexmark.saperion.exceptions.ErrorCodeType errorCode)
      Description copied from interface: ExceptionFactory
      This method determines if an exception mapping for faults with the given error code exists in the factory instance. Therefore, the exception factory searches its internal exception mappings whether a mapping for the given error code exists or not.
      Specified by:
      supports in interface ExceptionFactory<T extends Exception>
      Parameters:
      errorCode - the server error code
      Returns:
      the exception instance for the given server fault
    • valueOf

      public ExceptionMapping<T> valueOf(com.lexmark.saperion.exceptions.ErrorCodeType code)
      Returns the exception mapping for this error code. If there is no exception mapping with the given error code registered with this factory the method returns null.
      Parameters:
      code - the error code to retrieve a mapping for
      Returns:
      the exception mapping for the given error code, or null if no such mapping exists in this factory
    • getExceptionMappings

      protected abstract ExceptionMapping<T>[] getExceptionMappings()
      This method returns all exception mappings registered with this factory. Concrete exception factories must implement this method.
      Returns:
      all exception mappings registered with this factory
    • checkIntegrity

      public ExceptionFactory.IntegrityCheckResult checkIntegrity()
      Description copied from interface: ExceptionFactory
      Performs an integrity check on the factories exception mapping registries.
      Specified by:
      checkIntegrity in interface ExceptionFactory<T extends Exception>
      Returns:
      the integrity check result