?? actionrunner.java
字號(hào):
/*****************************************************************************
* (C) Copyright 2004 。
* 保留對(duì)所有使用、復(fù)制、修改和發(fā)布整個(gè)軟件和相關(guān)文檔的權(quán)利。
* 本計(jì)算機(jī)程序受著作權(quán)法和國(guó)際公約的保護(hù),未經(jīng)授權(quán)擅自復(fù)制或
* 傳播本程序的全部或部分,可能受到嚴(yán)厲的民事和刑事制裁,并
* 在法律允許的范圍內(nèi)受到最大可能的起訴。
*/
/*****************************************************************************
* @作者:Golden Peng
* @版本: 1.0
* @時(shí)間: 2002-10-08
*/
/*****************************************************************************
* 修改記錄清單
* 修改人 :
* 修改記錄:
* 修改時(shí)間:
* 修改描述:
*
*/
package com.corp.bisc.ebiz.base;
/**
* 此處插入類型描述。
* 創(chuàng)建日期:(2002-5-15 20:49:45)
* @author:Administrator
*/
import java.util.*;
import org.w3c.dom.*;
import com.corp.bisc.ebiz.util.XMLUtil;
import com.corp.bisc.ebiz.exception.InvalidConfigException;
public class ActionRunner extends ObjectBase
{
protected Hashtable actionMap = new Hashtable();
/**
* ActionRunner 構(gòu)造子注解。
*/
public ActionRunner() {
super();
}
public ActionDef getAction(String actionName)
{
return (ActionDef)actionMap.get(actionName);
}
public void init(Node cfgNode) throws InvalidConfigException
{
enter("init(Node)");
Node actionNode = XMLUtil.selectSingleNode2(cfgNode , "actions");
if (actionNode == null)
throw new InvalidConfigException(cfgNode.getNodeName());
Node cmdNode = XMLUtil.selectSingleNode2(cfgNode , "commands");
if (cmdNode == null)
throw new InvalidConfigException(cfgNode.getNodeName());
String defaultPkg = XMLUtil.selectSingleValue2(cmdNode , "@defaultPkg");
if (defaultPkg == null)
throw new InvalidConfigException("commands/@defaultPkg");
NodeList nodes = cmdNode.getChildNodes();
int size = nodes.getLength();
Hashtable cmdMap = new Hashtable();
for(int i = 0 ; i < size ; i ++)
{
Node node = nodes.item(i);
if (node.getNodeType() != Node.ELEMENT_NODE) continue;
String nodeName = node.getNodeName();
if (!nodeName.equals("command")) throw new InvalidConfigException(nodeName);
NamedNodeMap attribs = node.getAttributes();
Node nameAttrib = attribs.getNamedItem("name");
Node classAttrib = attribs.getNamedItem("class");
if (nameAttrib == null)
throw new InvalidConfigException("command/@name");
if (classAttrib == null)
throw new InvalidConfigException("command/@class");
String className = classAttrib.getNodeValue();
int dotIndex = className.indexOf('.');
if (dotIndex == -1)
className = defaultPkg + '.' + className;
cmdMap.put(nameAttrib.getNodeValue() , className);
}
nodes = actionNode.getChildNodes();
size = nodes.getLength();
for(int i = 0 ; i < size ; i ++)
{
Node node = nodes.item(i);
if (node.getNodeType() != Node.ELEMENT_NODE) continue;
String nodeName = node.getNodeName();
if (!nodeName.equals("action")) throw new InvalidConfigException(nodeName);
ActionDef action = new ActionDef();
action.init(node , cmdMap);
actionMap.put(action.getActionName() , action);
}
/*
Vector nodesSession = XMLUtil.selectNodes2(cfgNode , "action/commands/command/session-invalidate/key");
int keySize = nodesSession.size();
Hashtable sessionInvalidator = new Hashtable();
for(int i = 0 ; i < keySize ; i ++)
{
Node nodeKey = (Node)nodesSession.elementAt(i);
NamedNodeMap attribs = nodeKey.getAttributes();
Node keyNode = attribs.getNamedItem("name");
actionNode = attribs.getNamedItem("action");
if (keyNode == null)
throw new InvalidConfigException("action/commands/command/session-invalidate/key/@name");
if (actionNode == null)
throw new InvalidConfigException("action/commands/command/session-invalidate/key/@action");
String key = keyNode.getNodeValue();
String action = actionNode.getNodeValue();
ActionDef actionDef = (ActionDef)actionMap.get(action);
if (actionDef == null)
throw new InvalidConfigException("action/commands/command/session-invalidate/key/[@action=" + action + "]");
actionDef.addInvalidKey(key);
}
*/
leave("init(Node)");
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -