Package tigase.db.beans

## Class MDPoolConfigBean<A,​B extends MDPoolConfigBean<A,​B>>

- java.lang.Object
- - tigase.db.beans.MDPoolConfigBean<A,​B>

- All Implemented Interfaces:
    `ConfigurationChangedAware`, `Initializable`, `RegistrarBean`
  Direct Known Subclasses:
    `AuthUserRepositoryConfigBean`, `DataSourceBean.DataSourceMDConfigBean`

      public abstract class MDPoolConfigBean<A,​B extends MDPoolConfigBean<A,​B>>
      extends java.lang.Object
      implements Initializable, ConfigurationChangedAware, RegistrarBean

  Base class for configuration beans of `DataSourceBean`, `AuthRepositoryMDPoolBean` and `UserRepositoryMDPoolBean`
  Created by andrzej on 08.03.2016.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.lang.String` | `cls` |
    `protected MDPoolBean<A,​B>` | `mdPool` |
    `protected java.lang.String` | `name` |
    `protected java.lang.String` | `poolCls` |
    `protected int` | `poolSize` |
    `protected java.lang.String` | `uri` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MDPoolConfigBean()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `beanConfigurationChanged​(java.util.Collection<java.lang.String> changedFields)` | Method called when configuration was applied to bean.
    `protected A` | `getRepository()` |
    `protected java.lang.String` | `getRepositoryClassName()` | Get class name to initialize as repository
    `protected abstract java.lang.Class<? extends A>` | `getRepositoryIfc()` | Get interface to which instances initialized by this config bean must conform to.
    `protected abstract java.lang.String` | `getRepositoryPoolClassName()` | Get name of a pool which should be used if any.
    `protected java.lang.String` | `getUri()` |
    `void` | `initialize()` | Method will be called, when bean will be created, configured and ready to use.
    `protected abstract void` | `initRepository​(A repo)` | Method used to initialize provided instance
    `void` | `register​(Kernel kernel)` | Method called when bean is being registered allowing developer to programatically register other beans.
    `void` | `setInstances​(java.util.Set<A> instances)` |
    `void` | `setMdPool​(MDPoolBean<A,​B> mdPool)` |
    `void` | `setRepository​(A repo)` |
    `void` | `unloadOldBeans()` |
    `void` | `unregister​(Kernel kernel)` | Method called while bean is being unregistered.

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

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

- - ### Field Detail

    - #### cls

          @ConfigField(alias="repo-class",
                       desc="Class implementing repository",
                       allowAliasFromParent=false)
          protected java.lang.String cls

    - #### mdPool

          @Inject
          protected MDPoolBean<A,​B extends MDPoolConfigBean<A,​B>> mdPool

    - #### name

          @ConfigField(desc="Name (ie. domain)")
          protected java.lang.String name

    - #### poolCls

          @ConfigField(alias="pool-class",
                       desc="Class implementing repository pool",
                       allowAliasFromParent=false)
          protected java.lang.String poolCls

    - #### poolSize

          @ConfigField(alias="pool-size",
                       desc="Pool size",
                       allowAliasFromParent=false)
          protected int poolSize

    - #### uri

          @ConfigField(alias="repo-uri",
                       desc="URI for repository",
                       allowAliasFromParent=false,
                       type=JdbcUrl)
          protected java.lang.String uri

  - ### Constructor Detail

    - #### MDPoolConfigBean

          public MDPoolConfigBean()

  - ### Method Detail

    - #### beanConfigurationChanged

          public void beanConfigurationChanged​(java.util.Collection<java.lang.String> changedFields)

      Description copied from interface: `ConfigurationChangedAware`
      Method called when configuration was applied to bean.
      Specified by:
        `beanConfigurationChanged` in interface `ConfigurationChangedAware`
      Parameters:
        `changedFields` - collection of field names which were changed

    - #### unloadOldBeans

          public void unloadOldBeans()

    - #### initialize

          public void initialize()

      Description copied from interface: `Initializable`
      Method will be called, when bean will be created, configured and ready to use.
      Specified by:
        `initialize` in interface `Initializable`

    - #### register

          public void register​(Kernel kernel)

      Description copied from interface: `RegistrarBean`
      Method called when bean is being registered allowing developer to programatically register other beans.
      Specified by:
        `register` in interface `RegistrarBean`
      Parameters:
        `kernel` - - instance from local scope

    - #### unregister

          public void unregister​(Kernel kernel)

      Description copied from interface: `RegistrarBean`
      Method called while bean is being unregistered.
      Specified by:
        `unregister` in interface `RegistrarBean`
      Parameters:
        `kernel` - - instance from local scope

    - #### setInstances

          public void setInstances​(java.util.Set<A> instances)

    - #### setMdPool

          public void setMdPool​(MDPoolBean<A,​B> mdPool)

    - #### getRepositoryIfc

          protected abstract java.lang.Class<? extends A> getRepositoryIfc()

      Get interface to which instances initialized by this config bean must conform to.
      Returns:
        interface

    - #### getRepositoryPoolClassName

          protected abstract java.lang.String getRepositoryPoolClassName()
                                                                  throws DBInitException

      Get name of a pool which should be used if any.
      Returns:
        class name
      Throws:
        `DBInitException`

    - #### initRepository

          protected abstract void initRepository​(A repo)
                                          throws RepositoryException

      Method used to initialize provided instance
      Throws:
        `RepositoryException`

    - #### getRepositoryClassName

          protected java.lang.String getRepositoryClassName()
                                                     throws DBInitException

      Get class name to initialize as repository
      Throws:
        `DBInitException`

    - #### getUri

          protected java.lang.String getUri()

    - #### getRepository

          protected A getRepository()

    - #### setRepository

          public void setRepository​(A repo)