org.griphyn.cPlanner.poolinfo
Class PoolMode

java.lang.Object
  extended by org.griphyn.cPlanner.poolinfo.PoolMode

public class PoolMode
extends 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: 50 $
Author:
Karan Vahi, Gaurang Mehta

Field Summary
private static LogManager mLogger
           
static String MULTIPLE_READ
          Constants for multiple read.
static int NON_SINGLETON_LOAD
           
static String PACKAGE_NAME
           
static String SINGLE_READ
          Constants for single read.
static int SINGLETON_LOAD
          Constants to specify how to load the class, as singleton or non singleton.
static String TEXT_READ_CLASS
           
static int TEXT_READ_VALUE
          Constants for multiline text pool read.
static int UNDEFINED_READ_VALUE
          Constants for mode not defined.
static String XML_READ_CLASS
           
static int XML_READ_VALUE
          Constants for xml pool read.
 
Constructor Summary
PoolMode()
           
 
Method Summary
static String getImplementingClass(String readMode)
          Given a string readMode returns the name of the class that implements that read mode.
static 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(String readMode)
          Deprecated.  
private static PoolInfoProvider loadPoolInstance(String poolClass, int lMode, Object[] argList)
          Loads the appropriate class that implements a particular pool mode using the reflection package in java at runtime.
static PoolInfoProvider loadPoolInstance(String poolClass, String poolProvider, int lMode)
          Loads the pool info provider class using the reflection package in java at runtime.
static PoolInfoProvider loadPoolInstance(String poolClass, String poolProvider, 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

NON_SINGLETON_LOAD

public static final int NON_SINGLETON_LOAD
See Also:
Constant Field Values

SINGLE_READ

public static final String SINGLE_READ
Constants for single read.

See Also:
Constant Field Values

MULTIPLE_READ

public static final 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

XML_READ_CLASS

public static final String XML_READ_CLASS
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

TEXT_READ_CLASS

public static final String TEXT_READ_CLASS
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

PACKAGE_NAME

public static final String PACKAGE_NAME
See Also:
Constant Field Values

mLogger

private static LogManager mLogger
Constructor Detail

PoolMode

public PoolMode()
Method Detail

getImplementingClass

public static String getImplementingClass(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(String poolClass,
                                                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(String poolClass,
                                                String poolProvider,
                                                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 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(String poolClass,
                                                 int lMode,
                                                 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(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


Copyright © 2007 The University of Southern California. All Rights Reserved.