示例#1
0
 /*     */ private List<EopApp> listSaasApp() /*     */ {
   /* 602 */ List appList = new ArrayList();
   /*     */
   /* 604 */ String xmlFile =
       EopSetting.EOP_PATH + EopContext.getContext().getContextPath() + "/profile.xml";
   /* 605 */ if (new File(xmlFile).exists()) {
     /*     */ try
     /*     */ {
       /* 608 */ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
       /*     */
       /* 610 */ DocumentBuilder builder = factory.newDocumentBuilder();
       /* 611 */ org.w3c.dom.Document document = builder.parse(xmlFile);
       /* 612 */ NodeList nodeList = document.getElementsByTagName("apps");
       /* 613 */ if (nodeList != null)
       /*     */ {
         /* 615 */ Node appsNode = nodeList.item(0);
         /* 616 */ NodeList appNodeList = appsNode.getChildNodes();
         /*     */
         /* 619 */ int i = 0;
         for (int len = appNodeList.getLength(); i < len; i++) {
           /* 620 */ Node node = appNodeList.item(i);
           /* 621 */ if (node.getNodeType() == 1) {
             /* 622 */ org.w3c.dom.Element appNode = (org.w3c.dom.Element) node;
             /* 623 */ EopApp eopApp = new EopApp();
             /* 624 */ eopApp.setAppid(appNode.getAttribute("id"));
             /* 625 */ eopApp.setVersion(appNode.getAttribute("version"));
             /* 626 */ appList.add(eopApp);
             /*     */ }
           /*     */ }
         /*     */ }
       /*     */
       /* 631 */ return appList;
       /*     */ }
     /*     */ catch (Exception e) {
       /* 634 */ e.printStackTrace();
       /* 635 */ throw new RuntimeException("加载本站点根目录的profile.xml失败,不能导出。");
       /*     */ }
     /*     */ }
   /* 638 */ throw new RuntimeException("本站点根目录下未含有profile.xml,不能导出。");
   /*     */ }
示例#2
0
 /*     */ public void createProfile(String path) /*     */ {
   /*  37 */ Element product = new Element("product");
   /*     */
   /*  39 */ List appList = this.siteManager.getSiteApps();
   /*     */
   /*  45 */ Element apps = new Element("apps");
   /*  46 */ for (EopApp app : appList)
   /*     */ {
     /*  48 */ Element appEl = new Element("app");
     /*  49 */ appEl.setAttribute("id", app.getAppid());
     /*  50 */ appEl.setAttribute("version", app.getVersion());
     /*  51 */ apps.addContent(appEl);
     /*     */ }
   /*     */
   /*  54 */ product.addContent(apps);
   /*     */
   /*  60 */ Element site = new Element("site");
   /*  61 */ fillSiteElement(site);
   /*  62 */ product.addContent(site);
   /*     */
   /*  67 */ Element urlsEl = new Element("urls");
   /*  68 */ fillUrlElement(urlsEl);
   /*  69 */ product.addContent(urlsEl);
   /*     */
   /*  74 */ Element menusEl = new Element("menus");
   /*  75 */ fillMenuElement(menusEl);
   /*  76 */ product.addContent(menusEl);
   /*     */
   /*  81 */ Element themesEl = new Element("themes");
   /*  82 */ fillThemesElement(themesEl);
   /*  83 */ product.addContent(themesEl);
   /*     */
   /*  85 */ Element indexItemEl = new Element("indexitems");
   /*  86 */ fillIndexItemElement(indexItemEl);
   /*  87 */ product.addContent(indexItemEl);
   /*     */
   /*  89 */ Document pfDocument = new Document(product);
   /*  90 */ outputDocumentToFile(pfDocument, path);
   /*     */ }
示例#3
0
  /**
   * 获取此产品所有应用的更新日志<br>
   *
   * @return
   */
  private List<UpdateLog> getUpdateLog() {

    if (this.logger.isDebugEnabled()) {
      this.logger.debug("获取产品所有应用的更新日志...");
    }

    // 声明要返回的容器
    List<UpdateLog> updateLogList = new ArrayList<UpdateLog>();

    // 加载升级xml文件
    Document document = this.loadUpdateXmlDoc("/version.xml");

    // 找到apps结点
    Element appsNode = XMLUtil.getChildByTagName(document, "apps");

    // 获取此产品的应用
    List<EopApp> appList = this.siteManager.getSiteApps();
    for (EopApp app : appList) {
      // 获取每个应用的版本
      String verison = app.getVersion();

      // 获取远程服务器上version.xml中的此应用节点
      Element appNode = XMLUtil.getChildByTagName(appsNode, app.getAppid());

      // 获取此应用的所有版本历史的更新日志
      UpdateLog updateLog = this.getAppUpdateLog(app.getAppid(), verison, appNode);
      if (updateLog != null) {
        updateLogList.add(updateLog);
      }
    }

    if (this.logger.isDebugEnabled()) {
      this.logger.debug("获取产品所有应用的更新日志完成.");
    }

    return updateLogList;
  }
示例#4
0
  /** 执行升级操作 */
  public void update() {
    if (logger.isDebugEnabled()) {
      logger.debug("执行升级操作...");
    }

    String newVersion = this.getNewVersion();
    if (logger.isDebugEnabled()) {
      logger.debug("产品最新版本为:[" + newVersion + "]");
    }

    // 加载升级xml文件
    Document document = this.loadUpdateXmlDoc("/version.xml");

    // 找到apps结点
    Element appsNode = XMLUtil.getChildByTagName(document, "apps");

    // 获取此产品的应用
    List<EopApp> appList = this.siteManager.getSiteApps();

    for (EopApp app : appList) {

      // 获取每个应用的版本
      String appVersion = app.getVersion();

      // 获取远程服务器上version.xml中的此应用节点
      Element appNode = XMLUtil.getChildByTagName(appsNode, app.getAppid());

      // 此应用的最新版本
      String appLastVersion = appNode.getAttribute("lastversion");

      if (logger.isDebugEnabled()) {
        logger.debug(
            "升级应用["
                + app.getAppid()
                + "],产品中此应用当前版本["
                + appVersion
                + "],最新版本["
                + appLastVersion
                + "]");
      }

      this.update(app.getAppid(), appVersion, appNode);

      // 记录app以便以后更新
      // app.setVersion(appLastVersion);

      // 更新站点的应用版本
      daoSupport.execute(
          "update eop_app set version=? where appid=?", appLastVersion, app.getAppid());

      if (logger.isDebugEnabled()) {
        logger.debug("升级应用[" + app.getAppid() + "]完成。");
      }
    }

    //	updateProfile(appList); //更新profile.xml
    this.updateVersion(newVersion); // 更新eop.properties中的version

    if (logger.isDebugEnabled()) {
      logger.debug("产品升级完成,当前版本为:[" + EopSetting.VERSION + "]");
    }
  }