其余XML则可按这样的规则来定制
五.技术实现
RouterFactory
| 以下是引用片段: package com.web.router; import com.web.platform.Exception.RouterException; import java.util.java/util/Hashtable.java.html" target="_blank">Hashtable; |
| 以下是引用片段: /** * Router产生和清除的类 */ public class RouterFactory { /** * Router存储的树front */ private static java/util/Hashtable.java.html" target="_blank">Hashtable QueuePairFront = null; /** * Router存储的树back */ private static java/util/Hashtable.java.html" target="_blank">Hashtable QueuePairBack = null; /** * Router存储的树 */ private static java/util/Hashtable.java.html" target="_blank">Hashtable QueueRouter = null; /** * 返回的XMLRouter */ public static XMLRouter instance = null; /** * Router的定义 */ public static RouterDefine routerdefine = null; /** * Router的ID号 */ public static long routeIndex = 0; /** * @roseuid 3F169C21027C */ public RouterFactory() { } /** * 初始化Hashtable和Vector */ public static void initFactory() throws java/lang/Exception.java.html" target="_blank">Exception { QueuePairFront = new java/util/Hashtable.java.html" target="_blank">Hashtable(); QueuePairBack = new java/util/Hashtable.java.html" target="_blank">Hashtable(); QueueRouter = new java/util/Hashtable.java.html" target="_blank">Hashtable(); initRouteDefine(); } /** * 初始化Route的设置 * */ private static void initRouteDefine() throws java/lang/Exception.java.html" target="_blank">Exception { if( routerdefine == null ) routerdefine = new RouterDefine(); routerdefine.loadRouterDef(); } /** * 返回实例 * @return com.web.router.XMLRouter */ public static XMLRouter getInstance(long index) throws RouterException { return (XMLRouter)QueueRouter.get(new java/lang/Long.java.html" target="_blank">Long(index)); } /** * 产生一个XMLRouter的实例 * @return com.web.router.XMLRouter * @roseuid 3F1618A103BC */ public static XMLRouter popInstance() throws RouterException { routeIndex ; instance = new XMLRouter(routeIndex); setDefine( instance ); QueueRouter.put(new java/lang/Long.java.html" target="_blank">Long(routeIndex), instance); return instance; } /** * 清空Hashtable,Vector等 * @roseuid 3F1618B203C1 */ private static void freeResource() throws java/lang/Exception.java.html" target="_blank">Exception { QueuePairFront.clear(); QueuePairBack.clear(); QueueRouter.clear(); QueuePairFront = QueuePairBack = QueueRouter = null; } /** * 清除实例 * @param instanceID * @throws Exception */ public static void removeInstance(XMLRouter instance) throws java/lang/Exception.java.html" target="_blank">Exception { instance.clear(); QueueRouter.remove( new java/lang/Long.java.html" target="_blank">Long(instance.getIndex() ) ) ; } /** * Method isNull. * @return boolean */ public static boolean isNull() { …… return false; } } |
XMLRouter




