模块之间 同步报文校验

9 篇文章 0 订阅
4 篇文章 0 订阅

/*
 * 工 程 名:  nportalMS
 * 包       名:  com.xxxx.dhm.portalMS.base.web.servlet
 * 文 件 名:  CheckportalMSConfigServlet.java
 * 版       权:  Copyright (c) 2010 xxxx All Rights Reserved.
 * 描       述:  <描述>
 * 修 改 人:  
 * 修改时间:  2010-8-30
 * 跟踪单号:  <跟踪单号>
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */

package com.xxxx.dhm.portalMS.base.web.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;

import com.xxxx.dhm.common.config.impl.XMLFactory;
import com.xxxx.dhm.portalMS.sync.dataCheck.SyncDataCheck;

/**
 * <一句话功能简述>
 * <功能详细描述>
 *
 * @author
 * @version
 * @date
 * @see  [相关类/方法]
 * @since  
 */

public class CheckPortalMSConfigServlet extends HttpServlet
{

    /**
     * 注释内容
     */
    private static final long serialVersionUID = -7994025781217474094L;

    private static final Logger log = Logger.getLogger(CheckPortalMSConfigServlet.class);

    /**
     * 服务器启动成功,向NMS发送消息
     *
     * @param config
     *            FilterConfig对象
     * @throws ServletException
     */
    public void init(ServletConfig config) throws ServletException
    {
        String[] keys = { "nodeResource.maximumSize", "verificationCode.enable",
                "commonTemplateFileUpload.maxFileSize", "resourceRelation.number",
                "paginatedComponent.defaultPageSize", "paginatedComponent.pageSizeList" };
        String[] arrays = null;
        for (int i = 0; i < keys.length; i++)
        {   //读取配置文件的值
            arrays = XMLFactory.getValueArray(keys[i]);
            if (arrays == null || arrays.length == 0)
            {
                // 向网管告警
                // TrapSender.sendportalMSConfigError(keys[i]);
                // 记录系统错误日志
                log
                        .error("portalMSConfig.xml: Configure item  '"
                                + keys[i]
                                + "', is blank! ,Please strictly in accordance with the installation and configuration file configuration!");
                // 退出系统
                // System.exit(1);
                Runtime.getRuntime().exit(1);
                return;
            }
            else
            {
                StringBuffer sb = new StringBuffer();
                for (String value : arrays)
                {
                    sb = sb.append(value).append(",");
                }
                String tmp = sb.substring(0, sb.length() - 1).toString();
                if (!SyncDataCheck.checkItem("portalMSconfig." + keys[i], tmp))
                {
                    // 向网管告警
                    // TrapSender.sendportalMSConfigError(keys[i]);
                    // 记录系统错误日志
                    log
                            .error("portalMSConfig.xml: Configure item'"
                                    + keys[i]
                                    + "',check failure! value is"
                                    + tmp
                                    + ",Please strictly in accordance with the installation and configuration file configuration!");
                    // 退出系统
                    // System.exit(1);
                    Runtime.getRuntime().exit(1);
                    return;
                }
            }
        }
    }
}


/*
 * 工 程 名:  portalMS
 * 包       名:  com.xxxx.dhm.portalMS.sync.tool
 * 文 件 名:  SyncDataCheck.java
 * 版       权:  Copyright (c) 2009 xxxx All Rights Reserved.
 * 描       述:  同步数据的检查
 * 修 改 人:  
 * 修改时间:  
 * 跟踪单号:  <跟踪单号>
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */
package com.xxxx.dhm.portalMS.sync.dataCheck;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;

import com.xxxx.ChineseCharacter;
import com.xxxx.dhm.common.config.impl.PropertiesFactory;
import com.xxxx.dhm.common.uif.vo.cms.CMSConstants;
import com.xxxx.dhm.portalMS.common.DebugLogHelper;
import com.xxxx.dhm.portalMS.exception.PortalMSException;

/**
 * 同步数据的检查<br/>
 * 检查数据的长度,类型,是否为空,以及正则匹配
 *
 * @author  
 * @version  
 * @see  [相关类/方法]
 * @since  
 */
public class SyncDataCheck
{
    /**
     * 验证规则Map
     */
    private static Map<String, CheckObj> checkMap = null;

    /**
     * 日志对象
     */
    private static final DebugLogHelper logger = new DebugLogHelper(SyncDataCheck.class);

    /**
     * 检查XML的名字
     */
    private final static String CHECK_XML_NAME = "SyncCheckAction-UpdateData-validation.xml";

