Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29952
Added Files:
JobLoggingConfig.java
Log Message:
no message
--- NEW FILE: JobLoggingConfig.java ---
/*
* JobLoggingConfig.java
*
* Created on March 13, 2006, 7:01 PM
*
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
*/
package org.jmonks.batchserver.framework.config;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* JobLoggingConfig holds the list of loggers defined for this job. Each logger
* will be represented by the JobLoggerConfig object. Implementation of this class
* will be done by the classes defined in corresponding factories.
* </p>
* @author Suresh Pragada
* @version 1.0
* @since 1.0
*/
public abstract class JobLoggingConfig
{
/**
* Holds the list of JobLoggerConfig objects.
*/
private List loggerList=new ArrayList();
/**
* Gets the array of JobLoggerConfig objects defined for this job.
*
*/
public JobLoggerConfig[] getLoggers()
{
JobLoggerConfig[] returnConfigs=new JobLoggerConfig[this.loggerList.size()];
return (JobLoggerConfig[])this.loggerList.toArray(returnConfigs);
}
protected void addLogger(String loggerName,String loggerLevel)
{
JobLoggerConfig loggerConfig=new JobLoggerConfig(loggerName,loggerLevel);
this.loggerList.add(loggerConfig);
}
/**
* JobLoggerConfig holds the information of each logger defined for the job.
*/
public class JobLoggerConfig
{
/**
* Holds the logger name.
*/
private String loggerName=null;
/**
* Holds the logger level.
*/
private String loggerLevel=null;
/**
* Private constructor make sure only this class can create the instances of
* JobLoggerConfig. Sub classes should use addLogger method JobLoggingConfig
* to add the logger configuration.
*
* @param loggerName Logger name.
* @param loggerLevel Logger level.
*/
private JobLoggerConfig(String loggerName,String loggerLevel)
{
this.loggerName=loggerName;
this.loggerLevel=loggerLevel;
}
/**
* Returns the logger name.
*/
public String getLoggerName()
{
return this.loggerName;
}
/**
* Returns the logger level.
*/
public String getLoggerLevel()
{
return this.loggerLevel;
}
/**
* <p>
* Returns the string representation of JobLoggerConfig class in the format
* <br> {JobLoggerConfig [loggerName = value] [loggerLevel = value]}
* </p>
*
* @return Returns the string representation of JobLoggerConfig.
*/
public String toString()
{
StringBuffer stringValue=new StringBuffer("{JobLoggerConfig ");
stringValue.append("[loggerName = " + this.loggerName + "]");
stringValue.append("[loggerLevel = " + this.loggerLevel + "]");
stringValue.append("}");
return stringValue.toString();
}
}
/**
* <p>
* Returns the string representation of JobLoggingConfig class in the format
* <br> {JobLoggingConfig [loggerList = value]}
* </p>
*
* @return Returns the string representation of JobLoggingConfig.
*/
public String toString()
{
StringBuffer stringValue=new StringBuffer("{JobLoggingConfig ");
stringValue.append("[loggerList = " + this.loggerList + "]");
stringValue.append("}");
return stringValue.toString();
}
}
|