org.appng.api.support

## Class ApplicationConfigProviderImpl

- java.lang.Object
- - org.appng.api.support.ApplicationConfigProviderImpl

- All Implemented Interfaces:
    Closeable, AutoCloseable, ApplicationConfigProvider

      public class ApplicationConfigProviderImpl
      extends Object
      implements ApplicationConfigProvider

  Default `ApplicationConfigProvider`-implementation.
  Author:
    Matthias Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.appng.api.support.ApplicationConfigProviderImpl.ActionMap` | `actionMap`
    `protected org.appng.api.support.ApplicationConfigProviderImpl.DataSourceMap` | `datasourceMap`
    `protected List<Object[]>` | `descendantDatasources`
    `protected org.appng.api.support.ApplicationConfigProviderImpl.EventMap` | `eventMap`
    `protected org.appng.api.support.ApplicationConfigProviderImpl.PageMap` | `pageMap`
    `protected Map<String,String>` | `resourceMap`
    `protected ApplicationRootConfig` | `rootConfig`
    `protected ConfigValidator` | `validator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ApplicationConfigProviderImpl(MarshallService marshallService, String applicationName, Resources applicationResources, boolean devMode)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `clear()`
    `ApplicationConfigProvider` | `cloneConfig(MarshallService marshallService)` Clones this `ApplicationConfigProvider`, which is necessary because the
    `void` | `close()`
    `Action` | `getAction(String eventId, String actionId)` Returns the `Action` with the given `actionId`, which belongs to the `Event` with the given `eventId`.
    `Map<String,Action>` | `getActions(String eventId)` Returns a map of all `Action`s for the `Event` with the given id, using the id as the key.
    `ApplicationInfo` | `getApplicationInfo()` Returns the `ApplicationInfo` for the `Application`, parsed from `application-info.xml`
    `ApplicationRootConfig` | `getApplicationRootConfig()` Returns the `ApplicationRootConfig`.
    `Datasource` | `getDatasource(String id)` Returns the `Datasource` with the given id, if present.
    `Map<String,Datasource>` | `getDataSources()` Returns a map of all `Datasource`s, using the id as the key.
    `String` | `getDefaultPage()` Returns the id of the default-page, which is the `PageDefinition` with the type '`index`'.
    `Event` | `getEvent(String id)` Returns the `Event` with the given id, if present.
    `Set<String>` | `getEventIds()` Returns all ids from all known `Event`s
    `PageDefinition` | `getPage(String id)` Returns the `PageDefinition` with the given id, if present.
    `Map<String,PageDefinition>` | `getPages()` Returns a map of all `PageDefinition`s, using the id as the key.
    `String` | `getResourceNameForApplicationRootConfig()` Returns the name of the `Resource` where the `ApplicationRootConfig` was defined.
    `String` | `getResourceNameForDataSource(String datasourceId)` Returns the name of the `Resource` where the `Datasource` with the given id was defined.
    `String` | `getResourceNameForEvent(String eventId)` Returns the name of the `Resource` where the `Event` with the given id was defined.
    `String` | `getResourceNameForPage(String pageId)` Returns the name of the `Resource` where the `PageDefinition` with the given id was defined.
    `Resources` | `getResources()`
    `Set<String>` | `getSessionParams()`
    `void` | `setDefaultPage(String defaultPage)`
    `void` | `setSessionParams(Set<String> sessionParams)`

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

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

