Log4j 1.1b7

org.apache.log4j.examples.appserver
Class AppServerCategoryFactory

java.lang.Object
  |
  +--org.apache.log4j.examples.appserver.AppServerCategoryFactory
All Implemented Interfaces:
CategoryFactory

public class AppServerCategoryFactory
extends Object
implements CategoryFactory

Creates correctly populated instances of AppServerCategory. An attempt is made to determine the hostname using the java.net API. The other three attributes,

  1. server name
  2. component name
  3. version string

can be set via the constructor. All four attributes may be obtained and set through getters and setters.

Author:
Paul Glezen

Field Summary
protected  String component
          The name of the component using this factory.
protected  String hostname
          The hostname on which this factory resides.
protected  ResourceBundle messageBundle
          The message bundle to be used by AppServerCategory instances.
protected  String server
          The application server name for this factory.
protected  String version
          An identifier for this particular version/release.
 
Constructor Summary
AppServerCategoryFactory(String serverName, String componentName, String versionName)
          Construct a new AppServerCategoryFactory with the provided attributes.
 
Method Summary
 String getComponent()
          Get the name of the component for which this category is logging.
 String getHostname()
          Get the hostname of the machine on which this category is running.
 String getServer()
          Get the name of the server process in which this category is running.
 String getVersion()
          Get the version name of the component in which this category is running.
 Category makeNewCategoryInstance(String name)
          Create a new instance of AppServerCategory using the information contained in this instance.
 void setComponent(String component)
          Set the name of the component for which the category will be logging.
 void setHostname(String hostname)
          Set the host name of the component on which this category is running.
 void setMessageBundle(ResourceBundle bundle)
          Set the message bundle to be used for all Category objects created by this CatgoryFactory. param bundle a bundle of messages
 void setServer(String server)
          Set the name of the application server process in which this category is logging.
 void setVersion(String version)
          Set the version string for the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hostname

protected String hostname
The hostname on which this factory resides. This is determined dynamically using the java.net.InetAddress class.

server

protected String server
The application server name for this factory. This is particularly meaningful in a CORBA or EBJ application server environment.

component

protected String component
The name of the component using this factory.

version

protected String version
An identifier for this particular version/release.

messageBundle

protected ResourceBundle messageBundle
The message bundle to be used by AppServerCategory instances.
Constructor Detail

AppServerCategoryFactory

public AppServerCategoryFactory(String serverName,
                                String componentName,
                                String versionName)
Construct a new AppServerCategoryFactory with the provided attributes. An attempt is made to obtain the hostname from the java.net API.
Parameters:
categoryName - the name of the category.
serverName - the name of the server using this category. This may be null.
componentName - the name of the component using this category. This may be null.
versionName - the version identifier of the component. This may may be null.
Method Detail

getComponent

public String getComponent()
Get the name of the component for which this category is logging.
Returns:
the component name

getHostname

public String getHostname()
Get the hostname of the machine on which this category is running.
Returns:
the hostname

getServer

public String getServer()
Get the name of the server process in which this category is running.
Returns:
the server name

getVersion

public String getVersion()
Get the version name of the component in which this category is running.
Returns:
the version name

makeNewCategoryInstance

public Category makeNewCategoryInstance(String name)
Create a new instance of AppServerCategory using the information contained in this instance.
Specified by:
makeNewCategoryInstance in interface CategoryFactory

setComponent

public void setComponent(String component)
Set the name of the component for which the category will be logging.
Parameters:
component - name of component

setHostname

public void setHostname(String hostname)
Set the host name of the component on which this category is running. An attempt is made by the constructor to determine the hostname using the java.net API. Use this method only to override this determination.
Parameters:
hostname - the host name.

setMessageBundle

public void setMessageBundle(ResourceBundle bundle)
Set the message bundle to be used for all Category objects created by this CatgoryFactory. param bundle a bundle of messages

setServer

public void setServer(String server)
Set the name of the application server process in which this category is logging.
Parameters:
server - name of application server process.

setVersion

public void setVersion(String version)
Set the version string for the component.
Parameters:
version - version name of component

Log4j 1.1b7

Please notify me about new log4j releases.