Package org.apache.oodt.cas.resource.scheduler

Examples of org.apache.oodt.cas.resource.scheduler.QueueManager


    this.dirUris = dirUris;
  }

  public QueueManager loadQueues() {

    QueueManager queueManager = new QueueManager();

    if (dirUris != null && dirUris.size() > 0) {
      for (Iterator i = dirUris.iterator(); i.hasNext();) {
        String dirUri = (String) i.next();

        try {
          File nodesDir = new File(new URI(dirUri));
          if (nodesDir.isDirectory()) {

            String nodesDirStr = nodesDir.getAbsolutePath();

            if (!nodesDirStr.endsWith("/")) {
              nodesDirStr += "/";
            }

            // get all the workflow xml files
            File[] nodesFiles = nodesDir.listFiles(queuesXmlFilter);

            for (int j = 0; j < nodesFiles.length; j++) {

              String nodesXmlFile = nodesFiles[j]
                  .getAbsolutePath();
              Document nodesRoot = null;
              try {
                nodesRoot = XMLUtils
                    .getDocumentRoot(new FileInputStream(
                        nodesFiles[j]));
              } catch (FileNotFoundException e) {
                e.printStackTrace();
                return null;
              }

              NodeList nodeList = nodesRoot
                  .getElementsByTagName("node");

              if (nodeList != null && nodeList.getLength() > 0) {
                for (int k = 0; k < nodeList.getLength(); k++) {

                  String nodeId = ((Element) nodeList.item(k))
                      .getAttribute("id");
                  Vector assignments = (Vector) XmlStructFactory
                      .getQueueAssignment((Element) nodeList
                          .item(k));
                  for (int l = 0; l < assignments.size(); l++) {
                    try {
                      // make sure queue exists
                      queueManager
                          .addQueue((String) assignments
                              .get(l));
                      // add node to queue
                      queueManager
                          .addNodeToQueue(nodeId,
                              (String) assignments
                                  .get(l));
                    } catch (Exception e) {
                      LOG
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.resource.scheduler.QueueManager

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.