📄 textfileeventpropertyhandler.java
字号:
/** 僾儘僷僥傿僴儞僪儔傪弶婜壔偟傑偡丅
*
* @param params 弶婜僷儔儊乕僞
* @throws PropertyHandlerException 僾儘僷僥傿僴儞僪儔偺弶婜壔帪偵椺奜偑敪惗
*/
public void init(PropertyParam[] params) throws PropertyHandlerException {
String bundleName = null;
String fileDir = null;
String dynamic = null;
// 僷儔儊乕僞偺僷乕僗
for (int i = 0; i < params.length; i++) {
if (params[i]
.getName()
.equals(
DefaultEventPropertyHandler.DEFAULT_BUNDLE_NAME_PARAM)) {
// 儕僜乕僗僶儞僪儖偺僼傽僀儖柤偺応崌
bundleName = params[i].getValue();
} else if (params[i].getName().equals(PARAM_FILE_DIR)) {
// 僼傽僀儖僨傿儗僋僩儕偺応崌
fileDir = params[i].getValue();
} else if (params[i].getName().equals(PARAM_DYNAMIC)) {
// 嵞愝掕壜擻僼儔僌偺応崌
dynamic = params[i].getValue();
}
}
// 儕僜乕僗僶儞僪儖僾儗僼傿僢僋僗偺愝掕
if (bundleName == null) {
bundleName = DefaultEventPropertyHandler.DEFAULT_BUNDLE_NAME;
}
setBundlePrefix(bundleName);
// 嵞愝掕壜擻僼儔僌偺愝掕
Boolean dummyDynamic = new Boolean(dynamic);
setDynamic(dummyDynamic.booleanValue());
// 僾儘僷僥傿僼傽僀儖僨傿儗僋僩儕偺昁恵僠僃僢僋
if (fileDir == null) {
String message = null;
try {
message =
ResourceBundle
.getBundle("jp.co.intra_mart.framework.base.event.i18n")
.getString("TextFileEventPropertyHandler.param.FileDirNotFound");
} catch (MissingResourceException e) {
}
throw new PropertyHandlerException(
message + " : " + PARAM_FILE_DIR);
}
this.propertyFileDir = fileDir;
}
/**
* 僾儘僷僥傿僼傽僀儖偑偁傞僨傿儗僋僩儕傪愝掕偟傑偡丅
*
* @param propertyFileDir 僾儘僷僥傿僼傽僀儖偑偁傞僨傿儗僋僩儕
*
* @uml.property name="propertyFileDir"
*/
private void setPropertyFileDir(String propertyFileDir) {
this.propertyFileDir = propertyFileDir;
}
/**
* 僾儘僷僥傿僼傽僀儖偑偁傞僨傿儗僋僩儕傪庢摼偟傑偡丅
*
* @return 僾儘僷僥傿僼傽僀儖偑偁傞僨傿儗僋僩儕
*
* @uml.property name="propertyFileDir"
*/
private String getPropertyFileDir() {
return this.propertyFileDir;
}
/**
* 嵞愝掕壜擻乛晄壜擻傪愝掕偟傑偡丅
*
* @param dynamic true 嵞愝掕壜擻丄false 嵞愝掕晄壜
*
* @uml.property name="dynamic"
*/
private void setDynamic(boolean dynamic) {
this.dynamic = dynamic;
}
/**
* 僾儘僷僥傿偺摦揑撉傒崬傒偑壜擻偐偳偆偐挷傋傑偡丅
*
* @return true丗僾儘僷僥傿偺摦揑撉傒崬傒偑壜擻丄false丗僾儘僷僥傿偺摦揑撉傒崬傒晄壜
*/
public boolean isDynamic() {
return this.dynamic;
}
/**
* 僉乕偵奩摉偡傞僀儀儞僩偺僋儔僗柤傪庢摼偟傑偡丅
* 奩摉偡傞僀儀儞僩偑懚嵼偟側偄応崌丄null傪曉偟傑偡丅
*
* @param application 傾僾儕働乕僔儑儞
* @param key 僀儀儞僩偺僉乕
* @return 僀儀儞僩偺僋儔僗柤
* @throws EventPropertyException 僀儀儞僩偺僋儔僗柤偺庢摼偵幐攕
*/
public String getEventName(String application, String key)
throws EventPropertyException {
return ResourceBundleEventPropertyHandlerUtil.getEventName(
getResourceBundle(application),
application,
key);
}
/**
* 僉乕偵奩摉偡傞僀儀儞僩儕僗僫僼傽僋僩儕偺僋儔僗柤傪庢摼偟傑偡丅
*
* @param application 傾僾儕働乕僔儑儞
* @param key 僀儀儞僩儕僗僫僼傽僋僩儕偺僉乕
* @return 僀儀儞僩儕僗僫僼傽僋僩儕偺僋儔僗柤
* @throws EventPropertyException 僀儀儞僩儕僗僫僼傽僋僩儕偺僋儔僗柤偺庢摼偵幐攕
*/
public String getEventListenerFactoryName(String application, String key)
throws EventPropertyException {
return ResourceBundleEventPropertyHandlerUtil
.getEventListenerFactoryName(
getResourceBundle(application),
application,
key);
}
/**
* 僉乕偵奩摉偡傞僀儀儞僩儕僗僫僼傽僋僩儕偺弶婜僷儔儊乕僞傪庢摼偟傑偡丅
*
* @param application 傾僾儕働乕僔儑儞
* @param key 僀儀儞僩偺僉乕
* @return 僀儀儞僩儕僗僫僼傽僋僩儕偺弶婜僷儔儊乕僞
* @throws EventPropertyException 僀儀儞僩儕僗僫僼傽僋僩儕偺弶婜僷儔儊乕僞偺庢摼偵幐攕
*/
public EventListenerFactoryParam[] getEventListenerFactoryParams(
String application,
String key)
throws EventPropertyException {
return ResourceBundleEventPropertyHandlerUtil
.getEventListenerFactoryParams(
getResourceBundle(application),
application,
key);
}
/**
* 僉乕偵奩摉偡傞僀儀儞僩偺僀儀儞僩僩儕僈忣曬傪偡傋偰庢摼偟傑偡丅
* <CODE>application</CODE>偲<CODE>key</CODE>偱掕媊偝傟傞{@link EventTrigger}傪掕媊偝傟偨弴斣偱僜乕僩偟偨Collection偲偟偰庢摼偟傑偡丅
*
* @param application 傾僾儕働乕僔儑儞
* @param key 僀儀儞僩偺僉乕
* @return 僀儀儞僩僩儕僈忣曬偺僐儗僋僔儑儞
* @throws EventPropertyException 僀儀儞僩僩儕僈忣曬偺庢摼偵幐攕
* @see EventListener
*/
public Collection getEventTriggerInfos(String application, String key)
throws EventPropertyException {
Map infoCollections = null;
Collection infos = null;
if (isDynamic()) {
infos =
ResourceBundleEventPropertyHandlerUtil.getEventTriggerInfos(
getResourceBundle(application),
application,
key);
} else {
// 僉乕偵奩摉偡傞僀儀儞僩僩儕僈偺僐儗僋僔儑儞傪庢摼偡傞
synchronized (this.eventTriggers) {
infoCollections = (Map)getEventTriggers().get(application);
if (infoCollections == null) {
infoCollections = new HashMap();
getEventTriggers().put(application, infoCollections);
}
infos = (Collection)infoCollections.get(key);
if (infos == null) {
// 僀儀儞僩僩儕僈偺僐儗僋僔儑儞偑懚嵼偟側偄応崌怴偨偵庢摼偡傞
infos =
ResourceBundleEventPropertyHandlerUtil
.getEventTriggerInfos(
getResourceBundle(application),
application,
key);
// 怴婯偵惗惉偝傟偨僀儀儞僩僩儕僈孮傪搊榐偡傞
infoCollections.put(key, infos);
}
}
}
return infos;
}
/**
* 僉乕偵奩摉偡傞僀儀儞僩偺僀儀儞僩僩儕僈忣曬傪偡傋偰庢摼偟傑偡丅
* 偙偙偱庢摼偝傟傞僀儀儞僩僩儕僈偼僀儀儞僩偺張棟屻偵幚峴偝傟傑偡丅
* <CODE>application</CODE>偲<CODE>key</CODE>偱掕媊偝傟傞{@link EventTrigger}傪掕媊偝傟偨弴斣偱僜乕僩偟偨Collection偲偟偰庢摼偟傑偡丅
*
* @param application 傾僾儕働乕僔儑儞
* @param key 僀儀儞僩偺僉乕
* @return 僀儀儞僩僩儕僈忣曬偺僐儗僋僔儑儞
* @throws EventPropertyException 僀儀儞僩僩儕僈忣曬偺庢摼偵幐攕
* @see EventListener
*/
public Collection getPostEventTriggerInfos(String application, String key)
throws EventPropertyException {
Map infoCollections = null;
Collection infos = null;
if (isDynamic()) {
infos =
ResourceBundleEventPropertyHandlerUtil
.getPostEventTriggerInfos(
getResourceBundle(application),
application,
key);
} else {
// 僉乕偵奩摉偡傞僀儀儞僩僩儕僈偺僐儗僋僔儑儞傪庢摼偡傞
synchronized (this.eventTriggers) {
infoCollections = (Map)getPostEventTriggers().get(application);
if (infoCollections == null) {
infoCollections = new HashMap();
getPostEventTriggers().put(application, infoCollections);
}
infos = (Collection)infoCollections.get(key);
if (infos == null) {
// 僀儀儞僩僩儕僈偺僐儗僋僔儑儞偑懚嵼偟側偄応崌怴偨偵庢摼偡傞
infos =
ResourceBundleEventPropertyHandlerUtil
.getPostEventTriggerInfos(
getResourceBundle(application),
application,
key);
// 怴婯偵惗惉偝傟偨僀儀儞僩僩儕僈孮傪搊榐偡傞
infoCollections.put(key, infos);
}
}
}
return infos;
}
/**
* properties僼傽僀儖偑懚嵼偡傞僷僢働乕僕傪庢摼偟傑偡丅
* 僷僢働乕僕壔偝傟偰偄側偄応崌偼嬻暥帤傪曉媝偟傑偡丅
*
* @param application
* @return 僷僢働乕僕
* @since 2004.09.13
*/
private String getPropertyPackage( String application ) {
String[] paramAry = application.split("[.]");
StringBuffer buf = new StringBuffer();
if ( paramAry.length > 1 ) {
for ( int i = 0; i < paramAry.length - 1; i++ ) {
buf.append(paramAry[i]);
buf.append(File.separator);
}
}
return buf.toString();
}
/**
* 傾僾儕働乕僔儑儞ID傪庢摼偟傑偡丅
*
* @param application
* @return 傾僾儕働乕僔儑儞ID
* @since 2004.09.13
*/
private String getApplicationID( String application ) {
String[] paramAry = application.split("[.]");
String id = paramAry[paramAry.length - 1];
return id;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -