MakeInd.jsp 2.6 KB

1
  1. <%@ page import="core.db.DbFunc" %> <%@ page import="core.db.DbConnB" %> <%@ page import="ss.db.DbC" %> <%@ page import="java.sql.SQLException" %> <%@ page import="org.apache.commons.lang3.StringUtils" %> <%@ page import="org.dom4j.Document" %> <%@ page import="ss.xml.XmlU" %> <%@ page import="ss.cmn.file.FileU" %> <%@ page import="ss.AppB" %> <%@ page import="biz.pwj.PwjlbE" %> <%@ page import="org.dom4j.DocumentException" %> <%@ page import="core.rls.IndRls" %> <%@ page import="ss.db.Db" %> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <HEAD> <title>InsInd</title></head> <body> <% String ipStr = request.getParameter("ip"); if (StringUtils.isBlank(ipStr)) { out.println("指定IP:ip=10.0.3.107"); return; } String pwdStr = request.getParameter("pwd"); if (StringUtils.isBlank(pwdStr)) { out.println("指定PWD:pwd=???"); return; } String indName = request.getParameter("name"); if (StringUtils.isBlank(indName)) { out.println("指定 .ind.xml:name=dw/dw"); return; } String[] srcArr = indName.split("/"); if (srcArr.length != 2) { out.println("按格式指定:<配置文件所在目录(不含 cfg/biz/)>/<配置文件名(不含 .ind.xml)>"); return; } String srcDir = srcArr[0] +"/"; indName = srcArr[1]; String fileName = AppB.webRoot +"pms/cfg/biz/"+ srcDir + indName + PwjlbE.indXml.ext; Document doc; try { doc = XmlU.toDoc(FileU.rdStr(fileName), null); // null = XMLErrorHandler。Lin } catch (DocumentException e) { throw new RuntimeException(e); } /// 来自 PrjXs.(DbFunc) fetchDbFunc()、PrjXs.(DbB) fetchDbB()。Lin // 建 PMS 自己的,不需要 RmtConn 了 -- 转为 null /* 再改,支持不同的 IP 网段 和 PWD。Lin DbConnB info = new DbConnB("192.168.10." + ipStr, 1521, "free", "C##DC", "111", DbC.DB_oracleType); */DbConnB info = new DbConnB(ipStr, 1521, "free", "C##DC", pwdStr, DbC.DB_oracleType); DbFunc dbFunc; Db gdba; try { dbFunc = DbFunc.newDbFunc(info, null); // null = RmtConn。Lin gdba = Db.makeConn(dbFunc.fetchDbConn()); } catch (SQLException | CloneNotSupportedException e) { throw new RuntimeException(e); } /// /// 来自 IndRls.rlsInd(。Lin try { IndRls ind = new IndRls(); IndRls.RootIndB statItems = ind.rdIndXml(doc); ind.doRlsInd(statItems.indList, gdba); } catch (Exception e) { throw new RuntimeException(e); } /// try { gdba.commit(); } catch (SQLException e) { throw new RuntimeException(e); } gdba.close(); dbFunc.close(); %> 插入统计指标码本 SUCCEED!! </body> </html>