TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.hyades.logging.commons
Class FileLoggerFactory

java.lang.Object
  extended by org.apache.commons.logging.LogFactory
      extended by org.eclipse.hyades.logging.commons.FileLoggerFactory

public class FileLoggerFactory
extends org.apache.commons.logging.LogFactory

Implementation of the Apache Commons org.apache.commons.logging.LogFacotry abstract class which represents a proxy factory specific for org.eclipse.hyades.logging.commons.FileLogger instances.

This proxy factory is intended for use in multiple class loader environments where one or more different types of loggers and their factories are required for each separate class loader, all utilizing the same Apache Commons binaries. Alternatively, users may configure the default org.apache.commons.logging.LogFactory implementation to use the generate org.eclipse.hyades.logging.commons.FileLogger instances but all class loaders will be forced to use the org.eclipse.hyades.logging.commons.FileLogger instances.

An instance of this class will be returned from the static getFactory() API on the default org.apache.commons.logging.LogFactory implementation. The org.apache.commons.logging.LogFactory implementation uses the following discovery process to resolve the configured org.apache.commons.logging.LogFactory implementation within the caller's class loader:

1) Look for a system property named org.apache.commons.logging.LogFactory.

For example, ...-Dorg.apache.commons.logging.LogFactory=org.eclipse.hyades.logging.commons.FileLoggerFactory... - or - System.setProperty("org.apache.commons.logging.LogFactory","org.eclipse.hyades.logging.commons.FileLoggerFactory");

2) Use the JDK 1.3 JAR Services Discovery mechanism (see http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html) to look for a resource named META-INF/services/org.apache.commons.logging.LogFactory whose first line is assumed to contain the desired class name.

For example (META-INF/services/org.apache.commons.logging.LogFactory), org.eclipse.hyades.logging.commons.FileLoggerFactory

2) Look for a properties file named commons-logging.properties visible in the application class path, with a property named org.apache.commons.logging.LogFactory defining the desired implementation class name.

For example, org.apache.commons.logging.LogFactory=org.eclipse.hyades.logging.commons.FileLoggerFactory

NOTE: Although this proxy factory provides functionality for setting/getting/removing configuration attributes, no configuration attributes are used internally. As such, setting any configuration attributes will have no effect aside from containment purposes.

NOTE: The Apache Commons logging classes must be on the CLASSPATH at run-time to utilize this logging class

See Also:
LogFactory, FileLogger

Field Summary
 
Fields inherited from class org.apache.commons.logging.LogFactory
FACTORY_DEFAULT, FACTORY_PROPERTIES, FACTORY_PROPERTY
 
Constructor Summary
FileLoggerFactory()
          No-argument constructor.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Returns the configuration attribute with the specified non-null name, or null if no such named attribute exists.
 java.lang.String[] getAttributeNames()
          Returns an array containing the names of all currently defined configuration attributes.
 org.apache.commons.logging.Log getInstance(java.lang.Class classInstance)
          Convenience API which returns an instance of a named org.eclipse.hyades.logging.commons.FileLogger based on the name of the parameter class instance.
 org.apache.commons.logging.Log getInstance(java.lang.String loggerName)
          Returns an instance of a non-null named org.eclipse.hyades.logging.commons.FileLogger based on the parameter name.
 void release()
          Releases all cached org.eclipse.hyades.logging.commons.FileLogger instances created by this org.eclipse.hyades.logging.commons.FileLoggerFactory instance.
 void removeAttribute(java.lang.String name)
          Removes a configuration attribute with the specified non-null name.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set a configuration attribute with the specified non-null name.
 
Methods inherited from class org.apache.commons.logging.LogFactory
getFactory, getLog, getLog, release, releaseAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLoggerFactory

public FileLoggerFactory()
No-argument constructor.

Method Detail

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set a configuration attribute with the specified non-null name.

Passing a null name results in no action.

Passing a null value is equivalent to calling #removeAttribute(String).

Specified by:
setAttribute in class org.apache.commons.logging.LogFactory
Parameters:
name - The non-null name of the configuration attribute.
value - The value of the configuration attribute, or null to remove the named configuration attribute.
See Also:
LogFactory.setAttribute(java.lang.String, java.lang.Object)

removeAttribute

public void removeAttribute(java.lang.String name)
Removes a configuration attribute with the specified non-null name.

Passing a null name results in a no-operation.

Specified by:
removeAttribute in class org.apache.commons.logging.LogFactory
Parameters:
name - The non-null name of the configuration attribute to be removed.
See Also:
LogFactory.removeAttribute(java.lang.String)

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the configuration attribute with the specified non-null name, or null if no such named attribute exists.

Passing a null name results in a null return value.

Specified by:
getAttribute in class org.apache.commons.logging.LogFactory
Parameters:
name - Name of the requested configuration attribute.
Returns:
The requested configuration attribute, or null if no such named attribute exists
See Also:
LogFactory.getAttribute(java.lang.String)

getAttributeNames

public java.lang.String[] getAttributeNames()
Returns an array containing the names of all currently defined configuration attributes. If there are no configuration attributes, a zero length array is returned.

Specified by:
getAttributeNames in class org.apache.commons.logging.LogFactory
Returns:
The array of configuration attribute names, otherwise a zero length array.
See Also:
LogFactory.getAttributeNames()

getInstance

public org.apache.commons.logging.Log getInstance(java.lang.Class classInstance)
                                           throws org.apache.commons.logging.LogConfigurationException
Convenience API which returns an instance of a named org.eclipse.hyades.logging.commons.FileLogger based on the name of the parameter class instance.

An instance of a named org.eclipse.hyades.logging.commons.FileLogger is created if no named instance current exists or all instances have been released.

Once a named org.eclipse.hyades.logging.commons.FileLogger is created, the instance is cached for future calls to retrieve the same named org.eclipse.hyades.logging.commons.FileLogger.

The name of the org.eclipse.hyades.logging.commons.FileLogger uniquely identifies an instance of an org.eclipse.hyades.logging.commons.FileLogger. All subsequent calls will return the same instance of the named org.eclipse.hyades.logging.commons.FileLogger.

Specified by:
getInstance in class org.apache.commons.logging.LogFactory
Parameters:
classInstance - Class instance used to derive the name of the returned org.eclipse.hyades.logging.commons.FileLogger instance.
Returns:
A named org.eclipse.hyades.logging.commons.FileLogger instance.
Throws:
org.apache.commons.logging.LogConfigurationException - if the named org.eclipse.hyades.logging.commons.FileLogger instance could not be created.
See Also:
LogFactory.getInstance(java.lang.Class), getInstance(String)

getInstance

public org.apache.commons.logging.Log getInstance(java.lang.String loggerName)
                                           throws org.apache.commons.logging.LogConfigurationException
Returns an instance of a non-null named org.eclipse.hyades.logging.commons.FileLogger based on the parameter name.

Passing a null logger name results in a null return value.

An instance of a named org.eclipse.hyades.logging.commons.FileLogger is created if no named instance current exists or all instances have been released.

Once a named org.eclipse.hyades.logging.commons.FileLogger is created, the instance is cached for future calls to retrieve the same named org.eclipse.hyades.logging.commons.FileLogger.

The name of the org.eclipse.hyades.logging.commons.FileLogger uniquely identifies an instance of an org.eclipse.hyades.logging.commons.FileLogger. All subsequent calls will return the same instance of the named org.eclipse.hyades.logging.commons.FileLogger.

Specified by:
getInstance in class org.apache.commons.logging.LogFactory
Parameters:
loggerName - The non-null name of the returned org.eclipse.hyades.logging.commons.FileLogger instance.
Returns:
A named org.eclipse.hyades.logging.commons.FileLogger instance, otherwise null if the parameter logger name is null.
Throws:
org.apache.commons.logging.LogConfigurationException - if the named org.eclipse.hyades.logging.commons.FileLogger instance could not be created.
See Also:
LogFactory.getInstance(java.lang.String)

release

public void release()
Releases all cached org.eclipse.hyades.logging.commons.FileLogger instances created by this org.eclipse.hyades.logging.commons.FileLoggerFactory instance.

All cached org.eclipse.hyades.logging.commons.FileLogger are de-registered (e.g. org.eclipse.hyades.logging.commons.FileLogger#finalize() before being released.

Specified by:
release in class org.apache.commons.logging.LogFactory
See Also:
LogFactory.release()

TPTP 4.5.0 Platform Project
Public API Specification