Package org.jdom.xpath

Examples of org.jdom.xpath.XPath


    java.util.ArrayList list = new java.util.ArrayList();

    if(_config == null)
      return new String[0];
    try {
      XPath x3 = XPath.newInstance("//job_chain");        
      List listOfElement = x3.selectNodes(_dom.getDoc());

      for(int i = 0; i < listOfElement.size(); i++ ) {
        Element e = (Element)listOfElement.get(i);
        if(e.getChild("job_chain_node.job_chain") == null &&
            !Utils.getAttributeValue("name", e).equalsIgnoreCase(getChainName())) {
View Full Code Here


    try {
      if(which == null) which ="";       
      if(type == Editor.JOB_CHAIN) {

        XPath x3 = XPath.newInstance("//order[@job_chain='"+ name + "']");        
        List<Element> listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty())
          //throw new Exception ("Die Jobkette [job_chain=" + name + "] wird in einem Auftrag verwendet. " +
          //"Soll die Jobkette trotzdem umbennant werden");
          throw new Exception ("The Jobchain [job_chain=" + name + "] is currently being used by an order. " +
          "Do you want really rename the jobchain");       

        XPath x4 = XPath.newInstance("//add_order[@job_chain='"+ name + "']");        
        List<Element> listOfElement_4 = x4.selectNodes(_dom.getDoc());
        if(!listOfElement_4.isEmpty())
          throw new Exception ("The Jobchain [job_chain=" + name + "] is currently being used by an order. " +
          "Do you want really rename the jobchain");       

      } else if(type == Editor.JOB_CHAINS) {

        XPath x3 = XPath.newInstance("//order[@job_chain='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty())
          //throw new Exception ("Die Jobkette [job_chain=" + name + "] wird in einem Auftrag verwendet. " +
          //"Soll die Jobkette trotzdem gel�scht werden");
          throw new Exception ("The Jobchain [job_chain=" + name + "] is currently being used by an order. " +
          "Do you want to delete the jobchain");

        XPath x4 = XPath.newInstance("//add_order[@job_chain='"+ name + "']");        
        List listOfElement_4 = x4.selectNodes(_dom.getDoc());
        if(!listOfElement_4.isEmpty())
          //throw new Exception ("Die Jobkette [job_chain=" + name + "] wird in einem Auftrag verwendet. " +
          //"Soll die Jobkette trotzdem gel�scht werden");
          throw new Exception ("The Jobchain [job_chain=" + name + "] is currently being used by an order. " +
          "Do you want to delete the jobchain");

      } else if(type==Editor.JOB) {

        if(which != null && which.equalsIgnoreCase("close")) {
          onlyWarning = true;
          XPath x0 = XPath.newInstance("//job[@name='"+ name + "']");      
          Element e = (Element)x0.selectSingleNode(_dom.getDoc());
          boolean isOrder = Utils.getAttributeValue("order", e).equalsIgnoreCase("yes");

          if(!isOrder) {
            XPath x3 = XPath.newInstance("//job_chain_node[@job='"+ name + "']");        
            List listOfElement_3 = x3.selectNodes(_dom.getDoc());
            if(!listOfElement_3.isEmpty())
              //throw new Exception ("Der Standalone Job " + name + " ist in einer Jobkette definiert.");
              throw new Exception   ("The Standalone Job " + name + " is currently being used by a job chain");
          }
        } else {

          if(name.length() == 0)
            return true;

          //
          XPath x0 = XPath.newInstance("//job[@name='"+ name + "']");      
          Element e = (Element)x0.selectSingleNode(_dom.getDoc());
          boolean isOrder = Utils.getAttributeValue("order", e).equalsIgnoreCase("yes");
          if( isOrder) {           

            XPath x = XPath.newInstance("//job[@name='"+ name + "']/run_time[@let_run='yes' or @once='yes' or @single_start]");      

            List listOfElement = x.selectNodes(_dom.getDoc());
            if(!listOfElement.isEmpty())
              throw new Exception ("An order job [name=" + name+ "] may not use single_start-, start_once- and " +
              "let_run attributes in Runtime Elements. Should these attributes be deleted?");

            XPath x2 = XPath.newInstance("//job[@name='"+ name + "']/run_time//period[@let_run='yes' or @single_start]");        
            List listOfElement_2 = x2.selectNodes(_dom.getDoc());
            if(!listOfElement_2.isEmpty())
              throw new Exception ("An order job [name=" + name+ "] may not use single_start-, start_once- and " +
              "let_run attributes in Runtime Elements. Should these attributes be deleted?");

          }


          XPath x3 = XPath.newInstance("//job_chain_node[@job='"+ name + "']");        
          List listOfElement_3 = x3.selectNodes(_dom.getDoc());
          if(!listOfElement_3.isEmpty()) {
            if(which.equalsIgnoreCase("change_order")) {
              throw new Exception   ("The Job " + name + " is currently being used by a job chain. Do you want really change to a standalone job?");
            } else {
              throw new Exception   ("The Job " + name + " is currently being used by a job chain. Do you want really rename the name?");
            }
          }

        }

      } else if(type == Editor.JOBS) {

        XPath x3 = XPath.newInstance("//job_chain_node[@job='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty())         
          throw new Exception ("The Job [name=" + name + "] is currently being used by a job chain. Do you want to delete?");

      } else if(type == Editor.LOCKS) {

        XPath x3 = XPath.newInstance("//lock.use[@lock='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty())         
          throw new Exception ("The lock [lock=" + name + "] is currently  being used by a job. Do you want to continue?");       


      } else if(type == Editor.PROCESS_CLASSES) {

        XPath x3 = XPath.newInstance("//job[@process_class='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty())         
          throw new Exception ("The process class [process_class=" + name + "] is currently being used by a job. Do you want to continue?");

      } else if(type == Editor.SCHEDULES || type == Editor.SCHEDULE) {

        XPath x3 = XPath.newInstance("//run_time[@schedule='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty())         
          throw new Exception ("The Schedule [name=" + name + "] is currently being used by a Runtime. Do you want to continue?");

      }
View Full Code Here

    //if(_events != null) {
    List l = null;
    //if(_eventGroup.getName().equals("commands")) {
    try {
      if(type == Editor.ADD_EVENT_GROUP) {   
        XPath x3 = XPath.newInstance("add_event/event");
        l = x3.selectNodes(_eventGroup);
      } else if(type == Editor.REMOVE_EVENT_GROUP) {
     
        XPath x3 = XPath.newInstance("remove_event/event");        
        l = x3.selectNodes(_eventGroup);     
        /*XPath x3 = XPath.newInstance("//remove_event/event");        
        l = x3.selectNodes(_dom.getDoc());*/
              
      } else {
        l = _eventGroup.getChildren("event");   
View Full Code Here

        //String schema = _properties.getProperty("editor.xml.xsd");
        SAXBuilder builder = new SAXBuilder(false);
       
      Document doc = builder.build(System.class.getResource(Options.getSchema()).toString());
     
      XPath x = XPath.newInstance("//xsd:documentation");         
      List<Element> listOfElement = x.selectNodes(doc);
      if(!listOfElement.isEmpty()) {
        Element e = listOfElement.get(0);
        String version = e.getText();
        int pos1 = version.indexOf("$") + "$Id: ".length();
        int pos2 = version.indexOf("jz $");
View Full Code Here

              if(f.isDirectory()) {
                for(int i = 0; i < changeFiles.size(); i++) {
                  File hFfile = changeFiles.get(i);
                  String sXPATH= getXPathString(hFfile, false);

                  XPath x1 = XPath.newInstance(sXPATH);
                  List<Element> listOfElement = x1.selectNodes(dom.getDoc());
                  if(!listOfElement.isEmpty()){
                    Element e = listOfElement.get(0);
                    Element pe = e.getParentElement();
                    e.detach();
                    Element n = MergeAllXMLinDirectory.readElementFromHotHolderFile(hFfile);
                    pe.addContent((Element)n.clone());

                  }

                }


                //Es wurden ausserhalb vom Editor neue Hot Folder dateien hinzugef�gt. In diesem Fall soll der Editor aktualisiert werden
                for(int i = 0; i < newFFiles.size(); i++) {
                  File newHFFile = newFFiles.get(i);

                  String sXPATH= getXPathString(newHFFile, true);

                  XPath x1 = XPath.newInstance(sXPATH);
                  List<Element> listOfElement = x1.selectNodes(dom.getDoc());
                  if(!listOfElement.isEmpty()) {
                    Element pe = listOfElement.get(0);
                    Element n = MergeAllXMLinDirectory.readElementFromHotHolderFile(newHFFile);
                    pe.addContent((Element)n.clone());
                  } else {

                    Element pe = new Element(sXPATH);             
                    dom.getRoot().addContent(pe);
                    Element n = MergeAllXMLinDirectory.readElementFromHotHolderFile(newHFFile);
                    pe.addContent((Element)n.clone());

                  }
                }
                       
               
                for(int i = 0; i < delFFiles.size(); i++){
                  File delFile = delFFiles.get(i);
                  String sXPATH= getXPathString(delFile, false);

                  XPath x1 = XPath.newInstance(sXPATH);
                  List<Element> listOfElement = x1.selectNodes(dom.getDoc());
                  if(!listOfElement.isEmpty()) {
                    Element pe = listOfElement.get(0);
                    pe.detach();
                    ((SchedulerDom)dom).getHotFolderFiles().remove(delFile.getName());
                  }                 
View Full Code Here

      String[] retVal = new String[]{""};
      ArrayList stateList = new ArrayList();
     
      try {
        String jobChainname = Utils.getAttributeValue("job_chain", getCommand());       
        XPath x3 = XPath.newInstance("//job_chain[@name='"+ jobChainname + "']");
        Element jobChain = (Element)x3.selectSingleNode(_dom.getDoc());
       
        if(jobChain == null) {
          jobChainname = Utils.getAttributeValue("job_chain_node.job_chain", getCommand());
          x3 = XPath.newInstance("//job_chain_node.job_chain[@name='"+ jobChainname + "']");
            jobChain = (Element)x3.selectSingleNode(_dom.getDoc());
           
        }
        if(jobChain == null)
          return retVal;
       
View Full Code Here

  }

  //ein Job Chain hat entweder job_chain_node ODER job_chain_node.job_chain Kindknoten.
  private boolean check() {
    try {
      XPath x3 = XPath.newInstance("//job_chain[@name='"+ listener.getChainName() + "']/job_chain_node");        
      List listOfElement_3 = x3.selectNodes(dom.getDoc());
      XPath x4 = XPath.newInstance("//job_chain[@name='"+ listener.getChainName() + "']/file_order_sink");        
      List listOfElement_4 = x4.selectNodes(dom.getDoc());
      if(listOfElement_3.isEmpty() && listOfElement_4.isEmpty())
        return true;
      else
        return false;
     
View Full Code Here

        name = name.substring(1);
      }

      if(type==Editor.JOB) {

        XPath x3 = XPath.newInstance("//job[@name='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());                

        if(!listOfElement_3.isEmpty()) {   

          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          for(int i = 0; i < tree.getItemCount(); i++) {           
            TreeItem item = tree.getItem(i);
            if(item.getText().equals(SchedulerListener.JOBS)){

              TreeItem[] jobsItem = item.getItems();
              for(int j = 0; j < jobsItem.length; j++) {
                TreeItem jItem = jobsItem[j];
                //if(jItem.getText().equals("Job: "+ name)){
                if(jItem.getText().endsWith("Job: "+ name)){
                  tree.setSelection(new TreeItem [] {jItem});
                  f.updateTreeItem(jItem.getText());
                  f.updateTree("jobs");
                  break;
                }
              }
            }
          }
        }
      } else if(type==Editor.MONITOR) {

        String[] split = name.split("_@_");
        String jobname = split[0];
        String monitorname = split[1];

        XPath x3 = XPath.newInstance("//job[@name='"+ jobname + "']/monitor[@name='"+ monitorname + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());                

        if(!listOfElement_3.isEmpty()) {   

          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          //if(tree.getSelection()[0].getText().equals("Monitor")){
          if(tree.getSelection()[0].getText().equals(SchedulerListener.MONITOR)){
            TreeItem[] monitorsItem = tree.getSelection()[0].getItems();
            for(int k = 0; k < monitorsItem.length; k++) {
              TreeItem monitor = monitorsItem[k];

              if(monitor.getText().equals(monitorname)){
                //if(jItem.getText().endsWith("Job: "+ name)){
                tree.setSelection(new TreeItem [] {monitor});
                f.updateTreeItem(monitorname);
                f.updateTree("monitor");
                break;
              }
            }
          } else {
            for(int i = 0; i < tree.getItemCount(); i++) {           
              TreeItem item = tree.getItem(i);
              if(item.getText().equals(SchedulerListener.JOB + jobname)){
                TreeItem[] jobsItem = item.getItems();
                for(int j = 0; j < jobsItem.length; j++) {
                  TreeItem jItem = jobsItem[j];
                  if(jItem.getText().equals("Monitor")){
                    TreeItem[] monitorsItem = jItem.getItems();
                    for(int k = 0; k < monitorsItem.length; k++) {
                      TreeItem monitor = monitorsItem[k];

                      if(monitor.getText().equals(monitorname)){
                        //if(jItem.getText().endsWith("Job: "+ name)){
                        tree.setSelection(new TreeItem [] {monitor});
                        f.updateTreeItem(monitorname);
                        f.updateTree("monitor");
                        break;
                      }
                    }
                  }
                }
              }
            }
          }
        }

      } else if(type==Editor.JOB_CHAIN) {

        XPath x3 = XPath.newInstance("//job_chain[@name='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          for(int i = 0; i < tree.getItemCount(); i++) {           
            TreeItem item = tree.getItem(i);
            if(item.getText().equals(SchedulerListener.JOB_CHAINS)){
              TreeItem[] jobsItem = item.getItems();
              for(int j = 0; j < jobsItem.length; j++) {
                TreeItem jItem = jobsItem[j];
                //if(jItem.getText().equals("Job Chain: "+ name)){
                if(jItem.getText().endsWith("Job Chain: "+ name)){
                  tree.setSelection(new TreeItem [] {jItem});
                  f.updateTreeItem(jItem.getText());
                  f.updateTree("");
                  break;
                }
              }
            }
          }
        }

      } else if (type == Editor.PROCESS_CLASSES) {

        XPath x3 = XPath.newInstance("//process_class[@name='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          for(int i = 0; i < tree.getItemCount(); i++) {           
            TreeItem item = tree.getItem(i);
            //if(item.getText().equals("Process Classes")){
            if(item.getText().endsWith("Process Classes")){
              tree.setSelection(new TreeItem [] {item});
              f.updateTreeItem(item.getText());
              f.updateTree("");               
              break;
            }
          }
        }
      } else if(type==Editor.SCHEDULE) {

        XPath x3 = XPath.newInstance("//schedule[@name='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          for(int i = 0; i < tree.getItemCount(); i++) {           
            TreeItem item = tree.getItem(i);
            if(item.getText().equals(SchedulerListener.SCHEDULES)){

              TreeItem[] items = item.getItems();
              for(int j = 0; j < items.length; j++) {
                TreeItem jItem = items[j];
                //if(jItem.getText().equals(name)){
                if(jItem.getText().endsWith(name)){
                  tree.setSelection(new TreeItem [] {jItem});
                  f.updateTreeItem(jItem.getText());
                  f.updateTree("");
                  break;
                }
              }
            }
          }
        }

      } else if(type == Editor.ORDER) {

        XPath x3 = XPath.newInstance("//order[@id='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());

        if(listOfElement_3.isEmpty()) {
          x3 = XPath.newInstance("//add_order[@id='"+ name + "']");        
          listOfElement_3 = x3.selectNodes(_dom.getDoc());
        }

        if(!listOfElement_3.isEmpty()) {         
          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          for(int i = 0; i < tree.getItemCount(); i++) {           
            TreeItem item = tree.getItem(i);
            if(item.getText().equals(SchedulerListener.ORDERS)){

              TreeItem[] items = item.getItems();
              for(int j = 0; j < items.length; j++) {
                TreeItem jItem = items[j];
                //if(jItem.getText().equals("Order: " + name)){
                if(jItem.getText().endsWith("Order: " + name)){
                  tree.setSelection(new TreeItem [] {jItem});
                  f.updateTreeItem(jItem.getText());
                  f.updateTree("");
                  break;
                }
              }
            }
          }
        }

      } else if(type == Editor.WEBSERVICE) {

        XPath x3 = XPath.newInstance("//web_service[@name='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());       

        if(!listOfElement_3.isEmpty()) {         
          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          for(int i = 0; i < tree.getItemCount(); i++) {           
            TreeItem item = tree.getItem(i);
            if(item.getText().equals(SchedulerListener.HTTP_SERVER)){
              for(int k = 0; k < item.getItemCount(); k++) {   
                TreeItem httpItem = item.getItem(k);

                if(httpItem.getText().equals(SchedulerListener.WEB_SERVICES)){

                  TreeItem[] items = httpItem.getItems();
                  for(int j = 0; j < items.length; j++) {
                    TreeItem jItem = items[j];
                    if(jItem.getText().equals("Web Service: " + name)){
                      tree.setSelection(new TreeItem [] {jItem});
                      f.updateTreeItem(jItem.getText());
                      f.updateTree("");
                      break;
                    }
                  }
                }
              }
            }
          }
        }
      } else if (type == Editor.ACTIONS) {


        XPath x3 = XPath.newInstance("//action[@name='"+ name + "']");        
        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          for(int i = 0; i < tree.getItemCount(); i++) {           
            TreeItem item = tree.getItem(i);
            if(item.getText().equals("Actions")){
              TreeItem[] jobsItem = item.getItems();
              for(int j = 0; j < jobsItem.length; j++) {
                TreeItem jItem = jobsItem[j];
                //if(jItem.getText().equals("Job Chain: "+ name)){
                if(jItem.getText().endsWith(sos.scheduler.editor.actions.listeners.ActionsListener.ACTION_PREFIX + name)){
                  tree.setSelection(new TreeItem [] {jItem});
                  f.updateTreeItem(jItem.getText());
                  f.updateTree("");
                  break;
                }
              }
            }
          }
        }
      } else if(type == Editor.EVENTS) {
        //<event_group logic="or" group="1">
        XPath x3 = XPath.newInstance("//event_group[@group='"+ name + "']");   


        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          if(tree.getSelectionCount() > 0) {
            TreeItem itemp = tree.getSelection()[0];
            for(int i = 0; i < itemp.getItemCount(); i++) {           
              TreeItem item = itemp.getItem(i);
              if(item.getText().endsWith(sos.scheduler.editor.actions.listeners.ActionsListener.GROUP_PREFIX + name)){
                tree.setSelection(new TreeItem [] {item});
                f.updateTreeItem(item.getText());
                f.updateTree("");
                break;
              }
            }
          }           
        }
      } else if(type == Editor.ACTION_COMMANDS) {
        XPath x3 = XPath.newInstance("//command[@name='"+ name + "']");   


        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          if(tree.getSelectionCount() > 0) {
            TreeItem itemp = tree.getSelection()[0];
            for(int i = 0; i < itemp.getItemCount(); i++) {           
              TreeItem item = itemp.getItem(i);
              if(item.getText().endsWith(sos.scheduler.editor.actions.listeners.ActionsListener.COMMAND_PREFIX + name)){
                tree.setSelection(new TreeItem [] {item});
                f.updateTreeItem(item.getText());
                f.updateTree("");
                break;
              }
            }
          }           
        }
      } else if (type == Editor.JOB_COMMAND_EXIT_CODES &&
          sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor() instanceof ActionsForm){


        XPath x3 = null;
        String job = "";
        if(name.startsWith("start_job")) {
          job = name.substring("start_job: ".length());
          x3 = XPath.newInstance("//command/start_job[@job='"+ job + "']");

        } else {
          String child = name.substring(0, name.indexOf(": "));
          job = name.substring(child.length() + 2);
          x3 = XPath.newInstance("//command/"+child+"[@job_chain='"+ job + "']");           

        }


        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          ActionsForm f = (ActionsForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
          if(tree.getSelectionCount() > 0) {
            TreeItem itemp = tree.getSelection()[0];
            for(int i = 0; i < itemp.getItemCount(); i++) {           
              TreeItem item = itemp.getItem(i);
              if(item.getText().equals(name)){
                tree.setSelection(new TreeItem [] {item});
                f.updateTreeItem(item.getText());
                f.updateTree("");
                break;
              }
            }
          }           
        }
      } else if (type == Editor.JOB_COMMAND_EXIT_CODES &&
          sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor() instanceof SchedulerForm){


        XPath x3 = null;
        String job = "";
        if(name.startsWith("start_job")) {
          job = name.substring("start_job: ".length());
          x3 = XPath.newInstance("//commands/start_job[@job='"+ job + "']");

        } else {
          String child = name.substring(0, name.indexOf(": "));
          job = name.substring(child.length() + 2);
          x3 = XPath.newInstance("//commands/"+child+"[@job_chain='"+ job + "']");           

        }


        List listOfElement_3 = x3.selectNodes(_dom.getDoc());
        if(!listOfElement_3.isEmpty()) {         
          SchedulerForm f = (SchedulerForm)(sos.scheduler.editor.app.MainWindow.getContainer().getCurrentEditor());
          if(f == null)
            return;
          Tree tree = f.getTree();
View Full Code Here

        for (File f : files) {
            System.out.println("file:" + f.getAbsolutePath());
            Document document = builder.build(f);
            System.out.println(document.getRootElement().getName());
       
            XPath xpath = XPath.newInstance("/spooler/answer");
            Element e = (Element)xpath.selectSingleNode(document);
            String timeStamp = e.getAttributeValue("time");
            System.out.println("Timestamp:" + timeStamp);

            xpath = XPath.newInstance("/spooler/answer/state");
            e = (Element)xpath.selectSingleNode(document);
            String pid = e.getAttributeValue("pid");
            System.out.println("pid:" + pid);
           
            SystemProcess process = processes.select(pid);

            xpath = XPath.newInstance("//spooler/answer/state/allocations");
            e = (Element)xpath.selectSingleNode(document);
            String count = e.getAttributeValue("count");
            String size = e.getAttributeValue("size");

            String reserved_virtual = "";
            String total_virtual = "";
            String avail_virtual = "";
            String total_physical = "";
            String avail_physical = "";
            String total_pagefile = "";
            String avail_pagefile = "";
            String memoryload = "";

            reserved_virtual = e.getAttributeValue("reserved_virtual");           
            if(reserved_virtual != null)
            {
                total_virtual = e.getAttributeValue("total_virtual");
                avail_virtual = e.getAttributeValue("avail_virtual");
                total_physical = e.getAttributeValue( "total_physical");
                avail_physical = e.getAttributeValue("avail_physical");
                total_pagefile = e.getAttributeValue( "total_pagefile");
                avail_pagefile = e.getAttributeValue( "avail_pagefile");
                memoryload = e.getAttributeValue( "memoryload");
                csvLine = pid;
                csvLine += ";" + timeStamp;
                csvLine += ";" + size;
                csvLine += ";" + count;
                csvLine += ";" + reserved_virtual;
                csvLine += ";" + total_virtual;
                csvLine += ";" + avail_virtual;
                csvLine += ";" + total_physical;
                csvLine += ";" + avail_physical;
                csvLine += ";" + total_pagefile;
                csvLine += ";" + avail_pagefile;
                csvLine += ";" + memoryload;
                csvLine += "\n";
                os1.write(csvLine.getBytes());
            }

           
            xpath = XPath.newInstance("//spooler/answer/state/allocations/allocation");
            List<Element> list = xpath.selectNodes(document);
            for (Element element : list) {
                System.out.println(
                        "count:" + element.getAttributeValue("count")
                        + " name:" + element.getAttributeValue("name")
                        + " size:" + element.getAttributeValue("size")
View Full Code Here

        for (File f : files) {
            Document document = builder.build(f);
            System.out.println(document.getRootElement().getName() + "file:" + f.getAbsolutePath());
       
            boolean schedulerProcessFound = false;
            XPath xpath = XPath.newInstance("//Table[@name='TableWorkingSet']/Item/Data[@name='process' and . = 'scheduler']/following-sibling::node()[@name='pid']");
            Element e = (Element)xpath.selectSingleNode(document);
            if (e != null) {
                schedulerProcessFound = true;           
                String pid = e.getText();
                System.out.println("pid:" + pid);
                xpath = XPath.newInstance("//Table[@name='TableWorkingSet']/Item/Data[@name='process' and . = 'scheduler']/following-sibling::node()[@name='private']");
                e = (Element)xpath.selectSingleNode(document);
                String privateBytes = e.getText();
                System.out.println("private bytes:" + privateBytes);   
               
                xpath = XPath.newInstance("//Table[@name='collection']/Item/Data[@name='start']");
                e = (Element)xpath.selectSingleNode(document);
                String year = e.getAttributeValue("year");
                String month = e.getAttributeValue("month");
                String day = e.getAttributeValue("day");
                String hour = e.getAttributeValue("hour");
                String minute = e.getAttributeValue("minute");
View Full Code Here

TOP

Related Classes of org.jdom.xpath.XPath

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.