    /**
     * 检查项目的值是否合法,不合法则抛出异常
     *
     * @param itemName 待检查项目的名
     * @param value  待检查项目的值
     * @return [参数说明]
     *
     * @return void [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    public static void catchInvalidateData(String itemName, Object value) throws PortalMSException
    {
        if (!checkItem(itemName, value))
        {
            throw new PortalMSException( PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CONTROL_ITEM) + "[" + itemName + "]"
                    +  PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CHECK_FAIL )+ "。" +  PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CHECK_VALUE)
                    + "[" + value + "]");
        }
    }

    /**
     * 检查项目的值
     *
     * @param itemName 待检查项目的名
     * @param value  待检查项目的值
     * @return [参数说明]
     *
     * @return boolean [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    public static boolean checkItem(String itemName, Object value)
    {
        logger.enterFuncDebugLog();
        // 初始化Map 读取配置文件中的校验信息到 Map中
        initMap();

        logger.excepFuncDebugLog( PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CONTROL_ITEM )+ "[" + itemName + "]"
                +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_START )+  PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CHECK_VALUE) + "["
                + value + "]");
        //取出校验项的校验信息(portalMSconfig.nodeResource.maximumSize)
        CheckObj obj = checkMap.get(itemName);
        if (obj == null)
        {
            logger.exitFuncDebugLog( PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CONTROL_ITEM) + "[" + itemName + "]"
                    +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_END) +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_RETURN_TRUE) + "["
                    +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_OBJ_NULL )+ "]");
            return true;
        }
        // 检查项目
        String type = obj.getFieldType();
        String isNull = obj.getIsNull();
        int maxLength = obj.getMaxLength();
        String expression = obj.getExpression();
        logger.excepFuncDebugLog("type[" + type + "];isNull[" + isNull + "];maxLength[" + maxLength + "];expression[" + expression
                + "]");

        // 是否为空验证
        if (value == null || "".equals(value))
        {
            if (!"false".equalsIgnoreCase(isNull))
            {
                logger.exitFuncDebugLog( PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CONTROL_ITEM) + "[" + itemName + "]"
                        +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_END )+  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_RETURN_TRUE)
                        + "[" +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_OBJ_NULL) + "]");
                return true;
            }
            else
            {
                logger.exitFuncDebugLog( PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CONTROL_ITEM )+ "[" + itemName + "]"
                        +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_END) +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_RETURN_FALSE)
                        + "[" +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_OBJ_NULL )+ "]");
                return false;
            }
        }
        //值 跟数据类型 最大值 校验表达式进行校验
        boolean isCheckPass = toCheck(value, type, maxLength, expression);
        logger.exitFuncDebugLog( PropertiesFactory.getValueString(ChineseCharacter.EXCELDATACHECK_CONTROL_ITEM )+ "[" + itemName + "]"
                +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_END) +  PropertiesFactory.getValueString(ChineseCharacter.SYNCDATACHECK_CHECK_RETURN)
                + String.valueOf(isCheckPass).toUpperCase());
        //返回校验结果
        return isCheckPass;
    }

    private static boolean toCheck(Object value, String type, int maxLength, String expression)
    {
        logger.enterFuncDebugLog();
        boolean isCheckPass = true;
        // 类型验证
        if (type != null && !"".equals(type))
        {
            isCheckPass = checkType(value, type, isCheckPass);
        }
        // 最大长度验证
        if (maxLength != -1)
        {
            int java2oracleLength = getJava2OracleLength(String.valueOf(value));// value
            // 不可能为空了
            if (java2oracleLength > maxLength)
            {
                isCheckPass = false;
            }
        }
        // 正则表达式验证
        if (expression != null && !"".equals(expression))
        {
            if (!Pattern.matches(expression, String.valueOf(value)))
            {
                isCheckPass = false;
            }
        }
        logger.exitFuncDebugLog();
        return isCheckPass;
    }

    /**
     * 校验项目类型
     * @param type
     * @param value
     * @return
     */
    private static boolean checkType(Object value, String type, boolean isCheckPass)
    {
        logger.enterFuncDebugLog();
        if ("Integer".equalsIgnoreCase(type))
        {
            try
            {
                Integer.parseInt(String.valueOf(value));
            }
            catch (Exception e)
            {
                isCheckPass = false;
            }
        }
        /* 2010/03/15 文件大小长度类型改为long */
        else if ("Long".equalsIgnoreCase(type))
        {
            try
            {
                Long.parseLong(String.valueOf(value));
            }
            catch (Exception e)
            {
                isCheckPass = false;
            }
        }
        /* 2010/03/15 文件大小长度类型改为long */
        else if ("Double".equalsIgnoreCase(type))
        {
            try
            {
                Double.parseDouble(String.valueOf(value));
            }
            catch (Exception e)
            {
                isCheckPass = false;
            }
        }
        // 所有变量都是字符型
        if ("String".equalsIgnoreCase(type) && !(value instanceof String))
        {
            isCheckPass = false;
        }

        if ("Date".equalsIgnoreCase(type))
        {
            try
            {
                DateFormat df = new SimpleDateFormat(CMSConstants.IF_DATE_FORMAT);

                df.parse((String) value);
            }
            catch (Exception e)
            {
                isCheckPass = false;
            }
        }
        logger.exitFuncDebugLog();
        return isCheckPass;
    }

