Class PoolMode


  • public class PoolMode
    extends java.lang.Object
    This class determines at runtime which implementing class to use as a Pool Handle. It uses the reflection package of java to dynamically load a class. The class to be loaded is specified by the vds.pool.mode property.
    Version:
    $Revision$
    Author:
    Karan Vahi, Gaurang Mehta
    • Constructor Summary

      Constructors 
      Constructor Description
      PoolMode()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String getImplementingClass​(java.lang.String readMode)
      Given a string readMode returns the name of the class that implements that read mode.
      static java.lang.String getMethodName​(int lMode)
      Its returns the name of the method that needs to be invoked to get the object of the implementing pool class.
      static int getValue​(java.lang.String readMode)
      Deprecated. 
      private static PoolInfoProvider loadPoolInstance​(java.lang.String poolClass, int lMode, java.lang.Object[] argList)
      Loads the appropriate class that implements a particular pool mode using the reflection package in java at runtime.
      static PoolInfoProvider loadPoolInstance​(java.lang.String poolClass, java.lang.String poolProvider, int lMode)
      Loads the pool info provider class using the reflection package in java at runtime.
      static PoolInfoProvider loadPoolInstance​(java.lang.String poolClass, java.lang.String poolProvider, java.lang.String propFileName, int lMode)
      Loads the pool info provider class using the reflection package in java at runtime.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SINGLETON_LOAD

        public static final int SINGLETON_LOAD
        Constants to specify how to load the class, as singleton or non singleton.
        See Also:
        Constant Field Values
      • SINGLE_READ

        public static final java.lang.String SINGLE_READ
        Constants for single read.
        See Also:
        Constant Field Values
      • MULTIPLE_READ

        public static final java.lang.String MULTIPLE_READ
        Constants for multiple read.
        See Also:
        Constant Field Values
      • XML_READ_VALUE

        public static final int XML_READ_VALUE
        Constants for xml pool read.
        See Also:
        Constant Field Values
      • TEXT_READ_VALUE

        public static final int TEXT_READ_VALUE
        Constants for multiline text pool read.
        See Also:
        Constant Field Values
      • UNDEFINED_READ_VALUE

        public static final int UNDEFINED_READ_VALUE
        Constants for mode not defined.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PoolMode

        public PoolMode()
    • Method Detail

      • getImplementingClass

        public static java.lang.String getImplementingClass​(java.lang.String readMode)
        Given a string readMode returns the name of the class that implements that read mode. If the readMode doesnt equal any of the predefined constants then the value of readMode is taken as the name of the implementing class.
        Parameters:
        readMode - The String form of the read mode, got from the property vds.pool.mode.
        Returns:
        the corresponding int value of the mode. If not found then null
      • loadPoolInstance

        public static PoolInfoProvider loadPoolInstance​(java.lang.String poolClass,
                                                        java.lang.String poolProvider,
                                                        int lMode)
        Loads the pool info provider class using the reflection package in java at runtime. The class is loaded as a singleton or a non-singleton dependant on the parameter passed. The properties file that is picked up is the default properties file from $PEGASUS_HOME/etc directory.
        Parameters:
        poolClass - the name of the class that resides in the package named PoolMode.PACKAGE_NAME or the complete name of the class including the package name.
        poolProvider - the path to the file, that contains the pool configuration in the appropriate format that the implementing poolClass understands.
        lMode - the loading mode of the class. It specifies whether the singleton object of the class needs to be loaded or the non singleton instance.
        Returns:
        the object corresponding to the pool info provider class.
      • loadPoolInstance

        public static PoolInfoProvider loadPoolInstance​(java.lang.String poolClass,
                                                        java.lang.String poolProvider,
                                                        java.lang.String propFileName,
                                                        int lMode)
        Loads the pool info provider class using the reflection package in java at runtime. The class is loaded as a singleton or a non-singleton dependant on the parameter passed.
        Parameters:
        poolClass - the name of the class that resides in the package named PoolMode.PACKAGE_NAME or the complete name of the class including the package name.
        poolProvider - the path to the file, that contains the pool configuration in the appropriate format that the implementing poolClass understands.
        propFileName - name of the properties file to picked from $PEGASUS_HOME/etc/ directory. For the singleton loading only the default file is picked up.
        lMode - the loading mode of the class. It specifies whether the singleton object of the class needs to be loaded or the non singleton instance.
        Returns:
        the object corresponding to the pool info provider class.
      • getMethodName

        public static java.lang.String getMethodName​(int lMode)
        Its returns the name of the method that needs to be invoked to get the object of the implementing pool class. It determines the method name on the basis of the value of the loading mode specified.
        Parameters:
        lMode - the loading mode of the class. It specifies whether the singleton object of the class needs to be loaded or the non singleton instance.
        Returns:
        the name of the method that needs to be invoked.
      • loadPoolInstance

        private static PoolInfoProvider loadPoolInstance​(java.lang.String poolClass,
                                                         int lMode,
                                                         java.lang.Object[] argList)
                                                  throws FactoryException
        Loads the appropriate class that implements a particular pool mode using the reflection package in java at runtime.
        Parameters:
        poolClass - String
        lMode - the loading mode of the class. It specifies whether the singleton object of the class needs to be loaded or the non singleton instance.
        argList - Object[]
        Returns:
        PoolInfoProvider
        Throws:
        FactoryException - that nests any error that might occur during the instantiation of the implementation.
      • getValue

        public static int getValue​(java.lang.String readMode)
        Deprecated.
        given a string Mode returns the corresponding int value
        Parameters:
        readMode - The String form of the read mode
        Returns:
        the corresponding int value of the mode. If not found then null