com.ihr.xbrl.dataloader

## Class LoaderEngine

- java.lang.Object
- - com.ihr.xbrl.dataloader.LoaderEngine

-     public class LoaderEngine
      extends java.lang.Object

  The Class LoaderEngine.
  Author:
    Ignacio

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `loaderSchemaURI` The loader schema uri.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LoaderEngine(java.net.URI configFile)` Creates a loader engine and loads the configuration file for this engine.
    `LoaderEngine(java.net.URI configFile, int initialLoaders, boolean bCreateMasterLoader, java.util.Properties loaderProperties)` Creates a loader engine and loads the configuration file for this engine.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `createLoaderFromMapper(java.lang.String mapperTemplateFile, java.lang.String loaderTemplateFile, java.lang.String transformerConfigFile, java.lang.String driverClassName, java.lang.String driverConfFile)` Creates the loader from mapper.
    `java.util.Iterator<DTSContainer>` | `getDTSs()` Returns an iterator over all DTSs loaded in this engine.
    `Loader` | `getLoader(DTSContainer dts)` Returns a loader from the engine.
    `Loader` | `getMasterLoader(DTSContainer dts)` Access to the master loader.
    `net.sf.saxon.s9api.Processor` | `getProcessor()` Gets the processor.
    `java.lang.Object[]` | `load(javax.xml.transform.Source xmlSource)` Executes the mapping defined in the configuration file.
    `java.lang.Object[]` | `load(XBRLInstance instance, DTSContainer dts)` Executes the mapping defined in the configuration file.
    `void` | `migrateConfigFile(XBRLInstance versioningReport, java.net.URI outputReportUri, java.net.URI newConfigFileUri)` Migrates a configuration file from using a DTS to using a new DTS with information from an XBRL versioning report.
    `void` | `releaseLoader(Loader l, DTSContainer dts)` Liberates a loader so it can be used by other threads.
    `void` | `setURI(java.net.URI newURI)` Changes or sets this URI new config file.
    `void` | `writeConfigFile()` Write config file.

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

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

- - ### Field Detail

    - #### loaderSchemaURI

          public static java.lang.String loaderSchemaURI

      The loader schema uri.

  - ### Constructor Detail

    - #### LoaderEngine

          public LoaderEngine(java.net.URI configFile)
                       throws LoaderConfigurationFileException,
                              com.rs.lic.LicenseVerificationException

      Creates a loader engine and loads the configuration file for this engine.
      Parameters:
        `configFile` - the config file
      Throws:
        `LoaderConfigurationFileException` - the loader configuration file exception
        `com.rs.lic.LicenseVerificationException` - the license verification exception

    - #### LoaderEngine

          public LoaderEngine(java.net.URI configFile,
                      int initialLoaders,
                      boolean bCreateMasterLoader,
                      java.util.Properties loaderProperties)
                       throws LoaderConfigurationFileException,
                              com.rs.lic.LicenseVerificationException

      Creates a loader engine and loads the configuration file for this engine.
      Parameters:
        `configFile` - the config file
        `initialLoaders` - the initial loaders
        `bCreateMasterLoader` - the b create master loader
        `loaderProperties` - the loader properties
      Throws:
        `LoaderConfigurationFileException` - the loader configuration file exception
        `com.rs.lic.LicenseVerificationException` - the license verification exception

  - ### Method Detail

    - #### getProcessor

          public net.sf.saxon.s9api.Processor getProcessor()

      Gets the processor.
      Returns:
        the processor

    - #### getDTSs

          public java.util.Iterator<DTSContainer> getDTSs()

      Returns an iterator over all DTSs loaded in this engine.
      Returns:
        Iterator

    - #### getLoader

          public Loader getLoader(DTSContainer dts)
                           throws LoaderConfigurationFileException

      Returns a loader from the engine. Loaders are thread safe (one loader per thread) and can be reused. Normal applications should use load(Source) method A call to releaseLoader MUST be done before the loader is liberated
      Parameters:
        `dts` - the dts
      Returns:
        Loader
      Throws:
        `LoaderConfigurationFileException` - the loader configuration file exception

    - #### getMasterLoader

          public Loader getMasterLoader(DTSContainer dts)
                                 throws LoaderException,
                                        LoaderConfigurationFileException

      Access to the master loader. A master loader is a loader used by GUIs so properties of the loader can be set and tested.
      Parameters:
        `dts` - the dts
      Returns:
        Loader
      Throws:
        `LoaderException` - the loader exception
        `LoaderConfigurationFileException` - the loader configuration file exception

    - #### releaseLoader

          public void releaseLoader(Loader l,
                           DTSContainer dts)
                             throws LoaderException

      Liberates a loader so it can be used by other threads. The loader remains initialized. Normal applications should use load(Source) method
      Parameters:
        `l` - the l
        `dts` - the dts
      Throws:
        `LoaderException` - the loader exception

    - #### setURI

          public void setURI(java.net.URI newURI)

      Changes or sets this URI new config file.
      Parameters:
        `newURI` - URI

    - #### load

          public java.lang.Object[] load(XBRLInstance instance,
                                DTSContainer dts)
                                  throws LoaderException

      Executes the mapping defined in the configuration file. In this case the XBRLDataTarget(s) involved will receive the input parameters before start.
      Parameters:
        `instance` - document input to be sent. No DTS Checking is performed
        `dts` - is the DTS of this loader that is compatible with the instance DTS container.
      Returns:
        Object[]
      Throws:
        `LoaderException` - the loader exception

    - #### load

          public java.lang.Object[] load(javax.xml.transform.Source xmlSource)
                                  throws LoaderException

      Executes the mapping defined in the configuration file. In this case the XBRLDataTarget(s) involved will receive the input parameters before start.
      Parameters:
        `xmlSource` - input source of the instance document
      Returns:
        Object[]
      Throws:
        `LoaderException` - the loader exception

    - #### migrateConfigFile

          public void migrateConfigFile(XBRLInstance versioningReport,
                               java.net.URI outputReportUri,
                               java.net.URI newConfigFileUri)
                                 throws LoaderException

      Migrates a configuration file from using a DTS to using a new DTS with information from an XBRL versioning report.
      Parameters:
        `versioningReport` - XBRLInstance the versioning report describing the changes between the two DTSs
        `outputReportUri` - where the report about the migration process will be serailized
        `newConfigFileUri` - the URI for the new configuration file
      Throws:
        `LoaderException` - the loader exception

    - #### createLoaderFromMapper

          public static void createLoaderFromMapper(java.lang.String mapperTemplateFile,
                                    java.lang.String loaderTemplateFile,
                                    java.lang.String transformerConfigFile,
                                    java.lang.String driverClassName,
                                    java.lang.String driverConfFile)
                                             throws MapConfigurationFileException

      Creates the loader from mapper.
      Parameters:
        `mapperTemplateFile` - the mapper template file
        `loaderTemplateFile` - the loader template file
        `transformerConfigFile` - the transformer config file
        `driverClassName` - the driver class name
        `driverConfFile` - the driver conf file
      Throws:
        `MapConfigurationFileException` - the map configuration file exception

    - #### writeConfigFile

          public void writeConfigFile()
                               throws LoaderException

      Write config file.
      Throws:
        `LoaderException` - the loader exception