    /**
     * 获取存储到Oracle的长度
     * 对于utf8的oracle来说,一个双字节字符等于3个单字节字符的长度
     * @param value 需要转化的字符串
     * @return 存储到Oracle的字符串长度
     *
     * @return int [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    private static int getJava2OracleLength(String value)
    {
        if (value == null)
        {
            return 0;
        }

        // if (value.length() == value.getBytes().length)
        // {
        // // 无双字节字符
        // return value.length();
        // }
        //        
        // int len = 0;
        // // 转换为字节数组
        // char[] charArr = value.toCharArray();
        // for (int i = 0; i < charArr.length; i++)
        // {
        // if (String.valueOf(charArr[i]).matches("[^x00-xff]"))
        // {
        // len += 3;
        // }
        // else
        // {
        // len++;
        // }
        // }
        // return len;
        // 按照接口定义的长度进行校验
        return value.length();
    }

    /**
     * 获取检查XML的值
     * 获取检查XML的值,保存入checkMap
     * @return [参数说明]
     *
     * @return Map<String,CheckObj> [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    private synchronized static void initMap()
    {
        logger.enterFuncDebugLog();
        if (checkMap != null)
        {
            logger.exitFuncDebugLog();
            return;
        }
        checkMap = new HashMap<String, CheckObj>();
        try
        {
            SAXReader reader = new SAXReader();
            //获取配置文件的路径 D:/tomcat_portal/webapps/portalMS/WEB-INF/classes/com/xxxx/dhm/portalMS/sync/dataCheck/ SyncCheckAction-UpdateData-validation.xml
            String filePath = SyncDataCheck.class.getResource("").getFile() + CHECK_XML_NAME;
            filePath = URLDecoder.decode(filePath, "utf-8");
            Document document = reader.read(new File(filePath));
            Element ele = document.getRootElement();
            //表的字段
            List<?> fieldList = ele.selectNodes("/validators/table/field");
            //进行迭代把每个字段的校验信息保存到checkMap 中
            for (Iterator<?> iterator = fieldList.iterator(); iterator.hasNext();)
            {
                Element fieldEle = (Element) iterator.next();
                //表的名称
                String tblName = fieldEle.getParent().attributeValue("name");
                //字段名
                String fieldName = fieldEle.attributeValue("name");
                //获取配置文件中的校验信息
                Node maxLenEle = fieldEle.selectSingleNode("max-length");
                Node fieldTypeEle = fieldEle.selectSingleNode("field-type");
                Node isNullEle = fieldEle.selectSingleNode("is-null");
                Node expressionEle = fieldEle.selectSingleNode("expression");
                CheckObj obj = new CheckObj();
                if (maxLenEle != null)
                {
                    String maxLen = maxLenEle.getStringValue();
                    int maxLenInt = -1;
                    maxLenInt = Integer.parseInt(maxLen);
                    obj.setMaxLength(maxLenInt);
                }
                if (fieldTypeEle != null)
                {
                    obj.setFieldType(fieldTypeEle.getStringValue());
                }
                if (isNullEle != null)
                {
                    obj.setIsNull(isNullEle.getStringValue());
                }
                if (expressionEle != null)
                {
                    obj.setExpression(expressionEle.getStringValue());
                }
                //以表明跟字段作为key保存每个字段的校验规则信息
                checkMap.put(tblName + "." + fieldName, obj);
            }
        }

        catch (UnsupportedEncodingException e)
        {
            logger.excepFuncDebugLog("Obtaining configuration file ,exception 。", e);
        }
        catch (DocumentException e)
        {
            logger.excepFuncDebugLog("Obtaining configuration file ,document exception 。", e);
        }

    }

}

/**
 * 检查信息VO
 * 定义检查项目
 *
 * @author  
 * @version  
 * @see  [相关类/方法]
 * @since  
 */
class CheckObj
{
    /**
     * 字段类型int String Date
     */
    private String fieldType;

    /**
     * 是否为空
     */
    private String isNull;

    /**
     * 最大长度
     */
    private int maxLength = -1;

    /**
     * 正则表达式
     */
    private String expression;

    /**
     * @return 返回 maxLength
     */
    public int getMaxLength()
    {
        return maxLength;
    }

    /**
     * @param 对maxLength进行赋值
     */
    public void setMaxLength(int maxLength)
    {
        this.maxLength = maxLength;
    }

    /**
     * @return 返回 fieldType
     */
    public String getFieldType()
    {
        return fieldType;
    }

    /**
     * @param 对fieldType进行赋值
     */
    public void setFieldType(String fieldType)
    {
        this.fieldType = fieldType;
    }

    /**
     * @return 返回 isNull
     */
    public String getIsNull()
    {
        return isNull;
    }

    /**
     * @param 对isNull进行赋值
     */
    public void setIsNull(String isNull)
    {
        this.isNull = isNull;
    }

    /**
     * @return 返回 expression
     */
    public String getExpression()
    {
        return expression;
    }

    /**
     * @param 对expression进行赋值
     */
    public void setExpression(String expression)
    {
        this.expression = expression;
    }
}

SyncCheckAction-UpdateData-validation.xml

<?xml version="1.0" encoding="UTF-8"?>
<validators>
    <table name="goods">
        <field name="goodscode">
            <max-length>20</max-length>
            <field-type>String</field-type>
            <is-null>false</is-null>
            <expression><![CDATA[^[a-zA-Z0-9_]*$]]></expression>
        </field>
        <field name="goodsname">
            <max-length>100</max-length>
            <field-type>String</field-type>
            <is-null>false</is-null>
        </field>
                
