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 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 String`
  `cls`
  `protected MDPoolBean<A,B>`
  `mdPool`
  `protected String`
  `name`
  `protected String`
  `poolCls`
  `protected int`
  `poolSize`
  `protected String`
  `uri`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MDPoolConfigBean()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `beanConfigurationChanged(Collection<String> changedFields)`
  Method called when configuration was applied to bean.
  `protected A`
  `getRepository()`
  `protected String`
  `getRepositoryClassName()`
  Get class name to initialize as repository
  `protected abstract Class<? extends A>`
  `getRepositoryIfc()`
  Get interface to which instances initialized by this config bean must conform to.
  `protected abstract String`
  `getRepositoryPoolClassName()`
  Get name of a pool which should be used if any.
  `protected 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(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 Details

  - ### cls

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

  - ### mdPool

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

  - ### name

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

  - ### poolCls

    @ConfigField(alias="pool-class", desc="Class implementing repository pool", allowAliasFromParent=false) protected 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 String uri

- ## Constructor Details

  - ### MDPoolConfigBean

    public MDPoolConfigBean()

- ## Method Details

  - ### beanConfigurationChanged

    public void beanConfigurationChanged(Collection<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(Set<A> instances)

  - ### setMdPool

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

  - ### getRepositoryIfc

    protected abstract Class<? extends A> getRepositoryIfc()
    Get interface to which instances initialized by this config bean must conform to.
    Returns:
      interface

  - ### getRepositoryPoolClassName

    protected abstract 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 String getRepositoryClassName() throws DBInitException
    Get class name to initialize as repository
    Throws:
      `DBInitException`

  - ### getUri

    protected String getUri()

  - ### getRepository

    protected A getRepository()

  - ### setRepository

    public void setRepository(A repo)