http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java
new file mode 100644
index 0000000..0f14078
--- /dev/null
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/ComputeResourceImpl.java
@@ -0,0 +1,888 @@
+/*
+ *
+ * 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.registry.core.app.catalog.impl;
+
+import java.util.*;
+
+import org.apache.airavata.model.appcatalog.computeresource.*;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import 
org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogUtils;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ComputeResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ComputeResourceImpl implements ComputeResource {
+    private final static Logger logger = 
LoggerFactory.getLogger(ComputeResourceImpl.class);
+
+    @Override
+    public String addComputeResource(ComputeResourceDescription description) 
throws AppCatalogException {
+        try {
+            if (description.getComputeResourceId().equals("") || 
description.getComputeResourceId().equals(computeResourceModelConstants.DEFAULT_ID)){
+                
description.setComputeResourceId(AppCatalogUtils.getID(description.getHostName()));
+            }
+               return saveComputeResourceDescriptorData(description);
+        } catch (Exception e) {
+            logger.error("Error while saving compute resource...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+       protected String saveComputeResourceDescriptorData(
+                       ComputeResourceDescription description) throws 
AppCatalogException {
+               //TODO remove existing one
+               ComputeResourceAppCatalogResourceAppCat computeHostResource = 
saveComputeResource(description);
+               saveHostAliases(description, computeHostResource);
+               saveIpAddresses(description, computeHostResource);
+               saveBatchQueues(description, computeHostResource);
+               saveFileSystems(description, computeHostResource);
+               saveJobSubmissionInterfaces(description, computeHostResource);
+               saveDataMovementInterfaces(description, computeHostResource);
+               return computeHostResource.getResourceId();
+       }
+
+       protected ComputeResourceAppCatalogResourceAppCat saveComputeResource(
+                       ComputeResourceDescription description) throws 
AppCatalogException {
+               ComputeResourceAppCatalogResourceAppCat computeHostResource = 
AppCatalogThriftConversion.getComputeHostResource(description);
+               computeHostResource.save();
+               return computeHostResource;
+       }
+
+       protected void saveDataMovementInterfaces(
+                       ComputeResourceDescription description,
+                       ComputeResourceAppCatalogResourceAppCat 
computeHostResource)
+                       throws AppCatalogException {
+               List<DataMovementInterface> dataMovemenetInterfaces = 
description.getDataMovementInterfaces();
+               if (dataMovemenetInterfaces != null && 
!dataMovemenetInterfaces.isEmpty()) {
+                   for (DataMovementInterface dataMovementInterface : 
dataMovemenetInterfaces) {
+                       DataMovementInterfaceAppCatalogResourceAppCat dmir = 
AppCatalogThriftConversion.getDataMovementInterface(dataMovementInterface);
+                       dmir.setComputeHostResource(computeHostResource);
+                       
dmir.setComputeResourceId(computeHostResource.getResourceId());
+                               dmir.save();
+                   }
+               }
+       }
+
+       protected void saveJobSubmissionInterfaces(
+                       ComputeResourceDescription description,
+                       ComputeResourceAppCatalogResourceAppCat 
computeHostResource)
+                       throws AppCatalogException {
+               List<JobSubmissionInterface> jobSubmissionInterfaces = 
description.getJobSubmissionInterfaces();
+               if (jobSubmissionInterfaces != null && 
!jobSubmissionInterfaces.isEmpty()) {
+                   for (JobSubmissionInterface jobSubmissionInterface : 
jobSubmissionInterfaces) {
+                       JobSubmissionInterfaceAppCatalogResourceAppCat jsir = 
AppCatalogThriftConversion.getJobSubmissionInterface(jobSubmissionInterface);
+                               
jsir.setComputeHostResource(computeHostResource);
+                               
jsir.setComputeResourceId(computeHostResource.getResourceId());
+                               jsir.save();
+                   }
+               }
+       }
+
+       protected void saveFileSystems(ComputeResourceDescription description,
+                       ComputeResourceAppCatalogResourceAppCat 
computeHostResource)
+                       throws AppCatalogException {
+               Map<FileSystems, String> fileSystems = 
description.getFileSystems();
+               if (fileSystems != null && !fileSystems.isEmpty()) {
+                   for (FileSystems key : fileSystems.keySet()) {
+                       ComputeResourceFileSystemAppCatalogResourceAppCat 
computeResourceFileSystemResource = new 
ComputeResourceFileSystemAppCatalogResourceAppCat();
+                       
computeResourceFileSystemResource.setComputeHostResource(computeHostResource);
+                       
computeResourceFileSystemResource.setComputeResourceId(computeHostResource.getResourceId());
+                       
computeResourceFileSystemResource.setFileSystem(key.toString());
+                       
computeResourceFileSystemResource.setPath(fileSystems.get(key));
+                       computeResourceFileSystemResource.save();
+                   }
+               }
+       }
+
+       protected void saveBatchQueues(ComputeResourceDescription description,
+                       ComputeResourceAppCatalogResourceAppCat 
computeHostResource)
+                       throws AppCatalogException {
+               List<BatchQueue> batchQueueList = description.getBatchQueues();
+               if (batchQueueList != null && !batchQueueList.isEmpty()) {
+                   for (BatchQueue batchQueue : batchQueueList) {
+                       BatchQueueAppCatalogResourceAppCat bq = 
AppCatalogThriftConversion.getBatchQueue(batchQueue);
+                       
bq.setComputeResourceId(computeHostResource.getResourceId());
+                       bq.setComputeHostResource(computeHostResource);
+                       bq.save();
+                   }
+               }
+       }
+
+       protected void saveIpAddresses(ComputeResourceDescription description,
+                       ComputeResourceAppCatalogResourceAppCat 
computeHostResource)
+                       throws AppCatalogException {
+               List<String> ipAddresses = description.getIpAddresses();
+        HostIPAddressAppCatalogResourceAppCat resource = new 
HostIPAddressAppCatalogResourceAppCat();
+        resource.remove(description.getComputeResourceId());
+               if (ipAddresses != null && !ipAddresses.isEmpty()) {
+                   for (String ipAddress : ipAddresses) {
+                       HostIPAddressAppCatalogResourceAppCat ipAddressResource 
= new HostIPAddressAppCatalogResourceAppCat();
+                       
ipAddressResource.setComputeHostResource(computeHostResource);
+                       
ipAddressResource.setResourceID(computeHostResource.getResourceId());
+                       ipAddressResource.setIpaddress(ipAddress);
+                       ipAddressResource.save();
+                   }
+               }
+       }
+
+       protected void saveHostAliases(ComputeResourceDescription description,
+                       ComputeResourceAppCatalogResourceAppCat 
computeHostResource)
+                       throws AppCatalogException {
+               List<String> hostAliases = description.getHostAliases();
+        // delete previous host aliases
+        HostAliasAppCatalogResourceAppCat resource = new 
HostAliasAppCatalogResourceAppCat();
+        resource.remove(description.getComputeResourceId());
+               if (hostAliases != null && !hostAliases.isEmpty()) {
+                   for (String alias : hostAliases) {
+                       HostAliasAppCatalogResourceAppCat aliasResource = new 
HostAliasAppCatalogResourceAppCat();
+                       
aliasResource.setComputeHostResource(computeHostResource);
+                       
aliasResource.setResourceID(computeHostResource.getResourceId());
+                aliasResource.setAlias(alias);
+                       aliasResource.save();
+                   }
+               }
+       }
+
+    @Override
+    public void updateComputeResource(String computeResourceId, 
ComputeResourceDescription updatedComputeResource) throws AppCatalogException{
+        try {
+               saveComputeResourceDescriptorData(updatedComputeResource);
+        } catch (Exception e) {
+            logger.error("Error while updating compute resource...", e);
+            throw new AppCatalogException(e);
+        } 
+    }
+
+    @Override
+    public String addSSHJobSubmission(SSHJobSubmission sshJobSubmission) 
throws AppCatalogException {
+        try {
+            String submissionId = AppCatalogUtils.getID("SSH");
+            sshJobSubmission.setJobSubmissionInterfaceId(submissionId);
+               String resourceJobManagerId = 
addResourceJobManager(sshJobSubmission.getResourceJobManager());
+               SshJobSubmissionAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getSSHJobSubmission(sshJobSubmission);
+               resource.setResourceJobManagerId(resourceJobManagerId);
+               
resource.getResourceJobManagerResource().setResourceJobManagerId(resourceJobManagerId);
+            if (sshJobSubmission.getMonitorMode() != null){
+                
resource.setMonitorMode(sshJobSubmission.getMonitorMode().toString());
+            }
+            resource.save();
+               return submissionId;
+        }catch (Exception e) {
+            logger.error("Error while saving SSH Job Submission...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public String addCloudJobSubmission(CloudJobSubmission sshJobSubmission) 
throws AppCatalogException {
+        try {
+            
sshJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("Cloud"));
+            CloudSubmissionAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getCloudJobSubmission(sshJobSubmission);
+            resource.save();
+            return resource.getJobSubmissionInterfaceId();
+        }catch (Exception e) {
+            logger.error("Error while saving SSH Job Submission...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+    
+       @Override
+       public String addUNICOREJobSubmission(UnicoreJobSubmission 
unicoreJobSubmission)
+                       throws AppCatalogException {
+                try {
+             
unicoreJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("UNICORE"));
+             UnicoreJobSubmissionAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getUnicoreJobSubmission(unicoreJobSubmission);
+             
resource.setUnicoreEndpointUrl(unicoreJobSubmission.getUnicoreEndPointURL());
+             if (unicoreJobSubmission.getSecurityProtocol() !=  null){
+                 
resource.setSecurityProtocol(unicoreJobSubmission.getSecurityProtocol().toString());
+             }
+             resource.save();
+             return resource.getjobSubmissionInterfaceId();
+         }catch (Exception e){
+                   logger.error("Error while retrieving SSH Job 
Submission...", e);
+                   throw new AppCatalogException(e);
+               }
+                
+       }
+
+    @Override
+    public String addJobSubmissionProtocol(String computeResourceId, 
JobSubmissionInterface jobSubmissionInterface) throws AppCatalogException {
+        try {
+               JobSubmissionInterfaceAppCatalogResourceAppCat jsi = 
AppCatalogThriftConversion.getJobSubmissionInterface(jobSubmissionInterface);
+               jsi.setComputeResourceId(computeResourceId);
+               ComputeResourceAppCatalogResourceAppCat computeResourceResource 
= new ComputeResourceAppCatalogResourceAppCat();
+               
computeResourceResource=(ComputeResourceAppCatalogResourceAppCat)computeResourceResource.get(computeResourceId);
+               jsi.setComputeHostResource(computeResourceResource);
+            jsi.save();
+            return jsi.getJobSubmissionInterfaceId();
+        }catch (Exception e){
+            logger.error("Error while saving 
"+jobSubmissionInterface.getJobSubmissionProtocol().toString()+" Job Submission 
Protocol...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+//    @Override
+//    public String addGSISSHJobSubmission(GSISSHJobSubmission 
gsisshJobSubmission) throws AppCatalogException {
+//        try {
+//            GSISSHSubmissionResource resource = new 
GSISSHSubmissionResource();
+//            String hostName = "GSISSH";
+//            resource.setDeploymentId(AppCatalogUtils.getID(hostName));
+//            resource.setSshPort(resource.getSshPort());
+//            
resource.setResourceJobManager(gsisshJobSubmission.getResourceJobManager().toString());
+//            
resource.setInstalledPath(gsisshJobSubmission.getInstalledPath());
+//            resource.setMonitorMode(gsisshJobSubmission.getMonitorMode());
+//            resource.save();
+//            
gsisshJobSubmission.setJobSubmissionDataID(resource.getDeploymentId());
+//
+//            Set<String> exports = gsisshJobSubmission.getExports();
+//            if (exports != null && !exports.isEmpty()){
+//                for (String export : exports){
+//                    GSISSHExportResource exportResource = new 
GSISSHExportResource();
+//                    
exportResource.setDeploymentId(resource.getDeploymentId());
+//                    exportResource.setExport(export);
+//                    exportResource.setAppDeploymentResource(resource);
+//                    exportResource.save();
+//                }
+//            }
+//
+//            List<String> preJobCommands = 
gsisshJobSubmission.getPreJobCommands();
+//            if (preJobCommands != null && !preJobCommands.isEmpty()){
+//                for (String command : preJobCommands){
+//                    GSISSHPreJobCommandResource commandResource = new 
GSISSHPreJobCommandResource();
+//                    
commandResource.setDeploymentId(resource.getDeploymentId());
+//                    commandResource.setCommand(command);
+//                    commandResource.setAppDeploymentResource(resource);
+//                    commandResource.save();
+//                }
+//            }
+//
+//            List<String> postJobCommands = 
gsisshJobSubmission.getPostJobCommands();
+//            if (postJobCommands != null && !postJobCommands.isEmpty()){
+//                for (String command : postJobCommands){
+//                    GSISSHPostJobCommandResource commandResource = new 
GSISSHPostJobCommandResource();
+//                    
commandResource.setDeploymentId(resource.getDeploymentId());
+//                    commandResource.setCommand(command);
+//                    commandResource.setAppDeploymentResource(resource);
+//                    commandResource.save();
+//                }
+//            }
+//            return resource.getDeploymentId();
+//        }catch (Exception e) {
+//            logger.error("Error while saving GSISSH Job Submission...", e);
+//            throw new AppCatalogException(e);
+//        }
+//    }
+//
+//    @Override
+//    public void addGSISSHJobSubmissionProtocol(String computeResourceId, 
String jobSubmissionId) throws AppCatalogException {
+//        try {
+//            JobSubmissionProtocolResource resource = new 
JobSubmissionProtocolResource();
+//            resource.setResourceID(computeResourceId);
+//            resource.setDeploymentId(jobSubmissionId);
+//            ComputeResourceDescription computeResource = 
getComputeResource(computeResourceId);
+//            
resource.setComputeHostResource(AppCatalogThriftConversion.getComputeHostResource(computeResource));
+//            resource.setJobType(JobSubmissionProtocol.GSISSH.toString());
+//            resource.save();
+//        }catch (Exception e){
+//            logger.error("Error while saving GSISSH Job Submission 
Protocol...", e);
+//            throw new AppCatalogException(e);
+//        }
+//    }
+
+    @Override
+    public String addGlobusJobSubmission(GlobusJobSubmission 
globusJobSubmission) throws AppCatalogException {
+//        try {
+//            GlobusJobSubmissionResource resource = new 
GlobusJobSubmissionResource();
+//            String hostName = "GLOBUS";
+//            resource.setDeploymentId(AppCatalogUtils.getID(hostName));
+//            
resource.setSecurityProtocol(globusJobSubmission.getSecurityProtocol().toString());
+//            
resource.setResourceJobManager(globusJobSubmission.getResourceJobManager().toString());
+//            resource.save();
+//            
globusJobSubmission.setJobSubmissionDataID(resource.getDeploymentId());
+//            List<String> globusGateKeeperEndPoint = 
globusJobSubmission.getGlobusGateKeeperEndPoint();
+//            if (globusGateKeeperEndPoint != null && 
!globusGateKeeperEndPoint.isEmpty()) {
+//                for (String endpoint : globusGateKeeperEndPoint) {
+//                    GlobusGKEndpointResource endpointResource = new 
GlobusGKEndpointResource();
+//                    
endpointResource.setDeploymentId(resource.getDeploymentId());
+//                    endpointResource.setEndpoint(endpoint);
+//                    
endpointResource.setGlobusJobSubmissionResource(resource);
+//                    endpointResource.save();
+//                }
+//            }
+//            return resource.getDeploymentId();
+//        } catch (Exception e) {
+//            logger.error("Error while saving Globus Job Submission...", e);
+//            throw new AppCatalogException(e);
+//        }
+       return null;
+    }
+
+    @Override
+    public String addScpDataMovement(SCPDataMovement scpDataMovement) throws 
AppCatalogException {
+        try {
+               
scpDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("SCP"));
+               ScpDataMovementAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getSCPDataMovementDescription(scpDataMovement);
+            resource.save();
+            return resource.getDataMovementInterfaceId();
+        }catch (Exception e){
+            logger.error("Error while saving SCP Data Movement...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public String addUnicoreDataMovement(UnicoreDataMovement 
unicoreDataMovement) throws AppCatalogException {
+        try {
+            
unicoreDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("UNICORE"));
+            UnicoreDataMovementAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getUnicoreDMResource(unicoreDataMovement);
+            resource.save();
+            return resource.getDataMovementId();
+        }catch (Exception e){
+            logger.error("Error while saving UNICORE Data Movement...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public String addDataMovementProtocol(String computeResourceId, 
DataMovementInterface dataMovementInterface) throws AppCatalogException {
+        try {
+               DataMovementInterfaceAppCatalogResourceAppCat dmi = 
AppCatalogThriftConversion.getDataMovementInterface(dataMovementInterface);
+               dmi.setComputeResourceId(computeResourceId);
+               ComputeResourceAppCatalogResourceAppCat computeResourceResource 
= new ComputeResourceAppCatalogResourceAppCat();
+               
computeResourceResource=(ComputeResourceAppCatalogResourceAppCat)computeResourceResource.get(computeResourceId);
+               dmi.setComputeHostResource(computeResourceResource);
+               dmi.save();
+            return dmi.getDataMovementInterfaceId();
+        }catch (Exception e){
+            logger.error("Error while saving 
"+dataMovementInterface.getDataMovementProtocol().toString()+" data movement 
Protocol...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public String addGridFTPDataMovement(GridFTPDataMovement 
gridFTPDataMovement) throws AppCatalogException {
+        try {
+               
gridFTPDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("GRIDFTP"));
+               GridftpDataMovementAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getGridFTPDataMovementDescription(gridFTPDataMovement);
+            resource.save();
+            List<String> gridFTPEndPoint = 
gridFTPDataMovement.getGridFTPEndPoints();
+            if (gridFTPEndPoint != null && !gridFTPEndPoint.isEmpty()) {
+                for (String endpoint : gridFTPEndPoint) {
+                    GridftpEndpointAppCatalogResourceAppCat endpointResource = 
new GridftpEndpointAppCatalogResourceAppCat();
+                    
endpointResource.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
+                    endpointResource.setEndpoint(endpoint);
+                    endpointResource.setGridftpDataMovementResource(resource);
+                    endpointResource.save();
+                }
+            }
+            return resource.getDataMovementInterfaceId();
+        }catch (Exception e){
+            logger.error("Error while saving GridFTP Data Movement...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public ComputeResourceDescription getComputeResource(String resourceId) 
throws AppCatalogException {
+        try {
+            ComputeResourceAppCatalogResourceAppCat resource = new 
ComputeResourceAppCatalogResourceAppCat();
+            ComputeResourceAppCatalogResourceAppCat computeResource = 
(ComputeResourceAppCatalogResourceAppCat)resource.get(resourceId);
+            return 
AppCatalogThriftConversion.getComputeHostDescription(computeResource);
+        }catch (Exception e){
+            logger.error("Error while retrieving compute resource...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public List<ComputeResourceDescription> getComputeResourceList(Map<String, 
String> filters) throws AppCatalogException {
+        List<ComputeResourceDescription> computeResourceDescriptions = new 
ArrayList<ComputeResourceDescription>();
+        try {
+               //TODO check if this is correct way to do this
+            ComputeResourceAppCatalogResourceAppCat resource = new 
ComputeResourceAppCatalogResourceAppCat();
+            for (String fieldName : filters.keySet() ){
+                if 
(fieldName.equals(AppCatAbstractResource.ComputeResourceConstants.HOST_NAME)){
+                    List<AppCatalogResource> resources = 
resource.get(AppCatAbstractResource.ComputeResourceConstants.HOST_NAME, 
filters.get(fieldName));
+                    if (resources != null && !resources.isEmpty()){
+                        computeResourceDescriptions = 
AppCatalogThriftConversion.getComputeDescriptionList(resources);
+                    }
+                }else {
+                    logger.error("Unsupported field name for compute 
resource.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Unsupported field name 
for compute resource.");
+                }
+            }
+        }catch (Exception e){
+            logger.error("Error while retrieving compute resource list...", e);
+            throw new AppCatalogException(e);
+        }
+        return computeResourceDescriptions;
+    }
+
+    @Override
+    public List<ComputeResourceDescription> getAllComputeResourceList() throws 
AppCatalogException {
+        List<ComputeResourceDescription> computeResourceDescriptions = new 
ArrayList<ComputeResourceDescription>();
+        try {
+            ComputeResourceAppCatalogResourceAppCat resource = new 
ComputeResourceAppCatalogResourceAppCat();
+            List<AppCatalogResource> resources = resource.getAll();
+            if (resources != null && !resources.isEmpty()){
+                computeResourceDescriptions = 
AppCatalogThriftConversion.getComputeDescriptionList(resources);
+            }
+        }catch (Exception e){
+            logger.error("Error while retrieving compute resource list...", e);
+            throw new AppCatalogException(e);
+        }
+        return computeResourceDescriptions;
+    }
+
+    @Override
+    public Map<String, String> getAllComputeResourceIdList() throws 
AppCatalogException {
+        try {
+            Map<String, String> computeResourceMap = new HashMap<String, 
String>();
+            ComputeResourceAppCatalogResourceAppCat resource = new 
ComputeResourceAppCatalogResourceAppCat();
+            List<AppCatalogResource> allComputeResources = resource.getAll();
+            if (allComputeResources != null && !allComputeResources.isEmpty()){
+                for (AppCatalogResource cm : allComputeResources){
+                    ComputeResourceAppCatalogResourceAppCat cmr = 
(ComputeResourceAppCatalogResourceAppCat)cm;
+                    computeResourceMap.put(cmr.getResourceId(), 
cmr.getHostName());
+                }
+            }
+            return computeResourceMap;
+        }catch (Exception e){
+            logger.error("Error while retrieving compute resource list...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+//    @Override
+//    public GSISSHJobSubmission getGSISSHJobSubmission(String submissionId) 
throws AppCatalogException {
+//        try {
+//            GSISSHSubmissionResource resource = new 
GSISSHSubmissionResource();
+//            GSISSHSubmissionResource submissionResource = 
(GSISSHSubmissionResource)resource.get(submissionId);
+//            return 
AppCatalogThriftConversion.getGSISSHSubmissionDescription(submissionResource);
+//        }catch (Exception e){
+//            logger.error("Error while retrieving GSISSH Job Submission...", 
e);
+//            throw new AppCatalogException(e);
+//        }
+//    }
+//
+//    @Override
+//    public List<GSISSHJobSubmission> getGSISSHJobSubmissionList(Map<String, 
String> filters) throws AppCatalogException {
+//        try {
+//            GSISSHSubmissionResource resource = new 
GSISSHSubmissionResource();
+//            for (String fieldName : filters.keySet() ){
+//                if 
(fieldName.equals(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)){
+//                    List<Resource> resources = 
resource.get(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, 
filters.get(fieldName));
+//                    if (resources != null && !resources.isEmpty()){
+//                        return 
AppCatalogThriftConversion.getGSISSHSubmissionList(resources);
+//                    }
+//                }else {
+//                    logger.error("Unsupported field name for GSISSH 
Submission.", new IllegalArgumentException());
+//                    throw new IllegalArgumentException("Unsupported field 
name for GSISSH Submission.");
+//                }
+//            }
+//        }catch (Exception e){
+//            logger.error("Error while retrieving GSISSH Submission list...", 
e);
+//            throw new AppCatalogException(e);
+//        }
+//        return null;
+//    }
+//
+//    @Override
+//    public GlobusJobSubmission getGlobusJobSubmission(String submissionId) 
throws AppCatalogException {
+//        try {
+//             GlobusJobSubmissionResource globusJobSubmissionResource = new 
GlobusJobSubmissionResource();
+//             
globusJobSubmissionResource=(GlobusJobSubmissionResource)globusJobSubmissionResource.get(submissionId);
+//             AppCatalogThriftConversion.getglo
+//            GlobusJobSubmissionResource resource = 
globusJobSubmissionResource;
+//            GlobusJobSubmissionResource submissionResource = 
(GlobusJobSubmissionResource)resource.get(submissionId);
+//            return 
AppCatalogThriftConversion.getGlobusJobSubmissionDescription(submissionResource);
+//        }catch (Exception e){
+//            logger.error("Error while retrieving Globus Job Submission...", 
e);
+//            throw new AppCatalogException(e);
+//        }
+//    }
+//
+//    @Override
+//    public List<GlobusJobSubmission> getGlobusJobSubmissionList(Map<String, 
String> filters) throws AppCatalogException {
+//        try {
+//            GlobusJobSubmissionResource resource = new 
GlobusJobSubmissionResource();
+//            for (String fieldName : filters.keySet() ){
+//                if 
(fieldName.equals(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)){
+//                    List<Resource> resources = 
resource.get(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER,
 filters.get(fieldName));
+//                    if (resources != null && !resources.isEmpty()){
+//                        return 
AppCatalogThriftConversion.getGlobusSubmissionList(resources);
+//                    }
+//                }else if 
(fieldName.equals(AbstractResource.GlobusJobSubmissionConstants.SECURITY_PROTOCAL)){
+//                    List<Resource> resources = 
resource.get(AbstractResource.GlobusJobSubmissionConstants.SECURITY_PROTOCAL, 
filters.get(fieldName));
+//                    if (resources != null && !resources.isEmpty()){
+//                        return 
AppCatalogThriftConversion.getGlobusSubmissionList(resources);
+//                    }
+//                }else {
+//                    logger.error("Unsupported field name for Globus 
Submission.", new IllegalArgumentException());
+//                    throw new IllegalArgumentException("Unsupported field 
name for Globus Submission.");
+//                }
+//            }
+//        }catch (Exception e){
+//            logger.error("Error while retrieving Globus Submission list...", 
e);
+//            throw new AppCatalogException(e);
+//        }
+//        return null;
+//    }
+
+    @Override
+    public SSHJobSubmission getSSHJobSubmission(String submissionId) throws 
AppCatalogException {
+        try {
+            SshJobSubmissionAppCatalogResourceAppCat resource = new 
SshJobSubmissionAppCatalogResourceAppCat();
+            resource = 
(SshJobSubmissionAppCatalogResourceAppCat)resource.get(submissionId);
+            return 
AppCatalogThriftConversion.getSSHJobSubmissionDescription(resource);
+        }catch (Exception e){
+            logger.error("Error while retrieving SSH Job Submission...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    //    @Override
+       //    public List<GridFTPDataMovement> 
getGridFTPDataMovementList(Map<String, String> filters) throws 
AppCatalogException {
+       //        try {
+       //            GridftpDataMovementResource resource = new 
GridftpDataMovementResource();
+       //            for (String fieldName : filters.keySet() ){
+       //                if 
(fieldName.equals(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL)){
+       //                    List<Resource> resources = 
resource.get(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, 
filters.get(fieldName));
+       //                    if (resources != null && !resources.isEmpty()){
+       //                        return 
AppCatalogThriftConversion.getGridFTPDataMovementList(resources);
+       //                    }
+       //                }else {
+       //                    logger.error("Unsupported field name for GridFTP 
Data movement.", new IllegalArgumentException());
+       //                    throw new IllegalArgumentException("Unsupported 
field name for GridFTP Data movement.");
+       //                }
+       //            }
+       //        }catch (Exception e){
+       //            logger.error("Error while retrieving GridFTP Data 
movement list...", e);
+       //            throw new AppCatalogException(e);
+       //        }
+       //        return null;
+       //    }
+       
+           @Override
+               public UnicoreJobSubmission getUNICOREJobSubmission(String 
submissionId)
+                               throws AppCatalogException {
+               try {
+                   UnicoreJobSubmissionAppCatalogResourceAppCat resource = new 
UnicoreJobSubmissionAppCatalogResourceAppCat();
+                   resource = 
(UnicoreJobSubmissionAppCatalogResourceAppCat)resource.get(submissionId);
+                   return 
AppCatalogThriftConversion.getUnicoreJobSubmissionDescription(resource);
+               }catch (Exception e){
+                   logger.error("Error while retrieving UNICORE Job Submission 
model instance...", e);
+                   throw new AppCatalogException(e);
+               }
+               }
+
+    @Override
+    public UnicoreDataMovement getUNICOREDataMovement(String dataMovementId)
+            throws AppCatalogException {
+        try {
+            UnicoreDataMovementAppCatalogResourceAppCat resource = new 
UnicoreDataMovementAppCatalogResourceAppCat();
+            resource = 
(UnicoreDataMovementAppCatalogResourceAppCat)resource.get(dataMovementId);
+            return 
AppCatalogThriftConversion.getUnicoreDMDescription(resource);
+        }catch (Exception e){
+            logger.error("Error while retrieving UNICORE data movement...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+       @Override
+    public CloudJobSubmission getCloudJobSubmission(String submissionId) 
throws AppCatalogException {
+        try {
+            CloudSubmissionAppCatalogResourceAppCat resource = new 
CloudSubmissionAppCatalogResourceAppCat();
+            resource = 
(CloudSubmissionAppCatalogResourceAppCat)resource.get(submissionId);
+            return 
AppCatalogThriftConversion.getCloudJobSubmissionDescription(resource);
+        }catch (Exception e){
+            logger.error("Error while retrieving SSH Job Submission...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+//
+//    @Override
+//    public List<SSHJobSubmission> getSSHJobSubmissionList(Map<String, 
String> filters) throws AppCatalogException {
+//        try {
+//            SshJobSubmissionResource resource = new 
SshJobSubmissionResource();
+//            for (String fieldName : filters.keySet() ){
+//               if 
(fieldName.equals(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER)){
+//                    List<Resource> resources = 
resource.get(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER, 
filters.get(fieldName));
+//                    if (resources != null && !resources.isEmpty()){
+//                        return 
AppCatalogThriftConversion.getSSHSubmissionList(resources);
+//                    }
+//                }else {
+//                    logger.error("Unsupported field name for SSH 
Submission.", new IllegalArgumentException());
+//                    throw new IllegalArgumentException("Unsupported field 
name for SSH Submission.");
+//                }
+//            }
+//        }catch (Exception e){
+//            logger.error("Error while retrieving SSH Submission list...", e);
+//            throw new AppCatalogException(e);
+//        }
+//        return null;
+//    }
+
+    @Override
+    public SCPDataMovement getSCPDataMovement(String dataMoveId) throws 
AppCatalogException {
+        try {
+            ScpDataMovementAppCatalogResourceAppCat resource = new 
ScpDataMovementAppCatalogResourceAppCat();
+            ScpDataMovementAppCatalogResourceAppCat dataMovementResource = 
(ScpDataMovementAppCatalogResourceAppCat)resource.get(dataMoveId);
+            return 
AppCatalogThriftConversion.getSCPDataMovementDescription(dataMovementResource);
+        }catch (Exception e){
+            logger.error("Error while retrieving SCP Data Movement...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+//    @Override
+//    public List<SCPDataMovement> getSCPDataMovementList(Map<String, String> 
filters) throws AppCatalogException {
+//        try {
+//            ScpDataMovementResource resource = new ScpDataMovementResource();
+//            for (String fieldName : filters.keySet() ){
+//                if 
(fieldName.equals(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL)){
+//                    List<Resource> resources = 
resource.get(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL, 
filters.get(fieldName));
+//                    if (resources != null && !resources.isEmpty()){
+//                        return 
AppCatalogThriftConversion.getSCPDataMovementList(resources);
+//                    }
+//                }else {
+//                    logger.error("Unsupported field name for SCP Data 
movement.", new IllegalArgumentException());
+//                    throw new IllegalArgumentException("Unsupported field 
name for SCP Data movement.");
+//                }
+//            }
+//        }catch (Exception e){
+//            logger.error("Error while retrieving SCP Data movement list...", 
e);
+//            throw new AppCatalogException(e);
+//        }
+//        return null;
+//    }
+
+    @Override
+    public GridFTPDataMovement getGridFTPDataMovement(String dataMoveId) 
throws AppCatalogException {
+        try {
+            GridftpDataMovementAppCatalogResourceAppCat resource = new 
GridftpDataMovementAppCatalogResourceAppCat();
+            GridftpDataMovementAppCatalogResourceAppCat dataMovementResource = 
(GridftpDataMovementAppCatalogResourceAppCat)resource.get(dataMoveId);
+            return 
AppCatalogThriftConversion.getGridFTPDataMovementDescription(dataMovementResource);
+        }catch (Exception e){
+            logger.error("Error while retrieving Grid FTP Data Movement...", 
e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+//    @Override
+//    public List<GridFTPDataMovement> getGridFTPDataMovementList(Map<String, 
String> filters) throws AppCatalogException {
+//        try {
+//            GridftpDataMovementResource resource = new 
GridftpDataMovementResource();
+//            for (String fieldName : filters.keySet() ){
+//                if 
(fieldName.equals(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL)){
+//                    List<Resource> resources = 
resource.get(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, 
filters.get(fieldName));
+//                    if (resources != null && !resources.isEmpty()){
+//                        return 
AppCatalogThriftConversion.getGridFTPDataMovementList(resources);
+//                    }
+//                }else {
+//                    logger.error("Unsupported field name for GridFTP Data 
movement.", new IllegalArgumentException());
+//                    throw new IllegalArgumentException("Unsupported field 
name for GridFTP Data movement.");
+//                }
+//            }
+//        }catch (Exception e){
+//            logger.error("Error while retrieving GridFTP Data movement 
list...", e);
+//            throw new AppCatalogException(e);
+//        }
+//        return null;
+//    }
+
+    @Override
+    public boolean isComputeResourceExists(String resourceId) throws 
AppCatalogException {
+        try {
+            ComputeResourceAppCatalogResourceAppCat resource = new 
ComputeResourceAppCatalogResourceAppCat();
+            return resource.isExists(resourceId);
+        }catch (Exception e){
+            logger.error("Error while retrieving compute resource...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void removeComputeResource(String resourceId) throws 
AppCatalogException {
+        try {
+            ComputeResourceAppCatalogResourceAppCat resource = new 
ComputeResourceAppCatalogResourceAppCat();
+            resource.remove(resourceId);
+        }catch (Exception e){
+            logger.error("Error while removing compute resource...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void removeJobSubmissionInterface(String computeResourceId, String 
jobSubmissionInterfaceId) throws AppCatalogException {
+        try {
+            JobSubmissionInterfaceAppCatalogResourceAppCat resource = new 
JobSubmissionInterfaceAppCatalogResourceAppCat();
+            Map<String, String> ids = new HashMap<String, String>();
+            
ids.put(AppCatAbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID,
 computeResourceId);
+            
ids.put(AppCatAbstractResource.JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID,
 jobSubmissionInterfaceId);
+            resource.remove(ids);
+        }catch (Exception e){
+            logger.error("Error while removing job submission interface..", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void removeDataMovementInterface(String computeResourceId, String 
dataMovementInterfaceId) throws AppCatalogException {
+        try {
+            DataMovementInterfaceAppCatalogResourceAppCat resource = new 
DataMovementInterfaceAppCatalogResourceAppCat();
+            Map<String, String> ids = new HashMap<String, String>();
+            
ids.put(AppCatAbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID,
 computeResourceId);
+            
ids.put(AppCatAbstractResource.DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID,
 dataMovementInterfaceId);
+            resource.remove(ids);
+        }catch (Exception e){
+            logger.error("Error while removing data movement interface..", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void removeBatchQueue(String computeResourceId, String queueName) 
throws AppCatalogException {
+        try {
+            BatchQueueAppCatalogResourceAppCat resource = new 
BatchQueueAppCatalogResourceAppCat();
+            Map<String, String> ids = new HashMap<String, String>();
+            
ids.put(AppCatAbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, 
computeResourceId);
+            ids.put(AppCatAbstractResource.BatchQueueConstants.QUEUE_NAME, 
queueName);
+            resource.remove(ids);
+        }catch (Exception e){
+            logger.error("Error while removing batch queue..", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+       public String addResourceJobManager(ResourceJobManager 
resourceJobManager)
+                       throws AppCatalogException {
+               
resourceJobManager.setResourceJobManagerId(AppCatalogUtils.getID("RJM"));
+               ResourceJobManagerAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getResourceJobManager(resourceJobManager);
+               resource.save();
+               Map<JobManagerCommand, String> jobManagerCommands = 
resourceJobManager.getJobManagerCommands();
+               if (jobManagerCommands!=null && jobManagerCommands.size() != 0) 
{
+                       for (JobManagerCommand commandType : 
jobManagerCommands.keySet()) {
+                               JobManagerCommandAppCatalogResourceAppCat r = 
new JobManagerCommandAppCatalogResourceAppCat();
+                               r.setCommandType(commandType.toString());
+                               
r.setCommand(jobManagerCommands.get(commandType));
+                               
r.setResourceJobManagerId(resource.getResourceJobManagerId());
+                               r.save();
+                       }
+               }
+               return resource.getResourceJobManagerId();
+       }
+
+    @Override
+    public void updateResourceJobManager(String resourceJobManagerId, 
ResourceJobManager updatedResourceJobManager) throws AppCatalogException {
+        try {
+            ResourceJobManagerAppCatalogResourceAppCat resource = 
AppCatalogThriftConversion.getResourceJobManager(updatedResourceJobManager);
+            resource.setResourceJobManagerId(resourceJobManagerId);
+            resource.save();
+            Map<JobManagerCommand, String> jobManagerCommands = 
updatedResourceJobManager.getJobManagerCommands();
+            if (jobManagerCommands!=null && jobManagerCommands.size() != 0) {
+                for (JobManagerCommand commandType : 
jobManagerCommands.keySet()) {
+                    JobManagerCommandAppCatalogResourceAppCat r = new 
JobManagerCommandAppCatalogResourceAppCat();
+                    Map<String, String> ids = new HashMap<String, String>();
+                    
ids.put(AppCatAbstractResource.JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID,
 resourceJobManagerId);
+                    
ids.put(AppCatAbstractResource.JobManagerCommandConstants.COMMAND_TYPE, 
commandType.toString());
+                    JobManagerCommandAppCatalogResourceAppCat existingCommand;
+                    if (r.isExists(ids)){
+                        existingCommand = 
(JobManagerCommandAppCatalogResourceAppCat)r.get(ids);
+                    }else {
+                        existingCommand = new 
JobManagerCommandAppCatalogResourceAppCat();
+                    }
+                    existingCommand.setCommandType(commandType.toString());
+                    
existingCommand.setCommand(jobManagerCommands.get(commandType));
+                    
existingCommand.setResourceJobManagerId(resource.getResourceJobManagerId());
+                    existingCommand.save();
+                }
+            }
+        }catch (Exception e){
+            logger.error("Error while updating resource job manager..", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public ResourceJobManager getResourceJobManager(String 
resourceJobManagerId) throws AppCatalogException {
+        try {
+            ResourceJobManagerAppCatalogResourceAppCat resource = new 
ResourceJobManagerAppCatalogResourceAppCat();
+            ResourceJobManagerAppCatalogResourceAppCat jobManagerResource = 
(ResourceJobManagerAppCatalogResourceAppCat)resource.get(resourceJobManagerId);
+            return 
AppCatalogThriftConversion.getResourceJobManager(jobManagerResource);
+        }catch (Exception e){
+            logger.error("Error while retrieving resource job manager..", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void deleteResourceJobManager(String resourceJobManagerId) throws 
AppCatalogException {
+        try {
+            ResourceJobManagerAppCatalogResourceAppCat resource = new 
ResourceJobManagerAppCatalogResourceAppCat();
+            resource.remove(resourceJobManagerId);
+        }catch (Exception e){
+            logger.error("Error while deleting resource job manager..", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+       public String addLocalJobSubmission(LOCALSubmission localSubmission)
+                       throws AppCatalogException {
+               
localSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("LOCAL"));
+               String resourceJobManagerId = 
addResourceJobManager(localSubmission.getResourceJobManager());
+               LocalSubmissionAppCatalogResourceAppCat localJobSubmission = 
AppCatalogThriftConversion.getLocalJobSubmission(localSubmission);
+               
localJobSubmission.setResourceJobManagerId(resourceJobManagerId);
+               
localJobSubmission.getResourceJobManagerResource().setResourceJobManagerId(resourceJobManagerId);
+       localJobSubmission.save();
+       return localJobSubmission.getJobSubmissionInterfaceId();
+       }
+
+       @Override
+       public String addLocalDataMovement(LOCALDataMovement localDataMovement)
+                       throws AppCatalogException {
+               
localDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("LOCAL"));
+               LocalDataMovementAppCatalogResourceAppCat ldm = 
AppCatalogThriftConversion.getLocalDataMovement(localDataMovement);
+               ldm.save();
+       return ldm.getDataMovementInterfaceId();
+       }
+
+       @Override
+       public LOCALSubmission getLocalJobSubmission(String submissionId)
+                       throws AppCatalogException {
+               LocalSubmissionAppCatalogResourceAppCat localSubmissionResource 
= new LocalSubmissionAppCatalogResourceAppCat();
+               localSubmissionResource= 
(LocalSubmissionAppCatalogResourceAppCat)localSubmissionResource.get(submissionId);
+               return 
AppCatalogThriftConversion.getLocalJobSubmission(localSubmissionResource);
+       }
+
+       @Override
+       public LOCALDataMovement getLocalDataMovement(String datamovementId)
+                       throws AppCatalogException {
+               LocalDataMovementAppCatalogResourceAppCat 
localDataMovementResource = new LocalDataMovementAppCatalogResourceAppCat();
+               localDataMovementResource = 
(LocalDataMovementAppCatalogResourceAppCat) 
localDataMovementResource.get(datamovementId);
+               return 
AppCatalogThriftConversion.getLocalDataMovement(localDataMovementResource);
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
new file mode 100644
index 0000000..05cbcdc
--- /dev/null
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
@@ -0,0 +1,252 @@
+/*
+ *
+ * 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.registry.core.app.catalog.impl;
+
+import 
org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import 
org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import 
org.apache.airavata.model.appcatalog.gatewayprofile.gatewayResourceProfileModelConstants;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import 
org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.GwyResourceProfile;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GwyResourceProfileImpl implements GwyResourceProfile {
+    private final static Logger logger = 
LoggerFactory.getLogger(GwyResourceProfileImpl.class);
+
+    @Override
+    public String 
addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile
 gatewayProfile) throws AppCatalogException {
+        try {
+            GatewayProfileAppCatalogResourceAppCat profileResource = new 
GatewayProfileAppCatalogResourceAppCat();
+            if (!gatewayProfile.getGatewayID().equals("") && 
!gatewayProfile.getGatewayID().equals(gatewayResourceProfileModelConstants.DEFAULT_ID)){
+                profileResource.setGatewayID(gatewayProfile.getGatewayID());
+            }
+//            profileResource.setGatewayID(gatewayProfile.getGatewayID());
+            profileResource.save();
+            List<ComputeResourcePreference> computeResourcePreferences = 
gatewayProfile.getComputeResourcePreferences();
+            if (computeResourcePreferences != null && 
!computeResourcePreferences.isEmpty()){
+                for (ComputeResourcePreference preference : 
computeResourcePreferences ){
+                    ComputeHostPreferenceAppCatalogResourceAppCat resource = 
new ComputeHostPreferenceAppCatalogResourceAppCat();
+                    resource.setGatewayProfile(profileResource);
+                    resource.setResourceId(preference.getComputeResourceId());
+                    ComputeResourceAppCatalogResourceAppCat 
computeHostResource = new ComputeResourceAppCatalogResourceAppCat();
+                    
resource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)computeHostResource.get(preference.getComputeResourceId()));
+                    resource.setGatewayId(profileResource.getGatewayID());
+                    
resource.setOverrideByAiravata(preference.isOverridebyAiravata());
+                    resource.setLoginUserName(preference.getLoginUserName());
+                    if (preference.getPreferredJobSubmissionProtocol() != 
null){
+                        
resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString());
+                    }
+
+                    if (preference.getPreferredDataMovementProtocol() != null){
+                        
resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol().toString());
+                    }
+
+                    
resource.setBatchQueue(preference.getPreferredBatchQueue());
+                    
resource.setProjectNumber(preference.getAllocationProjectNumber());
+                    
resource.setScratchLocation(preference.getScratchLocation());
+                    resource.save();
+                }
+            }
+            return profileResource.getGatewayID();
+        }catch (Exception e) {
+            logger.error("Error while saving gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void updateGatewayResourceProfile(String gatewayId, 
org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile 
updatedProfile) throws AppCatalogException {
+        try {
+            GatewayProfileAppCatalogResourceAppCat profileResource = new 
GatewayProfileAppCatalogResourceAppCat();
+            GatewayProfileAppCatalogResourceAppCat existingGP = 
(GatewayProfileAppCatalogResourceAppCat)profileResource.get(gatewayId);
+            existingGP.save();
+
+            List<ComputeResourcePreference> computeResourcePreferences = 
updatedProfile.getComputeResourcePreferences();
+            if (computeResourcePreferences != null && 
!computeResourcePreferences.isEmpty()){
+                for (ComputeResourcePreference preference : 
computeResourcePreferences ){
+                    ComputeHostPreferenceAppCatalogResourceAppCat resource = 
new ComputeHostPreferenceAppCatalogResourceAppCat();
+                    resource.setGatewayProfile(existingGP);
+                    resource.setResourceId(preference.getComputeResourceId());
+                    ComputeResourceAppCatalogResourceAppCat 
computeHostResource = new ComputeResourceAppCatalogResourceAppCat();
+                    
resource.setComputeHostResource((ComputeResourceAppCatalogResourceAppCat)computeHostResource.get(preference.getComputeResourceId()));
+                    resource.setGatewayId(gatewayId);
+                    resource.setLoginUserName(preference.getLoginUserName());
+                    
resource.setOverrideByAiravata(preference.isOverridebyAiravata());
+                    if (preference.getPreferredJobSubmissionProtocol() != 
null){
+                        
resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString());
+                    }
+
+                    if (preference.getPreferredDataMovementProtocol() != null){
+                        
resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol().toString());
+                    }
+                    
resource.setBatchQueue(preference.getPreferredBatchQueue());
+                    
resource.setProjectNumber(preference.getAllocationProjectNumber());
+                    
resource.setScratchLocation(preference.getScratchLocation());
+                    resource.save();
+                }
+            }
+        }catch (Exception e) {
+            logger.error("Error while updating gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public GatewayResourceProfile getGatewayProfile(String gatewayId) throws 
AppCatalogException {
+        try {
+            GatewayProfileAppCatalogResourceAppCat resource = new 
GatewayProfileAppCatalogResourceAppCat();
+            GatewayProfileAppCatalogResourceAppCat gwresource = 
(GatewayProfileAppCatalogResourceAppCat)resource.get(gatewayId);
+            ComputeHostPreferenceAppCatalogResourceAppCat prefResource = new 
ComputeHostPreferenceAppCatalogResourceAppCat();
+            List<AppCatalogResource> computePrefList = 
prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID,
 gatewayId);
+            List<ComputeResourcePreference> computeResourcePreferences = 
AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
+            return 
AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, 
computeResourcePreferences);
+        }catch (Exception e) {
+            logger.error("Error while retrieving gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public boolean removeGatewayResourceProfile(String gatewayId) throws 
AppCatalogException {
+       try {
+           GatewayProfileAppCatalogResourceAppCat resource = new 
GatewayProfileAppCatalogResourceAppCat();
+           resource.remove(gatewayId);
+           return true;
+       }catch (Exception e) {
+           logger.error("Error while deleting gateway profile...", e);
+           throw new AppCatalogException(e);
+       }
+    }
+
+    @Override
+    public boolean removeComputeResourcePreferenceFromGateway(String 
gatewayId, String preferenceId) throws AppCatalogException {
+        try {
+            ComputeHostPreferenceAppCatalogResourceAppCat resource = new 
ComputeHostPreferenceAppCatalogResourceAppCat();
+            Map<String, String> ids = new HashMap<String, String>();
+            
ids.put(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, 
gatewayId);
+            
ids.put(AppCatAbstractResource.ComputeResourcePreferenceConstants.RESOURCE_ID, 
preferenceId);
+            resource.remove(ids);
+            return true;
+        }catch (Exception e) {
+            logger.error("Error while deleting gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public boolean isGatewayResourceProfileExists(String gatewayId) throws 
AppCatalogException {
+        try {
+            GatewayProfileAppCatalogResourceAppCat resource = new 
GatewayProfileAppCatalogResourceAppCat();
+            return resource.isExists(gatewayId);
+        }catch (Exception e) {
+            logger.error("Error while retrieving gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    /**
+     * @param gatewayId
+     * @param hostId
+     * @return ComputeResourcePreference
+     */
+    @Override
+    public ComputeResourcePreference getComputeResourcePreference(String 
gatewayId, String hostId) throws AppCatalogException {
+        try {
+            ComputeHostPreferenceAppCatalogResourceAppCat prefResource = new 
ComputeHostPreferenceAppCatalogResourceAppCat();
+            List<AppCatalogResource> computePrefList = 
prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID,
 gatewayId);
+            for (AppCatalogResource resource : computePrefList){
+                ComputeHostPreferenceAppCatalogResourceAppCat cmP = 
(ComputeHostPreferenceAppCatalogResourceAppCat) resource;
+                if (cmP.getResourceId() != null && 
!cmP.getResourceId().equals("")){
+                    if (cmP.getResourceId().equals(hostId)){
+                        return 
AppCatalogThriftConversion.getComputeResourcePreference(cmP);
+                    }
+                }
+            }
+        }catch (Exception e) {
+            logger.error("Error while retrieving compute resource 
preference...", e);
+            throw new AppCatalogException(e);
+        }
+        return null;
+    }
+
+    /**
+     * @param gatewayId
+     * @return
+     */
+    @Override
+    public List<ComputeResourcePreference> 
getAllComputeResourcePreferences(String gatewayId) throws AppCatalogException {
+        try {
+            ComputeHostPreferenceAppCatalogResourceAppCat prefResource = new 
ComputeHostPreferenceAppCatalogResourceAppCat();
+            List<AppCatalogResource> computePrefList = 
prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID,
 gatewayId);
+            return 
AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
+        }catch (Exception e) {
+            logger.error("Error while retrieving compute resource 
preference...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public List<String> getGatewayProfileIds(String gatewayName) throws 
AppCatalogException {
+        try {
+            GatewayProfileAppCatalogResourceAppCat profileResource = new 
GatewayProfileAppCatalogResourceAppCat();
+            List<AppCatalogResource> resourceList = 
profileResource.get(AppCatAbstractResource.GatewayProfileConstants.GATEWAY_ID, 
gatewayName);
+            List<String> gatewayIds = new ArrayList<String>();
+            if (resourceList != null && !resourceList.isEmpty()){
+                for (AppCatalogResource resource : resourceList){
+                    
gatewayIds.add(((GatewayProfileAppCatalogResourceAppCat)resource).getGatewayID());
+                }
+            }
+            return gatewayIds;
+        }catch (Exception e) {
+            logger.error("Error while retrieving gateway ids...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public List<GatewayResourceProfile> getAllGatewayProfiles() throws 
AppCatalogException {
+        try {
+            List<GatewayResourceProfile> gatewayResourceProfileList = new 
ArrayList<GatewayResourceProfile>();
+            GatewayProfileAppCatalogResourceAppCat profileResource = new 
GatewayProfileAppCatalogResourceAppCat();
+            List<AppCatalogResource> resourceList = profileResource.getAll();
+            if (resourceList != null && !resourceList.isEmpty()){
+                for (AppCatalogResource resource : resourceList){
+                    GatewayProfileAppCatalogResourceAppCat 
gatewayProfileResource = (GatewayProfileAppCatalogResourceAppCat)resource;
+                    List<ComputeResourcePreference> computeResourcePreferences 
= getAllComputeResourcePreferences(gatewayProfileResource.getGatewayID());
+                    GatewayResourceProfile gatewayResourceProfile = 
AppCatalogThriftConversion.getGatewayResourceProfile(gatewayProfileResource, 
computeResourcePreferences);
+                    gatewayResourceProfileList.add(gatewayResourceProfile);
+                }
+            }
+            return gatewayResourceProfileList;
+        }catch (Exception e) {
+            logger.error("Error while retrieving gateway ids...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java
new file mode 100644
index 0000000..3a400cc
--- /dev/null
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/WorkflowCatalogImpl.java
@@ -0,0 +1,232 @@
+/*
+ *
+ * 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.registry.core.app.catalog.impl;
+
+import org.apache.airavata.model.Workflow;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import 
org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConversion;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogUtils;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.WorkflowCatalog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class WorkflowCatalogImpl implements WorkflowCatalog {
+    private final static Logger logger = 
LoggerFactory.getLogger(WorkflowCatalogImpl.class);
+
+    @Override
+    public List<String> getAllWorkflows(String gatewayId) throws 
AppCatalogException {
+        List<String> workflowIds = new ArrayList<String>();
+        try {
+            WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+            resource.setGatewayId(gatewayId);
+            workflowIds = resource.getAllIds();
+        } catch (Exception e) {
+            logger.error("Error while retrieving all the workflow template 
ids...", e);
+            throw new AppCatalogException(e);
+        }
+        return workflowIds;
+    }
+
+    @Override
+    public Workflow getWorkflow(String workflowTemplateId) throws 
AppCatalogException {
+        try {
+            WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+            WorkflowAppCatalogResourceAppCat wfResource = 
(WorkflowAppCatalogResourceAppCat)resource.get(workflowTemplateId);
+            return AppCatalogThriftConversion.getWorkflow(wfResource);
+        } catch (Exception e) {
+            logger.error("Error while retrieving the workflow...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void deleteWorkflow(String workflowTemplateId) throws 
AppCatalogException {
+        try {
+            WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+            resource.remove(workflowTemplateId);
+        } catch (Exception e) {
+            logger.error("Error while deleting the workflow...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public String registerWorkflow(Workflow workflow, String gatewayId) throws 
AppCatalogException {
+        try {
+            WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+            
resource.setWfTemplateId(AppCatalogUtils.getID(workflow.getName()));
+            resource.setWfName(workflow.getName());
+            resource.setGraph(workflow.getGraph());
+            resource.setGatewayId(gatewayId);
+            if (workflow.getImage() != null){
+                resource.setImage(new String(workflow.getImage()));
+            }
+            resource.save();
+            workflow.setTemplateId(resource.getWfTemplateId());
+            List<InputDataObjectType> workflowInputs = 
workflow.getWorkflowInputs();
+            if (workflowInputs != null && workflowInputs.size() != 0){
+                for (InputDataObjectType input : workflowInputs){
+                    WorkflowInputAppCatalogResourceAppCat wfInputResource = 
new WorkflowInputAppCatalogResourceAppCat();
+                    wfInputResource.setWorkflowResource(resource);
+                    wfInputResource.setInputKey(input.getName());
+                    wfInputResource.setInputVal(input.getValue());
+                    
wfInputResource.setWfTemplateId(resource.getWfTemplateId());
+                    wfInputResource.setDataType(input.getType().toString());
+                    
wfInputResource.setAppArgument(input.getApplicationArgument());
+                    wfInputResource.setStandardInput(input.isStandardInput());
+                    
wfInputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
+                    wfInputResource.setMetadata(input.getMetaData());
+                    wfInputResource.save();
+                }
+            }
+            List<OutputDataObjectType> workflowOutputs = 
workflow.getWorkflowOutputs();
+            if (workflowOutputs != null && workflowOutputs.size() != 0){
+                for (OutputDataObjectType output : workflowOutputs){
+                    WorkflowOutputAppCatalogResourceAppCat outputResource = 
new WorkflowOutputAppCatalogResourceAppCat();
+                    outputResource.setWorkflowResource(resource);
+                    outputResource.setOutputKey(output.getName());
+                    outputResource.setOutputVal(output.getValue());
+                    outputResource.setWfTemplateId(resource.getWfTemplateId());
+                    outputResource.setDataType(output.getType().toString());
+                    outputResource.save();
+                }
+            }
+            return resource.getWfTemplateId();
+        } catch (Exception e) {
+            logger.error("Error while saving the workflow...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void updateWorkflow(String workflowTemplateId, Workflow workflow) 
throws AppCatalogException {
+        try {
+            WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+            WorkflowAppCatalogResourceAppCat existingWF = 
(WorkflowAppCatalogResourceAppCat)resource.get(workflowTemplateId);
+            existingWF.setWfName(workflow.getName());
+            existingWF.setGraph(workflow.getGraph());
+            if (workflow.getImage() != null){
+                existingWF.setImage(new String(workflow.getImage()));
+            }
+            existingWF.save();
+            List<InputDataObjectType> existingwFInputs = 
workflow.getWorkflowInputs();
+            if (existingwFInputs != null && existingwFInputs.size() != 0){
+                for (InputDataObjectType input : existingwFInputs){
+                    WorkflowInputAppCatalogResourceAppCat wfInputResource = 
new WorkflowInputAppCatalogResourceAppCat();
+                    Map<String, String> ids = new HashMap<String, String>();
+                    
ids.put(AppCatAbstractResource.WFInputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
+                    
ids.put(AppCatAbstractResource.WFInputConstants.INPUT_KEY,input.getName());
+                    WorkflowInputAppCatalogResourceAppCat existingInput = 
(WorkflowInputAppCatalogResourceAppCat)wfInputResource.get(ids);
+                    existingInput.setWorkflowResource(existingWF);
+                    existingInput.setInputKey(input.getName());
+                    existingInput.setInputVal(input.getValue());
+                    
existingInput.setWfTemplateId(existingWF.getWfTemplateId());
+                    existingInput.setDataType(input.getType().toString());
+                    
existingInput.setAppArgument(input.getApplicationArgument());
+                    existingInput.setStandardInput(input.isStandardInput());
+                    
existingInput.setUserFriendlyDesc(input.getUserFriendlyDescription());
+                    existingInput.setMetadata(input.getMetaData());
+                    existingInput.save();
+                }
+            }
+            List<OutputDataObjectType> workflowOutputs = 
workflow.getWorkflowOutputs();
+            if (workflowOutputs != null && workflowOutputs.size() != 0){
+                for (OutputDataObjectType output : workflowOutputs){
+                    WorkflowOutputAppCatalogResourceAppCat outputResource = 
new WorkflowOutputAppCatalogResourceAppCat();
+                    Map<String, String> ids = new HashMap<String, String>();
+                    
ids.put(AppCatAbstractResource.WFOutputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
+                    
ids.put(AppCatAbstractResource.WFOutputConstants.OUTPUT_KEY,output.getName());
+                    WorkflowOutputAppCatalogResourceAppCat existingOutput = 
(WorkflowOutputAppCatalogResourceAppCat)outputResource.get(ids);
+                    existingOutput.setWorkflowResource(existingWF);
+                    existingOutput.setOutputKey(output.getName());
+                    existingOutput.setOutputVal(output.getValue());
+                    
existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
+                    existingOutput.setDataType(output.getType().toString());
+                    existingOutput.save();
+                }
+            }
+        } catch (Exception e) {
+            logger.error("Error while updating the workflow...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public String getWorkflowTemplateId(String workflowName) throws 
AppCatalogException {
+        try {
+            WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+            List<AppCatalogResource> resourceList = 
resource.get(AppCatAbstractResource.WorkflowConstants.WF_NAME, workflowName);
+            if (resourceList != null && !resourceList.isEmpty()){
+                WorkflowAppCatalogResourceAppCat wfResource = 
(WorkflowAppCatalogResourceAppCat)resourceList.get(0);
+                return wfResource.getWfTemplateId();
+            }
+        } catch (Exception e) {
+            logger.error("Error while retrieving the workflow with the 
workflow name...", e);
+            throw new AppCatalogException(e);
+        }
+        return null;
+    }
+
+    @Override
+    public boolean isWorkflowExistWithName(String workflowName) throws 
AppCatalogException {
+        try {
+            WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+            List<AppCatalogResource> resourceList = 
resource.get(AppCatAbstractResource.WorkflowConstants.WF_NAME, workflowName);
+            if (resourceList != null && !resourceList.isEmpty()){
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("Error while retrieving the workflow with the 
workflow name...", e);
+            throw new AppCatalogException(e);
+        }
+        return false;
+    }
+
+    @Override
+    public void updateWorkflowOutputs(String workflowTemplateId, 
List<OutputDataObjectType> workflowOutputs) throws AppCatalogException {
+        WorkflowAppCatalogResourceAppCat resource = new 
WorkflowAppCatalogResourceAppCat();
+        WorkflowAppCatalogResourceAppCat existingWF = 
(WorkflowAppCatalogResourceAppCat)resource.get(workflowTemplateId);
+        if (workflowOutputs != null && workflowOutputs.size() != 0) {
+            for (OutputDataObjectType output : workflowOutputs) {
+                WorkflowOutputAppCatalogResourceAppCat outputResource = new 
WorkflowOutputAppCatalogResourceAppCat();
+                Map<String, String> ids = new HashMap<String, String>();
+                
ids.put(AppCatAbstractResource.WFOutputConstants.WF_TEMPLATE_ID, 
existingWF.getWfTemplateId());
+                ids.put(AppCatAbstractResource.WFOutputConstants.OUTPUT_KEY, 
output.getName());
+                WorkflowOutputAppCatalogResourceAppCat existingOutput = 
(WorkflowOutputAppCatalogResourceAppCat) outputResource.get(ids);
+                existingOutput.setWorkflowResource(existingWF);
+                existingOutput.setOutputKey(output.getName());
+                existingOutput.setOutputVal(output.getValue());
+                existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
+                existingOutput.setDataType(output.getType().toString());
+                existingOutput.save();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java
new file mode 100644
index 0000000..3d5a842
--- /dev/null
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.registry.core.app.catalog.model;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "APP_ENVIRONMENT")
+@IdClass(AppEnvironment_PK.class)
+public class AppEnvironment implements Serializable {
+    @Id
+    @Column(name = "DEPLOYMENT_ID")
+    private String deploymentID;
+    @Id
+    @Column(name = "NAME")
+    private String name;
+
+    @Column(name = "VALUE")
+    private String value;
+
+    @ManyToOne(cascade= CascadeType.MERGE)
+    @JoinColumn(name = "DEPLOYMENT_ID")
+    private ApplicationDeployment applicationDeployment;
+
+    public String getDeploymentID() {
+        return deploymentID;
+    }
+
+    public void setDeploymentID(String deploymentID) {
+        this.deploymentID = deploymentID;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public ApplicationDeployment getApplicationDeployment() {
+        return applicationDeployment;
+    }
+
+    public void setApplicationDeployment(ApplicationDeployment 
applicationDeployment) {
+        this.applicationDeployment = applicationDeployment;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.java
new file mode 100644
index 0000000..3859ebd
--- /dev/null
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppEnvironment_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.registry.core.app.catalog.model;
+
+import java.io.Serializable;
+
+public class AppEnvironment_PK implements Serializable {
+    private String deploymentID;
+    private String name;
+
+    public AppEnvironment_PK(String deploymentID, String name) {
+        this.deploymentID = deploymentID;
+        this.name = name;
+    }
+
+    public AppEnvironment_PK() {
+        ;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return 1;
+    }
+
+    public String getDeploymentID() {
+        return deploymentID;
+    }
+
+    public void setDeploymentID(String deploymentID) {
+        this.deploymentID = deploymentID;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.java
new file mode 100644
index 0000000..fe9254c
--- /dev/null
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppInput_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.registry.core.app.catalog.model;
+
+import java.io.Serializable;
+
+public class AppInput_PK implements Serializable {
+    private String interfaceID;
+    private String inputKey;
+
+    public AppInput_PK(String interfaceID, String inputKey) {
+        this.interfaceID = interfaceID;
+        this.inputKey = inputKey;
+    }
+
+    public AppInput_PK() {
+        ;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return 1;
+    }
+
+    public String getInterfaceID() {
+        return interfaceID;
+    }
+
+    public void setInterfaceID(String interfaceID) {
+        this.interfaceID = interfaceID;
+    }
+
+    public String getInputKey() {
+        return inputKey;
+    }
+
+    public void setInputKey(String inputKey) {
+        this.inputKey = inputKey;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java
 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java
new file mode 100644
index 0000000..6c17af6
--- /dev/null
+++ 
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/AppModuleMapping.java
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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.registry.core.app.catalog.model;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "APP_MODULE_MAPPING")
+@IdClass(AppModuleMapping_PK.class)
+public class AppModuleMapping implements Serializable {
+    @Id
+    @Column(name = "INTERFACE_ID")
+    private String interfaceID;
+    @Id
+    @Column(name = "MODULE_ID")
+    private String moduleID;
+
+    @ManyToOne(cascade= CascadeType.MERGE)
+    @JoinColumn(name = "INTERFACE_ID")
+    private ApplicationInterface applicationInterface;
+
+    @ManyToOne(cascade= CascadeType.MERGE)
+    @JoinColumn(name = "MODULE_ID")
+    private ApplicationModule applicationModule;
+
+    public String getInterfaceID() {
+        return interfaceID;
+    }
+
+    public void setInterfaceID(String interfaceID) {
+        this.interfaceID = interfaceID;
+    }
+
+    public String getModuleID() {
+        return moduleID;
+    }
+
+    public void setModuleID(String moduleID) {
+        this.moduleID = moduleID;
+    }
+
+    public ApplicationInterface getApplicationInterface() {
+        return applicationInterface;
+    }
+
+    public void setApplicationInterface(ApplicationInterface 
applicationInterface) {
+        this.applicationInterface = applicationInterface;
+    }
+
+    public ApplicationModule getApplicationModule() {
+        return applicationModule;
+    }
+
+    public void setApplicationModule(ApplicationModule applicationModule) {
+        this.applicationModule = applicationModule;
+    }
+}

Reply via email to