Ejemplo n.º 1
0
  /**
   * 加载配置文件
   *
   * @param projectConfigPath
   * @throws DocumentException
   */
  public void loadProjectConfigPath(String projectConfigPath) throws DocumentException {
    this.projectConfigPath = projectConfigPath;
    Document doc = XmlUitl.getFileDocument(this.projectConfigPath);

    // 加载项目名称
    List<Element> nameList = XmlUitl.getAllTag(doc, "name");
    this.setProjectName(nameList.get(0).getText());
    nameList = null;

    // 加载项目logo
    List<Element> logoList = XmlUitl.getAllTag(doc, "logo");
    this.setLogoPath(logoList.get(0).getText());
    logoList = null;

    // 加载项目pageType
    List<Element> pageTypeList = XmlUitl.getAllTag(doc, "pageType");
    this.setPageType(pageTypeList.get(0).getText());
    pageTypeList = null;

    // 加载项目index
    List<Element> indexTypeList = XmlUitl.getAllTag(doc, "index");
    this.setIndex(indexTypeList.get(0).getText());
    indexTypeList = null;

    // 加载插件
    List<Element> pluginList = XmlUitl.getAllTag(doc, "plugin");
    for (Element element : pluginList) {
      Map<String, String> map = XmlUitl.getAllAttribute(element);
      if (map.get("type").equals(PluginTypes.CLASSPATH)) {
        try {
          PluginManager.getManager()
              .loadPlugin(
                  (Plugin) ReflectionUtil.getClasstoObject(makeupLocalPlugin(map.get("name"))));
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      map = null;
    }
    pluginList = null;
  }
  @Override
  public void excute(Object... args) {
    try {
      if (args != null && args.length != 0) {
        DBModel dbModel = null;
        if ((Boolean) args[4]) {
          dbModel = DBUtil.getInstance().executeCacheQuery((String) args[0], (String) args[1]);
        } else {
          dbModel = DBUtil.getInstance().executeQuery((String) args[0], (String) args[1]);
        }

        this.object = args[2];
        this.methodName = (String) args[3];

        ReflectionUtil.invokeMethod(this.object, this.methodName, dbModel);
        dbModel = null;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }