oracle.cloud.scanning.spi.config.factory

## Class ConfigurationFactory

- java.lang.Object
- - oracle.cloud.scanning.spi.config.factory.ConfigurationFactory

-     public final class ConfigurationFactory
      extends Object

  A factory for creating instances of `IConfiguration`.

  This provides the entry point to use the whitelist configration API. `IClassConfiguration` `IFileConfiguration`

  It is recommended to cache the default configuration instances.

        Below is a sample usage
          ConfigurationFactory  factory = ConfigurationFactory.getInstance();
          IClassConfiguration config = factory.getDefaultClassConfiguration();
          // Please cache config for later use.
          Result  chk = config.checkClassAllowed("java.lang.ClassLoader");
          if (!chk.isAllowed()) {
           System.out.println(chk.getMessage());
          }

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T extends IConfiguration> T` | `getConfiguration(InputStream config, ConfigurationProvider<T> provider)` Generic method to get an implementation of `IConfiguration`
    `IClassConfiguration` | `getDefaultClassConfiguration()` A convenient method to get the instance of `IClassConfiguration`
    `<T extends IConfiguration> T` | `getDefaultConfiguration(ConfigurationProvider<T> provider)` Generic method to get an implementation of `IConfiguration` against the default configuration.
    `static InputStream` | `getDefaultConfigurationInputStream()` Returns inputstream to the default configuration file.
    `IFileConfiguration` | `getDefaultFileConfiguration()` A convenient method to get the instance of `IFileConfiguration`
    `static ConfigurationFactory` | `getInstance()` Returns the singleton instnace of the ConfigurationFactory

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

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

- - ### Method Detail

    - #### getDefaultConfigurationInputStream

          public static InputStream getDefaultConfigurationInputStream()

      Returns inputstream to the default configuration file.
      Returns:
        input stream to defauult whitelist configuration.

    - #### getInstance

          public static ConfigurationFactory getInstance()

      Returns the singleton instnace of the ConfigurationFactory
      Returns:
        the ConfigurationFactory instance

    - #### getDefaultFileConfiguration

          public IFileConfiguration getDefaultFileConfiguration()

      A convenient method to get the instance of `IFileConfiguration`

      It is recommended to cache the default configuration instance.

      Returns:
        instance of IFileConfiguration against the default configuration that is packaged in the api jar

    - #### getDefaultClassConfiguration

          public IClassConfiguration getDefaultClassConfiguration()

      A convenient method to get the instance of `IClassConfiguration`

      It is recommended to cache the default configuration instance.

      Returns:
        instance of IClassConfiguration against the default configuration that is packaged in the api jar

    - #### getConfiguration

          public <T extends IConfiguration> T getConfiguration(InputStream config,
                                                      ConfigurationProvider<T> provider)

      Generic method to get an implementation of `IConfiguration`

      This is to be used by the users who has extended `IConfiguration` and can provide a provider implementation of the configuration extension.

      Type Parameters:
        `T` - generic extension of `IConfiguration`
      Parameters:
        `config` - inputstream to the configuration content
        `provider` - provider that can provide the imppmentation of the IConfiguration extension
      Returns:
        the implementation of extension of IConfiguration

    - #### getDefaultConfiguration

          public <T extends IConfiguration> T getDefaultConfiguration(ConfigurationProvider<T> provider)

      Generic method to get an implementation of `IConfiguration` against the default configuration.

      This is to be used by the users who has extended `IConfiguration` and can provide a provider implementation of the configuration extension.

      It is recommended to cache the default configuration instance.

      Type Parameters:
        `T` - generic extension of `IConfiguration`
      Parameters:
        `provider` - provider that can provide the imppmentation of the IConfiguration extension
      Returns:
        the implementation of extension of IConfiguration

Copyright © 2018 Oracle. All rights reserved.