Package org.apache.oodt.cas.resource.structs

Examples of org.apache.oodt.cas.resource.structs.ResourceNode


                    .intValue();
        } catch (Exception e) {
            e.printStackTrace();
        }

        ResourceNode resource = new ResourceNode(id, ip, capacity);

        return resource;
    }
View Full Code Here


public static Vector getXmlRpcResourceNodeList(List resNodes) {
    Vector resNodeVector = new Vector();

    if (resNodes != null && resNodes.size() > 0) {
      for (Iterator i = resNodes.iterator(); i.hasNext();) {
        ResourceNode node = (ResourceNode) i.next();
        resNodeVector.add(getXmlRpcResourceNode(node));
      }
    }

    return resNodeVector;
View Full Code Here

    return resNodeHash;
  }

  public static ResourceNode getResourceNodeFromXmlRpc(Hashtable resNodeHash) {
    ResourceNode node = new ResourceNode();
    node.setId((String) resNodeHash.get("node.id"));
    node.setCapacity(Integer
        .parseInt((String) resNodeHash.get("node.capacity")));
    try {
      node.setIpAddr(new URL((String) resNodeHash.get("node.url")));
    } catch (MalformedURLException ignore) {
    }

    return node;
  }
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.oodt.cas.resource.monitor.Monitor#getLoad(org.apache.oodt.cas.resource.structs.ResourceNode)
     */
    public int getLoad(ResourceNode node) throws MonitorException {
        ResourceNode resource = (ResourceNode) nodesMap.get(node.getNodeId());
        Integer i = (Integer) loadMap.get(node.getNodeId());
        return (resource.getCapacity() - i.intValue());
    }
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.oodt.cas.resource.monitor.Monitor#getNodeByURL(java.net.URL)
     */
    public ResourceNode getNodeByURL(URL ipAddr) throws MonitorException {
        ResourceNode targetResource = null;
        Vector nodes = (Vector) this.getNodes();
        for (int i = 0; i < nodes.size(); i++) {
            if (((ResourceNode) nodes.get(i)).getIpAddr() == ipAddr) {
                targetResource = (ResourceNode) nodes.get(i);
                break;
View Full Code Here

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

                            if (nodeList != null && nodeList.getLength() > 0) {
                                for (int k = 0; k < nodeList.getLength(); k++) {
                                    ResourceNode resource = XmlStructFactory
                                            .getNodes((Element) nodeList
                                                    .item(k));
                                    resources.put(resource.getNodeId(),
                                            resource);
                                }
                            }
                        }
                    }
View Full Code Here

        List resNodes = scheduler.getMonitor().getNodes();
        return XmlRpcStructFactory.getXmlRpcResourceNodeList(resNodes);
    }

    public Hashtable getNodeById(String nodeId) throws MonitorException {
        ResourceNode node = scheduler.getMonitor().getNodeById(nodeId);
        return XmlRpcStructFactory.getXmlRpcResourceNode(node);

    }
View Full Code Here

            LOG.log(Level.WARNING, "Attempt to kill job: [" + jobId
                    + "]: cannot find execution node"
                    + " (has the job already finished?)");
            return false;
        }
        ResourceNode node = scheduler.getMonitor().getNodeById(resNodeId);
        return scheduler.getBatchmgr().killJob(jobId, node);
    }
View Full Code Here

        in.read(jobIn);

        JobSpec spec = new JobSpec(in, exec);

        URL remoteUrl = safeGetUrlFromString(urlStr);
        ResourceNode remoteNode = null;

        try {
            remoteNode = scheduler.getMonitor().getNodeByURL(remoteUrl);
        } catch (MonitorException e) {
        }
View Full Code Here

            // no arguments to read, just call getNodes
            List resNodes = client.getNodes();

            if (resNodes != null && resNodes.size() > 0) {
                for (Iterator i = resNodes.iterator(); i.hasNext();) {
                    ResourceNode node = (ResourceNode) i.next();
                    System.out.println("node: [id=" + node.getNodeId()
                            + ",capacity=" + node.getCapacity() + ",url="
                            + node.getIpAddr() + "]");
                }
            }

        } else if (operation.equals("--getExecNode")) {
            String jobId = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--id")) {
                    jobId = args[++i];
                }
            }

            if (jobId == null) {
                System.err.println(getExecutionNodeOperation);
                System.exit(1);

            }

            String execNode = client.getExecutionNode(jobId);
            if (execNode == null || (execNode != null && execNode.equals(""))) {
                System.out.println("Job: [" + jobId
                        + "] not executing on any known node!");
            } else {
                System.out.println(execNode);
            }
        } else if (operation.equals("--kill")) {
            String jobId = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--id")) {
                    jobId = args[++i];
                }
            }

            if (jobId == null) {
                System.err.println(killOperation);
                System.exit(1);

            }

            if (client.killJob(jobId)) {
                System.out.println("Job: [" + jobId + "] successfully killed.");
            } else {
                System.out.println("Unable to kill job: [" + jobId + "]");
            }

        } else if (operation.equals("--getNodeById")) {
            String nodeId = null;
            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--nodeId")) {
                    nodeId = args[++i];
                }
            }

            if (nodeId == null) {
                System.err.println(getNodeByIdOperation);
                System.exit(1);
            }

            ResourceNode node = client.getNodeById(nodeId);

            if (node != null) {
                System.out.println("node: [id=" + node.getNodeId()
                        + ",capacity=" + node.getCapacity() + ",url="
                        + node.getIpAddr() + "]");
            }
        } else if (operation.equals("--getJobInfo")) {
            String jobId = null;

            for (int i = 4; i < args.length; i++) {
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.resource.structs.ResourceNode

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.