D:\tomcat_portal\bin\portalMS\portalPackage\tmp\PublishConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<PublishConfig><!-- 发布包名称 -->
<name>幻灯版门户</name>
<!-- 针对的局点 -->
<customer>台湾广电</customer>
<!-- 发布日期 -->
<date>2013-03-11</date>
<!-- 发布版本,数据库唯一主键 -->
<version>NJGD</version>
<!-- portal虚拟IP地址或者域名 如:http://172.21.13.11/portal/ -->
<!-- 需要转换成静态页面的模板,可以配置多个,多个之间用分号隔开 -->
<templatePages>datas/data.js</templatePages>
</PublishConfig>
public class PortalVersion implements Serializable
{
private static final long serialVersionUID = 1L;
private Long versionId;
private Long siteID;
private Integer status;
private String statusStr;
// 门户版本别名,如幻灯版
private String versionName;
// 版本号
private String version;
// 局点简称,如南京广电
private String customer;
// 模板页面,需要通过PortalMS生成静态页面
private String templatepages;
// 门户版本包发布日期
private Date deploydate;
private String deploydateStr;
// 门户导入日期
private Date importdate;
private String importdateStr;
// 最后修改日期
private Date lastmodifydate;
private String lastmodifydateStr;
private String remark;
private void readConfig(String filePath, PortalVersion portalVersion)
throws Exception
{
SAXReader saxReader = new SAXReader();
FileInputStream in = null;
Reader read = null;
try
{
in = new FileInputStream(new File(jboosbin + File.separator
+ filePath + File.separator + "PublishConfig.xml"));
read = new InputStreamReader(in, "UTF-8");
Document document = saxReader.read(read);
// 获取根节点下的子节点PublishConfig
Element ele = document.getRootElement();
List<?> fieldList = ele.selectNodes("/PublishConfig");
for (Iterator<?> iterator = fieldList.iterator(); iterator.hasNext();)
{
Element element = (Element)iterator.next();
portalVersion.setCustomer(element.elementTextTrim("customer"));
portalVersion.setVersionName(element.elementTextTrim("name"));
portalVersion.setVersion(element.elementTextTrim("version"));
portalVersion.setDeploydateStr(element.elementTextTrim("date"));
portalVersion.setTemplatepages(element.elementTextTrim("templatePages"));
}
}
finally
{
if (null != in)
{
in.close();
}
if (null != read)
{
read.close();
}
}
}