⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handlernettinfo.java

📁 监控大型网络的软件。能够自动发现拓扑结构
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		String strekIcon = "";		String typeIcon = "";		String fontBegin = "";		String fontEnd = "";		boolean box = false; boolean boxOpen = false;		String nodeType = (String)swrec.get("nodeType");		if (nodeType == null) nodeType = "default";		String boksid = (String)swrec.get("netboxid");		String boksbak = (String)swrec.get("to_netboxid");		if (boksbak != null && boksbak.endsWith("r")) boksbak = boksbak.substring(0, boksbak.length()-1);		String sysname = (String)sysnameMap.get(boksbak);		String kat;		if (swrec.containsKey("to_catid")) {			kat = (String)swrec.get("to_catid");		} else {			if (boksbak != null && katMap.containsKey(boksbak)) kat = ((String)katMap.get(boksbak)).toLowerCase();			else kat = "undef";		}		String parentBoksbak = (String)parentrec.get("to_netboxid");		String parentVlan = (String)parentrec.get("vlan");		String modul = (String)swrec.get("module");		String port = (String)swrec.get("interface");		String mp = (modul!=null?modul+"; ":"")+port;		if (depth >= 2) mp = " [<b>"+mp+"</b>]";		String modulbak = (String)swrec.get("to_module");		String portbak = (String)swrec.get("to_interface");		String mpBak;		if (modulbak == null && portbak == null) mpBak = "";		else mpBak = " [<b>"+(modulbak!=null?modulbak:"")+(portbak!=null?"; "+portbak:"")+"</b>]";		String vlan = (String)swrec.get("vlan");		String retning = (String)swrec.get("direction");		typeIcon = imgRoot + kat + ".gif" + "\">";		if (retning.charAt(0) == 'o') arrowIcon = arrowUpIcon;		else if (retning.charAt(0) == 'b') arrowIcon = arrowBlockIcon;		else arrowIcon = arrowDownIcon;		String label = "<a name=\"" + boksbak+":"+vlan + "\"></a>";		String linkLabel = "";		String linkLabelExpand = boksbak+":"+vlan;		switch (strekType)		{			case REDCROSS:				strekIcon = redCross;			break;			case STREK_BOTTOM:				strekIcon = strekBottom;			break;			case BOXOPEN_BOTH:				strekIcon = boxOpenBoth;				linkLabel = parentBoksbak+":"+parentVlan;				box = true;				boxOpen = true;			break;			case BOXOPEN_BOTTOM:				strekIcon = boxOpenBottom;				linkLabel = parentBoksbak+":"+parentVlan;				box = true;				boxOpen = true;			break;			case BOXCLOSED_BOTH:				strekIcon = boxClosedBoth;				linkLabel = boksbak+":"+vlan;				box = true;			break;			case BOXCLOSED_BOTTOM:				strekIcon = boxClosedBottom;				linkLabel = boksbak+":"+vlan;				box = true;			break;			default:				strekIcon = strekBoth;			break;		}		com.outl("  <tr>");		printDepth(depth, strekVertical, searchHit);		if (searchHit) {			com.outl("<td bgcolor=\"#F0E18C\" colspan=\"50\" style=\"font-size: 13\">");		} else {			com.outl("<td colspan=\"50\" style=\"font-size: 13\">");		}		com.out(label);		if (searchHit && !firstSearchHit) {			firstSearchHit = true;			com.out("\n<a name=\"searchtarget\">");		}		if (box)		{			com.out("<a href=\"");			if (boxOpen)			{				link("link.ni.visTopologi.close." + boksbak);			} else			{				link("link.ni.visTopologi.open." + boksbak);			}			com.out("&vlan="+vlan);			com.out("#" + linkLabel);			com.out("\">" + strekIcon + "</a>");		} else		{			com.out(strekIcon);		}		// Expand ikon		if (box) {			com.out("<a href=\"");			link("link.ni.visTopologi.expand." + boksbak);			com.out("&vlan="+vlan);			com.out("#" + linkLabelExpand);			com.out("\">" + expandIcon + "</a>");		} else {			com.out(expandGrayIcon);		}		com.outl("&nbsp;");		String netaddr = "";		if (showdetails && swrec.containsKey("netaddr")) {			String prefixLink = "/report/prefix?prefix.prefixid=" + swrec.get("prefixid");			netaddr = " (<a target=\"_new\" href=\""+prefixLink+"\">"+swrec.get("netaddr")+"</a>, " + swrec.get("nettype") + ", " + swrec.get("netident")+")";		}		if (boksbak == null || boksbak.startsWith("cam")) sysname = (String)swrec.get("portname");		if (sysname == null) sysname = "";		if (sysname.length() > 0 && swrec.containsKey("up") && "n".equals(swrec.get("up")))			sysname = "<font color=\"gray\">" + sysname + "</font>";		String parentSysname = (String)parentrec.get("to_netboxid");		parentSysname = (String)sysnameMap.get(parentSysname);		if (nodeType.equals("cam")) parentSysname = (String)swrec.get("ip");		// Add sysname links		{			String sysnameLink = "/browse/";			parentSysname = "<a target=\"_new\" href=\""+sysnameLink+parentSysname+"\">"+parentSysname+"</a>";			if (sysname.length() > 0) sysname = "<a target=\"_new\" href=\""+sysnameLink+sysname+"\">"+sysname+"</a>";		}		// Evt. modul/port		if (!parentrec.containsKey("rootRec")) {			if (depth >= 2) com.outl(parentSysname + " ");			if (!nodeType.equals("service") && !nodeType.equals("cam")) {				com.outl("      " + mp);			}			com.outl("      " + portIcon);		}		com.outl("&nbsp;&nbsp;" + arrowIcon + "&nbsp;");		com.out(typeIcon);		// Append service version information, if available		if (nodeType.equals("service") && swrec.get("version") != null) {			sysname += " (" + swrec.get("version") + ")";		}		com.outl("      " + fontBegin + "" + sysname + mpBak + netaddr + fontEnd);		com.outl("    </td>");		com.out("  </tr>");	}	private void printDepth(int depth, String strek, boolean searchHit)	{		for (int i = 0; i < depth; i++)		{			if (searchHit) {				com.outl("<td bgcolor=\"#F0E18C\">" + strek + "</td>");			} else {				com.outl("<td>" + strek + "</td>");			}		}	}	private static HashMap getHashFromResultSet(ResultSet rs, ResultSetMetaData md, boolean convertNull) throws SQLException {		HashMap hm = new HashMap();		for (int i=md.getColumnCount(); i > 0; i--) {			String val = rs.getString(i);			hm.put(md.getColumnName(i), (convertNull&&val==null)?"":val);		}		return hm;	}	/************************************************************	* End functions												*	* admin.*													*	************************************************************/	public static String handle(Com com)	{		String html = null;		String subSect = com.getReq().getParameter("func");		if (subSect != null)		{			if (subSect.equals("avledVlan")) html = "html/ni/avledVlan.html";			else if (subSect.equals("updateMac"))			{				html = "html/ni/updateMac.html";			} else			if (subSect.equals("updatePortBak"))			{				html = "html/ni/updatePortBak.html";			} else			if (subSect.equals("updateStatic"))			{				html = "html/ni/updateStatic.html";			} else			if (subSect.equals("visTopologi"))			{				if (com.getp("B1") != null) {					String showdetails = com.getp("showdetails");					com.set("ni.visTopologi.showdetails", (showdetails!=null ? "checked" : ""), true );					String showempty = com.getp("showempty");					com.set("ni.visTopologi.showempty", (showempty!=null ? "checked" : ""), true );					String searchexact = com.getp("searchexact");					com.set("ni.visTopologi.searchexact", (searchexact!=null ? "checked" : ""), true );					String showpath = com.getp("showpath");					com.set("ni.visTopologi.showpath", (showpath!=null ? "checked" : ""), true );					String searchblocked = com.getp("searchblocked");					com.set("ni.visTopologi.searchblocked", (searchblocked!=null ? "checked" : ""), true );					String searchField = com.getp("searchField");					com.set("ni.visTopologi.searchFieldNum", (searchField!=null ? searchField.substring(0, searchField.indexOf(".")) : ""), true );				}				String p1 = com.getp("p1");				if (p1 != null && p1.equals("closeAll")) {					HashMap trav;					Object o = com.getUser().getData("traverseList");					if (o != null) {						trav = (HashMap)o;						trav.clear();					}				} else				if (p1 != null)				{					String p2 = com.getp("p2");					String vlan = com.getp("vlan");					if (p2 != null && vlan != null)					{						HashMap trav;						Object o = com.getUser().getData("traverseList");						if (o != null) trav = (HashMap)o;						else trav = new HashMap();						String key = p2+":"+vlan;						if (p1.equals("open")) trav.put(key, new Boolean(false) );						else if (p1.equals("close")) trav.remove(key);						else if (p1.equals("expand")) trav.put(key, new Boolean(true) );						com.getUser().setData("traverseList", trav);					}				}				html = "html/ni/visTopologi.html";			} else			if (subSect.equals("checkError"))			{				html = "html/ni/checkError.html";			} else			if (subSect.equals("findMissingLinks"))			{				html = "html/ni/findMissingLinks.html";			} else			if (subSect.equals("updateCommunity"))			{				html = "html/ni/upcommunity.html";			} else			if (subSect.equals("listkant"))			{				html = "html/ni/listkant.html";			} else			if (subSect.equals("avledTopologi"))			{				html = "html/ni/topologi.html";			}		} else		{			html = "html/ni/main.html";		}		return html;	}	private void link(String s)	{		com.getHandler().handle(s);	}	// final ints	final int UPDATE_DB = 0;	final int PRINT = 1;	final int STREK = 0;	final int REDCROSS = 5;	final int STREK_BOTH = 10;	final int STREK_BOTTOM = 20;	final int BOXOPEN_BOTH = 30;	final int BOXOPEN_BOTTOM = 40;	final int BOXCLOSED_BOTH = 50;	final int BOXCLOSED_BOTTOM = 60;	// klasse vars	String[] s;	Com com;	int num;	int tempNr;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -