org.osesb.utilities.compression
Class CompressionServiceFactory

java.lang.Object
  extended by org.osesb.utilities.compression.CompressionServiceFactory

public class CompressionServiceFactory
extends java.lang.Object

Factory for creating NEW instances of ICompressionService.

Since:
Version .9

Field Summary
static java.lang.String COMPRESSION_SERVICE_CLASS_PROPERTY
          The name of the system property used to set the ICompressionService implementation class name.
static java.lang.String COMPRESSION_SERVICE_PROPERTIES_FILE
          The name of the properties file to search for.
protected static CompressionServiceFactory compressionFactory
          Singleton pattern - thread-safe construction of the factory.
protected static boolean debugFlag
          debugFlag.
static java.lang.String DEFAULT_COMPRESSION_SERVICE_CLASS
          The fully qualified class name of the default ICompressionService implementation.
protected static org.apache.commons.logging.Log log
          The logging implementation for this class.
protected static java.lang.String thisClassName
          The full name of this class
 
Constructor Summary
protected CompressionServiceFactory()
          Protected constructor -- singleton pattern.
 
Method Summary
 ICompressionService getCompressionService()
          Construct and return a new instance of ICompressionService, using the following ordered lookup:

1.

static CompressionServiceFactory getInstance()
          Singleton pattern - returns the instance of this class.
static void main(java.lang.String[] args)
          main() - For Testing and sandboxing.
 void setDebugFlag(boolean theDebugFlag)
          Sets the debugFlag for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
The logging implementation for this class.


compressionFactory

protected static CompressionServiceFactory compressionFactory
Singleton pattern - thread-safe construction of the factory.


thisClassName

protected static java.lang.String thisClassName
The full name of this class


COMPRESSION_SERVICE_CLASS_PROPERTY

public static final java.lang.String COMPRESSION_SERVICE_CLASS_PROPERTY
The name of the system property used to set the ICompressionService implementation class name.

See Also:
Constant Field Values

DEFAULT_COMPRESSION_SERVICE_CLASS

public static final java.lang.String DEFAULT_COMPRESSION_SERVICE_CLASS
The fully qualified class name of the default ICompressionService implementation.

See Also:
Constant Field Values

COMPRESSION_SERVICE_PROPERTIES_FILE

public static final java.lang.String COMPRESSION_SERVICE_PROPERTIES_FILE
The name of the properties file to search for. The properties file has a key that is equal to COMPRESSION_SERVICE_CLASS_PROPERTY.

See Also:
Constant Field Values

debugFlag

protected static boolean debugFlag
debugFlag.

Constructor Detail

CompressionServiceFactory

protected CompressionServiceFactory()
Protected constructor -- singleton pattern.

Method Detail

getInstance

public static CompressionServiceFactory getInstance()
Singleton pattern - returns the instance of this class. Callers can then call getCompressionService() to get the configured implementation of ICompressionService.


getCompressionService

public ICompressionService getCompressionService()
                                          throws java.lang.Exception
Construct and return a new instance of ICompressionService, using the following ordered lookup:

1. The System Property defined by COMPRESSION_SERVICE_CLASS_PROPERTY is used to determine the implementation class.

2. The config/compression-service-factory.properties file is used to determine the implementation class.

3. The default implementation class (DEFAULT_COMPRESSION_SERVICE_CLASS) is loaded.

Returns:
the configured ICompressionService implementation.
Throws:
java.lang.Exception - if the ICompressionService implementation cannot be instantiated.

setDebugFlag

public void setDebugFlag(boolean theDebugFlag)
Sets the debugFlag for this object.

Parameters:
theDebugFlag - The debugFlag for this object.

main

public static void main(java.lang.String[] args)
main() - For Testing and sandboxing.