You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2013/07/11 22:07:39 UTC

svn commit: r1502344 [1/2] - in /oodt/trunk: ./ resource/src/main/java/org/apache/oodt/cas/resource/monitor/ resource/src/main/java/org/apache/oodt/cas/resource/monitor/exceptions/ resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/ re...

Author: mattmann
Date: Thu Jul 11 20:07:38 2013
New Revision: 1502344

URL: http://svn.apache.org/r1502344
Log:
- Apply patch for OODT-619 Implement the capability to pull status of resource nodes from ganglia contributed by Rajith Siriwardana

Added:
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitor.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitorFactory.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/exceptions/GangliaMonitorException.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaAdapter.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitorFactory.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculator.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculatorFactory.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalc.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalcFactory.java
    oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java
    oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/utils/
    oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/utils/MockGmetad.java
    oodt/trunk/resource/src/testdata/resourcemon/
    oodt/trunk/resource/src/testdata/resourcemon/gangliaXMLdump.xml
    oodt/trunk/resource/src/testdata/resourcemon/nodes.xml
    oodt/trunk/resource/src/testdata/test.resource.properties
Removed:
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/exceptions/MonitoringException.java
    oodt/trunk/resource/src/testdata/gangliaXMLdump.xml
Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitorFactory.java
    oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java
    oodt/trunk/resource/src/main/resources/resource.properties
    oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestAssignmentMonitor.java
    oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaXMLParser.java
    oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/TestXmlRpcResourceManager.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Thu Jul 11 20:07:38 2013
@@ -1,6 +1,13 @@
 Apache OODT Change Log
 ======================
 
+Release 0.7 - Current Development
+---------------------------------
+
+* OODT-619 Implement the capability to pull status of resource 
+  nodes from ganglia (Rajith Siriwardana via mattmann)
+
+
 Release 0.6 - 07/08/2013
 --------------------------------------------
 

Modified: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java (original)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java Thu Jul 11 20:07:38 2013
@@ -30,11 +30,12 @@ import org.apache.oodt.cas.resource.stru
 import org.apache.oodt.cas.resource.structs.exceptions.MonitorException;
 
 /**
- * 
+ *
  * @author woollard
  * @author bfoster
+ * @author rajith
  * @version $Revision$
- * 
+ *
  * <p>
  * An implementation of the {@link Monitor} interface that loads its information
  * about the underlying nodes from an XML file called <code>nodes.xml</code>.
@@ -51,16 +52,15 @@ public class AssignmentMonitor implement
     /* our nodes map */
     private static HashMap<String, ResourceNode> nodesMap;
 
-    /* our load map */
-    private static HashMap<String, Integer> loadMap;
+    /* resource monitor */
+    private ResourceMonitor resourceMonitor;
 