        <field name="platform">
            <max-length>1</max-length>
            <field-type>String</field-type>
            <is-null>true</is-null>
            <expression><![CDATA[^[0,1,2]$]]></expression>
        </field>
    </table>
    <table name="portalMSconfig">
        <field name="nodeResource.maximumSize">
            <field-type>Long</field-type>
            <is-null>false</is-null>
        </field>
        <field name="verificationCode.enable">
            <field-type>Integer</field-type>
            <is-null>false</is-null>
            <expression><![CDATA[^[0,1]$]]></expression>
        </field>
        <field name="commonTemplateFileUpload.maxFileSize">
            <field-type>Integer</field-type>
            <is-null>false</is-null>
        </field>
        <field name="paginatedComponent.defaultPageSize">
            <field-type>Integer</field-type>
            <is-null>false</is-null>
        </field>
        <field name="paginatedComponent.pageSizeList">
            <field-type>String</field-type>
            <is-null>false</is-null>
            <expression><![CDATA[^\d+(\,\d+)*,\d+$]]></expression>
            
        </field>        
        <field name="resourceRelation.number">
            <field-type>Integer</field-type>
            <is-null>false</is-null>
        </field>        
    </table>
</validators>


portalMSConfig_tianwei.xml
<?xml version="1.0" encoding="UTF-8"?>

<portalMS>
  <!-- 配置推流方式,默认的,可添加,可修改
       Configure streaming type which can be added or modified -->
  <pushStream>
    <pushStreamTypes>IPTVUDP,IPTVTCP,IPQAM</pushStreamTypes>
  </pushStream>  
  <template>
    <syncSystem>Portal,IAG</syncSystem>
  </template>  
  <!-- 模板相关配置
       Configurations related to template -->
  <templateConfig>
    <!-- 模板在ftp上保存的根路径 针对模板上传
         Root path of template file on FTP -->
    <ftpconfig>
      <ftpHostName>ftp.xxxxxx.com</ftpHostName>  
      <ftpPort>21</ftpPort>  
      <ftpUserName>903399</ftpUserName>  
      <ftpPasswd>xxxxxx_test</ftpPasswd>  
      <ftpMaxRow>100000000</ftpMaxRow>  
      <!-- 模板文件在FTP上的路径:注意前后的斜杠是必须的
           Path of template file on FTP (Note: slashes must exist!) -->
      <ftpRemoteAddress>/templateFile/</ftpRemoteAddress>  
      <retryNum>5</retryNum>
    </ftpconfig>  
    <!-- 模板文件历史记录最多保存数量
         Maximum number of history operation records of that can be saved   -->
    <maxHisNum>20</maxHisNum>  
    <!-- 模板zip文件大小上限(单位M)
         Maximum size of template file (zip),(Unit: M) -->
    <maxSize>30</maxSize>
    <!-- 是否支持发布策略
         Whether to support release strategies -->
    <pubStrategy>false</pubStrategy>
    <fileEncode>UTF-8</fileEncode>
    <enableColumnTemplate>true</enableColumnTemplate>
  </templateConfig>
  <!-- 模板预览时用到的模拟器路径
       Simulator path for template preview -->
  <viewConfig>
    <ewSrc>D:/xxxxxx-EW300/EW300Simulator.exe</ewSrc>  
    <ewPath>D:/xxxxxx-EW300/startup.bat</ewPath>
  </viewConfig>  
  <nodeResource>
    <!-- =============资源上传和网站资源查看时选择路径的下拉菜单项
                      Drop-down menu for choosing a path when uploading resources and querying contents of a website ========== -->
    <!-- =============资源上传允许的文件类型,不同类型请以半角逗号隔开
                       File types that are allowed to be uploaded (use English comma to separate them)  ======================== -->
    <!-- =============常用的文件类型,后缀名
                      Common file types, suffix   ============================================================================= -->
    <type>
      <name>图片(Images)</name>  
      <value>images</value>  
      <images>gif,ico,png,bmp,jpg,jpeg,zip</images>
    </type>  
    <type>
      <name>模板(Template)</name>  
      <value>ftl</value>  
      <ftl>ftl,zip</ftl>
    </type>  
    <type>
      <name>js文件(js file)</name>  
      <value>js</value>  
      <js>js,zip</js>
    </type>  
    <type>
      <name>css文件(css file)</name>  
      <value>css</value>  
      <css>css,zip</css>
    </type>  
    <type>
      <name>html文件(html file)</name>  
      <value>html</value>  
      <html>html,zip</html>
    </type>  
     <!-- =============资源上传最大文件大小,单位为B
                      Maximum size of uploaded file (Byte) ==================================================================== -->
    <maximumSize>10971520</maximumSize>
  </nodeResource>
  <xlsFileUpload>
    <!-- =============导入的xls文件的最大记录数,单位为行,最大不能超过
                      60000  Maximum number of history operation records of xls file (row); it can not be greater than 60,000 rows.== -->
    <maxFileSize>64</maxFileSize>
  </xlsFileUpload>
  <recContentUpload>
    <!-- =============上传资源的文件格式  
                      Format of uploaded file =================================================================================== -->
    <type>
      <name>图片(Images)</name>  
      <value>images</value>  
      <images>gif,ico,png,bmp,jpg,jpeg</images>
    </type>  
    <type>
      <name>报告文件(Report file)</name>  
      <value>reportfile</value>  
      <reportfile>doc,txt,pdf</reportfile>
    </type>  
    <type>
      <name>全部文件(All files)</name>  
      <value>all</value>  
      <all>gif,ico,png,bmp,jpg,jpeg,zip,doc,txt,pdf</all>
    </type>
  </recContentUpload>  
  <plugin>
    <staticPage>
       <!-- =============静态页面的字符集
                          Character set for static page ============================================================================ -->
      <charSet>UTF-8</charSet>
    </staticPage>
  </plugin>   
 <!-- 门户是否要审核 N不需要,Y要
       Whether the portal needs to be verified? N: No, Y: Yes -->
  <Verfiy>
    <isNeed>N</isNeed>
  </Verfiy>
  <!-- 预览路径
       Path preview-->
  <preView>
    <path>http://%s:80/</path>
  </preView>  
  <!-- 市级用户是否能将自己的栏目克隆给省 市用户是否能将自己的栏目推荐给省  0:不能推荐给省,1.可以推荐
      Whether a city-level user can copy or recommend his columns to a province-level user?  0: No 1:Yes -->
  <cloneColumn>
    <isCtoP>0</isCtoP>
  </cloneColumn>  
   <!-- 说明:0:表示打开resourceName 1 :表示关闭,不再显示栏目名称
       (Note) 0: Display column name  1: Do not display column name -->
  <resourceName>
    <enable>1</enable>
  </resourceName>  
  <!-- 栏目名称是否需要全表校验  说明:name项可根据实际需要扩充
       Whether column name need check in full table.(Tips: The name can expansion according to actual needs) -->  
  <column>
    <name>nrzx_widget</name>  
    <!-- 请根据portalMS系统栏目的名称配置
         Please configure it according to column name -->
    <name>hd_xnw</name>
  </column>  
  <!-- =================发布管理部门配置项  
                          Release the configuration items related to management department==================================== -->
  <publish>
    <context/>  
      <!-- 发布模式。0:台湾,1:南京
           Release mode:  0:Taiwan  1:Nanjing -->
    <publishType_zh_CN>1</publishType_zh_CN>
    <publishType_zh_TW>0</publishType_zh_TW>   
    <publishType_en_US>1</publishType_en_US>  
    <!-- 预览服务器Url 需要根据实际地址配置
         URL for previewing server (Please configure it based on the actual address)-->
    <preViewServer>http://172.30.60.193:8881/portal</preViewServer>
        <!-- 预览首页 -->
        <indexPageURL>index_reView.htm</indexPageURL>
   <!-- 预览服务器的磁盘物理地址
         Physical address for previewing server -->
    <preViewServerHardiskPath>/usr/local/portalMS/jboss5/server/default/deploy/portal.war</preViewServerHardiskPath>
    <!-- 网站资源文件的磁盘物理地址
         Physical address of website resources -->
    <resourceHardiskPath>/usr/local/portalMS/jboss5/server/default/deploy/portal.war/</resourceHardiskPath>
    <!-- 目录结构磁盘物理地址
         Physical address of directory structure -->
    <directoryHardiskPath>/usr/local/portalMS/jboss5/server/default/deploy/portal.war/pages</directoryHardiskPath>
    <!-- 待同步的文件夹地址
         Address of to-be-synchronized file folder -->
    <sysPath>/usr/local/portal/jboss5/server/default/deploy/portal.war</sysPath>
    <!-- rsync sdp.portal.synclogodest.dat路径
         rsync sdp.portal.synclogodest.dat-->
    <filePath>/root/rsync/sdp.portal.synclogodest.dat</filePath>
    <!-- 客户端预览仿真器exe文件磁盘物理地址
         Physical address for previewing the exe file of emulator via client-side -->
    <emluatorHardiskPath>D:/Program Files/xxxxxx-EW300-Simulator/EW300Simulator.exe</emluatorHardiskPath>
    <!-- 客户端预览仿真器启动脚本
         Startup script for previewing the emulator via client-side  -->
    <textFile>D:/Program Files/xxxxxx-EW300-Simulator/startup.bat</textFile>
  </publish>
  <!--=======================自动生成密码
                             Generate password automatically ========================= -->
  <auto>
    <password>888888</password>
  </auto>  
  <!-- ====================验证码开关  
                           Switch of auth code:  1: On, 0: Off   ================== -->
  <verificationCode>
    <enable>0</enable>
  </verificationCode>  
  <!-- ====================分页标签的下拉框设置
                           Drop-down box for paging setting========================= -->
  <paginatedComponent>
    <defaultPageSize>10</defaultPageSize>  
    <pageSizeList>10, 20, 40,100</pageSizeList>
  </paginatedComponent>  
  <!-- ===================== 公共模板上传文件大小设置 最大不能超过300k 超过300
                             Size of the uploaded common template (It can not be greater than 300 K)
                             IE会很久才有反应
                             It takes a long period of time for the IE to response================ -->
  <commonTemplateFileUpload>
    <!-- 1024*300 -->  
    <maxFileSize>307200</maxFileSize>
  </commonTemplateFileUpload>  
  <!-- ====================关联资源的最大数  
                           Maximum number of associated resources ======================== -->
  <resourceRelation>
    <number>5</number>
  </resourceRelation>  
  <!-- ===================== 网管参数
                             Parameters of network managemen======================== -->
  <nmsParams>
    <!-- JVM剩余内存阈值(M)
         Remaining memory of JVM-->
    <jvmMemory>50</jvmMemory>
  </nmsParams>  
  <categoryMessage>
    <type>
      <name>已定购(Has been ordered)</name>  
      <value>0</value>
    </type>  
    <type>
      <name>未定购(Has yet to be ordered)</name>  
      <value>1</value>
    </type>
  </categoryMessage>  
  <!-- 如果有多种图片类型可以继续添加
       You can add other types of image if there are any. -->
  <categoryImage>
    <type>
      <!-- 中文名称
           Chinese name -->
      <name_zh_CN>普通版图片</name_zh_CN>
      <!-- 繁体名称  
           Name in traditional Chinesse -->
      <name_zh_TW>普通版圖片</name_zh_TW>
      <!-- 英文名称
           English name -->
      <name_en_US>Common image</name_en_US>
      <value>0</value>
    </type>
  </categoryImage>  
  <overloadProtection>
    <cpuMonitorInterval>5</cpuMonitorInterval>  
    <cpuLimitValve>0.95</cpuLimitValve>  
    <!-- 检查cpu使用状态取平均值时的间隔周期。单位:秒
         The time interval to read a value of CPU usage. (Second) -->
    <cpuCheckInterval>3</cpuCheckInterval>  
    <!-- 检查cpu使用状态 取平均值时的间隔次数。
         The number of times to read values of CPU usage -->
    <cpuCheckTimes>3</cpuCheckTimes>  
    <memoryMonitorInterval>5</memoryMonitorInterval>  
    <memoryAlarmValve>0.90</memoryAlarmValve>  
    <memoryLimitValve>0.95</memoryLimitValve>  
    <!-- 检查内存使用状态取平均值时的间隔周期。单位:秒
         The time interval to read a value of memory usage. (Second)-->
    <memoryCheckInterval>3</memoryCheckInterval>
    <!-- 检查内存使用状态取平均值时的间隔次数。
         The number of times to read values of memory usage-->
    <memoryCheckTimes>3</memoryCheckTimes>  
    <licenseAdoptPeriod>3</licenseAdoptPeriod>  
    <licenseAdoptInterval>3</licenseAdoptInterval>  
    <licenseAdoptTimes>3</licenseAdoptTimes>  
    <!-- 监控数据库连接时间间隔  单位:秒-
         The time interval to monitor the connection of database. -->
    <dbCheckInterval>30</dbCheckInterval>
  </overloadProtection>
  <!-- 栏目管理
       Column management -->
  <columnManage>
    <column>
       <!-- 一级栏目服务标识唯一校验和是否必填开关:0:关,不校验(非必填);1:开(必填),校验唯一
            Switch for checking whether the service ID of level-one column is unique:    0:Off (no need to check); 1: On (need to check)   -->
      <serviceCodeCheck>1</serviceCodeCheck>  
       <!-- 关联产品限制开关:0:关,不限制产品关联到栏目个数;1:开,限制一个包月产品只能关联到一个栏目
               Switch for restricting the number of products associated to a column  0: Off (The number of associated products is not restricted), 1: On Only one product based on monthly payment can be associated to a column) -->
      <relationProductNum>1</relationProductNum>  
      <!-- 上架内容限制开关:0:关,不限制关联产品;1:开,限制当前栏目及其递归父栏目至少有一个存在服务标识的栏目已关联产品
          Added content limit switch: 0: OFF, no restrictions related products; 1: open, limiting the current column and the parent column recursive least have a presence service-related products have been identified in section -->
      <upShelf>1</upShelf>  
      <!-- 定时上下架开关:0:关,页面不显示;1:开,页面显示
           Switch for scheduled loading and unloading  0: Off (Not be displayed on the page) 1: On (Be displayed on the page) -->
      <timeUpDownShelf>0</timeUpDownShelf>  
      <!-- 配置哪级栏目可以关联产品,多个以分英文分号(;)隔开 0为不限制
           To configure which level of columns can be associated to products (use semicolon to separate them; 0: No restriction) -->
      <columnRelaProduct>1</columnRelaProduct>  
      <!-- 配置哪些销售类型的产品可以关联栏目 -1;1;0;3
           To configure which type of products can be associated to columns, -1;1;0;3 -->
      <columnRelaGoodsType>1;3</columnRelaGoodsType>
      <!-- 针对天威项目一级栏目必须有服务标识
           As for the Topway project, level-one columns must have their own service ID.-->
      <firstColumnServerCode>1</firstColumnServerCode>  
      <!-- 针对南京项目0:关联产品、内容上下架部分不展示 1:关联产品、内容上下架部分展示
           As for the Nanjing project, 0: Not display the associated products or contents that are loaded or unloaded  1: Display the associated products or contents that are loaded or unloaded -->
      <isNeedUpShelf>1</isNeedUpShelf>
      <!-- 1:支持过滤上架方式 2:支持全部上架方式
          1: Support "filtering and loading"  2: Support "all loading" -->
      <upType>1</upType>  
      <!-- 获取最新内容间隔时间(单位:分钟)
           Time interval to obtain latest contents (Minute)-->
      <GetNewAssetTime>3</GetNewAssetTime>  
       <!-- 新内容的判定条件为:内容注入到PortalMS在指定的时间期限内(单位:天),且内容未手工上架到任何栏目
           The criteria to judge which contents are new contents:  those contents that are injected into the PortalMS within a designated time (day) and have yet to be loaded to a column.  -->
      <NewAsset>3</NewAsset>  
      <!-- 自动上架开关 1:打开 0:关闭
           Switch for automatic loading  1:On  0: Off -->
      <autoUpShelf>1</autoUpShelf>  
      <columnImage>
       <!-- 栏目上传图片大小,单位M 默认2M
             Size of the image uploaded to a column (M,  default:2M)-->
        <imageMaxSize>2</imageMaxSize>  
        <!-- 栏目上传图片规格 宽*高,默认400*300 ,多种规格可以以英文分号分隔
             Specification of the image uploaded to a column (width x height, default: 400*300; use semicolon to separate the specifications)  -->
        <imageSpecification>400*300</imageSpecification>
      </columnImage>
        <!-- 媒资包上架到按次栏目是否要关联产品(0:不需要,1:需要).默认(1)
             Asset package that shelf on per-column is need associated product(0:no, 1:yes), default:0. -->
     <pkgUpshelfNeedGoods>1</pkgUpshelfNeedGoods>
    </column>
  </columnManage>  
  <!-- ===================== 同步系统名称配置  Configure the sync system name======================== -->
  <uif>
    <site>
      <bussinessSystem>VOD</bussinessSystem>  
      <value>VOD</value>  
      <!-- 多个系统用逗号隔开
           Separate the systems with comma -->
      <VOD>SDPAdapter,IAG,Portal</VOD>
    </site>  
    <site>
      <bussinessSystem>OTT</bussinessSystem>  
      <value>OTT</value>  
      <OTT>OTT</OTT>
    </site>  
    <!-- 所有跟站点业务系统同步有关的接口,需要过滤不发送报文的系统名称,多个系统请用英文分号分隔
         It's required to filter those systems that do not send message. (Separate the systems with semicolon)  -->
    <system>
      <filter>ams</filter>
    </system>  
    <!-- 地市接收到数据后是否同步给地市portal
         Whether to synchronize the data that are received to the city-level Portal? -->
    <syncCityPortal>true</syncCityPortal>  
   
    <!-- 由CMS和SME外部系统引起的媒资下架操作,是否同步标识 默认为需要同步
         Whether sync assets off shelf caused by CMS, SME and other external systems. Default,yes.  -->  
     <sync>
      <flag>true</flag>
    </sync>
    
   <!-- 配置点播次数和推荐次数以及媒资关联需要同步的系统
           Configuration system required synchronization those VOD number, recommended number and assets associated -->  
   <sync>
      <sysname>Portal</sysname>
   </sync>

 </uif>  
  <weather>
    <!-- 0:自动 1:手动
         0: Automatically  1:Manually-->
    <type>1</type>  
    <imagesPath>/images/weather/</imagesPath>  
    <imageSuffix>png</imageSuffix>  
    <weatherUrl>http://www.szmb.gov.cn/data_cache/szWeather/szweather.xml</weatherUrl>
  </weather>  
 
 
  <!-- ===================== 发布路径  Release path======================== -->
  <portal>
    <publishPath>/hd/pages</publishPath>  
    <preViewPath>index.htm</preViewPath>  
    <!-- 推荐位、跑马灯、天气预报排期数据为空时,是否发布。0:不发布,1:发布
         Whether to release in case that the schedules of recommendation position, marquee and weather forecast are null?  0: Not release  1: Release -->
    <dataIsNullDealType>0</dataIsNullDealType>
  </portal>  
  <topWayPortal>
    <!-- ==============天威发布包 Topway's release package========================== -->
    <name>topWayPortal</name>  
    <!-- 多个文件用分号隔开
         Separate semicolon to separate the file names -->
    <files>mainMenu.js;weather.js;itvMenu.js;vvMenu.js;marquee.js</files>
  </topWayPortal>  
  <!-- 推荐位海报图片大小尺寸规则
       Rules for the image size of recommendation position -->
  <recommendImage>
     <!-- 推荐位上传图片大小,单位KB默认5000KB
         image size of recommendation position (KB, Default: 5000 KB)-->
    <imageMaxSize>5000</imageMaxSize>  
    <!-- 推荐位上传图片规格 宽*高,默认163*399;320*199 ,多种规格可以以英文分号分隔
         Specification of the image of recommmendation position (Width X Height, default: 163*399;320*199; separate Specifications with semicolon) -->
    <imageSpecification>163*399;320*199</imageSpecification>  
    <!-- 上传的图片格式
         Format of the uploaded image -->
    <images>gif;ico;png;bmp;jpg;jpeg</images>
  </recommendImage>  
  <!-- 上架的时候查询媒资的媒资文件根据的适配的平台属性
       Platform attribute adaptive to the asset file for query -->
  <asset>
    <assetFile>
      <!-- 值可以为 “ALL”(支持两种平台)、“VOD”、“OTT”默认都支持
           The value can be "All" (Support VOD and OTT) -->
      <platform>VOD</platform>
    </assetFile>
  </asset>  
  <!-- 初始化当前站点的id值,确保跟初始化脚本一致
       Initialize the ID value of the current site and ensure it is consistent with the initialization script. -->
  <site>
    <siteId>
      <value>1</value>
    </siteId>
  </site>  
   <paragraph>
     <!-- 新闻拆条type默认值
         Default type of news paragraph-->
         <defaultType>
            <value>新闻</value>
         </defaultType>
         <!-- 不需要自动创建栏目和自动上架就为false 需要就为true
             False: No need to create column automatically or load column automatically, True: Need to create column automatically or load column automatically  -->
         <autoUpShelf>
            <value>true</value>
         </autoUpShelf>
     </paragraph>
  <!-- 栏目图片同步系统过虑
       The system for synchronizing column image -->
  <columnNotSyncSystem/>  
  <!-- 栏目关联产品是否需要将该栏目及其子栏目下的所有上架关系全量同步给指定系统
       Is it required to synchronize all the loaded products under a column or under the subcolumns of the column to a designated system -->
  <columnResGoods>
    <!-- 不需要同步就改为false 需要就为true
         False: No need to synchronize   True: Need to synchronize -->
    <isFullSync>false</isFullSync>  
    <!-- 所需同步的业务系统,多个用逗号“,”分隔
         The service systems that need to be synchronized (Separate them with ",") -->
    <syncSystem>IAG</syncSystem>  
    <!-- 全量同步一次同步的List包含的最大条数
         Maximum number of systems that can be synchronized -->
    <maxSyncCount>200</maxSyncCount>
  </columnResGoods>
 
  <!-- 媒资海报的预览,等比限制
       Preview of poster, geometric proportion -->
  <assetImage>
    <height>125</height>
    <width>75</width>
  </assetImage>  
 
  <!-- 节点管理,说明:1:表示打开 0 :表示关闭
       Node management  1: On  0: Off -->
  <nodeManager>
     <!-- 应用
          Application-->
    <application_zh_CN>1</application_zh_CN>
    <!-- 推荐
         Recommend -->
    <recommend_zh_CN>1</recommend_zh_CN>
    <!-- 跑马灯
         Marquee -->
    <marquee_zh_CN>1</marquee_zh_CN>
    
    <application_zh_TW>0</application_zh_TW>
    <recommend_zh_TW>1</recommend_zh_TW>
    <marquee_zh_TW>0</marquee_zh_TW>
    
    <application_en_US>1</application_en_US>
    <recommend_en_US>1</recommend_en_US>
    <marquee_en_US>1</marquee_en_US>
  </nodeManager>
  <!-- 台湾门户发布,功能是否支持排期(默认1):0,不支持:不关联排期表查询推荐数据;1,支持:关联排期表查询推荐数据
       Whether the portal involved in the Taiwan project supports schedule or not? 0: Not support  1:Support  -->
  <supportSchedule>1</supportSchedule>
 
   <!-- ===================== 应急系统数据备份配置======================== -->
  <emergencyDate>
    <procedure>
        <!-- 数据库驱动
             DB driver -->
        <driver>oracle.jdbc.driver.OracleDriver</driver>
        <!-- 数据库链接URL, 根据实际的数据库服务器地址配置
             DB URL, config according to real database  server url -->
        <jdbcurl>jdbc:oracle:thin:@172.20.100.25:1521:orcl</jdbcurl>
        <!-- 数据库用户名, 根据实际的数据库服务器地址配置
             DB user name, config according to real database  server url -->
        <userName>szptest</userName>
        <!-- 数据库密码,  根据实际的数据库服务器地址配置
             DB password, config according to real database  server url -->
        <passwrod>szptest</passwrod>
        <!-- 调用的存储过程
             Stored Procedure called -->
        <sql>{call proc_refresh_mview()}</sql>
    </procedure>
  </emergencyDate>
 
    <!--清理库表冗余数据配置 单位为天
    Clean the table data redundancy allocation unit for the day-->
  <clearDate>
      <!-- 清除冗余数据(同步表成功信息)的周期时间
      Remove redundant data (the synchronization meter successful information) cycle time-->
      <clear_t_messagesync_his_succ_interval>90</clear_t_messagesync_his_succ_interval>
      <!-- 清除冗余数据(同步表失败信息)的周期时间
      Remove redundant data (the synchronization meter failure information) cycle time-->
      <clear_t_messagesync_his_fail_interval>180</clear_t_messagesync_his_fail_interval>
      <!-- 清除冗余数据(t_recommend_schedule表N天前的数据)的周期时间
      Remove redundant data (t_recommend_schedule's data OF N days before) cycle time-->
      <clear_t_recommend_schedule_interval>30</clear_t_recommend_schedule_interval>
      
      <!-- 清除冗余数据(t_schedule表N天前的数据)的周期时间
      Remove redundant data (t_schedule's data OF N days before) cycle time-->
      <clear_t_schedule_interval>30</clear_t_schedule_interval>
      
      <!-- 清除冗余数据(T_SYS_LOG表N天前的数据)的周期时间
      Remove redundant data (T_SYS_LOG's data OF N days before) cycle time-->
      <clear_t_sys_log_interval>90</clear_t_sys_log_interval>
      
      <!-- 清除冗余数据(t_weatherinfo表N天前的数据)的周期时间
      Remove redundant data (t_weatherinfo's data OF N days before) cycle time-->
      <clear_t_weatherinfo_interval>30</clear_t_weatherinfo_interval>
  </clearDate>
 
  <!--  门户版本管理 配置
         The Config OF portalVersion Manager-->
  <portalVersionConfig>
    <!-- 门户版本zip文件大小上限(单位M)
         Maximum size of portalVersion file (zip),(Unit: M) -->
    <maxSize>20</maxSize>
  </portalVersionConfig>
 
</portalMS>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值