- - ### Field Detail

    - #### actionMap

          protected org.appng.api.support.ApplicationConfigProviderImpl.ActionMap actionMap

    - #### datasourceMap

          protected org.appng.api.support.ApplicationConfigProviderImpl.DataSourceMap datasourceMap

    - #### pageMap

          protected org.appng.api.support.ApplicationConfigProviderImpl.PageMap pageMap

    - #### eventMap

          protected org.appng.api.support.ApplicationConfigProviderImpl.EventMap eventMap

    - #### resourceMap

          protected Map<String,String> resourceMap

    - #### descendantDatasources

          protected List<Object[]> descendantDatasources

    - #### validator

          protected ConfigValidator validator

    - #### rootConfig

          protected ApplicationRootConfig rootConfig

  - ### Constructor Detail

    - #### ApplicationConfigProviderImpl

          public ApplicationConfigProviderImpl(MarshallService marshallService,
                                               String applicationName,
                                               Resources applicationResources,
                                               boolean devMode)
                                        throws InvalidConfigurationException

      Throws:
        `InvalidConfigurationException`

  - ### Method Detail

    - #### getDataSources

          public Map<String,Datasource> getDataSources()

      Description copied from interface: `ApplicationConfigProvider`
      Returns a map of all `Datasource`s, using the id as the key.
      Specified by:
        `getDataSources` in interface `ApplicationConfigProvider`
      Returns:
        a map of all `Datasource`s

    - #### clear

          protected void clear()

    - #### getAction

          public Action getAction(String eventId,
                                  String actionId)

      Description copied from interface: `ApplicationConfigProvider`
      Returns the `Action` with the given `actionId`, which belongs to the `Event` with the given `eventId`.
      Specified by:
        `getAction` in interface `ApplicationConfigProvider`
      Parameters:
        `eventId` - the id of the `Event`
        `actionId` - the id of the `Action`
      Returns:
        the `Action`, or `null` if there is no such `Event` or `Action`

    - #### getActions

          public Map<String,Action> getActions(String eventId)

      Description copied from interface: `ApplicationConfigProvider`
      Returns a map of all `Action`s for the `Event` with the given id, using the id as the key.
      Specified by:
        `getActions` in interface `ApplicationConfigProvider`
      Parameters:
        `eventId` - the id of the `Event` to get the `Action`s for
      Returns:
        a map of all `Action`s for the given `Event`, or `null` if there is no such event

    - #### getDatasource

          public Datasource getDatasource(String id)

      Description copied from interface: `ApplicationConfigProvider`
      Returns the `Datasource` with the given id, if present.
      Specified by:
        `getDatasource` in interface `ApplicationConfigProvider`
      Parameters:
        `id` - the id of the `Datasource` to get
      Returns:
        the `Datasource` with the given id, or `null` if no such `Datasource` exists

    - #### getDefaultPage

          public String getDefaultPage()

      Description copied from interface: `ApplicationConfigProvider`
      Returns the id of the default-page, which is the `PageDefinition` with the type '`index`'.
      Specified by:
        `getDefaultPage` in interface `ApplicationConfigProvider`
      Returns:
        the id of the default-page

    - #### getEvent

          public Event getEvent(String id)

      Description copied from interface: `ApplicationConfigProvider`
      Returns the `Event` with the given id, if present.
      Specified by:
        `getEvent` in interface `ApplicationConfigProvider`
      Parameters:
        `id` - the id of the `Event` to get
      Returns:
        the `Event` with the given id, or `null` if no such `Event` exists

    - #### getEventIds

          public Set<String> getEventIds()

      Description copied from interface: `ApplicationConfigProvider`
      Returns all ids from all known `Event`s
      Specified by:
        `getEventIds` in interface `ApplicationConfigProvider`
      Returns:

    - #### getPage

          public PageDefinition getPage(String id)

      Description copied from interface: `ApplicationConfigProvider`
      Returns the `PageDefinition` with the given id, if present.
      Specified by:
        `getPage` in interface `ApplicationConfigProvider`
      Parameters:
        `id` - the id of the `PageDefinition` to get
      Returns:
        the `PageDefinition` with the given id, or `null` if no such `PageDefinition` exists

    - #### getPages

          public Map<String,PageDefinition> getPages()

      Description copied from interface: `ApplicationConfigProvider`
      Returns a map of all `PageDefinition`s, using the id as the key.
      Specified by:
        `getPages` in interface `ApplicationConfigProvider`
      Returns:
        a map of all `PageDefinition`s

    - #### getApplicationRootConfig

          public ApplicationRootConfig getApplicationRootConfig()

      Description copied from interface: `ApplicationConfigProvider`
      Returns the `ApplicationRootConfig`.
      Specified by:
        `getApplicationRootConfig` in interface `ApplicationConfigProvider`
      Returns:
        the `ApplicationRootConfig`

    - #### getSessionParams

          public Set<String> getSessionParams()

    - #### setDefaultPage

          public void setDefaultPage(String defaultPage)

    - #### setSessionParams

          public void setSessionParams(Set<String> sessionParams)

    - #### getResourceNameForEvent

          public String getResourceNameForEvent(String eventId)

      Description copied from interface: `ApplicationConfigProvider`
      Returns the name of the `Resource` where the `Event` with the given id was defined.
      Specified by:
        `getResourceNameForEvent` in interface `ApplicationConfigProvider`
      Parameters:
        `eventId` - the id of the `Event`
      Returns:
        the name of the `Resource` where the `Event` with the given id was defined, or `null` if there is no such `Event`

    - #### getResourceNameForPage

          public String getResourceNameForPage(String pageId)

      Description copied from interface: `ApplicationConfigProvider`
      Returns the name of the `Resource` where the `PageDefinition` with the given id was defined.
      Specified by:
        `getResourceNameForPage` in interface `ApplicationConfigProvider`
      Parameters:
        `pageId` - the id of the `PageDefinition`
      Returns:
        the name of the `Resource` where the `PageDefinition` with the given id was defined, or `null` if there is no such `PageDefinition`

    - #### getResourceNameForDataSource

          public String getResourceNameForDataSource(String datasourceId)

      Description copied from interface: `ApplicationConfigProvider`
      Returns the name of the `Resource` where the `Datasource` with the given id was defined.
      Specified by:
        `getResourceNameForDataSource` in interface `ApplicationConfigProvider`
      Parameters:
        `datasourceId` - the id of the `Datasource`
      Returns:
        the name of the `Resource` where the `Datasource` with the given id was defined, or `null` if there is no such `Datasource`

    - #### getResourceNameForApplicationRootConfig

          public String getResourceNameForApplicationRootConfig()

      Description copied from interface: `ApplicationConfigProvider`
      Returns the name of the `Resource` where the `ApplicationRootConfig` was defined.
      Specified by:
        `getResourceNameForApplicationRootConfig` in interface `ApplicationConfigProvider`
      Returns:
        the name of the `Resource` where the `ApplicationRootConfig` was defined.

    - #### cloneConfig

          public ApplicationConfigProvider cloneConfig(MarshallService marshallService)
                                                throws InvalidConfigurationException

      Description copied from interface: `ApplicationConfigProvider`
      Clones this `ApplicationConfigProvider`, which is necessary because the
      Specified by:
        `cloneConfig` in interface `ApplicationConfigProvider`
      Parameters:
        `marshallService` - a `MarshallService` to read the configuration files, only needed if appNG is in development-mode
      Returns:
        a new ApplicationConfigProvider
      Throws:
        `InvalidConfigurationException` - if there is some configuration error inside the application

    - #### getApplicationInfo

          public ApplicationInfo getApplicationInfo()

      Description copied from interface: `ApplicationConfigProvider`
      Returns the `ApplicationInfo` for the `Application`, parsed from `application-info.xml`
      Specified by:
        `getApplicationInfo` in interface `ApplicationConfigProvider`
      Returns:
        the `ApplicationInfo`

    - #### getResources

          public Resources getResources()

      Specified by:
        `getResources` in interface `ApplicationConfigProvider`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `ApplicationConfigProvider`
      Throws:
        `IOException`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.