com.asprise.imaging.scan

## Class ScanManager

- java.lang.Object
- - com.asprise.imaging.scan.ScanManager

- All Implemented Interfaces:
    Closeable, AutoCloseable
  Direct Known Subclasses:
    MacScanManager, WiaScanManager

      public abstract class ScanManager
      extends Object
      implements Closeable

  Manages all the devices.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `VERSION`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `convertImage(String sourceFiles, String targetFile, String targetFormat, int jpegQuality, String tiffCompressionScheme)`
    `static ScanManager` | `createDefaultManager()` Gets the scan manager instance.
    `static void` | `enableLogDebugToConsole(boolean enable)`
    `static ExecutorService` | `getDefaultExecutorServiceForScanning()` Use this executor service to make sure that all scanning related code is executed from the same thread.
    `static ScanManager` | `getDefaultManager()` Gets the scan manager instance.
    `abstract List<Device>` | `getDevices()` Lists all the devices available on the system.
    `abstract String` | `getLibraryVersion()`
    `static File` | `getTempFolder()` Returns the system temp folder.
    `boolean` | `isActive()` Whether the manager is active.
    `static boolean` | `isEnabledLogDebugToConsole()`
    `abstract void` | `load()` Initializes the manager.
    `static void` | `log(int level, String mesg, Object relatedObject)`
    `static void` | `logDebug(String mesg)`
    `static void` | `logDebug(String mesg, Object relatedObject)`
    `static void` | `logDebugToConsole(String mesg)`
    `static void` | `logError(String mesg)`
    `static void` | `logError(String mesg, Object relatedObject)`
    `static void` | `logInfo(String mesg)`
    `static void` | `logInfo(String mesg, Object relatedObject)`
    `static void` | `logWarn(String mesg)`
    `static void` | `logWarn(String mesg, Object relatedObject)`
    `static void` | `main(String[] args)` Prints the version information.
    `File[]` | `quickScanUsingUI()` Performs a quick scan using system UI - dialogs are non-modal.
    `File[]` | `quickScanUsingUI(File destinationFolder, Component parentComponentForDialog)` Performs a quick scan using system UI.
    `abstract File[]` | `quickScanUsingUI(File destinationFolder, Component parentComponentForDialog, String preferredFormat)` Performs a quick scan using system UI.
    `abstract Device` | `selectDeviceByIdOrName(String idOrName)` Selects the device by id or name.
    `String` | `selectDeviceUsingUI()` Prompts the system dialog in non-modal mode to allow the user to select a device.
    `abstract String` | `selectDeviceUsingUI(Component parentComponentForDialog)` Prompts the system dialog in modal mode to allow the user to select a device
    `static void` | `setLoggerObject(Object loggerObject)` The logger object should be an instance of: java.util.logging.Logger, org.slf4j.Logger, org.apache.log4j.Logger, java.io.PrintStream or LogAdapter
    `abstract void` | `unload()` Releases resources and invalidates the manager.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.io.Closeable

      `close`

