📄 defaulteventpropertyhandler.java
字号:
throw new EventPropertyException(e.getMessage(), e);
}
}
/**
* 傾僾儕働乕僔儑儞ID偱巜掕偝傟偨儕僜乕僗僶儞僪儖偐傜僉乕偱巜掕偝傟偨僾儘僷僥傿傪庢摼偟傑偡丅
*
* @param application 傾僾儕働乕僔儑儞ID
* @param key 僉乕
* @return 巜掕偝傟偨僉乕偵奩摉偡傞僾儘僷僥傿
* @throws MissingResourceException 僾儘僷僥傿偺庢摼帪偵椺奜偑敪惗
* @throws EventPropertyException 僾儘僷僥傿偺庢摼偵幐攕
*/
private String getString(String application, String key)
throws MissingResourceException, EventPropertyException {
ResourceBundle bundle;
String result;
bundle = getResourceBundle(application);
result = bundle.getString(key);
return result;
}
/**
* 僾儘僷僥傿僴儞僪儔傪弶婜壔偟傑偡丅
*
* @param params 弶婜僷儔儊乕僞
* @throws PropertyHandlerException 僾儘僷僥傿僴儞僪儔偺弶婜壔帪偵椺奜偑敪惗
*/
public void init(PropertyParam[] params) throws PropertyHandlerException {
String bundleName = null;
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (params[i].getName().equals(DEFAULT_BUNDLE_NAME_PARAM)) {
bundleName = params[i].getValue();
}
}
}
if (bundleName == null) {
bundleName = DEFAULT_BUNDLE_NAME;
}
setBundlePrefix(bundleName);
}
/**
* 僾儘僷僥傿偺摦揑撉傒崬傒偑壜擻偐偳偆偐挷傋傑偡丅
* 偙偺僋儔僗偱偼偙偺儊僜僢僪偼忢偵false傪曉偟傑偡丅
*
* @return 忢偵false
* @throws EventPropertyException 僠僃僢僋帪偵椺奜偑敪惗
* @since 3.2
*/
public boolean isDynamic() throws EventPropertyException {
return false;
}
/**
* 僉乕偵奩摉偡傞僀儀儞僩偺僋儔僗柤傪庢摼偟傑偡丅
* 奩摉偡傞僀儀儞僩偑懚嵼偟側偄応崌丄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 + -