Package com.ytec.jdap.model

Examples of com.ytec.jdap.model.Application


  }

  public Application getAppliaction() {
    try {
      if (appId == null) {
        appliaction = new Application();
      } else {
        appliaction = ConfigMamager.getReader().getAppById(appId);
      }
    } catch (Exception e) {
      BaseFrame.alert(e.getMessage());
View Full Code Here


      return false;
    }
    if (appId == null) {
      String appName = nameField.getText();
      try {
        Application app = ConfigMamager.getReader().getAppByName(appName);
        if (app.getId() != null) {
          alert("Ӧ�������Ѿ����ڣ� ");
          return false;
        }
      } catch (Exception e) {
        BaseFrame.alert(e.getMessage());
View Full Code Here

          for (int i = 0; i < table.getRowCount(); i++) {
            Boolean isSelect = (Boolean) table.getValueAt(i, 0);
            String appId = (String) table.getValueAt(i, 1);
            if (isSelect == true) {
              try {
                Application application = ConfigMamager.getReader().getAppById(appId);
                if (Application.RUNNING.equals(application.getState())) {
                  continue;
                }
                application.setState(Application.RUNNING);
                AppManagerToolkit.getAppManager().startApp(application);
              } catch (Exception ex) {
                sb.append(ex.getMessage());
                continue;
              }
            }
          }
          table.repaintTable();

          if (sb.length() > 0) {
            BaseFrame.alert(sb.toString());
          }
        } catch (Exception ex) {
          BaseFrame.alert(ex.getMessage());
        }
      }
    });
    appStopButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          StringBuffer sb = new StringBuffer();
          for (int i = 0; i < table.getRowCount(); i++) {
            Boolean isSelect = (Boolean) table.getValueAt(i, 0);
            if (isSelect == true) {
              try {
                String appId = (String) table.getValueAt(i, 1);
                Application application = ConfigMamager.getReader().getAppById(appId);
                if (Application.STOPED.equals(application.getState())) {
                  continue;
                }
                application.setState(Application.STOPED);
                AppManagerToolkit.getAppManager().stopApp(application);
              } catch (Exception ex) {
                sb.append(ex.getMessage());
                continue;
              }
            }
          }
          table.repaintTable();

          if (sb.length() > 0) {
            BaseFrame.alert(sb.toString());
          }
        } catch (Exception ex) {
          BaseFrame.alert(ex.getMessage());
        }
      }
    });
    removeButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          List<String> appIds = new ArrayList<String>();
          for (int i = 0; i < table.getRowCount(); i++) {
            Boolean isSelect = (Boolean) table.getValueAt(i, 0);
            String appId = (String) table.getValueAt(i, 1);
            if (isSelect == true) {
              String status;
              status = ConfigMamager.getReader().getAppById(appId).getState();
              if (Application.RUNNING.equals(status)) {
                BaseFrame.alert("ж��֮ǰ����ֹͣӦ��!");
                return;
              }
              appIds.add(appId);
            }
          }
          if (appIds.size() == 0) {
            BaseFrame.alert("��ѡ����Ҫж�ص�Ӧ�ã�");
            return;
          }
          ConfigMamager.getReader().removeApp(appIds);
          table.repaintTable();
        } catch (Exception e1) {
          BaseFrame.alert(e1.getMessage());
        }
      }
    });
    restartButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          StringBuffer sb = new StringBuffer();
          for (int i = 0; i < table.getRowCount(); i++) {
            Boolean isSelect = (Boolean) table.getValueAt(i, 0);
            if (isSelect == true) {
              try {
                String appId = (String) table.getValueAt(i, 1);
                Application application = ConfigMamager.getReader().getAppById(appId);
                application.setState(Application.STOPED);
                AppManagerToolkit.getAppManager().stopApp(application);
                application.setState(Application.RUNNING);
                AppManagerToolkit.getAppManager().startApp(application);
              } catch (Exception ex) {
                sb.append(ex.getMessage());
                continue;
              }
            }
          }
          table.repaintTable();

          if (sb.length() > 0) {
            BaseFrame.alert(sb.toString());
          }
        } catch (Exception ex) {
          BaseFrame.alert(ex.getMessage());
        }
      }
    });
    refreshButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          List<Application> appList = ConfigMamager.getReader().getAppList();
          Application modifyApp = new Application();
          for (Iterator<Application> it = appList.iterator(); it.hasNext();) {
            Application app = (Application) it.next();
            String pid = ProcessTookit.getIProcessManager().getPIDByAppId(app.getId());
            if (pid == null || ProcessTookit.getIProcessManager().getMemByPID(pid) == null) {
              app.setState(Application.STOPED);
              modifyApp.addBrother(app);
            }
          }
          if (modifyApp.hasBrother()) {// ��������
            AppManagerToolkit.getAppManager().stopApp(modifyApp.getBrother());
View Full Code Here

        int row = table.getSelectedRow();
        int column = table.getSelectedColumn();
        String appId = (String) dataModel.getValueAt(row, 1);
        String appName = (String) table.getValueAt(row, 2);
        try {
          Application application = ConfigMamager.getReader().getAppById(appId);
          if (column == 2) {// ���
            ProcessInfo info = ProcessTookit.getIProcessManager().getProcessInfo(appId);
            if (info != null && !info.isWatching() && Application.RUNNING.equals(application.getState())) {// ��ֹͨ��Ӧ�ô򿪶����������
              new MonitorFrame(appId, appName);
              info.setWatching(true);
            }
          } else if (column == 4) {// ����
            mainFrame.publishFrame(mainFrame, appId);
          } else if (column == 5) {// ֹͣ
            if (Application.STOPED.equals(application.getState())) {
              BaseFrame.alert("Ӧ���Ѿ�ֹͣ!");
              return;
            }
            application.setState(Application.STOPED);
            AppManagerToolkit.getAppManager().stopApp(application);
            thiz.repaintTable();
          } else if (column == 6) {// ����
            if (Application.RUNNING.equals(application.getState())) {
              BaseFrame.alert("Ӧ����������!");
              return;
            }
            application.setState(Application.RUNNING);
            AppManagerToolkit.getAppManager().startApp(application);
            thiz.repaintTable();
          }
        } catch (Exception e2) {
          BaseFrame.alert(e2.getMessage());
View Full Code Here

      JButton b2 = new JButton("ֹͣ");
      JButton b3 = new JButton("����");
      ImageIcon runningIcon = new ImageIcon(Global.runningImagePath);
      ImageIcon stopedIcon = new ImageIcon(Global.stopImagePath);
      for (int i = 0; i < size; i++) {
        Application application = (Application) appList.get(i);
        Object[] appArray = new Object[7];
        appArray[0] = false;
        appArray[1] = application.getId();
        appArray[2] = application.getName();
        appArray[3] = (Application.RUNNING.equals(application.getState()) ? runningIcon : stopedIcon);
        appArray[4] = b1;
        appArray[5] = b2;
        appArray[6] = b3;
        tableData[i] = appArray;
      }
View Full Code Here

   */
  public static void main(String[] args) {

    XmlReaderW3C xmlReaderW3C = new XmlReaderW3C();

    Application application = new Application();
    Map<String, String> map = new HashMap<String, String>();
    map.put("jvm", "-Xms256m");
    map.put("port", "12888");
    application.setId(System.currentTimeMillis() + "");
    application.setName("MUSEһ������");
    application.setParams(map);

    // xmlReaderW3C.addApp(application);
    // xmlReaderW3C.removeApp(application);
    // List<Application> list = xmlReaderW3C.getAppList();
    // list.size();
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    AppManager app = new AppManager();
    Application application = new Application("1234567890", "test", "1", "D:/mydata/workspace/springSpace/srp/engine", "museengine.jar");
    try {
      app.startApp(application);
      app.stopApp(application);
    } catch (Exception e) {
    }
View Full Code Here

    if (!application.hasBrother()) {
      application.addBrother(application);
    }
    for (Iterator<Application> its = application.getBrother().iterator(); its.hasNext();) {
      Application app = (Application) its.next();

      Element elem = null;
      for (int i = 0; i < apps.getLength(); i++) {
        elem = (Element) apps.item(i);
        if (app.getId().equals(elem.getAttribute(Constants.APP_ID))) {
          break;
        }
        elem = null;
      }
      if (elem == null) {
        continue;
      }
      app.fillElement(elem);
      Map<String, String> params = app.getParams();

      if (params != null && params.size() > 0) {
        while (elem.hasChildNodes()) {// �������
          elem.removeChild(elem.getFirstChild());
        }
View Full Code Here

  public void removeApp(List<String> appIds) throws Exception {
    Element element = getDocument().getDocumentElement();
    NodeList apps = element.getElementsByTagName(Constants.APPLICATION);

    for (int j = 0; j < appIds.size(); j++) {
      Application app = this.getAppById(appIds.get(j));
      for (int i = 0; i < apps.getLength(); i++) {
        Element elem = (Element) apps.item(i);
        if (app.getId().equals(elem.getAttribute(Constants.APP_ID))) {
          element.removeChild(elem);
        }
      }
    }
    saveDocument();
View Full Code Here

    List<Application> appList = new ArrayList<Application>();
    Element element = getDocument().getDocumentElement();
    NodeList apps = element.getElementsByTagName(Constants.APPLICATION);

    for (int i = 0; i < apps.getLength(); i++) {
      Application application = new Application();
      Element ele = (Element) apps.item(i);
      application.setProperties(ele);
      NodeList params = ele.getElementsByTagName(Constants.PARAM);

      if (params != null && params.getLength() > 0) {
        Map<String, String> paramMap = new HashMap<String, String>();
        for (int k = 0; k < params.getLength(); k++) {
          Element param = (Element) params.item(k);
          paramMap.put(param.getAttribute(Constants.PARAM_NAME), param.getAttribute(Constants.PARAM_VALUE));
        }
        application.setParams(paramMap);
      }
      appList.add(application);
    }
    return appList;
  }
View Full Code Here

TOP

Related Classes of com.ytec.jdap.model.Application

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.