?? actionrunner.java~2~
字號:
package com.corb.bisc.ebiz.base;
/**
* 此處插入類型描述。
* 創建日期:(2002-5-15 20:49:45)
* @author:Administrator
*/
import java.util.*;
import org.w3c.dom.*;
import com.ibm.bisc.ebiz.util.XMLUtil;
import com.ibm.bisc.ebiz.exception.InvalidConfigException;
public class ActionRunner extends ObjectBase
{
protected Hashtable actionMap = new Hashtable();
/**
* ActionRunner 構造子注解。
*/
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)");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號