You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/04/08 18:19:09 UTC

[12/15] airavata git commit: Add new gfac email monitor module to gfac monitor module and Intorduced gfac-hpc-monitor module to keep all hoc-monitor code

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
new file mode 100644
index 0000000..72c77d5
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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.airavata.gfac.monitor.impl.push.amqp;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.airavata.ComputingActivity;
+import org.apache.airavata.gfac.monitor.core.MessageParser;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+
+public class JSONMessageParser implements MessageParser {
+    private final static Logger logger = LoggerFactory.getLogger(JSONMessageParser.class);
+
+    public JobState parseMessage(String message)throws AiravataMonitorException {
+        /*todo write a json message parser here*/
+        logger.debug(message);
+        ObjectMapper objectMapper = new ObjectMapper();
+        try {
+            ComputingActivity computingActivity = objectMapper.readValue(message.getBytes(), ComputingActivity.class);
+            logger.info(computingActivity.getIDFromEndpoint());
+            List<String> stateList = computingActivity.getState();
+            JobState jobState = null;
+            for (String aState : stateList) {
+                jobState = getStatusFromString(aState);
+            }
+            // we get the last value of the state array
+            return jobState;
+        } catch (IOException e) {
+            throw new AiravataMonitorException(e);
+        }
+    }
+
+private JobState getStatusFromString(String status) {
+        logger.info("parsing the job status returned : " + status);
+        if(status != null){
+            if("ipf:finished".equals(status)){
+                return JobState.COMPLETE;
+            }else if("ipf:pending".equals(status)|| "ipf:starting".equals(status)){
+                return JobState.QUEUED;
+            }else if("ipf:running".equals(status) || "ipf:finishing".equals(status)){
+                return JobState.ACTIVE;
+            }else if ("ipf:held".equals(status) || "ipf:teminating".equals(status) || "ipf:teminated".equals(status)) {
+                return JobState.HELD;
+            } else if ("ipf:suspending".equals(status)) {
+                return JobState.SUSPENDED;
+            }else if ("ipf:failed".equals(status)) {
+                return JobState.FAILED;
+            }else if ("ipf:unknown".equals(status)){
+                return JobState.UNKNOWN;
+            }
+        }
+        return JobState.UNKNOWN;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/SimpleJobFinishConsumer.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/SimpleJobFinishConsumer.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/SimpleJobFinishConsumer.java
new file mode 100644
index 0000000..c4275f1
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/SimpleJobFinishConsumer.java
@@ -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.airavata.gfac.monitor.impl.push.amqp;
+
+import com.rabbitmq.client.Channel;
+import com.rabbitmq.client.Connection;
+import com.rabbitmq.client.ConnectionFactory;
+import com.rabbitmq.client.QueueingConsumer;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class SimpleJobFinishConsumer {
+    private final static Logger logger = LoggerFactory.getLogger(SimpleJobFinishConsumer.class);
+
+    private List<String> completedJobsFromPush;
+
+    public SimpleJobFinishConsumer(List<String> completedJobsFromPush) {
+        this.completedJobsFromPush = completedJobsFromPush;
+    }
+
+    public void listen() {
+        try {
+            String queueName = ServerSettings.getSetting(Constants.GFAC_SERVER_PORT, "8950");
+            String uri = "amqp://localhost";
+
+            ConnectionFactory connFactory = new ConnectionFactory();
+            connFactory.setUri(uri);
+            Connection conn = connFactory.newConnection();
+            logger.info("--------Created the connection to Rabbitmq server successfully-------");
+
+            final Channel ch = conn.createChannel();
+
+            logger.info("--------Created the channel with Rabbitmq server successfully-------");
+
+            ch.queueDeclare(queueName, false, false, false, null);
+
+            logger.info("--------Declare the queue " + queueName + " in Rabbitmq server successfully-------");
+
+            final QueueingConsumer consumer = new QueueingConsumer(ch);
+            ch.basicConsume(queueName, consumer);
+            (new Thread() {
+                public void run() {
+                    try {
+                        while (true) {
+                            QueueingConsumer.Delivery delivery = consumer.nextDelivery();
+                            String message = new String(delivery.getBody());
+                            logger.info("---------------- Job Finish message received:" + message + " --------------");
+                            synchronized (completedJobsFromPush) {
+                                completedJobsFromPush.add(message);
+                            }
+                            ch.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
+                        }
+                    } catch (Exception ex) {
+                        logger.error("--------Cannot connect to a RabbitMQ Server--------" , ex);
+                    }
+                }
+
+            }).start();
+        } catch (Exception ex) {
+            logger.error("Cannot connect to a RabbitMQ Server: " , ex);
+            logger.info("------------- Push monitoring for HPC jobs is disabled -------------");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
new file mode 100644
index 0000000..a701326
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
@@ -0,0 +1,67 @@
+/*
+ *
+ * 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.airavata.gfac.monitor.impl.push.amqp;
+
+import com.google.common.eventbus.Subscribe;
+import com.rabbitmq.client.Channel;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.gfac.monitor.util.CommonUtils;
+import org.apache.airavata.model.messaging.event.JobStatusChangeEvent;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Map;
+
+public class UnRegisterWorker{
+    private final static Logger logger = LoggerFactory.getLogger(UnRegisterWorker.class);
+    private Map<String, Channel> availableChannels;
+
+    public UnRegisterWorker(Map<String, Channel> channels) {
+        this.availableChannels = channels;
+    }
+
+    @Subscribe
+    private boolean unRegisterListener(JobStatusChangeEvent jobStatus, MonitorID monitorID) throws AiravataMonitorException {
+        String channelID = CommonUtils.getChannelID(monitorID);
+        if (JobState.FAILED.equals(jobStatus.getState()) || JobState.COMPLETE.equals(jobStatus.getState())){
+            Channel channel = availableChannels.get(channelID);
+            if (channel == null) {
+                logger.error("Already Unregistered the listener");
+                throw new AiravataMonitorException("Already Unregistered the listener");
+            } else {
+                try {
+                    channel.queueUnbind(channel.queueDeclare().getQueue(), "glue2.computing_activity", CommonUtils.getRoutingKey(monitorID));
+                    channel.close();
+                    channel.getConnection().close();
+                    availableChannels.remove(channelID);
+                } catch (IOException e) {
+                    logger.error("Error unregistering the listener");
+                    throw new AiravataMonitorException("Error unregistering the listener");
+                }
+            }
+        }
+        return true;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
new file mode 100644
index 0000000..6a4ed3b
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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.airavata.gfac.monitor.util;
+
+import com.rabbitmq.client.Connection;
+import com.rabbitmq.client.ConnectionFactory;
+import com.rabbitmq.client.DefaultSaslConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+import java.security.KeyStore;
+import java.util.Collections;
+import java.util.List;
+
+public class AMQPConnectionUtil {
+    private final static Logger logger = LoggerFactory.getLogger(AMQPConnectionUtil.class);
+    public static Connection connect(List<String>hosts,String vhost, String proxyFile) {
+        Collections.shuffle(hosts);
+        for (String host : hosts) {
+            Connection connection = connect(host, vhost, proxyFile);
+            if (host != null) {
+                System.out.println("connected to " + host);
+                return connection;
+            }
+        }
+        return null;
+    }
+
+    public static Connection connect(String host, String vhost, String proxyFile) {
+        Connection connection;
+        try {
+            String keyPassPhrase = "test123";
+            KeyStore ks = X509Helper.keyStoreFromPEM(proxyFile, keyPassPhrase);
+            KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+            kmf.init(ks, keyPassPhrase.toCharArray());
+
+            KeyStore tks = X509Helper.trustKeyStoreFromCertDir();
+            TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+            tmf.init(tks);
+
+            SSLContext c = SSLContext.getInstance("SSLv3");
+            c.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+            ConnectionFactory factory = new ConnectionFactory();
+            factory.setHost(host);
+            factory.setPort(5671);
+            factory.useSslProtocol(c);
+            factory.setVirtualHost(vhost);
+            factory.setSaslConfig(DefaultSaslConfig.EXTERNAL);
+
+            connection = factory.newConnection();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+        return connection;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
new file mode 100644
index 0000000..15b7241
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
@@ -0,0 +1,298 @@
+/*
+ *
+ * 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.airavata.gfac.monitor.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
+import org.apache.airavata.common.utils.AiravataZKUtils;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerConfig;
+import org.apache.airavata.gfac.core.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.HostMonitorData;
+import org.apache.airavata.gfac.monitor.UserMonitorData;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
+import org.apache.zookeeper.*;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CountDownLatch;
+
+public class CommonUtils {
+    private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(CommonUtils.class);
+
+    public static String getChannelID(MonitorID monitorID) {
+        return monitorID.getUserName() + "-" + monitorID.getComputeResourceDescription().getHostName();
+    }
+
+    public static String getRoutingKey(MonitorID monitorID) {
+        return "*." + monitorID.getUserName() + "." + monitorID.getComputeResourceDescription().getIpAddresses().get(0);
+    }
+
+    public static String getChannelID(String userName,String hostAddress) {
+        return userName + "-" + hostAddress;
+    }
+
+    public static String getRoutingKey(String userName,String hostAddress) {
+        return "*." + userName + "." + hostAddress;
+    }
+
+    public static void addMonitortoQueue(BlockingQueue<UserMonitorData> queue, MonitorID monitorID, JobExecutionContext jobExecutionContext) throws AiravataMonitorException {
+        synchronized (queue) {
+            Iterator<UserMonitorData> iterator = queue.iterator();
+            while (iterator.hasNext()) {
+                UserMonitorData next = iterator.next();
+                if (next.getUserName().equals(monitorID.getUserName())) {
+                    // then this is the right place to update
+                    List<HostMonitorData> monitorIDs = next.getHostMonitorData();
+                    for (HostMonitorData host : monitorIDs) {
+                        if (isEqual(host.getComputeResourceDescription(), monitorID.getComputeResourceDescription())) {
+                            // ok we found right place to add this monitorID
+                            host.addMonitorIDForHost(monitorID);
+                            logger.debugId(monitorID.getJobID(), "Added new job to the monitoring queue, experiment {}," +
+                                    " task {}", monitorID.getExperimentID(), monitorID.getTaskID());
+                            return;
+                        }
+                    }
+                    // there is a userMonitor object for this user name but no Hosts for this host
+                    // so we have to create new Hosts
+                    HostMonitorData hostMonitorData = new HostMonitorData(jobExecutionContext);
+                    hostMonitorData.addMonitorIDForHost(monitorID);
+                    next.addHostMonitorData(hostMonitorData);
+                    logger.debugId(monitorID.getJobID(), "Added new job to the monitoring queue, experiment {}," +
+                            " task {}", monitorID.getExperimentID(), monitorID.getTaskID());
+                    return;
+                }
+            }
+            HostMonitorData hostMonitorData = new HostMonitorData(jobExecutionContext);
+            hostMonitorData.addMonitorIDForHost(monitorID);
+
+            UserMonitorData userMonitorData = new UserMonitorData(monitorID.getUserName());
+            userMonitorData.addHostMonitorData(hostMonitorData);
+            try {
+                queue.put(userMonitorData);
+                logger.debugId(monitorID.getJobID(), "Added new job to the monitoring queue, experiment {}," +
+                        " task {}", monitorID.getExperimentID(), monitorID.getTaskID());
+            } catch (InterruptedException e) {
+                throw new AiravataMonitorException(e);
+            }
+        }
+    }
+
+    private static boolean isEqual(ComputeResourceDescription comRes_1, ComputeResourceDescription comRes_2) {
+        return comRes_1.getComputeResourceId().equals(comRes_2.getComputeResourceId()) &&
+                comRes_1.getHostName().equals(comRes_2.getHostName());
+    }
+
+    public static boolean isTheLastJobInQueue(BlockingQueue<MonitorID> queue,MonitorID monitorID){
+        Iterator<MonitorID> iterator = queue.iterator();
+        while(iterator.hasNext()){
+            MonitorID next = iterator.next();
+            if (monitorID.getUserName().equals(next.getUserName()) &&
+                    CommonUtils.isEqual(monitorID.getComputeResourceDescription(), next.getComputeResourceDescription())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method doesn't have to be synchronized because it will be invoked by HPCPullMonitor which already synchronized
+     * @param monitorID
+     * @throws AiravataMonitorException
+     */
+    public static void removeMonitorFromQueue(UserMonitorData userMonitorData, MonitorID monitorID) throws AiravataMonitorException {
+                if (userMonitorData.getUserName().equals(monitorID.getUserName())) {
+                    // then this is the right place to update
+                    List<HostMonitorData> hostMonitorData = userMonitorData.getHostMonitorData();
+                    Iterator<HostMonitorData> iterator1 = hostMonitorData.iterator();
+                    while (iterator1.hasNext()) {
+                        HostMonitorData iHostMonitorID = iterator1.next();
+                        if (isEqual(iHostMonitorID.getComputeResourceDescription(), monitorID.getComputeResourceDescription())) {
+                            Iterator<MonitorID> iterator2 = iHostMonitorID.getMonitorIDs().iterator();
+                            while (iterator2.hasNext()) {
+                                MonitorID iMonitorID = iterator2.next();
+                                if (iMonitorID.getJobID().equals(monitorID.getJobID())
+                                        || iMonitorID.getJobName().equals(monitorID.getJobName())) {
+                                    // OK we found the object, we cannot do list.remove(object) states of two objects
+                                    // could be different, thats why we check the jobID
+                                    iterator2.remove();
+                                    logger.infoId(monitorID.getJobID(), "Removed the jobId: {} JobName: {} from monitoring last " +
+                                            "status:{}", monitorID.getJobID(),monitorID.getJobName(), monitorID.getStatus().toString());
+
+                                    return;
+                                }
+                            }
+                        }
+                    }
+                }
+        logger.info("Cannot find the given MonitorID in the queue with userName " +
+                monitorID.getUserName() + "  and jobID " + monitorID.getJobID());
+        logger.info("This might not be an error because someone else removed this job from the queue");
+    }
+
+
+    public static void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
+        List<GFacHandlerConfig> handlers = jobExecutionContext.getGFacConfiguration().getOutHandlers();
+
+        for (GFacHandlerConfig handlerClassName : handlers) {
+            Class<? extends GFacHandler> handlerClass;
+            GFacHandler handler;
+            try {
+                handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class);
+                handler = handlerClass.newInstance();
+                handler.initProperties(handlerClassName.getProperties());
+            } catch (ClassNotFoundException e) {
+                logger.error(e.getMessage());
+                throw new GFacException("Cannot load handler class " + handlerClassName, e);
+            } catch (InstantiationException e) {
+                logger.error(e.getMessage());
+                throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
+            } catch (IllegalAccessException e) {
+                logger.error(e.getMessage());
+                throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
+            }
+            try {
+                handler.invoke(jobExecutionContext);
+            } catch (Exception e) {
+                // TODO: Better error reporting.
+                throw new GFacException("Error Executing a OutFlow Handler", e);
+            }
+        }
+    }
+
+        /**
+         *  Update job count for a given set of paths.
+         * @param zk - zookeeper instance
+         * @param changeCountMap - map of change job count with relevant path
+         * @param isAdd - Should add or reduce existing job count by the given job count.
+         */
+    public static void updateZkWithJobCount(ZooKeeper zk, final Map<String, Integer> changeCountMap, boolean isAdd) {
+        StringBuilder changeZNodePaths = new StringBuilder();
+        try {
+            if (zk == null || !zk.getState().isConnected()) {
+                try {
+                    final CountDownLatch countDownLatch = new CountDownLatch(1);
+                    zk = new ZooKeeper(AiravataZKUtils.getZKhostPort(), AiravataZKUtils.getZKTimeout(), new Watcher() {
+                        @Override
+                        public void process(WatchedEvent event) {
+                            countDownLatch.countDown();
+                        }
+                    });
+                    countDownLatch.await();
+                } catch (ApplicationSettingsException e) {
+                    logger.error("Error while reading zookeeper hostport string");
+                } catch (IOException e) {
+                    logger.error("Error while reconnect attempt to zookeeper where zookeeper connection loss state");
+                }
+            }
+
+            for (String path : changeCountMap.keySet()) {
+                if (isAdd) {
+                    CommonUtils.checkAndCreateZNode(zk, path);
+                }
+                byte[] byteData = zk.getData(path, null, null);
+                String nodeData;
+                if (byteData == null) {
+                    if (isAdd) {
+                        zk.setData(path, String.valueOf(changeCountMap.get(path)).getBytes(), -1);
+                    } else {
+                        // This is not possible, but we handle in case there any data zookeeper communication failure
+                        logger.warn("Couldn't reduce job count in " + path + " as it returns null data. Hence reset the job count to 0");
+                        zk.setData(path, "0".getBytes(), -1);
+                    }
+                } else {
+                    nodeData = new String(byteData);
+                    if (isAdd) {
+                        zk.setData(path, String.valueOf(changeCountMap.get(path) + Integer.parseInt(nodeData)).getBytes(), -1);
+                    } else {
+                        int previousCount = Integer.parseInt(nodeData);
+                        int removeCount = changeCountMap.get(path);
+                        if (previousCount >= removeCount) {
+                            zk.setData(path, String.valueOf(previousCount - removeCount).getBytes(), -1);
+                        } else {
+                            // This is not possible, do we need to reset the job count to 0 ?
+                            logger.error("Requested remove job count is " + removeCount +
+                                    " which is higher than the existing job count " + previousCount
+                                    + " in  " + path + " path.");
+                        }
+                    }
+                }
+                changeZNodePaths.append(path).append(":");
+            }
+
+            // update stat node to trigger orchestrator watchers
+            if (changeCountMap.size() > 0) {
+                changeZNodePaths.deleteCharAt(changeZNodePaths.length() - 1);
+                zk.setData("/" + Constants.STAT, changeZNodePaths.toString().getBytes(), -1);
+            }
+        } catch (KeeperException e) {
+            logger.error("Error while writing job count to zookeeper", e);
+        } catch (InterruptedException e) {
+            logger.error("Error while writing job count to zookeeper", e);
+        }
+
+    }
+
+    /**
+     * Increase job count by one and update the zookeeper
+     * @param monitorID - Job monitorId
+     */
+    public static void increaseZkJobCount(MonitorID monitorID) {
+        Map<String, Integer> addMap = new HashMap<String, Integer>();
+        addMap.put(CommonUtils.getJobCountUpdatePath(monitorID), 1);
+        updateZkWithJobCount(monitorID.getJobExecutionContext().getZk(), addMap, true);
+    }
+
+    /**
+     * Construct and return the path for a given MonitorID , eg: /stat/{username}/{resourceName}/job
+     * @param monitorID - Job monitorId
+     * @return
+     */
+    public static String getJobCountUpdatePath(MonitorID monitorID){
+        return new StringBuilder("/").append(Constants.STAT).append("/").append(monitorID.getUserName())
+                .append("/").append(monitorID.getComputeResourceDescription().getHostName()).append("/").append(Constants.JOB).toString();
+    }
+
+    /**
+     * Check whether znode is exist in given path if not create a new znode
+     * @param zk - zookeeper instance
+     * @param path - path to check znode
+     * @throws KeeperException
+     * @throws InterruptedException
+     */
+    private static void checkAndCreateZNode(ZooKeeper zk , String path) throws KeeperException, InterruptedException {
+        if (zk.exists(path, null) == null) { // if znode doesn't exist
+            if (path.lastIndexOf("/") > 1) {  // recursively traverse to parent znode and check parent exist
+                checkAndCreateZNode(zk, (path.substring(0, path.lastIndexOf("/"))));
+            }
+            zk.create(path, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);// create a znode
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
new file mode 100644
index 0000000..08c3f67
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
@@ -0,0 +1,164 @@
+/*
+ *
+ * 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.airavata.gfac.monitor.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+
+import java.io.*;
+import java.security.*;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateParsingException;
+import java.security.cert.X509Certificate;
+import java.security.spec.InvalidKeySpecException;
+
+public class X509Helper {
+
+    static {
+        // parsing of RSA key fails without this
+        java.security.Security.addProvider(new BouncyCastleProvider());
+    }
+
+
+
+    public static KeyStore keyStoreFromPEM(String proxyFile,
+                                           String keyPassPhrase) throws IOException,
+            CertificateException,
+            NoSuchAlgorithmException,
+            InvalidKeySpecException,
+            KeyStoreException {
+        return keyStoreFromPEM(proxyFile,proxyFile,keyPassPhrase);
+    }
+
+    public static KeyStore keyStoreFromPEM(String certFile,
+                                           String keyFile,
+                                           String keyPassPhrase) throws IOException,
+                                                                        CertificateException,
+                                                                        NoSuchAlgorithmException,
+                                                                        InvalidKeySpecException,
+                                                                        KeyStoreException {
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        X509Certificate cert = (X509Certificate)cf.generateCertificate(new FileInputStream(certFile));
+        //System.out.println(cert.toString());
+
+        // this works for proxy files, too, since it skips over the certificate
+        BufferedReader reader = new BufferedReader(new FileReader(keyFile));
+        String line = null;
+        StringBuilder builder = new StringBuilder();
+        boolean inKey = false;
+        while((line=reader.readLine()) != null) {
+            if (line.contains("-----BEGIN RSA PRIVATE KEY-----")) {
+                inKey = true;
+            }
+            if (inKey) {
+                builder.append(line);
+                builder.append(System.getProperty("line.separator"));
+            }
+            if (line.contains("-----END RSA PRIVATE KEY-----")) {
+                inKey = false;
+            }
+        }
+        String privKeyPEM = builder.toString();
+        //System.out.println(privKeyPEM);
+
+        // using BouncyCastle
+//        PEMReader pemParser = new PEMReader(new StringReader(privKeyPEM));
+//        Object object = pemParser.readObject();
+//
+//        PrivateKey privKey = null;
+//        if(object instanceof KeyPair){
+//            privKey = ((KeyPair)object).getPrivate();
+//        }
+        // PEMParser from BouncyCastle is good for reading PEM files, but I didn't want to add that dependency
+        /*
+        // Base64 decode the data
+        byte[] encoded = javax.xml.bind.DatatypeConverter.parseBase64Binary(privKeyPEM);
+
+        // PKCS8 decode the encoded RSA private key
+        java.security.spec.PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded);
+        KeyFactory kf = KeyFactory.getInstance("RSA");
+        PrivateKey privKey = kf.generatePrivate(keySpec);
+        //RSAPrivateKey privKey = (RSAPrivateKey)kf.generatePrivate(keySpec);
+        */
+        //System.out.println(privKey.toString());
+
+//        KeyStore keyStore = KeyStore.getInstance("PKCS12");
+//        keyStore.load(null,null);
+//
+//        KeyStore.PrivateKeyEntry entry =
+//            new KeyStore.PrivateKeyEntry(privKey,
+//                                         new java.security.cert.Certificate[] {(java.security.cert.Certificate)cert});
+//        KeyStore.PasswordProtection prot = new KeyStore.PasswordProtection(keyPassPhrase.toCharArray());
+//        keyStore.setEntry(cert.getSubjectX500Principal().getName(), entry, prot);
+
+//        return keyStore;
+        //TODO: Problem with BouncyCastle version used in gsissh 
+        throw new CertificateException("Method not implemented");
+
+    }
+
+
+    public static KeyStore trustKeyStoreFromCertDir() throws IOException,
+                                                             KeyStoreException,
+                                                             CertificateException,
+                                                             NoSuchAlgorithmException, ApplicationSettingsException {
+        return trustKeyStoreFromCertDir(ServerSettings.getSetting("trusted.cert.location"));
+    }
+
+    public static KeyStore trustKeyStoreFromCertDir(String certDir) throws IOException,
+                                                                           KeyStoreException,
+                                                                           CertificateException,
+                                                                           NoSuchAlgorithmException {
+        KeyStore ks = KeyStore.getInstance("JKS");
+        ks.load(null,null);
+
+        File dir = new File(certDir);
+        for(File file : dir.listFiles()) {
+            if (!file.isFile()) {
+                continue;
+            }
+            if (!file.getName().endsWith(".0")) {
+                continue;
+            }
+
+            try {
+                //System.out.println("reading file "+file.getName());
+                CertificateFactory cf = CertificateFactory.getInstance("X.509");
+                X509Certificate cert = (X509Certificate) cf.generateCertificate(new FileInputStream(file));
+                //System.out.println(cert.toString());
+
+                KeyStore.TrustedCertificateEntry entry = new KeyStore.TrustedCertificateEntry(cert);
+
+                ks.setEntry(cert.getSubjectX500Principal().getName(), entry, null);
+            } catch (KeyStoreException e) {
+            } catch (CertificateParsingException e) {
+                continue;
+            }
+
+        }
+
+        return ks;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/errors.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/errors.properties b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/errors.properties
new file mode 100644
index 0000000..88c41b8
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/errors.properties
@@ -0,0 +1,197 @@
+#
+#
+# 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.
+#
+
+# Directly copied from jglobus. Not a good way to manager error properties.
+1 = Parameter not supported
+2 = The RSL length is greater than the maximum allowed
+3 = No resources available
+4 = Bad directory specified
+5 = The executable does not exist
+6 = Insufficient funds
+7 = Authentication with the remote server failed
+8 = Job cancelled by user
+9 = Job cancelled by system
+
+10 = Data transfer to the server failed
+11 = The stdin file does not exist
+12 = The connection to the server failed (check host and port)
+13 = The provided RSL 'maxtime' value is invalid (not an integer or must be greater than 0)
+14 = The provided RSL 'count' value is invalid (not an integer or must be greater than 0)
+15 = The job manager received an invalid RSL
+16 = Could not connect to job manager
+17 = The job failed when the job manager attempted to run it
+18 = Paradyn error
+19 = The provided RSL 'jobtype' value is invalid
+
+20 = The provided RSL 'myjob' value is invalid
+21 = The job manager failed to locate an internal script argument file
+22 = The job manager failed to create an internal script argument file
+23 = The job manager detected an invalid job state
+24 = The job manager detected an invalid script response
+25 = The job manager detected an invalid job state
+26 = The provided RSL 'jobtype' value is not supported by this job manager
+27 = Unimplemented
+28 = The job manager failed to create an internal script submission file
+29 = The job manager cannot find the user proxy
+
+30 = The job manager failed to open the user proxy
+31 = The job manager failed to cancel the job as requested
+32 = System memory allocation failed
+33 = The interprocess job communication initialization failed
+34 = The interprocess job communication setup failed
+35 = The provided RSL 'host count' value is invalid
+36 = One of the provided RSL parameters is unsupported
+37 = The provided RSL 'queue' parameter is invalid
+38 = The provided RSL 'project' parameter is invalid
+39 = The provided RSL string includes variables that could not be identified
+
+40 = The provided RSL 'environment' parameter is invalid
+41 = The provided RSL 'dryrun' parameter is invalid
+42 = The provided RSL is invalid (an empty string)
+43 = The job manager failed to stage the executable
+44 = The job manager failed to stage the stdin file
+45 = The requested job manager type is invalid
+46 = The provided RSL 'arguments' parameter is invalid
+47 = The gatekeeper failed to run the job manager
+48 = The provided RSL could not be properly parsed
+49 = There is a version mismatch between GRAM components
+
+50 = The provided RSL 'arguments' parameter is invalid
+51 = The provided RSL 'count' parameter is invalid
+52 = The provided RSL 'directory' parameter is invalid
+53 = The provided RSL 'dryrun' parameter is invalid
+54 = The provided RSL 'environment' parameter is invalid
+55 = The provided RSL 'executable' parameter is invalid
+56 = The provided RSL 'host_count' parameter is invalid
+57 = The provided RSL 'jobtype' parameter is invalid
+58 = The provided RSL 'maxtime' parameter is invalid
+59 = The provided RSL 'myjob' parameter is invalid
+
+60 = The provided RSL 'paradyn' parameter is invalid
+61 = The provided RSL 'project' parameter is invalid
+62 = The provided RSL 'queue' parameter is invalid
+63 = The provided RSL 'stderr' parameter is invalid
+64 = The provided RSL 'stdin' parameter is invalid
+65 = The provided RSL 'stdout' parameter is invalid
+66 = The job manager failed to locate an internal script
+67 = The job manager failed on the system call pipe()
+68 = The job manager failed on the system call fcntl()
+69 = The job manager failed to create the temporary stdout filename
+
+70 = The job manager failed to create the temporary stderr filename
+71 = The job manager failed on the system call fork()
+72 = The executable file permissions do not allow execution
+73 = The job manager failed to open stdout
+74 = The job manager failed to open stderr
+75 = The cache file could not be opened in order to relocate the user proxy
+76 = Cannot access cache files in ~/.globus/.gass_cache, check permissions, quota, and disk space
+77 = The job manager failed to insert the contact in the client contact list
+78 = The contact was not found in the job manager's client contact list
+79 = Connecting to the job manager failed.  Possible reasons: job terminated, invalid job contact, network problems, ...
+
+80 = The syntax of the job contact is invalid
+81 = The executable parameter in the RSL is undefined
+82 = The job manager service is misconfigured.  condor arch undefined
+83 = The job manager service is misconfigured.  condor os undefined
+84 = The provided RSL 'min_memory' parameter is invalid
+85 = The provided RSL 'max_memory' parameter is invalid
+86 = The RSL 'min_memory' value is not zero or greater
+87 = The RSL 'max_memory' value is not zero or greater
+88 = The creation of a HTTP message failed
+89 = Parsing incoming HTTP message failed
+
+90 = The packing of information into a HTTP message failed
+91 = An incoming HTTP message did not contain the expected information
+92 = The job manager does not support the service that the client requested
+93 = The gatekeeper failed to find the requested service
+94 = The jobmanager does not accept any new requests (shutting down)
+95 = The client failed to close the listener associated with the callback URL
+96 = The gatekeeper contact cannot be parsed
+97 = The job manager could not find the 'poe' command
+98 = The job manager could not find the 'mpirun' command
+99 = The provided RSL 'start_time' parameter is invalid"
+100 = The provided RSL 'reservation_handle' parameter is invalid
+
+101 = The provided RSL 'max_wall_time' parameter is invalid
+102 = The RSL 'max_wall_time' value is not zero or greater
+103 = The provided RSL 'max_cpu_time' parameter is invalid
+104 = The RSL 'max_cpu_time' value is not zero or greater
+105 = The job manager is misconfigured, a scheduler script is missing
+106 = The job manager is misconfigured, a scheduler script has invalid permissions
+107 = The job manager failed to signal the job
+108 = The job manager did not recognize/support the signal type
+109 = The job manager failed to get the job id from the local scheduler
+
+110 = The job manager is waiting for a commit signal
+111 = The job manager timed out while waiting for a commit signal
+112 = The provided RSL 'save_state' parameter is invalid
+113 = The provided RSL 'restart' parameter is invalid
+114 = The provided RSL 'two_phase' parameter is invalid
+115 = The RSL 'two_phase' value is not zero or greater
+116 = The provided RSL 'stdout_position' parameter is invalid
+117 = The RSL 'stdout_position' value is not zero or greater
+118 = The provided RSL 'stderr_position' parameter is invalid
+119 = The RSL 'stderr_position' value is not zero or greater
+
+120 = The job manager restart attempt failed
+121 = The job state file doesn't exist
+122 = Could not read the job state file
+123 = Could not write the job state file
+124 = The old job manager is still alive
+125 = The job manager state file TTL expired
+126 = It is unknown if the job was submitted
+127 = The provided RSL 'remote_io_url' parameter is invalid
+128 = Could not write the remote io url file
+129 = The standard output/error size is different
+
+130 = The job manager was sent a stop signal (job is still running)
+131 = The user proxy expired (job is still running)
+132 = The job was not submitted by original jobmanager
+133 = The job manager is not waiting for that commit signal
+134 = The provided RSL scheduler specific parameter is invalid
+135 = The job manager could not stage in a file
+136 = The scratch directory could not be created
+137 = The provided 'gass_cache' parameter is invalid
+138 = The RSL contains attributes which are not valid for job submission
+139 = The RSL contains attributes which are not valid for stdio update
+
+140 = The RSL contains attributes which are not valid for job restart
+141 = The provided RSL 'file_stage_in' parameter is invalid
+142 = The provided RSL 'file_stage_in_shared' parameter is invalid
+143 = The provided RSL 'file_stage_out' parameter is invalid
+144 = The provided RSL 'gass_cache' parameter is invalid
+145 = The provided RSL 'file_cleanup' parameter is invalid
+146 = The provided RSL 'scratch_dir' parameter is invalid
+147 = The provided scheduler-specific RSL parameter is invalid
+148 = A required RSL attribute was not defined in the RSL spec
+149 = The gass_cache attribute points to an invalid cache directory
+
+150 = The provided RSL 'save_state' parameter has an invalid value
+151 = The job manager could not open the RSL attribute validation file
+152 = The  job manager could not read the RSL attribute validation file
+153 = The provided RSL 'proxy_timeout' is invalid
+154 = The RSL 'proxy_timeout' value is not greater than zero
+155 = The job manager could not stage out a file
+156 = The job contact string does not match any which the job manager is handling
+157 = Proxy delegation failed
+158 = The job manager could not lock the state lock file
+
+1000 = Failed to start up callback handler
+1003 = Job contact not set

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AccessPolicy.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AccessPolicy.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AccessPolicy.json
new file mode 100644
index 0000000..8f6cfe1
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AccessPolicy.json
@@ -0,0 +1,13 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AccessPolicy.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json"}],
+  "properties": {
+    "EndpointID": {
+      "type": "string",
+      "description": "The ID of the Endpoint this AccessPolicy is for"
+    }
+  },
+  "required": ["EndpointID"]
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Activity.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Activity.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Activity.json
new file mode 100644
index 0000000..8bd2495
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Activity.json
@@ -0,0 +1,31 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+  "properties": {
+    "UserDomainID": {
+      "type": "string",
+      "description": "An ID"
+    },
+    "EndpointID": {
+      "type": "string",
+      "description": "The ID of the Endpoint managing Activity"
+    },
+    "ShareID": {
+      "type": "string",
+      "description": "The ID of the Share servicing this Activity"
+    },
+    "ResourceID": {
+      "type": "string",
+      "description": "The ID of the Resource executing this Activity"
+    },
+    "ActivityID": {
+      "type": "array",
+      "description": "The IDs of other Activities related to this one",
+      "items": {
+        "type": "string"
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AdminDomain.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AdminDomain.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AdminDomain.json
new file mode 100644
index 0000000..8ed4606
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/AdminDomain.json
@@ -0,0 +1,51 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AdminDomain.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json"}],
+  "properties": {
+    "Distributed": {
+      "type": "boolean",
+      "description": "true if the services managed by the AdminDomain are geographically distributed"
+    },
+    "Owner": {
+      "type": "array",
+      "description": "Identification of persons or legal entities that own the resources in this AdminDomain",
+      "items": {
+        "type": "string"
+      }
+    },
+    "ServiceID": {
+      "type": "array",
+      "description": "IDs of Services in this AdminDomain",
+      "items": {
+        "type": "string"
+      }
+    },
+    "ChildDomainID": {
+      "type": "array",
+      "description": "IDs of AdminDomains aggregated by this AdminDomain",
+      "items": {
+        "type": "string"
+      }
+    },
+    "ParentDomainID": {
+      "type": "string",
+      "description": "The ID of the AdminDomain that this AdminDomain participates in"
+    },
+    "ComputingServiceID": {
+      "type": "array",
+      "description": "IDs of ComputingServices in this AdminDomain",
+      "items": {
+        "type": "string"
+      }
+    },
+    "StorageServiceID": {
+      "type": "array",
+      "description": "IDs of StorageServices in this AdminDomain",
+      "items": {
+        "type": "string"
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationEnvironment.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationEnvironment.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationEnvironment.json
new file mode 100644
index 0000000..89c78e0
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationEnvironment.json
@@ -0,0 +1,86 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationEnvironment.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+  "properties": {
+    "AppName": {
+      "type": "string",
+      "description": "The name of the application"
+    },
+    "AppVersion": {
+      "type": "string",
+      "description": "The version of the application"
+    },
+    "State": {
+      "type": "string",
+      "description": "The current installation state of the application - AppEnvState_t"
+    },
+    "RemovalDate": {
+      "type": "string",
+      "description": "The date/time after which the application may be removed - DateTime_t"
+    },
+    "License": {
+      "type": "string",
+      "description": "The license under which the application is usable - License_t"
+    },
+    "Description": {
+      "type": "string",
+      "description": "A human-readable description of the application"
+    },
+    "BestBenchmark": {
+      "type": "array",
+      "description": "The type(s) of the benchmarks which best describe the sensitivity of this application to the performance of the ExecutionEnvironment - Benchmark_t",
+      "items": {
+        "type": "string"
+      }
+    },
+    "ParallelSupport": {
+      "type": "string",
+      "description": "The type of supported parallel execution - ParallelSupport_t"
+    },
+    "MaxSlots": {
+      "type": "integer",
+      "description": "The maximum number of concurrent slots that may be used to run the application"
+    },
+    "MaxJobs": {
+      "type": "integer",
+      "description": "The maximum number of concurrent jobs that can run the application"
+    },
+    "MaxUserSeats": {
+      "type": "integer",
+      "description": "The maximum number of concurrent users that can run the application"
+    },
+    "FreeSlots": {
+      "type": "integer",
+      "description": "The maximum number slots currently available to run the application"
+    },
+    "FreeJobs": {
+      "type": "integer",
+      "description": "The maximum number of additional jobs that can run the application"
+    },
+    "FreeUserSeats": {
+      "type": "integer",
+      "description": "The maximum number of additional users that can run the application"
+    },
+    "ExecutionEnvironmentID": {
+      "type": "array",
+      "description": "ID(s) of ExecutionEnvironments where this ApplicationEnvironment can be used",
+      "items": {
+        "type": "string"
+      }
+    },
+    "ComputingManagerID": {
+      "type": "string",
+      "description": "ID of the ComputingManager this ApplicationEnvironment is associated with"
+    },
+    "ApplicationHandleID": {
+      "type": "array",
+      "description": "ID(s) of the ApplicationHandles that can be used to refer to this environment",
+      "items": {
+        "type": "string"
+      }
+    }
+  },
+  "required": ["AppName","ComputingManagerID"]
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationHandle.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationHandle.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationHandle.json
new file mode 100644
index 0000000..e7972e9
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ApplicationHandle.json
@@ -0,0 +1,21 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationHandle.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+  "properties": {
+    "Type": {
+      "type": "string",
+      "description": "The type of method used to set up an ApplicationEnvironment - ApplicationHandle_t (open enumeration)"
+    },
+    "Value": {
+      "type": "string",
+      "description": "How to set up the ApplicationEnvironment in the context of the Type"
+    },
+    "ApplicationEnvironmentID": {
+      "type": "string",
+      "description": "The ID of the ApplicationEnvironment this ApplicationHandle refers to"
+    }
+  },
+  "required": ["Type","Value","ApplicationEnvironmentID"]
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Benchmark.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Benchmark.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Benchmark.json
new file mode 100644
index 0000000..2b64261
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Benchmark.json
@@ -0,0 +1,21 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Benchmark.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+  "properties": {
+    "Type": {
+      "type": "string",
+      "description": "The type of the benchmark - Benchmark_t (open enumeration)"
+    },
+    "Value": {
+      "type": "number",
+      "description": "The value of the benchmark"
+    },
+    "ComputingManagerID": {
+      "type": "string",
+      "description": "The ID of the ComputingManager this benchmark is for"
+    }
+  },
+  "required": ["Type","Value"]
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingActivity.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingActivity.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingActivity.json
new file mode 100644
index 0000000..5fcae72
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingActivity.json
@@ -0,0 +1,165 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingActivity.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json"}],
+  "properties": {
+    "Type": {
+      "type": "string",
+      "description": "closed enumeration ComputingActivityType_t",
+      "enum": ["collectionelement","parallelelement","single","workflownode"]
+    },
+    "IDFromEndpoint": {
+      "type": "string",
+      "description": "The ID assigned by the ComputingEndpoint"
+    },
+    "LocalIDFromManager": {
+      "type": "string",
+      "description": "The local ID assigned by the ComputingManager"
+    },
+    "State": {
+      "type": "array",
+      "description": "open enumeration ComputingActivityState_t",
+      "items": {
+        "type": "string"
+      },
+      "minItems": 1
+    },
+    "RestartState": {
+      "type": "array",
+      "description": "open enumeration ComputingActivityState_t",
+      "items": {
+        "type": "string"
+      }
+    },
+    "ExitCode": {
+      "type": "integer",
+      "description": "The exit code as returned by the main executable code or script of the job"
+    },
+    "ComputingManagerExitCode": {
+      "type": "string",
+      "description": "The exit code provided by the ComputingManager"
+    },
+    "Error": {
+      "type": "array",
+      "description": "The error messages as provided by the software components involved in the management of the job",
+      "items": {
+        "type": "string"
+      }
+    },
+    "WaitingPosition": {
+      "type": "integer",
+      "description": "The position of the job in the queue, if the job is waiting"
+    },
+    "Owner": {
+      "type": "string",
+      "description": "The Grid identity of the job's owner"
+    },
+    "LocalOwner": {
+      "type": "string",
+      "description": "The local user name of the job's owner"
+    },
+    "RequestedTotalWallTime": {
+      "type": "integer",
+      "description": "The total wall clock time requested by the job"
+    },
+    "RequestedTotalCPUTime": {
+      "type": "integer",
+      "description": "The total CPU time requested by the job"
+    },
+    "RequestedSlots": {
+      "type": "integer",
+      "description": "The number of slots requested for the job"
+    },
+    "RequestedApplicationEnvironment": {
+      "type": "array",
+      "description": "The AppName and Version of the requested ApplicationEnvironments",
+      "items": {
+        "type": "string"
+      }
+    },
+    "StdIn": {
+      "type": "string",
+      "description": "The name of the file used for standard input"
+    },
+    "StdOut": {
+      "type": "string",
+      "description": "The name of the file used for standard output"
+    },
+    "StdErr": {
+      "type": "string",
+      "description": "The name of the file used for standard error"
+    },
+    "LogDir": {
+      "type": "string",
+      "description": "The name of the directory which contains job logs"
+    },
+    "ExecutionNode": {
+      "type": "array",
+      "description": "Hostnames associated with the ExecutionEnvironments running the job",
+      "items": {
+        "type": "string"
+      }
+    },
+    "Queue": {
+      "type": "string",
+      "description": "The name of the ComputingManager queue that held the job before execution"
+    },
+    "UsedTotalWallTime": {
+      "type": "integer",
+      "description": "The total wall clock time consumed by the job so far (slots*seconds)"
+    },
+    "UsedTotalCpuTime": {
+      "type": "integer",
+      "description": "The total CPU time consumed by the job so far (seconds)"
+    },
+    "UsedMainMemory": {
+      "type": "integer",
+      "description": "The physical RAM currently used by the job (MB)"
+    },
+    "SubmissionTime": {
+      "type": "string",
+      "description": "The time when the job was submitted to the ComputingEndpoint (DateTime_t)"
+    },
+    "ComputingManagerSubmissionTime": {
+      "type": "string",
+      "description": "The time when the job was submitted to the ComputingManager (DateTime_t)"
+    },
+    "StartTime": {
+      "type": "string",
+      "description": "The time when the ComputingManager started the job (DateTime_t)"
+    },
+    "EndTime": {
+      "type": "string",
+      "description": "The time when the job ended in the Grid layer (DateTime_t)"
+    },
+    "ComputingManagerEndTime": {
+      "type": "string",
+      "description": "The time when the job ended according to the ComputingManager (DateTime_t)"
+    },
+    "WorkingAreaEraseTime": {
+      "type": "string",
+      "description": "The time when working area will be removed from storage (DateTime_t)"
+    },
+    "ProxyExpirationTime": {
+      "type": "string",
+      "description": "The expiration time of the Grid proxy associated with the job (DateTime_t)"
+    },
+    "SubmissionHost": {
+      "type": "string",
+      "description": "The name of the host from which the job was submitted"
+    },
+    "SubmissionClientName": {
+      "type": "string",
+      "description": "The name of the software client used to submit the job"
+    },
+    "OtherMessages": {
+      "type": "array",
+      "description": "Optional messages provided by either the Grid layer or the ComputingManager",
+      "items": {
+        "type": "string"
+      }
+    }
+  },
+  "required": ["State","Owner"]
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingEndpoint.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingEndpoint.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingEndpoint.json
new file mode 100644
index 0000000..f94f889
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingEndpoint.json
@@ -0,0 +1,44 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingEndpoint.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json"}],
+  "properties": {
+    "Staging": {
+      "type": "string",
+      "description": "Supported file staging functionality - Staging_t",
+      "enum": ["none","stagingin","staginginout","stagingout"]
+    },
+    "JobDescription": {
+      "type": "array",
+      "description": "Supported job description languages - JobDescription_t (open Enumeration)",
+      "items": {
+        "type": "string"
+      }
+    },
+    "TotalJobs": {
+      "type": "integer",
+      "description": "The total number of Grid jobs known to the system"
+    },
+    "RunningJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs which are running in an ExecutionEnvironment"
+    },
+    "WaitingJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs which are waiting to start executing"
+    },
+    "StagingJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs staging files before or after execution"
+    },
+    "SuspendedJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs that started to execute, but are now suspended"
+    },
+    "PreLRMSWaitingJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs managed by the Grid software, but not yet passed to the LRMS"
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingManager.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingManager.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingManager.json
new file mode 100644
index 0000000..aecb114
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingManager.json
@@ -0,0 +1,117 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingManager.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
+  "properties": {
+    "Reservation": {
+      "type": "boolean",
+      "description": "Whether advance reservation is supported (no value implies undefined in ExtendedBoolean_t)"
+    },
+    "BulkSubmission": {
+      "type": "boolean",
+      "description": "Whether multiple jobs can be submitted at once (no value implies undefined in ExtendedBoolean_t)"
+    },
+    "TotalPhysicalCPUs": {
+      "type": "integer",
+      "description": "The total number of physical CPUs managed by this ComputingManager"
+    },
+    "TotalLogicalCPUs": {
+      "type": "integer",
+      "description": "The total number of logical CPUs managed by this ComputingManager"
+    },
+    "TotalSlots": {
+      "type": "integer",
+      "description": "The total number of slots managed by this ComputingManager"
+    },
+    "SlotsUsedByLocalJobs": {
+      "type": "integer",
+      "description": "The number of slots currently used by jobs submitted via a non-Grid interface"
+    },
+    "SlotsUsedByGridJobs": {
+      "type": "integer",
+      "description": "The number of slots currently used by jobs submitted via a non-Grid interface"
+    },
+    "Homogeneous": {
+      "type": "boolean",
+      "description": "Whether this ComputingManager manages only one type of ExecutionEnvironment"
+    },
+    "NetworkInfo": {
+      "type": "array",
+      "description": "The types of internal network connections between ExecutionEnvironments (NetworkInfo_t)",
+      "items": {
+        "type": "string"
+      }
+    },
+    "LocalCPUDistribution": {
+      "type": "boolean",
+      "description": "Classification of the managed ExecutionEnvironments aggregated by the number of logical CPUs"
+    },
+    "WorkingAreaShared": {
+      "type": "boolean",
+      "description": "True if the working area is shared across different ExecutionEnvironments"
+    },
+    "WorkingAreaGuaranteed": {
+      "type": "boolean",
+      "description": "True if the job is guaranteed all of WorkingAreaTotal"
+    },
+    "WorkingAreaTotal": {
+      "type": "integer",
+      "description": "Total size of the working area available to single slot jobs (GB)"
+    },
+    "WorkingAreaFree": {
+      "type": "integer",
+      "description": "The amount of free space in the working area (GB)"
+    },
+    "WorkingAreaLifeTime": {
+      "type": "integer",
+      "description": "The minimum guaranteed lifetime of files created in the working area (seconds)"
+    },
+    "WorkingAreaMultiSlotTotal": {
+      "type": "integer",
+      "description": "The total size of the working area across all ExecutionEnvironments (GB)"
+    },
+    "WorkingAreaMultiSlotFree": {
+      "type": "integer",
+      "description": "The available space in the working area across all ExecutionEnvironments (GB)"
+    },
+    "WorkingAreaMultiSlotLifeTime": {
+      "type": "integer",
+      "description": "The minimum guaranteed lifetime of files created in the working area (seconds)"
+    },
+    "CacheTotal": {
+      "type": "integer",
+      "description": "If local caching of input files is supported, the total size of the area they may be stored in"
+    },
+    "CacheFree": {
+      "type": "integer",
+      "description": "If local caching of input files is supported, the available size of the area they may be stored in"
+    },
+    "TmpDir": {
+      "type": "string",
+      "description": "The absolute path of a temporary directory local to an ExecutionEnvironment"
+    },
+    "ScratchDir": {
+      "type": "string",
+      "description": "The absolute path of a shared directory available for application data"
+    },
+    "ApplicationDir": {
+      "type": "string",
+      "description": "The absolute path of a directory available for installation of persistent application software"
+    },
+    "ApplicationEnvironmentID": {
+      "type": "array",
+      "description": "ID(s) of ApplicationEnvironments provided by this ComputingManager",
+      "items": {
+        "type": "string"
+      }
+    },
+    "BenchmarkID": {
+      "type": "array",
+      "description": "ID(s) of Benchmarks associated with this ComputingManager",
+      "items": {
+        "type": "string"
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingService.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingService.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingService.json
new file mode 100644
index 0000000..9cfde1b
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingService.json
@@ -0,0 +1,32 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingService.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json"}],
+  "properties": {
+    "TotalJobs": {
+      "type": "integer",
+      "description": "The total number of Grid jobs known to the system"
+    },
+    "RunningJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs which are running in an ExecutionEnvironment"
+    },
+    "WaitingJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs which are waiting to start executing"
+    },
+    "StagingJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs staging files before or after execution"
+    },
+    "SuspendedJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs that started to execute, but are now suspended"
+    },
+    "PreLRMSWaitingJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs managed by the Grid software, but not yet passed to the LRMS"
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingShare.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingShare.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingShare.json
new file mode 100644
index 0000000..340c83e
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/ComputingShare.json
@@ -0,0 +1,182 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingShare.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
+  "properties": {
+    "MappingQueue": {
+      "type": "string",
+      "description": "The name of the queue in the LRMS where jobs in this share are submitted"
+    },
+    "MaxWallTime": {
+      "type": "integer",
+      "description": "The maximum wall clock time that a single-slot job can run (seconds)"
+    },
+    "MaxMultiSlotWallTime": {
+      "type": "integer",
+      "description": "The maximum wall clock time that a multi-slot job can run (seconds)"
+    },
+    "DefaultWallTime": {
+      "type": "integer",
+      "description": "The default wall clock per slot assumed by the LRMS if a maximum time is not specified (seconds)"
+    },
+    "MaxCPUTime": {
+      "type": "integer",
+      "description": "The maximum pre-slot CPU time that a job can request (seconds)"
+    },
+    "MaxTotalCPUTime": {
+      "type": "integer",
+      "description": "The maximum amount of CPU time that a job can request across all slots assigned to it (seconds)"
+    },
+    "MinCPUTime": {
+      "type": "integer",
+      "description": "The minimum pre-slot CPU time that a job can request (seconds)"
+    },
+    "DefaultCPUTime": {
+      "type": "integer",
+      "description": "The default CPU time limit assumed by the LRMS if a maximum time is not specified (seconds)"
+    },
+    "MaxTotalJobs": {
+      "type": "integer",
+      "description": "The maximum number of jobs that can be in this Share"
+    },
+    "MaxRunningJobs": {
+      "type": "integer",
+      "description": "The maximum number of jobs that can be running in this Share"
+    },
+    "MaxWaitingJobs": {
+      "type": "integer",
+      "description": "The maximum number of jobs that can be waiting in this Share"
+    },
+    "MaxPreLRMSWaitingJobs": {
+      "type": "integer",
+      "description": "The maximum number of jobs that can be waiting in the Grid layer for this Share"
+    },
+    "MaxUserRunningJobs": {
+      "type": "integer",
+      "description": "The maximum number of jobs that can be running in this Share per user"
+    },
+    "MaxSlotsPerJob": {
+      "type": "integer",
+      "description": "The maximum number of slots that can be allocated to a single job in this Share"
+    },
+    "MaxStageInStreams": {
+      "type": "integer",
+      "description": "The maximum number of streams available to stage files in"
+    },
+    "MaxStageOutStreams": {
+      "type": "integer",
+      "description": "The maximum number of streams available to stage files out"
+    },
+    "ScheduingPolicy": {
+      "type": "string",
+      "description": "The scheduling policy used by the share - SchedulingPolicy_t (open enumeration)"
+    },
+    "MaxMainMemory": {
+      "type": "integer",
+      "description": "The maximum amount of physical RAM that a job can use (MB)"
+    },
+    "GuaranteedMainMemory": {
+      "type": "integer",
+      "description": "The amount of physical RAM that a job will have available (MB)"
+    },
+    "MaxVirtualMemory": {
+      "type": "integer",
+      "description": "The maximum amount memory (RAM+swap) that a job can use (MB)"
+    },
+    "GuaranteedVirtualMemory": {
+      "type": "integer",
+      "description": "The amount of memory (RAM+swap) that a job will have available (MB)"
+    },
+    "MaxDiskSpace": {
+      "type": "integer",
+      "description": "The maximum disk space that a job can use in the working area (GB)"
+    },
+    "DefaultStorageServiceID": {
+      "type": "string",
+      "description": "The ID of the default StorageService used to store files"
+    },
+    "Preemption": {
+      "type": "boolean",
+      "description": "Whether jobs can be preempted and resumed (no value implies undefined in ExtendedBoolean_t)"
+    },
+    "ServingState": {
+      "type": "string",
+      "description": "How the Share is currently serving jobs",
+      "enum": ["closed","draining","production","queueing"]
+    },
+    "TotalJobs": {
+      "type": "integer",
+      "description": "The total number of jobs in any state"
+    },
+    "RunningJobs": {
+      "type": "integer",
+      "description": "The number of running jobs submitted through Grid or non-Grid interfaces"
+    },
+    "LocalRunningJobs": {
+      "type": "integer",
+      "description": "The number of running jobs submitted using non-Grid interfaces"
+    },
+    "WaitingJobs": {
+      "type": "integer",
+      "description": "The number of waiting jobs submitted through Grid or non-Grid interfaces"
+    },
+    "LocalWaitingJobs": {
+      "type": "integer",
+      "description": "The number of waiting jobs submitted using non-Grid interfaces"
+    },
+    "SuspendedJobs": {
+      "type": "integer",
+      "description": "The number of suspended jobs submitted through Grid or non-Grid interfaces"
+    },
+    "LocalSuspendedJobs": {
+      "type": "integer",
+      "description": "The number of suspended jobs submitted using non-Grid interfaces"
+    },
+    "StagingJobs": {
+      "type": "integer",
+      "description": "The number of jobs staging files before or after execution"
+    },
+    "PreLRMSWaitingJobs": {
+      "type": "integer",
+      "description": "The number of Grid jobs which have not yet been passed to the LRMS"
+    },
+    "EstimatedAverageWaitingTime": {
+      "type": "integer",
+      "description": "An estimate of the average time a job will wait before it starts to execute (seconds)"
+    },
+    "EstimatedWorstWaitingTime": {
+      "type": "integer",
+      "description": "An estimate of the worst-case time a job will wait before it starts to execute (seconds)"
+    },
+    "FreeSlots": {
+      "type": "integer",
+      "description": "The number of slots which are currently available for use"
+    },
+    "FreeSlotsWithDuration": {
+      "type": "string",
+      "description": "The number of slots which are currently available for use and how long they are available"
+    },
+    "UsedSlots": {
+      "type": "integer",
+      "description": "The number of slots currently in use"
+    },
+    "RequestedSlots": {
+      "type": "integer",
+      "description": "The number of slots needd to execute all waiting and staging jobs"
+    },
+    "ReservationPolicy": {
+      "type": "string",
+      "description": "The policy used for advance reservation - ReservationPolicy_t",
+      "enum": ["mandatory","none","optional"]
+    },
+    "Tag": {
+      "type": "array",
+      "description": "UserDomain-defined tags for this Share",
+      "items": {
+        "type": "string"
+      }
+    }
+  },
+  "required": ["ServingState"]
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Contact.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Contact.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Contact.json
new file mode 100644
index 0000000..436b262
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Contact.json
@@ -0,0 +1,32 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Contact.json",
+  "description": "A GLUE 2 Contact",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+  "properties": {
+    "Detail": {
+      "type": "string",
+      "description": "A URI embedding the contact information"
+    },
+    "Type": {
+      "type": "string",
+      "description": "closed enumeration ContactType_t",
+      "enum": ["general","security","sysadmin","usersupport"]
+    },
+    "ServiceID": {
+      "type": "array",
+      "description": "The IDs of Services associated with this Contact",
+      "items": {
+        "type": "string"
+      }
+    },
+    "DomainID": {
+      "type": "array",
+      "description": "The IDs of Domains associated with this Contact",
+      "items": {
+        "type": "string"
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/DataStore.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/DataStore.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/DataStore.json
new file mode 100644
index 0000000..8f15447
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/DataStore.json
@@ -0,0 +1,30 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/DataStore.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json"}],
+  "properties": {
+    "Type": {
+      "type": "string",
+      "description": "The type of storage medium - DataStoreType_t (disk,optical,tape,...)"
+    },
+    "Latency": {
+      "type": "string",
+      "description": "The latency category under normal operating conditions - AccessLatency_t",
+      "enum": ["nearline","offline","online"]
+    },
+    "TotalSize": {
+      "type": "integer",
+      "description": "The total amount of storage (GB)"
+    },
+    "FreeSize": {
+      "type": "integer",
+      "description": "The amount of available storage (GB)"
+    },
+    "UsedSize": {
+      "type": "integer",
+      "description": "The amount of used storage (GB)"
+    }
+  },
+  "required": ["Type","Latency"]
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6ffc3ee7/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Domain.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Domain.json b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Domain.json
new file mode 100644
index 0000000..5bd996b
--- /dev/null
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/resources/schema/Domain.json
@@ -0,0 +1,30 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json",
+  "type": "object",
+  "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+  "properties": {
+    "Description": {
+      "type": "string",
+      "description": "A description of the Domain"
+    },
+    "WWW": {
+      "type": "array",
+      "description": "URLs of web pages with more information about the Domain",
+      "items": {
+        "type": "string"
+      }
+    },
+    "ContactID": {
+      "type": "array",
+      "description": "IDs of Contacts for this Domain",
+      "items": {
+        "type": "string"
+      }
+    },
+    "LocationID": {
+      "type": "string",
+      "description": "The ID of the primary Location for this Domain"
+    }
+  }
+}