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

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


        assertNotNull(resNodes);

        boolean hasNode1 = false;

        for (Iterator i = resNodes.iterator(); i.hasNext();) {
            ResourceNode node = (ResourceNode) i.next();
            assertNotNull(node);
            if (node.getNodeId().equals("localhost")) {
                hasNode1 = true;
                assertEquals(node.getIpAddr().toExternalForm(),
                        "http://localhost:2001");
            }
            assertEquals(node.getCapacity(), 8);
        }

        assertTrue(hasNode1);
    }
View Full Code Here


    public void testNodeModification() throws MonitorException,
            MalformedURLException {
        List<ResourceNode> nodes = new Vector<ResourceNode>(this.assgnMon
                .getNodes());
        ResourceNode test1 = new ResourceNode("Test1", new URL(
                "http://localhost:1111"), 9);
        ResourceNode test2 = new ResourceNode("Test2", new URL(
                "http://localhost:2222"), 9);
        ResourceNode test3 = new ResourceNode("Test3", new URL(
                "http://localhost:3333"), 9);
        this.assgnMon.addNode(test1);
        nodes.add(test1);
        this.assgnMon.addNode(test2);
        nodes.add(test2);
View Full Code Here

      try {
         Validate.notNull(nodeId, "Must specify nodeId");
         Validate.notNull(nodeUrl, "Must specify nodeUrl");
         Validate.notNull(capacity, "Must specify capacity");

         getClient().addNode(new ResourceNode(nodeId, nodeUrl, capacity));
         printer.println("Successfully added node!");
      } catch (Exception e) {
         throw new CmdLineActionException("Failed to add node with nodeId '"
               + nodeId + "', nodeUrl '" + nodeUrl + "', and capacity '"
               + capacity + "' : " + e.getMessage(), e);
View Full Code Here

   public void execute(ActionMessagePrinter printer)
         throws CmdLineActionException {
      try {
         Validate.notNull(nodeId, "Must specify nodeId");

         ResourceNode node = getClient().getNodeById(nodeId);

         if (node == null) {
            throw new Exception("ResourceManager returned null ResourceNode"
                  + " for nodeId '" + nodeId + "'");
         }
         printer.println("node: [id=" + node.getNodeId() + ",capacity="
               + node.getCapacity() + ",url=" + node.getIpAddr() + "]");
      } catch (Exception e) {
         throw new CmdLineActionException("Failed to get node by id '" + nodeId
               + "' : " + e.getMessage(), e);
      }
   }
View Full Code Here

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

     * (non-Javadoc)
     *
     * @see gov.nasa.jpl.oodt.cas.resource.monitor.Monitor#getNodeByURL(java.net.URL)
     */
    public ResourceNode getNodeByURL(URL ipAddr) throws MonitorException {
        ResourceNode targetResource = null;
        List<ResourceNode> nodes = 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

        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

    } else
        return false;     
    }
   
    public String getNodeLoad(String nodeId) throws MonitorException{
      ResourceNode node = this.scheduler.getMonitor().getNodeById(nodeId);
      int capacity = node.getCapacity();
      int load = (this.scheduler.getMonitor().getLoad(node)) * -1 + capacity;
      return load + "/" + capacity;
    }
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

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.