-    public AssignmentMonitor(List<ResourceNode> nodes) {
+    public AssignmentMonitor(List<ResourceNode> nodes, ResourceMonitor resourceMonitor) {
         nodesMap = new HashMap<String, ResourceNode>();
-        loadMap = new HashMap<String, Integer>();
-        
+        this.resourceMonitor = resourceMonitor;
+
         for (ResourceNode node : nodes) {
             nodesMap.put(node.getNodeId(), node);
-            loadMap.put(node.getNodeId(), new Integer(0));
         }
     }
 
@@ -72,12 +72,12 @@ public class AssignmentMonitor implement
      */
     public boolean assignLoad(ResourceNode node, int loadValue)
             throws MonitorException {
-        int loadCap = node.getCapacity();
-        int curLoad = ((Integer) loadMap.get(node.getNodeId())).intValue();
+        float loadVal = (float) loadValue;
+        float loadCap = (float) node.getCapacity();
+        float curLoad = resourceMonitor.getLoad(node);
 
-        if (loadValue <= (loadCap - curLoad)) {
-            loadMap.remove(node.getNodeId());
-            loadMap.put(node.getNodeId(), new Integer(curLoad + loadValue));
+        if (loadVal <= (loadCap - curLoad)) {
+            resourceMonitor.updateLoad(node.getNodeId(), curLoad + loadVal);
             return true;
         } else {
             return false;
@@ -86,12 +86,11 @@ public class AssignmentMonitor implement
 
     public boolean reduceLoad(ResourceNode node, int loadValue)
             throws MonitorException {
-        Integer load = (Integer) loadMap.get(node.getNodeId());
-        int newVal = load.intValue() - loadValue;
+        float load = resourceMonitor.getLoad(node);
+        float newVal = load - (float)loadValue;
         if (newVal < 0)
             newVal = 0; // should not happen but just in case
-        loadMap.remove(node.getNodeId());
-        loadMap.put(node.getNodeId(), new Integer(newVal));
+        resourceMonitor.updateLoad(node.getNodeId(), newVal);
         return true;
     }
 
@@ -102,8 +101,9 @@ public class AssignmentMonitor implement
      */
     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());
+//        Integer i = (Integer) loadMap.get(node.getNodeId());
+        float load = resourceMonitor.getLoad(node);
+        return (int) ((float) resource.getCapacity() - load);
     }
 
     /*
@@ -143,13 +143,12 @@ public class AssignmentMonitor implement
 
     public void addNode(ResourceNode node) throws MonitorException {
         nodesMap.put(node.getNodeId(), node);
-        if (!loadMap.containsKey(node.getNodeId()))
-            loadMap.put(node.getNodeId(), new Integer(0));
+        resourceMonitor.addNode(node.getNodeId(), node.getCapacity());
     }
 
     public void removeNodeById(String nodeId) throws MonitorException {
-        nodesMap.remove(nodeId);    
-        loadMap.remove(nodeId);
+        nodesMap.remove(nodeId);
+        resourceMonitor.removeNodeById(nodeId);
     }
 
 }

Modified: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitorFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitorFactory.java?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitorFactory.java (original)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitorFactory.java Thu Jul 11 20:07:38 2013
@@ -19,22 +19,24 @@
 package org.apache.oodt.cas.resource.monitor;
 
 //OODT imports
-import org.apache.oodt.cas.resource.noderepo.XmlNodeRepositoryFactory;
+import org.apache.oodt.cas.resource.structs.ResourceNode;
 import org.apache.oodt.cas.resource.util.GenericResourceManagerObjectFactory;
 
 //JDK imports
+import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
  * @author woollard
  * @author bfoster
+ * @author rajith
  * @version $Revision$
- * 
+ *
  * <p>
  * Creates implementations of {@link AssignmentMonitor}s.
  * </p>
- * 
+ *
  */
 public class AssignmentMonitorFactory implements MonitorFactory {
 
@@ -50,11 +52,16 @@ public class AssignmentMonitorFactory im
     public AssignmentMonitor createMonitor() {
         try {
             String nodeRepoFactoryStr = System.getProperty(
-                    "gov.nasa.jpl.oodt.cas.resource.nodes.repo.factory",
-                    XmlNodeRepositoryFactory.class.getCanonicalName());
-            return new AssignmentMonitor(GenericResourceManagerObjectFactory
-                    .getNodeRepositoryFromFactory(nodeRepoFactoryStr)
-                    .loadNodes());
+                    "org.apache.oodt.cas.resource.nodes.repo.factory");
+            String resourceMonitorStr = System
+                    .getProperty("org.apache.oodt.cas.resource.monitor.factory");
+
+            List<ResourceNode> resourceNodes = GenericResourceManagerObjectFactory
+                    .getNodeRepositoryFromFactory(nodeRepoFactoryStr).loadNodes();
+            ResourceMonitor resourceMonitor = GenericResourceManagerObjectFactory
+                    .getResourceMonitorFromServiceFactory(resourceMonitorStr);
+
+            return new AssignmentMonitor(resourceNodes, resourceMonitor);
         } catch (Exception e) {
             LOG.log(Level.SEVERE, "Failed to create Assignment Monitor : "
                     + e.getMessage(), e);

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitor.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitor.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitor.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor;
+
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ *
+ * The ResourceMonitor interface.
+ */
+public interface ResourceMonitor {
+
+    /**
+     * Gets the load on a resource node.
+     * @return A float representation of the load on a
+     * {@link org.apache.oodt.cas.resource.structs.ResourceNode}.
+     */
+    public float getLoad(ResourceNode node);
+
+    /**
+     * update the load value of a node
+     * {@link org.apache.oodt.cas.resource.structs.ResourceNode}  in the loadMap
+     * @param nodeId nodeId of the node
+     * @param loadValue load value to be assigned
+     */
+    public void updateLoad(String nodeId, float loadValue);
+
+    /**
+     * add a new node {@link org.apache.oodt.cas.resource.structs.ResourceNode}
+     * to monitor
+     * @param nodeId nodeId of the node
+     * @param capacity capacity of the node
+     */
+    public void addNode(String nodeId, float capacity);
+
+    /**
+     * remove node {@link org.apache.oodt.cas.resource.structs.ResourceNode}
+     * from the monitoring nodes set
+     * @param nodeId nodeId of the node
+     */
+    public void removeNodeById(String nodeId);
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitorFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitorFactory.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitorFactory.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ResourceMonitorFactory.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ *
+ * reates new {@link ResourceMonitor} implementations.
+ */
+public interface ResourceMonitorFactory {
+
+    /**
+     * @return A new implementation of the {@link ResourceMonitor} interface.
+     */
+    public ResourceMonitor createResourceMonitor();
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/exceptions/GangliaMonitorException.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/exceptions/GangliaMonitorException.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/exceptions/GangliaMonitorException.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/exceptions/GangliaMonitorException.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.exceptions;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public class GangliaMonitorException extends Exception {
+
+    /**
+     * Make a new exception.
+     *
+     * @param message the error message
+     */
+    public GangliaMonitorException(String message) {
+        super(message);
+    }
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaAdapter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaAdapter.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaAdapter.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaAdapter.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.ganglia;
+
+import org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException;
+import org.apache.oodt.cas.resource.monitor.ganglia.configuration.Cluster;
+import org.apache.oodt.cas.resource.monitor.ganglia.configuration.Host;
+import org.apache.oodt.cas.resource.monitor.ganglia.configuration.Metric;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public class GangliaAdapter {
+
+    private static String ENCODING = "ISO-8859-1";
+
+    /**
+     * Get resource nodes' status.
+     * @return List that contains status of resource nodes
+     * @throws org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException {@link org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException} if an error occurred.
+     */
+    public static HashMap<String, HashMap> getResourceNodeStatus(Set requiredNodes)
+            throws GangliaMonitorException {
+        String host = System
+                .getProperty("org.apache.oodt.cas.resource.monitor.ganglia.gemtad.host.address");
+        int port = Integer.valueOf(System
+                .getProperty("org.apache.oodt.cas.resource.monitor.ganglia.gemtad.host.port"));
+
+        List<Cluster> gridStatus = parseConfiguration(readXMLDump(host, port));
+        return filterRequiredNodes(requiredNodes, gridStatus);
+    }
+
+    /**
+     * Filter out the required nodes from the grid state ganglia configuration
+     * @param requiredNodes the required nodes
+     * @param gridStatus Ganglia meta daemon parsed grid status
+     * @return filtered resource node HashMap
+     */
+    private static HashMap<String, HashMap> filterRequiredNodes (Set requiredNodes,
+                                                                 List<Cluster> gridStatus){
+
+        HashMap<String, HashMap> filteredNodes = new HashMap<String, HashMap>();
+        for (Cluster cluster : gridStatus) {
+            for (Host host : cluster.getHosts()) {
+                if(requiredNodes.contains(host.getName())){
+                    HashMap<String, String> metrics = new HashMap<String, String>();
+                    for (Metric metric : host.getMetrics()) {
+                        metrics.put(metric.getName(), metric.getValue());
+                    }
+                    metrics.put(GangliaMetKeys.TN,host.getTn());
+                    metrics.put(GangliaMetKeys.TMAX, host.getTmax());
+                    filteredNodes.put(host.getName(), metrics);
+                }
+            }
+        }
+        return filteredNodes;
+    }
+
+    /**
+     * Get a XML dump from a ganglia meta daemon.
+     * @return A String that contains all the dump
+     * @throws org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException {@link org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException}
+     * if an error occurred during the read.
+     */
+    private static String readXMLDump(String host, int port) throws GangliaMonitorException {
+        StringBuilder buffer = new StringBuilder();
+
+        try {
+            Socket s = new Socket(host, port);
+            BufferedReader reader =
+                    new BufferedReader(new InputStreamReader(s.getInputStream(), ENCODING));
+            String line = reader.readLine();
+            while (line != null) {
+                buffer.append(line);
+                line = reader.readLine();
+            }
+            reader.close();
+        } catch (UnknownHostException e) {
+            throw new GangliaMonitorException
+                    ("Unknown host: " + host + ":" + port + "-" + e.getMessage());
+        } catch (IOException e) {
+            throw new GangliaMonitorException
+                    ("Unable to get the monitoring report from the GMeta daemon: "
+                            + e.getMessage());
+        }
+        return buffer.toString().trim();
+    }
+
+    /**
+     * Parse a configuration from a XML output of a Ganglia meta daemon.
+     * @param buffer the XML buffer
+     * @return a Configuration
+     * @throws org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException {@link org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException} if an error occurred
+     */
+    private static List<Cluster> parseConfiguration(String buffer)
+            throws GangliaMonitorException {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        javax.xml.parsers.SAXParser parser;
+        GangliaXMLParser gangliaXMLParser;
+        try {
+            parser = factory.newSAXParser();
+            gangliaXMLParser = new GangliaXMLParser();
+            parser.parse(new InputSource(new StringReader(buffer)), gangliaXMLParser);
+
+        } catch (ParserConfigurationException e) {
+            throw new GangliaMonitorException("Error while parsing: " + e.getMessage());
+        } catch (SAXException e) {
+            throw new GangliaMonitorException("Error while parsing the XML: " + e.getMessage());
+        } catch (IOException e) {
+            throw new GangliaMonitorException("I/O error: " + e.getMessage());
+        }
+        return gangliaXMLParser.getGridConfiguration();
+    }
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.ganglia;
+
+import org.apache.oodt.cas.resource.monitor.ResourceMonitor;
+import org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException;
+import org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator;
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public class GangliaResourceMonitor implements ResourceMonitor {
+
+    private static final Logger LOG = Logger.getLogger(GangliaResourceMonitor.class.getName());
+
+    /*loadMap will be updated after a UPDATE_INTERVAL milliseconds interval*/
+    private static long UPDATE_INTERVAL = 60000;
+
+    private static HashMap<String, Float> nodeCapacityMap = new HashMap<String, Float>();
+    private static HashMap<String, Float> loadMap = new HashMap<String, Float>();
+
+    private LoadCalculator loadCalculator;
+    private long lastUpdatedTime;
+
+    /**
+     * Make a new GangliaResourceMonitor that reads information
+     * from a ganglia meta daemon.
+     * @param loadCalculator LoadCalculator {@link org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator} to calculate load
+     * @param nodes resource nodes {@link org.apache.oodt.cas.resource.structs.ResourceNode} to be monitored.
+     */
+    public GangliaResourceMonitor(LoadCalculator loadCalculator, List<ResourceNode> nodes){
+        this.loadCalculator = loadCalculator;
+
+        for (ResourceNode node : nodes) {
+            nodeCapacityMap.put(node.getNodeId(), (float) node.getCapacity());
+        }
+        // Initially set the value UPDATE_INTERVAL earlier.
+        lastUpdatedTime = System.currentTimeMillis() - UPDATE_INTERVAL;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public float getLoad(ResourceNode node) {
+        try {
+            if(lastUpdatedTime + UPDATE_INTERVAL <= (System.currentTimeMillis())){
+                updateLoadMap();
+            }
+            return loadMap.get(node.getNodeId());
+        } catch (GangliaMonitorException e) {
+            LOG.log(Level.SEVERE, "Failed get status from the Ganglia meta daemon : "
+                    + e.getMessage(), e);
+            return nodeCapacityMap.get(node.getNodeId()); //return the capacity as the load of the node
+        } catch (NullPointerException e){
+            LOG.log(Level.SEVERE, "The required nodeId is not available: "
+                    + node.getNodeId() + " :" + e.getMessage(), e);
+            return (float) node.getCapacity(); //return node's if the nodeId is not available.
+        } catch (Exception e){
+            LOG.log(Level.SEVERE, "Failed get status from the Ganglia meta daemon for the nodeId: "
+                    + node.getNodeId() + " :" + e.getMessage(), e);
+            return nodeCapacityMap.get(node.getNodeId()); //return the capacity as the load of the node
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void updateLoad(String nodeId, float loadValue) {
+        loadMap.put(nodeId, loadValue);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addNode(String nodeId, float capacity) {
+        nodeCapacityMap.put(nodeId, capacity);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void removeNodeById(String nodeId) {
+        nodeCapacityMap.remove(nodeId);
+        loadMap.remove(nodeId);
+    }
+
+    /**
+     * Update the loadMap by calculating the load by the LoadCalculator
+     * @throws org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException {@link org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException} if an error occurred
+     */
+    private void updateLoadMap() throws GangliaMonitorException {
+        lastUpdatedTime = System.currentTimeMillis();
+        HashMap<String, HashMap> resourceNodesMetrics = GangliaAdapter
+                .getResourceNodeStatus(nodeCapacityMap.keySet());
+
+        for (Map.Entry<String, HashMap> entry: resourceNodesMetrics.entrySet()){
+            loadMap.put(entry.getKey(), loadCalculator.calculateLoad(
+                    nodeCapacityMap.get(entry.getKey()), resourceNodesMetrics.get(entry.getKey())));
+        }
+    }
+
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitorFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitorFactory.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitorFactory.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitorFactory.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.ganglia;
+
+import org.apache.oodt.cas.resource.monitor.ResourceMonitor;
+import org.apache.oodt.cas.resource.monitor.ResourceMonitorFactory;
+import org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator;
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+import org.apache.oodt.cas.resource.util.GenericResourceManagerObjectFactory;
+
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public class GangliaResourceMonitorFactory implements ResourceMonitorFactory {
+
+    private static final Logger LOG = Logger.getLogger(GangliaResourceMonitorFactory.class.getName());
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ResourceMonitor createResourceMonitor() {
+        try {
+            String loadCalculatorFactoryStr =  System
+                    .getProperty("org.apache.oodt.cas.resource.monitor.loadcalc.factory");
+            String nodeRepoFactoryStr = System
+                    .getProperty("org.apache.oodt.cas.resource.nodes.repo.factory");
+
+            List<ResourceNode> resourceNodes = GenericResourceManagerObjectFactory
+                    .getNodeRepositoryFromFactory(nodeRepoFactoryStr).loadNodes();
+            LoadCalculator loadCalculator = GenericResourceManagerObjectFactory
+                    .getLoadCalculatorFromServiceFactory(loadCalculatorFactoryStr);
+
+            return new GangliaResourceMonitor(loadCalculator, resourceNodes);
+        } catch (Exception e){
+            LOG.log(Level.SEVERE, "Failed to create Resource Monitor : " + e.getMessage(), e);
+            return null;
+        }
+    }
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculator.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculator.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculator.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculator.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.ganglia.loadcalc;
+
+import java.util.HashMap;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public interface LoadCalculator {
+
+    public static int MAXIMUM_FRACTION_DIGITS = 3;
+
+    /*Ganglia metric keys*/
+    public static String LOAD_ONE = "load_one";
+    public static String LOAD_FIVE = "load_five";
+    public static String LOAD_FIFTEEN = "load_fifteen";
+    public static String CPU_NUM = "cpu_num";
+
+    /**
+     * Calculate the load and normalize it within the given node's capacity
+     * @param nodeCapacity node's {@link org.apache.oodt.cas.resource.structs.ResourceNode}
+     *                     capacity
+     * @param metrics status metrics of the resource node
+     * @return An integer representation of the load within 0 and node's capacity
+     */
+    public float calculateLoad(float nodeCapacity, HashMap<String, String> metrics);
+
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculatorFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculatorFactory.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculatorFactory.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/LoadCalculatorFactory.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.ganglia.loadcalc;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public interface LoadCalculatorFactory {
+
+    /**
+     * @return A new implementation of the {@link LoadCalculator} interface.
+     */
+    public LoadCalculator createLoadCalculator();
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalc.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalc.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalc.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalc.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.ganglia.loadcalc;
+
+import org.apache.oodt.cas.resource.monitor.ganglia.GangliaMetKeys;
+
+import java.text.NumberFormat;
+import java.util.HashMap;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public class WeightedAverageLoadCalc implements LoadCalculator {
+
+    private int loadOneWeight;
+    private int loadFiveWeight;
+    private int loadFifteenWeight;
+
+    /* to format the load value*/
+    private NumberFormat numberFormat;
+
+    /**
+     * Make a new WeightedAverageLoadCalc {@link LoadCalculator}
+     * @param loadOneWeight weight for the load_one
+     * @param loadFiveWeight weight for the load_five
+     * @param loadFifteenWeight weight for the load_fifteen
+     */
+    public WeightedAverageLoadCalc (int loadOneWeight, int loadFiveWeight, int loadFifteenWeight){
+        this.loadOneWeight = loadOneWeight;
+        this.loadFiveWeight = loadFiveWeight;
+        this.loadFifteenWeight = loadFifteenWeight;
+
+        numberFormat = NumberFormat.getNumberInstance();
+        numberFormat.setMaximumFractionDigits(MAXIMUM_FRACTION_DIGITS);
+    }
+    /**
+     * {@inheritDoc}
+     *
+     * load is calculated as follows
+     * weightedLoadOne = loadOneWeight * minimum of (nodeCapacity, ((loadOne/numOfCPUs) * nodeCapacity))
+     *
+     * load = (weightedLoadOne + weightedLoadFive + weightedLoadFifteen) /
+     *           (loadOneWeight + loadFiveWeight + loadFifteenWeight)
+     */
+    @Override
+    public float calculateLoad(float nodeCapacity, HashMap<String, String> nodeMetrics) {
+        int tn = Integer.valueOf(nodeMetrics.get(GangliaMetKeys.TN));
+        int tmax = Integer.valueOf(nodeMetrics.get(GangliaMetKeys.TMAX));
+
+        if(tn > (4 * tmax)){
+           return nodeCapacity; //if the node is offline assign the node's capacity as the load
+        }
+        else {
+            float weightedLoadOne = loadOneWeight * Math.min(nodeCapacity,
+                    ((Float.valueOf(nodeMetrics.get(LOAD_ONE)) /
+                            Float.valueOf(nodeMetrics.get(CPU_NUM))) * nodeCapacity));
+            float weightedLoadFive = loadFiveWeight * Math.min(nodeCapacity,
+                    ((Float.valueOf(nodeMetrics.get(LOAD_FIVE)) /
+                            Float.valueOf(nodeMetrics.get(CPU_NUM)))* nodeCapacity));
+            float weightedLoadFifteen = loadFifteenWeight * Math.min(nodeCapacity,
+                    ((Float.valueOf(nodeMetrics.get(LOAD_FIFTEEN)) /
+                            Float.valueOf(nodeMetrics.get(CPU_NUM)))* nodeCapacity));
+
+            float weightedLoadAverage = (weightedLoadOne + weightedLoadFive + weightedLoadFifteen) /
+                    (loadOneWeight + loadFiveWeight + loadFifteenWeight);
+
+            return Float.valueOf(numberFormat.format(weightedLoadAverage));
+        }
+    }
+}

Added: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalcFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalcFactory.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalcFactory.java (added)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/loadcalc/WeightedAverageLoadCalcFactory.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.ganglia.loadcalc;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ */
+public class WeightedAverageLoadCalcFactory implements LoadCalculatorFactory {
+
+    private static final Logger LOG = Logger.getLogger(WeightedAverageLoadCalcFactory.class.getName());
+
+    /**
+     *
+     * {@inheritDoc}
+     */
+    @Override
+    public LoadCalculator createLoadCalculator() {
+        try {
+            int loadOneWeight = Integer.parseInt(
+                    System.getProperty("org.apache.oodt.cas.resource.monitor.loadcalc.weight.loadone"));
+            int loadFiveWeight = Integer.parseInt(
+                    System.getProperty("org.apache.oodt.cas.resource.monitor.loadcalc.weight.loadfive"));
+            int loadFifteenWeight = Integer.parseInt(
+                    System.getProperty("org.apache.oodt.cas.resource.monitor.loadcalc.weight.loadfifteen"));
+            return new WeightedAverageLoadCalc(loadOneWeight, loadFiveWeight, loadFifteenWeight);
+        } catch (Exception e) {
+            LOG.log(Level.SEVERE, "Failed to create Load Calculator : " + e.getMessage(), e);
+            return null;
+        }
+    }
+}

Modified: oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java (original)
+++ oodt/trunk/resource/src/main/java/org/apache/oodt/cas/resource/util/GenericResourceManagerObjectFactory.java Thu Jul 11 20:07:38 2013
@@ -31,6 +31,10 @@ import org.apache.oodt.cas.resource.jobr
 import org.apache.oodt.cas.resource.jobrepo.JobRepositoryFactory;
 import org.apache.oodt.cas.resource.monitor.Monitor;
 import org.apache.oodt.cas.resource.monitor.MonitorFactory;
+import org.apache.oodt.cas.resource.monitor.ResourceMonitor;
+import org.apache.oodt.cas.resource.monitor.ResourceMonitorFactory;
+import org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator;
+import org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculatorFactory;
 import org.apache.oodt.cas.resource.noderepo.NodeRepository;
 import org.apache.oodt.cas.resource.noderepo.NodeRepositoryFactory;
 import org.apache.oodt.cas.resource.queuerepo.QueueRepository;
@@ -44,7 +48,7 @@ import org.apache.oodt.cas.resource.stru
  * @author mattmann
  * @author bfoster
  * @version $Revision$
- * 
+ *
  * <p>
  * Generic object creation facilities for the Resource Manager.
  * </p>
@@ -62,7 +66,7 @@ public final class GenericResourceManage
   /**
    * Constructs a new {@link JobInput} implementation from the given
    * <code>className</code>.
-   * 
+   *
    * @param className
    *          The implementation class for the {@link JobInput}
    * @return A new {@link JobInput} implementation.
@@ -94,7 +98,7 @@ public final class GenericResourceManage
   /**
    * Constructs a new {@link JobInstance} implementation from the given
    * <code>className</code>.
-   * 
+   *
    * @param className
    *          The name of the implementation class for the {@link JobInstance}
    *          to construct.
@@ -127,7 +131,7 @@ public final class GenericResourceManage
   /**
    * Creates a new {@link QueueRepository} implementation from the given
    * {@link QueueRepositoryFactory} class name.
-   * 
+   *
    * @param serviceFactory
    *          The class name of the {@link QueueRepositoryFactory} to use to create new
    *          {@link QueueRepository}s.
@@ -160,11 +164,11 @@ public final class GenericResourceManage
 
     return null;
   }
-  
+
   /**
    * Creates a new {@link NodeRepository} implementation from the given
    * {@link QueueRepositoryFactory} class name.
-   * 
+   *
    * @param serviceFactory
    *          The class name of the {@link NodeRepositoryFactory} to use to create new
    *          {@link QueueRepository}s.
@@ -197,11 +201,11 @@ public final class GenericResourceManage
 
     return null;
   }
-  
+
   /**
    * Creates a new {@link JobQueue} implementation from the given
    * {@link JobQueueFactory} class name.
-   * 
+   *
    * @param serviceFactory
    *          The class name of the {@link JobQueueFactory} to use to create new
    *          {@link JobQueue}s.
@@ -234,11 +238,11 @@ public final class GenericResourceManage
 
     return null;
   }
-  
+
   /**
    * Creates a new Batchmgr implementation from a given String name of the
    * corresponding {@link BatchmgrFactory}.
-   * 
+   *
    * @param serviceFactory
    *          The name of the {@link BatchmgrFactory} class to use to create
    *          {@link Batchmgr}s.
@@ -275,7 +279,7 @@ public final class GenericResourceManage
   /**
    * Creates a new {@link Monitor} implementation from the given String name of
    * the {@link MonitorFactory}.
-   * 
+   *
    * @param serviceFactory
    *          The name of the {@link MonitorFactory} class to use to create
    *          {@link Monitor}s.
@@ -313,7 +317,7 @@ public final class GenericResourceManage
   /**
    * Creates a new {@link Scheduler} from the given String name of the
    * {@link SchedulerFactory}.
-   * 
+   *
    * @param serviceFactory
    *          The class name of the {@link SchedulerFactory} to use to create
    *          the new {@link Scheduler}.
@@ -346,7 +350,7 @@ public final class GenericResourceManage
 
     return null;
   }
-  
+
   /**
    * Creates a new {@link JobRepository} implementation from the given
    * name of the {@link JobRepositoryFactory}.
@@ -382,4 +386,79 @@ public final class GenericResourceManage
     return null;
   }
 
+
+    /**
+     * Creates a new {@link org.apache.oodt.cas.resource.monitor.ResourceMonitor} implementation from the given String name of
+     * the {@link org.apache.oodt.cas.resource.monitor.ResourceMonitorFactory}.
+     *
+     * @param serviceFactory
+     *          The name of the {@link org.apache.oodt.cas.resource.monitor.ResourceMonitorFactory} class to use to create
+     *          {@link org.apache.oodt.cas.resource.monitor.ResourceMonitor}s.
+     * @return A new {@link org.apache.oodt.cas.resource.monitor.ResourceMonitor} implementation.
+     */
+    public static ResourceMonitor getResourceMonitorFromServiceFactory(String serviceFactory){
+        Class clazz;
+        ResourceMonitorFactory factory;
+
+        try {
+            clazz = Class.forName(serviceFactory);
+            factory = (ResourceMonitorFactory) clazz.newInstance();
+            return factory.createResourceMonitor();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING,
+                    "ClassNotFoundException when loading resource monitor factory class "
+                            + serviceFactory + " Message: " + e.getMessage());
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING,
+                    "InstantiationException when loading resource monitor factory class "
+                            + serviceFactory + " Message: " + e.getMessage());
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING,
+                    "IllegalAccessException when loading resource monitor factory class "
+                            + serviceFactory + " Message: " + e.getMessage());
+        }
+
+        return null;
+    }
+
+    /**
+     * Creates a new {@link org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator} implementation from the given String name of
+     * the {@link ResourceMonitorFactory}.
+     *
+     * @param serviceFactory
+     *          The name of the {@link org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculatorFactory} class to use to create
+     *          {@link org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator}s.
+     * @return A new {@link org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.LoadCalculator} implementation.
+     */
+    public static LoadCalculator getLoadCalculatorFromServiceFactory(String serviceFactory){
+        Class clazz;
+        LoadCalculatorFactory factory;
+
+        try {
+            clazz = Class.forName(serviceFactory);
+            factory = (LoadCalculatorFactory) clazz.newInstance();
+            return factory.createLoadCalculator();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING,
+                    "ClassNotFoundException when loading load calculator factory class "
+                            + serviceFactory + " Message: " + e.getMessage());
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING,
+                    "InstantiationException when loading load calculator factory class "
+                            + serviceFactory + " Message: " + e.getMessage());
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING,
+                    "IllegalAccessException when loading load calculator factory class "
+                            + serviceFactory + " Message: " + e.getMessage());
+        }
+
+        return null;
+    }
+
 }

Modified: oodt/trunk/resource/src/main/resources/resource.properties
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/main/resources/resource.properties?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/resource/src/main/resources/resource.properties (original)
+++ oodt/trunk/resource/src/main/resources/resource.properties Thu Jul 11 20:07:38 2013
@@ -37,6 +37,12 @@ org.apache.oodt.cas.resource.nodes.repo.
 # queue repository factory
 org.apache.oodt.cas.resource.queues.repo.factory = org.apache.oodt.cas.resource.queuerepo.XmlQueueRepositoryFactory
 
+# resource nodes monitor factory
+org.apache.oodt.cas.resource.monitor.factory = org.apache.oodt.cas.resource.monitor.ganglia.GangliaResourceMonitorFactory
+
+# ganglia resource monitor's load calculator factory
+org.apache.oodt.cas.resource.monitor.loadcalc.factory = org.apache.oodt.cas.resource.monitor.ganglia.loadcalc.WeightedAverageLoadCalcFactory
+
 # JobStack JobQueue config properties
 org.apache.oodt.cas.resource.jobqueue.jobstack.maxstacksize=1000
 
@@ -57,5 +63,14 @@ org.apache.oodt.cas.resource.nodes.dirs=
 # XML Queue Repository config properties
 org.apache.oodt.cas.resource.nodetoqueues.dirs=file://[HOME]/nodes,file://[HOME]/nodes2
 
-
+# Load calculation weights
+org.apache.oodt.cas.resource.monitor.loadcalc.weight.loadone=1
+org.apache.oodt.cas.resource.monitor.loadcalc.weight.loadfive=5
+org.apache.oodt.cas.resource.monitor.loadcalc.weight.loadfifteen=5
+org.apache.oodt.cas.resource.monitor.loadcalc.weight.memfree=2
+org.apache.oodt.cas.resource.monitor.loadcalc.weight.swapfree=1
+
+#ganglia meta daemon (gmetad) host details
+org.apache.oodt.cas.resource.monitor.ganglia.gemtad.host.address=localhost
+org.apache.oodt.cas.resource.monitor.ganglia.gemtad.host.port=8651
 

Modified: oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestAssignmentMonitor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestAssignmentMonitor.java?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestAssignmentMonitor.java (original)
+++ oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestAssignmentMonitor.java Thu Jul 11 20:07:38 2013
@@ -24,6 +24,8 @@ import org.apache.oodt.cas.resource.stru
 
 //JDK imports
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Iterator;
@@ -36,6 +38,7 @@ import junit.framework.TestCase;
 /**
  * @author mattmann
  * @author bfoster
+ * @author rajith
  * @version $Revision$
  * 
  * <p>
@@ -46,11 +49,8 @@ public class TestAssignmentMonitor exten
 
     private AssignmentMonitor assgnMon = null;
 
-    protected void setUp() {
-        System.setProperty("org.apache.oodt.cas.resource.nodes.dirs",
-                "file:"
-                        + new File("./src/main/resources/examples")
-                                .getAbsolutePath());
+    protected void setUp() throws IOException {
+        generateTestConfig();
         assgnMon = new AssignmentMonitorFactory().createMonitor();
     }
 
@@ -134,4 +134,23 @@ public class TestAssignmentMonitor exten
                 && this.assgnMon.getNodes().containsAll(nodes));
     }
 
+    public void testGetLoad() throws MonitorException {
+        ResourceNode resourceNode = assgnMon.getNodeById("localhost");
+
+        /*since the Gmetad is offline load value from the ResourceMonitor
+        * should be node's capacity, therefore AssignmentMonitors
+        * load value is 0*/
+        assertEquals(0, assgnMon.getLoad(resourceNode));
+    }
+
+    private void generateTestConfig() throws IOException {
+        String propertiesFile = "." + File.separator + "src" + File.separator +
+                "testdata" + File.separator + "test.resource.properties";
+        System.getProperties().load(new FileInputStream(new File(propertiesFile)));
+        System.setProperty("org.apache.oodt.cas.resource.nodes.dirs",
+                "file:" + new File("." + File.separator + "src" + File.separator +
+                        "main" + File.separator + "resources" + File.separator +
+                        "examples").getAbsolutePath());
+    }
+
 }

Added: oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java (added)
+++ oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaResourceMonitor.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor;
+
+import junit.framework.TestCase;
+import org.apache.oodt.cas.resource.monitor.ganglia.GangliaResourceMonitor;
+import org.apache.oodt.cas.resource.monitor.ganglia.GangliaResourceMonitorFactory;
+import org.apache.oodt.cas.resource.monitor.utils.MockGmetad;
+import org.apache.oodt.cas.resource.structs.ResourceNode;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ *
+ * Test Suite for the {@link org.apache.oodt.cas.resource.monitor.ganglia.GangliaResourceMonitor}
+ */
+public class TestGangliaResourceMonitor extends TestCase {
+
+    private GangliaResourceMonitor gangliaResourceMonitor;
+    private ThreadLocal<MockGmetad> mockGmetad = new ThreadLocal<MockGmetad>();
+
+    @Override
+    protected void setUp() throws IOException {
+        generateTestConfig();
+        runMockGmetad();
+
+        gangliaResourceMonitor = (GangliaResourceMonitor)
+                new GangliaResourceMonitorFactory().createResourceMonitor();
+    }
+
+    @Override
+    protected void tearDown(){
+        mockGmetad.remove();
+    }
+
+    public void testGetLoad() {
+        try {
+            ResourceNode resourceNode =
+                    new ResourceNode("localhost",new URL("http://localhost:9999"), 8);
+            assertEquals((float)1.556, gangliaResourceMonitor.getLoad(resourceNode));
+        } catch (MalformedURLException ignored) {
+            //Exception ignored
+        }
+    }
+
+    public void testUpdateLoad(){
+        try {
+            ResourceNode resourceNode =
+                    new ResourceNode("remotenode",new URL("http://localhost:9999"), 9);
+            assertEquals((float) 1.751, gangliaResourceMonitor.getLoad(resourceNode));
+
+            gangliaResourceMonitor.updateLoad("remotenode", 6);
+            assertEquals((float) 6, gangliaResourceMonitor.getLoad(resourceNode));
+        }  catch (MalformedURLException ignored) {
+            //Exception ignored
+        }
+    }
+
+    public void testRemoveNodeById(){
+        try {
+            ResourceNode resourceNode =
+                    new ResourceNode("remotenode",new URL("http://localhost:9999"), 9);
+
+            gangliaResourceMonitor.removeNodeById("remotenode");
+            /*since node is not available node's capacity is returned as the load*/
+            assertEquals((float) 9, gangliaResourceMonitor.getLoad(resourceNode));
+        } catch (MalformedURLException ignored) {
+            //Exception ignored
+        }
+    }
+
+    private void runMockGmetad() {
+        int port = Integer.valueOf(System
+                .getProperty("org.apache.oodt.cas.resource.monitor.ganglia.gemtad.host.port"));
+        String sampleXMLfilePath = "." + File.separator + "src" + File.separator +
+                "testdata" + File.separator + "resourcemon" + File.separator + "gangliaXMLdump.xml";
+        mockGmetad.set(new MockGmetad(port, sampleXMLfilePath));
+
+        Thread mockGmetadServer = new Thread(mockGmetad.get());
+        mockGmetadServer.start();
+    }
+
+    private void generateTestConfig() throws IOException {
+        String propertiesFile = "." + File.separator + "src" + File.separator +
+                "testdata" + File.separator + "test.resource.properties";
+        System.getProperties().load(new FileInputStream(new File(propertiesFile)));
+        System.setProperty("org.apache.oodt.cas.resource.nodes.dirs",
+                "file:" + new File("." + File.separator + "src" + File.separator +
+                        "testdata" + File.separator + "resourcemon").getAbsolutePath());
+    }
+
+}

Modified: oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaXMLParser.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaXMLParser.java?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaXMLParser.java (original)
+++ oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/TestGangliaXMLParser.java Thu Jul 11 20:07:38 2013
@@ -18,7 +18,7 @@
 package org.apache.oodt.cas.resource.monitor;
 
 import junit.framework.TestCase;
-import org.apache.oodt.cas.resource.monitor.exceptions.MonitoringException;
+import org.apache.oodt.cas.resource.monitor.exceptions.GangliaMonitorException;
 import org.apache.oodt.cas.resource.monitor.ganglia.GangliaMetKeys;
 import org.apache.oodt.cas.resource.monitor.ganglia.GangliaXMLParser;
 import org.apache.oodt.cas.resource.monitor.ganglia.configuration.Cluster;
@@ -47,12 +47,13 @@ public class TestGangliaXMLParser extend
      * {@inheritDoc}
      * Read gangliaXMLdump.xml and build the grid configuration
      */
-    protected void setUp() throws MonitoringException {
+    protected void setUp() throws GangliaMonitorException, IOException {
         StringBuilder stringBuffer = new StringBuilder();
 
         try {
             BufferedReader reader = new BufferedReader(new FileReader("." + File.separator +
-                    "src" + File.separator + "testdata" + File.separator + "gangliaXMLdump.xml"));
+                    "src" + File.separator + "testdata" + File.separator + "resourcemon"
+                    + File.separator + "gangliaXMLdump.xml"));
             String line = reader.readLine();
             while (line != null) {
                 stringBuffer.append(line);
@@ -60,7 +61,7 @@ public class TestGangliaXMLParser extend
             }
             reader.close();
         } catch (IOException e) {
-            throw new MonitoringException("Unable to read the sample monitoring report from the file: "
+            throw new IOException("Unable to read the sample monitoring report from the file: "
                     + e.getMessage());
         }
 
@@ -74,11 +75,11 @@ public class TestGangliaXMLParser extend
             parser.parse(new InputSource(new StringReader(buffer)), gangliaXMLParser);
             gridConfiguration = gangliaXMLParser.getGridConfiguration();
         } catch (ParserConfigurationException e) {
-            throw new MonitoringException("Error while parsing: " + e.getMessage());
+            throw new GangliaMonitorException("Error while parsing: " + e.getMessage());
         } catch (SAXException e) {
-            throw new MonitoringException("Error while parsing the XML: " + e.getMessage());
+            throw new GangliaMonitorException("Error while parsing the XML: " + e.getMessage());
         } catch (IOException e) {
-            throw new MonitoringException("I/O error: " + e.getMessage());
+            throw new GangliaMonitorException("I/O error: " + e.getMessage());
         }
     }
 

Added: oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/utils/MockGmetad.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/utils/MockGmetad.java?rev=1502344&view=auto
==============================================================================
--- oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/utils/MockGmetad.java (added)
+++ oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/monitor/utils/MockGmetad.java Thu Jul 11 20:07:38 2013
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.resource.monitor.utils;
+
+import java.io.*;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * @author rajith
+ * @version $Revision$
+ *
+ * Ganglia meta daemon mock server
+ */
+public class MockGmetad implements Runnable {
+
+    private int socket;
+    private File fakeXMLDump;
+    private boolean testFinished;
+
+    public MockGmetad(int socket, String filePath){
+        this.socket = socket;
+        this.fakeXMLDump = new File(filePath);
+        this.testFinished = false;
+    }
+
+    public void stop(){
+        testFinished = true;
+    }
+
+    @Override
+    public void run() {
+        try {
+            ServerSocket serverSocket = new ServerSocket(socket);
+            FileInputStream fis = null;
+            OutputStream os = null;
+
+
+            while (!testFinished) {
+                Socket sock = serverSocket.accept();
+                try {
+                    byte[] xmlByteArray = new byte[1024];
+                    fis = new FileInputStream(fakeXMLDump);
+                    os = sock.getOutputStream();
+
+                    int count;
+                    while ((count = fis.read(xmlByteArray)) >= 0) {
+                        os.write(xmlByteArray, 0, count);
+                    }
+                    os.flush();
+                } finally {
+                    assert fis != null;
+                    fis.close();
+                    assert os != null;
+                    os.close();
+                    sock.close();
+                }
+            }
+        } catch (FileNotFoundException ignored) {
+            //Exception ignored
+        } catch (IOException ignored) {
+            //Exception ignored
+        }
+
+    }
+}

Modified: oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/TestXmlRpcResourceManager.java
URL: http://svn.apache.org/viewvc/oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/TestXmlRpcResourceManager.java?rev=1502344&r1=1502343&r2=1502344&view=diff
==============================================================================
--- oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/TestXmlRpcResourceManager.java (original)
+++ oodt/trunk/resource/src/test/org/apache/oodt/cas/resource/system/TestXmlRpcResourceManager.java Thu Jul 11 20:07:38 2013
@@ -20,6 +20,8 @@ package org.apache.oodt.cas.resource.sys
 //JDK imports
 import java.io.File;
 import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.net.URL;
 import java.util.Properties;
 
@@ -33,12 +35,13 @@ import org.apache.oodt.cas.resource.stru
 import junit.framework.TestCase;
 
 /**
- * 
+ *
  * Test harness for the {@link XmlRpcResourceManager}.
- * 
+ *
  * @author mattmann
+ * @author rajith
  * @version $Revision$
- * 
+ *
  */
 public class TestXmlRpcResourceManager extends TestCase {
 
@@ -79,7 +82,7 @@ public class TestXmlRpcResourceManager e
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see junit.framework.TestCase#setUp()
    */
   @Override
@@ -90,7 +93,7 @@ public class TestXmlRpcResourceManager e
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see junit.framework.TestCase#tearDown()
    */
   @Override
@@ -113,34 +116,12 @@ public class TestXmlRpcResourceManager e
 
   }
 
-  private void generateTestConfiguration() {
+    private void generateTestConfiguration() throws IOException {
     Properties config = new Properties();
-    config.setProperty("resource.batchmgr.factory",
-        "org.apache.oodt.cas.resource.batchmgr.XmlRpcBatchMgrFactory");
-    config.setProperty("resource.monitor.factory",
-        "org.apache.oodt.cas.resource.monitor.AssignmentMonitorFactory");
-    config.setProperty("resource.scheduler.factory",
-        "org.apache.oodt.cas.resource.scheduler.LRUSchedulerFactory");
-    config.setProperty("resource.jobqueue.factory",
-        "org.apache.oodt.cas.resource.jobqueue.JobStackJobQueueFactory");
-    config.setProperty("resource.jobrepo.factory",
-        "org.apache.oodt.cas.resource.jobrepo.MemoryJobRepositoryFactory");
-    config.setProperty("org.apache.oodt.cas.resource.nodes.repo.factory",
-        "org.apache.oodt.cas.resource.noderepo.XmlNodeRepositoryFactory");
-    config.setProperty("org.apache.oodt.cas.resource.queues.repo.factory",
-        "org.apache.oodt.cas.resource.queuerepo.XmlQueueRepositoryFactory");
-
-    config.setProperty(
-        "org.apache.oodt.cas.resource.jobqueue.jobstack.maxstacksize", "1000");
-    config.setProperty("org.apache.oodt.cas.resource.scheduler.wait.seconds",
-        "20");
-
-    config.setProperty(
-        "org.apache.oodt.cas.resource.system.xmlrpc.requestTimeout.minutes",
-        "20");
-    config.setProperty(
-        "org.apache.oodt.cas.resource.system.xmlrpc.connectionTimeout.minutes",
-        "60");
+
+    String propertiesFile = "." + File.separator + "src" + File.separator +
+            "testdata" + File.separator + "test.resource.properties";
+    System.getProperties().load(new FileInputStream(new File(propertiesFile)));
 
     // stage policy
     File tmpPolicyDir = null;