- - ### Field Detail

    - #### VERSION

          public static final String VERSION

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getDefaultExecutorServiceForScanning

          public static ExecutorService getDefaultExecutorServiceForScanning()

      Use this executor service to make sure that all scanning related code is executed from the same thread.

    - #### getDefaultManager

          public static ScanManager getDefaultManager()

      Gets the scan manager instance.
      Returns:

    - #### createDefaultManager

          public static ScanManager createDefaultManager()

      Gets the scan manager instance.
      Returns:

    - #### isActive

          public boolean isActive()

      Whether the manager is active. It remains active after load()ed but before unload() ed.
      Returns:
        Whether the manager is active

    - #### getDevices

          public abstract List<Device> getDevices()
                                           throws ScanException

      Lists all the devices available on the system.
      Returns:
      Throws:
        `ScanException`

    - #### selectDeviceByIdOrName

          public abstract Device selectDeviceByIdOrName(String idOrName)
                                                 throws ScanException

      Selects the device by id or name.
      Parameters:
        `idOrName` -
      Returns:
      Throws:
        `ScanException`

    - #### selectDeviceUsingUI

          public abstract String selectDeviceUsingUI(Component parentComponentForDialog)
                                              throws ScanException

      Prompts the system dialog in modal mode to allow the user to select a device
      Parameters:
        `parentComponentForDialog` - an optional UI component that owns the device selection dialog (modal).
      Returns:
        the id of the device selected.
      Throws:
        `ScanException`

    - #### selectDeviceUsingUI

          public String selectDeviceUsingUI()
                                     throws ScanException

      Prompts the system dialog in non-modal mode to allow the user to select a device.
      Returns:
      Throws:
        `ScanException`

    - #### quickScanUsingUI

          public abstract File[] quickScanUsingUI(File destinationFolder,
                                Component parentComponentForDialog,
                                String preferredFormat)
                                           throws ScanException

      Performs a quick scan using system UI.
      Parameters:
        `destinationFolder` - folder to save scanned images into. Pass `null` to use system temp.
        `parentComponentForDialog` - an optional UI component that owns the device selection dialog (modal).
        `preferredFormat` - e.g., 'jpg', 'png' - no guarantee
      Returns:
        the scanned images or `null`/empty array if user cancelled
      Throws:
        `ScanException`

    - #### quickScanUsingUI

          public File[] quickScanUsingUI(File destinationFolder,
                                Component parentComponentForDialog)
                                  throws ScanException

      Performs a quick scan using system UI.
      Parameters:
        `destinationFolder` - folder to save scanned images into. Pass `null` to use system temp.
        `parentComponentForDialog` - an optional UI component that owns the device selection dialog (modal).
      Returns:
        the scanned images or `null`/empty array if user cancelled
      Throws:
        `ScanException`

    - #### quickScanUsingUI

          public File[] quickScanUsingUI()
                                  throws ScanException

      Performs a quick scan using system UI - dialogs are non-modal.
      Returns:
      Throws:
        `ScanException`

    - #### convertImage

          public abstract void convertImage(String sourceFiles,
                          String targetFile,
                          String targetFormat,
                          int jpegQuality,
                          String tiffCompressionScheme)
                                     throws ScanException

      Throws:
        `ScanException`

    - #### getTempFolder

          public static File getTempFolder()

      Returns the system temp folder.
      Returns:

    - #### load

          public abstract void load()
                             throws ScanException

      Initializes the manager.
      Throws:
        `ScanException`

    - #### unload

          public abstract void unload()
                               throws ScanException

      Releases resources and invalidates the manager.
      Throws:
        `ScanException`

    - #### getLibraryVersion

          public abstract String getLibraryVersion()
                                            throws ScanException

      Throws:
        `ScanException`

    - #### setLoggerObject

          public static void setLoggerObject(Object loggerObject)

      The logger object should be an instance of: java.util.logging.Logger, org.slf4j.Logger, org.apache.log4j.Logger, java.io.PrintStream or LogAdapter
      Parameters:
        `loggerObject` -

    - #### isEnabledLogDebugToConsole

          public static boolean isEnabledLogDebugToConsole()

    - #### enableLogDebugToConsole

          public static void enableLogDebugToConsole(boolean enable)

    - #### logDebugToConsole

          public static void logDebugToConsole(String mesg)

    - #### log

          public static void log(int level,
                 String mesg,
                 Object relatedObject)

    - #### logDebug

          public static void logDebug(String mesg,
                      Object relatedObject)

    - #### logInfo

          public static void logInfo(String mesg,
                     Object relatedObject)

    - #### logWarn

          public static void logWarn(String mesg,
                     Object relatedObject)

    - #### logError

          public static void logError(String mesg,
                      Object relatedObject)

    - #### logDebug

          public static void logDebug(String mesg)

    - #### logInfo

          public static void logInfo(String mesg)

    - #### logWarn

          public static void logWarn(String mesg)

    - #### logError

          public static void logError(String mesg)

    - #### main

          public static void main(String[] args)

      Prints the version information.
      Parameters:
        `args` -

Copyright © Asprise Software. All Rights Reserved. Please visit the product page at asprise.com