📄 tablibconfig.java
字号:
package jsp.tags.dapact.conf;
import java.io.*;
import java.util.*;
/**
* Title: Data Aware Processing And Control Tags
* Description: Tag library for the processing and controlling the input and output of data.
* Copyright: LGPL (http://www.gnu.org/copyleft/lesser.html)
* Compile Date: @compile_date@
* @author Allen M Servedio
* @amp_sign@version @VERSION@
*/
/**
* Class implements reading and processing of configuration file for system.
*/
public class TablibConfig
{
/**
* Interface that defines property files that this class uses.
*/
public interface PropertyFiles
{
/**
* Defines the properties for the fully qualified class names.
*/
public static final String FULLY_QUALIFIED_CLASS_PROPS = "FullyQualifiedClass.properties";
}
/**
* Default constructor.
*/
private TablibConfig()
{
}
/**
* Returns a property list of name-value pairs listing fully qualified class names
* (value) that can be looked up by a name.
*
* @return properties listing the name-value pairs for this property file.
*
* @exception IOException thrown when there is a problem reading the property file.
*/
public static Properties getFullyQualifiedClassTable() throws IOException
{
if (propFullyQualifiedClassTable == null)
{
throw new IOException(propFullyQualifiedClassTableMsg);
}
return propFullyQualifiedClassTable;
}
/**
* This will hold any error messages created while trying to load the fully
* qualified class table.
*/
private static String propFullyQualifiedClassTableMsg;
/**
* Try to initialize the fully qualified class table in a thread safe way (ie. while
* the class is being loaded).
*/
private static Properties propFullyQualifiedClassTable;
static
{
try
{
InputStream in = Class.forName("jsp.tags.dapact.conf.TablibConfig").getResourceAsStream(PropertyFiles.FULLY_QUALIFIED_CLASS_PROPS);
if (in != null)
{
try
{
try
{
propFullyQualifiedClassTable = new Properties();
propFullyQualifiedClassTable.load(in);
}
finally
{
in.close();
}
}
catch (IOException e)
{
propFullyQualifiedClassTable = null;
// If it could not create the property table, create a message saying so.
propFullyQualifiedClassTableMsg = "Unable to load the following properties file from the directory containing the jsp.tags.dapact.conf.TablibConfig class:"
+ PropertyFiles.FULLY_QUALIFIED_CLASS_PROPS + " because " + e.toString();
UserClassFactory.getLogger().log("The following exception occurred while trying to load the fully qualified class table.", e);
}
}
}
catch (ClassNotFoundException e)
{
propFullyQualifiedClassTableMsg = "Unable to find class jsp.tags.dapact.conf.TablibConfig in class path.";
}
}
/**
* For testing...
*/
public static void main(String[] args)
{
try
{
Properties prop = getFullyQualifiedClassTable();
Enumeration names = prop.propertyNames();
if (names != null)
{
while (names.hasMoreElements())
{
String name = (String)names.nextElement();
System.out.println(name + " = " + prop.getProperty(name));
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -