public class Globals
extends java.lang.Object
The class also controls properties. properties are only meant to be set and retrevied by core classes.
All properties are stored in the file b2c_config.xml which is located in the b2cHome directory. The location of that directory should be specified one of two ways:
The file must be in your classpath so that it can be loaded by Java's classloader.
All property names must be in the form prop.name - parts of the
name must be seperated by ".". The value can be any valid String, including
Strings with line breaks.
日志配置文件加载次序: 1. JNDI: java:comp/env/com/hynnet/logconfig/file ; 2. 系统变量 com.hynnet.logconfig.file ,系统变量 com.eggwifi.config.file ; 3. 配置文件 log.logConfig 的设置。
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
B2C_MAJOR_VERSION
The Major version number of B2C. i.e. 1.x.x
|
static int |
B2C_MINOR_VERSION
The Minor version number of B2C. i.e. x.1.x.
|
static java.lang.String |
B2C_PROPERTIES_FILENAME
B2C 属性配置文件,里面要加path属性才能支持属性的保存。
|
static int |
B2C_REVISION_VERSION
The revision version number of . i.e. x.x.1.
|
static long |
DAY
一天的毫秒数
|
static java.lang.String |
DEFAULT_PROVIDER_NAME
默认数据提供者名称。
|
static long |
HOUR
小时的毫秒数
|
protected static org.slf4j.Logger |
log |
static long |
MINUTE
分钟的毫秒数
|
static long |
SECOND
秒的毫秒数
|
static long |
WEEK
一周的毫秒数
|
| 构造器和说明 |
|---|
Globals() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
deleteProperty(java.lang.String name)
Deletes a property.
|
static java.lang.String |
formatDate(java.util.Date date)
Formats a Date object to return a date using the global locale.
|
static java.lang.String |
formatDateTime(java.util.Date date)
Formats a Date object to return a date and time using the global locale.
|
static java.util.List<java.lang.String> |
getAllAttribute(java.lang.String strPath,
java.lang.String strAttrName)
获取匹配指定路径的所有节点的属性值。
|
static java.lang.String |
getAttribute(java.lang.String name)
Returns a attribute.
|
static org.w3c.dom.Node |
getConfig()
获取配置根节点。
|
static java.lang.String |
getConfigFileName()
获取配置文件路径。
|
static org.w3c.dom.Node |
getDatabaseConfig()
获取数据库配置根节点。
|
static java.lang.String |
getDefaultXSL()
取默认XSL存放路径。
|
static java.lang.String |
getHome()
加载次序为先从系统属性中取b2cHome值,没有设置时从资源中取。
|
static java.util.Locale |
getLocale()
Returns the global Locale used by .
|
static long |
getLongKey(java.lang.String name)
取标识用的长整数字值。
|
static java.lang.String |
getProperty(java.lang.String name)
Returns a property.
|
static boolean |
getPropertyBoolean(java.lang.String strPathName,
boolean bDefaultValue)
取属性的boolean 型值。
|
static double |
getPropertyDouble(java.lang.String strPathName,
double dbDefaultValue)
取属性的Double型值。
|
static int |
getPropertyInt(java.lang.String strPathName,
int nDefaultValue)
取属性的int 型值。
|
static long |
getPropertyLong(java.lang.String strPathName,
long lDefaultValue)
取属性的long 型值。
|
static java.util.TimeZone |
getTimeZone()
Returns the global TimeZone used by .
|
static java.lang.String |
getTimeZoneId()
获取时区名称。
|
static java.lang.String |
getVersion()
Returns the version number of as a String. i.e. major.minor.revision
|
static boolean |
isAutoSaveModifyTime()
是否自动保存数据的最后修改时间。
|
static boolean |
isHomeReadable()
Indicates whether or not we have read access to the
b2cHome
directory. |
static boolean |
isHomeWritable()
Indicates whether or not we have write access to the
b2cHome directory. |
static boolean |
loadLogConfig(java.io.File config)
加载日志配置文件。
|
static void |
reloadLogConfig()
重新加载日志配置文件。
|
static void |
setAttribute(java.lang.String strName,
java.lang.String strValue)
设置参数属性值
Sets a attribute.
|
static void |
setHome(java.lang.String strHome)
设置b2cHome值。
|
static void |
setLocale(java.util.Locale newLocale)
Sets the global locale used by .
|
static void |
setProperty(java.lang.String name,
java.lang.String value)
设置属性值
Sets a property.
|
static void |
setTimeZone(java.util.TimeZone newTimeZone)
Sets the global time zone used by .
|
protected static final org.slf4j.Logger log
public static final long SECOND
public static final long MINUTE
public static final long HOUR
public static final long DAY
public static final long WEEK
public static final int B2C_MAJOR_VERSION
public static final int B2C_MINOR_VERSION
public static final int B2C_REVISION_VERSION
public static final java.lang.String B2C_PROPERTIES_FILENAME
public static final java.lang.String DEFAULT_PROVIDER_NAME
public static final java.lang.String getVersion()
public static java.util.Locale getLocale()
public static void setLocale(java.util.Locale newLocale)
g_locale - the global Locale for .public static java.util.TimeZone getTimeZone()
public static java.lang.String getTimeZoneId()
public static void setTimeZone(java.util.TimeZone newTimeZone)
public static java.lang.String formatDate(java.util.Date date)
public static java.lang.String formatDateTime(java.util.Date date)
public static java.lang.String getHome()
b2cHome directory.public static void setHome(java.lang.String strHome)
strHome - public static java.lang.String getDefaultXSL()
public static final boolean isAutoSaveModifyTime()
public static boolean isHomeReadable()
b2cHome
directory.public static boolean isHomeWritable()
b2cHome directory.public static org.w3c.dom.Node getConfig()
public static java.lang.String getConfigFileName()
public static org.w3c.dom.Node getDatabaseConfig()
public static java.lang.String getProperty(java.lang.String name)
name - the name of the property to return. 格式 xxx.xxxpublic static boolean getPropertyBoolean(java.lang.String strPathName,
boolean bDefaultValue)
strPathName - 要返回的属性名.bDefaultValue - 当指定名字的属性不存在或不是合法的boolean类型时返回的值.main方法的使用示例程序。public static double getPropertyDouble(java.lang.String strPathName,
double dbDefaultValue)
strPathName - 要返回的属性名.dbDefaultValue - 当指定名字的属性不存在或不是合法的double类型时返回的值.main方法的使用示例程序。public static int getPropertyInt(java.lang.String strPathName,
int nDefaultValue)
strPathName - 要返回的属性名.nDefaultValue - 当指定名字的属性不存在或不是合法的int类型时返回的值.main方法的使用示例程序。public static long getPropertyLong(java.lang.String strPathName,
long lDefaultValue)
strPathName - 要返回的属性名.lDefaultValue - 当指定名字的属性不存在或不是合法的int类型时返回的值.main方法的使用示例程序。public static void setProperty(java.lang.String name,
java.lang.String value)
name - the name of the property being set. 格式 xxx.xxxvalue - the value of the property being set.public static java.util.List<java.lang.String> getAllAttribute(java.lang.String strPath,
java.lang.String strAttrName)
strPath - 路径名,允许 允许 name1.name2@attr=attrValue.name3 strAttrName - 返回值的属性名称。main方法的使用示例程序。public static java.lang.String getAttribute(java.lang.String name)
name - the name of the attribute to return. 格式 xxx.xxxpublic static void setAttribute(java.lang.String strName,
java.lang.String strValue)
strName - the name of the attribute being set. 格式 xxx.xxxstrValue - the value of the attribute being set.public static long getLongKey(java.lang.String name)
name - Stringpublic static void deleteProperty(java.lang.String name)
name - the name of the property to delete.public static void reloadLogConfig()
public static boolean loadLogConfig(java.io.File config)
config - Copyright © 2001-2014 hynnet.com