airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [02/52] [abbrv] [partial] airavata git commit: registry refactoring
Date Thu, 04 Jun 2015 20:36:48 GMT
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/util/AppCatalogThriftConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
new file mode 100644
index 0000000..cc0abc8
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
@@ -0,0 +1,800 @@
+/*
+ *
+ * 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.util;
+
+import org.apache.airavata.model.Workflow;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
+import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
+import org.apache.airavata.model.appcatalog.appinterface.*;
+import org.apache.airavata.model.appcatalog.computeresource.*;
+import org.apache.airavata.model.appcatalog.computeresource.BatchQueue;
+import org.apache.airavata.model.appcatalog.computeresource.CloudJobSubmission;
+import org.apache.airavata.model.appcatalog.computeresource.DataMovementInterface;
+import org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand;
+import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface;
+import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager;
+import org.apache.airavata.model.appcatalog.computeresource.UnicoreDataMovement;
+import org.apache.airavata.model.appcatalog.computeresource.UnicoreJobSubmission;
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.registry.core.app.catalog.resources.*;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+
+import java.util.*;
+
+public class AppCatalogThriftConversion {
+    public static ComputeResourceAppCatalogResourceAppCat getComputeHostResource (ComputeResourceDescription description){
+        ComputeResourceAppCatalogResourceAppCat resource = new ComputeResourceAppCatalogResourceAppCat();
+        resource.setHostName(description.getHostName());
+        resource.setResourceDescription(description.getResourceDescription());
+        resource.setResourceId(description.getComputeResourceId());
+        resource.setMaxMemoryPerNode(description.getMaxMemoryPerNode());
+        return resource;
+    }
+
+    public static ComputeResourceDescription getComputeHostDescription (ComputeResourceAppCatalogResourceAppCat resource) throws AppCatalogException {
+        ComputeResourceDescription description = new ComputeResourceDescription();
+        description.setComputeResourceId(resource.getResourceId());
+        description.setHostName(resource.getHostName());
+        description.setResourceDescription(resource.getResourceDescription());
+        description.setMaxMemoryPerNode(resource.getMaxMemoryPerNode());
+        HostAliasAppCatalogResourceAppCat aliasResource = new HostAliasAppCatalogResourceAppCat();
+        List<AppCatalogResource> resources = aliasResource.get(AppCatAbstractResource.HostAliasConstants.RESOURCE_ID, resource.getResourceId());
+        if (resources != null && !resources.isEmpty()){
+            description.setHostAliases(getHostAliases(resources));
+        }
+        HostIPAddressAppCatalogResourceAppCat ipAddressResource = new HostIPAddressAppCatalogResourceAppCat();
+        List<AppCatalogResource> ipAddresses = ipAddressResource.get(AppCatAbstractResource.HostIPAddressConstants.RESOURCE_ID, resource.getResourceId());
+        if (ipAddresses != null && !ipAddresses.isEmpty()){
+            description.setIpAddresses(getIpAddresses(ipAddresses));
+        }
+
+        BatchQueueAppCatalogResourceAppCat bqResource = new BatchQueueAppCatalogResourceAppCat();
+        List<AppCatalogResource> batchQueues = bqResource.get(AppCatAbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+        if (batchQueues != null && !batchQueues.isEmpty()){
+            description.setBatchQueues(getBatchQueues(batchQueues));
+        }
+        
+        ComputeResourceFileSystemAppCatalogResourceAppCat fsResource = new ComputeResourceFileSystemAppCatalogResourceAppCat();
+        List<AppCatalogResource> fsList = fsResource.get(AppCatAbstractResource.ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+        description.setFileSystems(new HashMap<FileSystems,String>());
+        if (fsList != null && !fsList.isEmpty()){
+        	for (AppCatalogResource r : fsList) {
+        		ComputeResourceFileSystemAppCatalogResourceAppCat rr=(ComputeResourceFileSystemAppCatalogResourceAppCat)r;
+        		description.getFileSystems().put(FileSystems.valueOf(rr.getFileSystem()), rr.getPath());
+			}
+        }
+        
+        JobSubmissionInterfaceAppCatalogResourceAppCat jsiResource = new JobSubmissionInterfaceAppCatalogResourceAppCat();
+        List<AppCatalogResource> hsiList = jsiResource.get(AppCatAbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+        if (hsiList != null && !hsiList.isEmpty()){
+            description.setJobSubmissionInterfaces(getJobSubmissionInterfaces(hsiList));
+        }
+        
+        DataMovementInterfaceAppCatalogResourceAppCat dmiResource = new DataMovementInterfaceAppCatalogResourceAppCat();
+        List<AppCatalogResource> dmiList = dmiResource.get(AppCatAbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
+        if (dmiList != null && !dmiList.isEmpty()){
+            description.setDataMovementInterfaces(getDataMovementInterfaces(dmiList));
+        }
+        return description;
+    }
+
+    public static  List<ComputeResourceDescription> getComputeDescriptionList (List<AppCatalogResource> resources) throws AppCatalogException {
+        List<ComputeResourceDescription> list = new ArrayList<ComputeResourceDescription>();
+        for (AppCatalogResource resource : resources){
+            list.add(getComputeHostDescription((ComputeResourceAppCatalogResourceAppCat)resource));
+        }
+        return list;
+    }
+
+    public static List<String> getHostAliases (List<AppCatalogResource> resources){
+        List<String> hostAliases = new ArrayList<String>();
+        for (AppCatalogResource alias : resources){
+            hostAliases.add(((HostAliasAppCatalogResourceAppCat)alias).getAlias());
+        }
+        return hostAliases;
+    }
+
+    public static List<String> getIpAddresses (List<AppCatalogResource> resources){
+        List<String> hostIpAddresses = new ArrayList<String>();
+        for (AppCatalogResource resource : resources){
+            hostIpAddresses.add(((HostIPAddressAppCatalogResourceAppCat)resource).getIpaddress());
+        }
+        return hostIpAddresses;
+    }
+    
+    public static List<BatchQueue> getBatchQueues (List<AppCatalogResource> resources){
+    	List<BatchQueue> batchQueues = new ArrayList<BatchQueue>();
+        for (AppCatalogResource resource : resources){
+        	batchQueues.add(getBatchQueue((BatchQueueAppCatalogResourceAppCat)resource));
+        }
+        return batchQueues;
+    }
+    
+    public static List<DataMovementInterface> getDataMovementInterfaces(List<AppCatalogResource> resources){
+    	List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>();
+        for (AppCatalogResource resource : resources){
+        	dataMovementInterfaces.add(getDataMovementInterface((DataMovementInterfaceAppCatalogResourceAppCat)resource));
+        }
+        return dataMovementInterfaces;
+    }
+    
+    public static DataMovementInterface getDataMovementInterface(DataMovementInterfaceAppCatalogResourceAppCat resource){
+    	DataMovementInterface dmi = new DataMovementInterface();
+    	dmi.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
+    	dmi.setDataMovementProtocol(DataMovementProtocol.valueOf(resource.getDataMovementProtocol()));
+    	dmi.setPriorityOrder(resource.getPriorityOrder());
+        return dmi;
+    }
+    
+    public static DataMovementInterfaceAppCatalogResourceAppCat getDataMovementInterface(DataMovementInterface resource){
+    	DataMovementInterfaceAppCatalogResourceAppCat dmi = new DataMovementInterfaceAppCatalogResourceAppCat();
+    	dmi.setDataMovementInterfaceId(resource.getDataMovementInterfaceId());
+    	dmi.setDataMovementProtocol(resource.getDataMovementProtocol().toString());
+    	dmi.setPriorityOrder(resource.getPriorityOrder());
+        return dmi;
+    }
+    
+    public static List<JobSubmissionInterface> getJobSubmissionInterfaces(List<AppCatalogResource> resources){
+    	List<JobSubmissionInterface> jobSubmissionInterfaces = new ArrayList<JobSubmissionInterface>();
+        for (AppCatalogResource resource : resources){
+        	jobSubmissionInterfaces.add(getJobSubmissionInterface((JobSubmissionInterfaceAppCatalogResourceAppCat)resource));
+        }
+        return jobSubmissionInterfaces;
+    }
+    
+    public static JobSubmissionInterface getJobSubmissionInterface(JobSubmissionInterfaceAppCatalogResourceAppCat resource){
+    	JobSubmissionInterface jsi = new JobSubmissionInterface();
+    	jsi.setJobSubmissionInterfaceId(resource.getJobSubmissionInterfaceId());
+    	jsi.setJobSubmissionProtocol(JobSubmissionProtocol.valueOf(resource.getJobSubmissionProtocol()));
+    	jsi.setPriorityOrder(resource.getPriorityOrder());
+        return jsi;
+    }
+    
+    public static JobSubmissionInterfaceAppCatalogResourceAppCat getJobSubmissionInterface(JobSubmissionInterface resource){
+    	JobSubmissionInterfaceAppCatalogResourceAppCat jsi = new JobSubmissionInterfaceAppCatalogResourceAppCat();
+    	jsi.setJobSubmissionInterfaceId(resource.getJobSubmissionInterfaceId());
+    	jsi.setJobSubmissionProtocol(resource.getJobSubmissionProtocol().toString());
+    	jsi.setPriorityOrder(resource.getPriorityOrder());
+        return jsi;
+    }
+    
+    public static BatchQueue getBatchQueue(BatchQueueAppCatalogResourceAppCat resource){
+    	BatchQueue batchQueue = new BatchQueue();
+    	batchQueue.setMaxJobsInQueue(resource.getMaxJobInQueue());
+    	batchQueue.setMaxNodes(resource.getMaxNodes());
+    	batchQueue.setMaxProcessors(resource.getMaxProcessors());
+    	batchQueue.setMaxRunTime(resource.getMaxRuntime());
+    	batchQueue.setMaxMemory(resource.getMaxMemory());
+    	batchQueue.setQueueDescription(resource.getQueueDescription());
+    	batchQueue.setQueueName(resource.getQueueName());
+        return batchQueue;
+    }
+
+    public static BatchQueueAppCatalogResourceAppCat getBatchQueue(BatchQueue resource){
+    	BatchQueueAppCatalogResourceAppCat batchQueue = new BatchQueueAppCatalogResourceAppCat();
+    	batchQueue.setMaxJobInQueue(resource.getMaxJobsInQueue());
+    	batchQueue.setMaxNodes(resource.getMaxNodes());
+    	batchQueue.setMaxProcessors(resource.getMaxProcessors());
+    	batchQueue.setMaxRuntime(resource.getMaxRunTime());
+    	batchQueue.setQueueDescription(resource.getQueueDescription());
+    	batchQueue.setQueueName(resource.getQueueName());
+    	batchQueue.setMaxMemory(resource.getMaxMemory());
+        return batchQueue;
+    }
+    
+//    public static Map<String, JobSubmissionProtocol> getJobSubmissionProtocolList(List<Resource> resources){
+//       Map<String, JobSubmissionProtocol> protocols = new HashMap<String, JobSubmissionProtocol>();
+//        for (Resource resource : resources){
+//            JobSubmissionProtocolResource submission = (JobSubmissionProtocolResource) resource;
+//            protocols.put(submission.getSubmissionID(), JobSubmissionProtocol.valueOf(submission.getJobType()));
+//        }
+//        return protocols;
+//    }
+
+//    public static Map<String, DataMovementProtocol> getDataMoveProtocolList(List<Resource> resources){
+//        Map<String, DataMovementProtocol> protocols = new HashMap<String, DataMovementProtocol>();
+//        for (Resource resource : resources){
+//            DataMovementProtocolResource protocolResource = (DataMovementProtocolResource) resource;
+//            protocols.put(protocolResource.getDataMoveID(), DataMovementProtocol.valueOf(protocolResource.getDataMoveType()));
+//        }
+//        return protocols;
+//    }
+
+    public static SshJobSubmissionAppCatalogResourceAppCat getSSHJobSubmission (SSHJobSubmission submission){
+    	SshJobSubmissionAppCatalogResourceAppCat resource = new SshJobSubmissionAppCatalogResourceAppCat();
+        resource.setAlternativeSshHostname(submission.getAlternativeSSHHostName());
+        resource.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+        ResourceJobManagerAppCatalogResourceAppCat resourceJobManager = getResourceJobManager(submission.getResourceJobManager());
+//        resourceJobManager.setResourceJobManagerId(submission.getJobSubmissionInterfaceId());
+        resource.setResourceJobManagerId(resourceJobManager.getResourceJobManagerId());
+        if (submission.getMonitorMode() != null){
+            resource.setMonitorMode(submission.getMonitorMode().toString());
+        }
+        resource.setResourceJobManagerResource(resourceJobManager);
+        if (submission.getSecurityProtocol() != null){
+            resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+        }
+        resource.setSshPort(submission.getSshPort());
+        return resource;
+    }
+    
+    
+    public static UnicoreJobSubmissionAppCatalogResourceAppCat getUnicoreJobSubmission (UnicoreJobSubmission submission){
+    	UnicoreJobSubmissionAppCatalogResourceAppCat resource = new UnicoreJobSubmissionAppCatalogResourceAppCat();
+        resource.setjobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+        if (submission.getSecurityProtocol() != null){
+            resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+        }
+        resource.setUnicoreEndpointUrl(submission.getUnicoreEndPointURL());
+        return resource;
+    }
+
+    public static UnicoreDataMovementAppCatalogResourceAppCat getUnicoreDMResource (UnicoreDataMovement dataMovement){
+        UnicoreDataMovementAppCatalogResourceAppCat resource = new UnicoreDataMovementAppCatalogResourceAppCat();
+        resource.setDataMovementId(dataMovement.getDataMovementInterfaceId());
+        if (dataMovement.getSecurityProtocol() != null){
+            resource.setSecurityProtocol(dataMovement.getSecurityProtocol().toString());
+        }
+        resource.setUnicoreEndpointUrl(dataMovement.getUnicoreEndPointURL());
+        return resource;
+    }
+
+    
+    public static CloudSubmissionAppCatalogResourceAppCat getCloudJobSubmission (CloudJobSubmission submission){
+        CloudSubmissionAppCatalogResourceAppCat resource = new CloudSubmissionAppCatalogResourceAppCat();
+        resource.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+        if (submission.getSecurityProtocol() != null){
+            resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+        }
+        if(submission.getProviderName() != null){
+            resource.setProviderName(submission.getProviderName().toString());
+        }
+        resource.setUserAccountName(submission.getUserAccountName());
+        resource.setNodeId(submission.getNodeId());
+        resource.setExecutableType(submission.getExecutableType());
+        return resource;
+    }
+
+    public static LocalDataMovementAppCatalogResourceAppCat getLocalDataMovement(LOCALDataMovement localSubmission)throws AppCatalogException {
+    	LocalDataMovementAppCatalogResourceAppCat submission = new LocalDataMovementAppCatalogResourceAppCat();
+    	submission.setDataMovementInterfaceId(localSubmission.getDataMovementInterfaceId());
+    	return submission;
+    }
+    
+    public static LOCALDataMovement getLocalDataMovement(LocalDataMovementAppCatalogResourceAppCat localSubmission)throws AppCatalogException {
+    	LOCALDataMovement submission = new LOCALDataMovement();
+    	submission.setDataMovementInterfaceId(localSubmission.getDataMovementInterfaceId());
+    	return submission;
+    }
+    
+    
+    public static LocalSubmissionAppCatalogResourceAppCat getLocalJobSubmission(LOCALSubmission localSubmission)throws AppCatalogException {
+    	LocalSubmissionAppCatalogResourceAppCat submission = new LocalSubmissionAppCatalogResourceAppCat();
+    	submission.setJobSubmissionInterfaceId(localSubmission.getJobSubmissionInterfaceId());
+    	ResourceJobManagerAppCatalogResourceAppCat resourceJobManager = getResourceJobManager(localSubmission.getResourceJobManager());
+    	submission.setResourceJobManagerId(resourceJobManager.getResourceJobManagerId());
+    	submission.setResourceJobManagerResource(resourceJobManager);
+    	return submission;
+    }
+    
+    public static LOCALSubmission getLocalJobSubmission(LocalSubmissionAppCatalogResourceAppCat localSubmission)throws AppCatalogException {
+    	LOCALSubmission submission = new LOCALSubmission();
+    	submission.setJobSubmissionInterfaceId(localSubmission.getJobSubmissionInterfaceId());
+    	submission.setResourceJobManager(getResourceJobManager(localSubmission.getResourceJobManagerResource()));
+    	return submission;
+    }
+    
+    public static ResourceJobManagerAppCatalogResourceAppCat getResourceJobManager(ResourceJobManager manager){
+    	ResourceJobManagerAppCatalogResourceAppCat r = new ResourceJobManagerAppCatalogResourceAppCat();
+    	r.setResourceJobManagerId(manager.getResourceJobManagerId());
+    	r.setJobManagerBinPath(manager.getJobManagerBinPath());
+    	r.setPushMonitoringEndpoint(manager.getPushMonitoringEndpoint());
+    	r.setResourceJobManagerType(manager.getResourceJobManagerType().toString());
+    	return r;
+    }
+    
+    public static ResourceJobManager getResourceJobManager(ResourceJobManagerAppCatalogResourceAppCat manager) throws AppCatalogException {
+    	ResourceJobManager r = new ResourceJobManager();
+    	r.setResourceJobManagerId(manager.getResourceJobManagerId());
+    	r.setJobManagerBinPath(manager.getJobManagerBinPath());
+    	r.setPushMonitoringEndpoint(manager.getPushMonitoringEndpoint());
+    	r.setResourceJobManagerType(ResourceJobManagerType.valueOf(manager.getResourceJobManagerType()));
+    	r.setJobManagerCommands(new HashMap<JobManagerCommand, String>());
+    	JobManagerCommandAppCatalogResourceAppCat jmcr=new JobManagerCommandAppCatalogResourceAppCat();
+        List<AppCatalogResource> jmcrList = jmcr.get(AppCatAbstractResource.JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, manager.getResourceJobManagerId());
+        if (jmcrList != null && !jmcrList.isEmpty()){
+        	for (AppCatalogResource rrr : jmcrList) {
+        		JobManagerCommandAppCatalogResourceAppCat rr=(JobManagerCommandAppCatalogResourceAppCat)rrr;
+        		r.getJobManagerCommands().put(JobManagerCommand.valueOf(rr.getCommandType()), rr.getCommand());
+			}
+        }
+    	return r;
+    }
+    
+    
+    public static SSHJobSubmission getSSHJobSubmissionDescription (SshJobSubmissionAppCatalogResourceAppCat submission) throws AppCatalogException {
+    	SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
+    	sshJobSubmission.setAlternativeSSHHostName(submission.getAlternativeSshHostname());
+    	sshJobSubmission.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+    	sshJobSubmission.setResourceJobManager(getResourceJobManager(submission.getResourceJobManagerResource()));
+    	sshJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+    	sshJobSubmission.setSshPort(submission.getSshPort());
+        if (submission.getMonitorMode() != null){
+            sshJobSubmission.setMonitorMode(MonitorMode.valueOf(submission.getMonitorMode()));
+        }
+        return sshJobSubmission;
+    }
+
+    public static UnicoreJobSubmission getUnicoreJobSubmissionDescription (UnicoreJobSubmissionAppCatalogResourceAppCat submission) throws AppCatalogException {
+    	UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
+    	unicoreJobSubmission.setUnicoreEndPointURL(submission.getUnicoreEndpointUrl());
+    	unicoreJobSubmission.setJobSubmissionInterfaceId(submission.getjobSubmissionInterfaceId());
+        if (submission.getSecurityProtocol() != null){
+            unicoreJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+        }
+        return unicoreJobSubmission;
+    }
+
+    public static UnicoreDataMovement getUnicoreDMDescription (UnicoreDataMovementAppCatalogResourceAppCat resource) throws AppCatalogException {
+        UnicoreDataMovement dataMovement = new UnicoreDataMovement();
+        dataMovement.setUnicoreEndPointURL(resource.getUnicoreEndpointUrl());
+        dataMovement.setDataMovementInterfaceId(resource.getDataMovementId());
+        if (resource.getSecurityProtocol() != null){
+            dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(resource.getSecurityProtocol()));
+        }
+        return dataMovement;
+    }
+
+    
+    public static CloudJobSubmission getCloudJobSubmissionDescription (CloudSubmissionAppCatalogResourceAppCat submission) throws AppCatalogException {
+        CloudJobSubmission cloudJobSubmission = new CloudJobSubmission();
+        cloudJobSubmission.setJobSubmissionInterfaceId(submission.getJobSubmissionInterfaceId());
+        cloudJobSubmission.setExecutableType(submission.getExecutableType());
+        cloudJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+        cloudJobSubmission.setNodeId(submission.getNodeId());
+        cloudJobSubmission.setUserAccountName(submission.getUserAccountName());
+        cloudJobSubmission.setProviderName(ProviderName.valueOf(submission.getProviderName()));
+        return cloudJobSubmission;
+    }
+
+//    public static GlobusJobSubmission getGlobusJobSubmissionDescription (GlobusJobSubmissionResource submission) throws AppCatalogException {
+//        GlobusJobSubmission globusJobSubmission = new GlobusJobSubmission();
+//        globusJobSubmission.setJobSubmissionInterfaceId(submission.getSubmissionID());
+//        globusJobSubmission.setResourceJobManager(ResourceJobManager.valueOf(submission.getResourceJobManager()));
+//        globusJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
+//
+//        GlobusGKEndpointResource endpointResource = new GlobusGKEndpointResource();
+//        List<Resource> endpoints = endpointResource.get(AbstractResource.GlobusEPConstants.SUBMISSION_ID, submission.getSubmissionID());
+//        if (endpoints != null && !endpoints.isEmpty()){
+//            globusJobSubmission.setGlobusGateKeeperEndPoint(getGlobusGateKeeperEndPointList(endpoints));
+//        }
+//
+//        return globusJobSubmission;
+//    }
+
+    public static SCPDataMovement getSCPDataMovementDescription (ScpDataMovementAppCatalogResourceAppCat dataMovementResource) throws AppCatalogException {
+        SCPDataMovement dataMovement = new SCPDataMovement();
+        dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+        dataMovement.setAlternativeSCPHostName(dataMovementResource.getAlternativeScpHostname());
+        dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(dataMovementResource.getSecurityProtocol()));
+        dataMovement.setSshPort(dataMovementResource.getSshPort());
+        return dataMovement;
+    }
+    
+    public static ScpDataMovementAppCatalogResourceAppCat getSCPDataMovementDescription (SCPDataMovement dataMovementResource) throws AppCatalogException {
+    	ScpDataMovementAppCatalogResourceAppCat dataMovement = new ScpDataMovementAppCatalogResourceAppCat();
+        dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+        dataMovement.setAlternativeScpHostname(dataMovementResource.getAlternativeSCPHostName());
+        dataMovement.setSecurityProtocol(dataMovementResource.getSecurityProtocol().toString());
+        dataMovement.setSshPort(dataMovementResource.getSshPort());
+        return dataMovement;
+    }
+
+    public static GridFTPDataMovement getGridFTPDataMovementDescription (GridftpDataMovementAppCatalogResourceAppCat dataMovementResource) throws AppCatalogException {
+        GridFTPDataMovement dataMovement = new GridFTPDataMovement();
+        dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+        dataMovement.setSecurityProtocol(SecurityProtocol.valueOf(dataMovementResource.getSecurityProtocol()));
+        GridftpEndpointAppCatalogResourceAppCat endpointResource = new GridftpEndpointAppCatalogResourceAppCat();
+        List<AppCatalogResource> endpoints = endpointResource.get(AppCatAbstractResource.GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, dataMovementResource.getDataMovementInterfaceId());
+        if (endpoints != null && !endpoints.isEmpty()){
+            dataMovement.setGridFTPEndPoints(getGridFTPDMEPList(endpoints));
+        }
+        return dataMovement;
+    }
+
+    public static GridftpDataMovementAppCatalogResourceAppCat getGridFTPDataMovementDescription (GridFTPDataMovement dataMovementResource) throws AppCatalogException {
+    	GridftpDataMovementAppCatalogResourceAppCat dataMovement = new GridftpDataMovementAppCatalogResourceAppCat();
+        dataMovement.setDataMovementInterfaceId(dataMovementResource.getDataMovementInterfaceId());
+        dataMovement.setSecurityProtocol(dataMovementResource.getSecurityProtocol().toString());
+        return dataMovement;
+    }
+    
+    public static List<String> getGridFTPDMEPList (List<AppCatalogResource> endpoints){
+        List<String> list = new ArrayList<String>();
+        for (AppCatalogResource resource : endpoints){
+            list.add(((GridftpEndpointAppCatalogResourceAppCat) resource).getEndpoint());
+        }
+        return list;
+    }
+
+    public static List<String> getGlobusGateKeeperEndPointList (List<AppCatalogResource> resources) throws AppCatalogException {
+        List<String> list = new ArrayList<String>();
+        for (AppCatalogResource resource : resources){
+            list.add(((GlobusGKEndpointAppCatalogResourceAppCat) resource).getEndpoint());
+        }
+        return list;
+    }
+//
+//    public static List<GSISSHJobSubmission> getGSISSHSubmissionList (List<Resource> resources) throws AppCatalogException {
+//        List<GSISSHJobSubmission> list = new ArrayList<GSISSHJobSubmission>();
+//        for (Resource resource : resources){
+//            list.add(getGSISSHSubmissionDescription((GSISSHSubmissionResource) resource));
+//        }
+//        return list;
+//    }
+//
+//    public static List<GlobusJobSubmission> getGlobusSubmissionList (List<Resource> resources) throws AppCatalogException {
+//        List<GlobusJobSubmission> list = new ArrayList<GlobusJobSubmission>();
+//        for (Resource resource : resources){
+//            list.add(getGlobusJobSubmissionDescription((GlobusJobSubmissionResource) resource));
+//        }
+//        return list;
+//    }
+//
+//    public static List<SSHJobSubmission> getSSHSubmissionList (List<Resource> resources) throws AppCatalogException {
+//        List<SSHJobSubmission> list = new ArrayList<SSHJobSubmission>();
+//        for (Resource resource : resources){
+//            list.add(getSSHJobSubmissionDescription((SshJobSubmissionResource) resource));
+//        }
+//        return list;
+//    }
+//
+//    public static List<GridFTPDataMovement> getGridFTPDataMovementList (List<Resource> resources) throws AppCatalogException {
+//        List<GridFTPDataMovement> list = new ArrayList<GridFTPDataMovement>();
+//        for (Resource resource : resources){
+//            list.add(getGridFTPDataMovementDescription((GridftpDataMovementResource) resource));
+//        }
+//        return list;
+//    }
+//
+//    public static List<SCPDataMovement> getSCPDataMovementList (List<Resource> resources) throws AppCatalogException {
+//        List<SCPDataMovement> list = new ArrayList<SCPDataMovement>();
+//        for (Resource resource : resources){
+//            list.add(getSCPDataMovementDescription((ScpDataMovementResource) resource));
+//        }
+//        return list;
+//    }
+//
+//    public static Set<String> getGSISSHExports (List<Resource> gsisshExportResources){
+//        Set<String> exports = new HashSet<String>();
+//        for (Resource resource : gsisshExportResources){
+//            exports.add(((GSISSHExportResource) resource).getExport());
+//        }
+//        return exports;
+//    }
+//
+//    public static List<String> getGSISSHPreJobCommands (List<Resource> gsisshPreJobCommandResources){
+//        List<String> list = new ArrayList<String>();
+//        for (Resource resource : gsisshPreJobCommandResources){
+//            list.add(((GSISSHPreJobCommandResource) resource).getCommand());
+//        }
+//        return list;
+//    }
+//
+//    public static List<String> getGSISSHPostJobCommands (List<Resource> gsisshPostJobCommandResources){
+//        List<String> list = new ArrayList<String>();
+//        for (Resource resource : gsisshPostJobCommandResources){
+//            list.add(((GSISSHPostJobCommandResource) resource).getCommand());
+//        }
+//        return list;
+//    }
+//
+//    public static GlobusJobSubmissionResource getGlobusJobSubmission (GlobusJobSubmission submission){
+//        GlobusJobSubmissionResource resource = new GlobusJobSubmissionResource();
+//        resource.setSubmissionID(submission.getJobSubmissionDataID());
+//        resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
+//        resource.setResourceJobManager(submission.getResourceJobManager().toString());
+//        return resource;
+//    }
+
+    public static ApplicationModule getApplicationModuleDesc (AppModuleAppCatalogResourceAppCat resource){
+        ApplicationModule module = new ApplicationModule();
+        module.setAppModuleId(resource.getModuleId());
+        module.setAppModuleDescription(resource.getModuleDesc());
+        module.setAppModuleName(resource.getModuleName());
+        module.setAppModuleVersion(resource.getModuleVersion());
+        return module;
+    }
+
+    public static ApplicationInterfaceDescription getApplicationInterfaceDescription (AppInterfaceAppCatalogResourceAppCat resource) throws AppCatalogException {
+        ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
+        description.setApplicationInterfaceId(resource.getInterfaceId());
+        description.setApplicationName(resource.getAppName());
+        description.setApplicationDescription(resource.getAppDescription());
+
+        AppModuleMappingAppCatalogResourceAppCat appModuleMappingResource = new AppModuleMappingAppCatalogResourceAppCat();
+        List<AppCatalogResource> appModules = appModuleMappingResource.get(AppCatAbstractResource.AppModuleMappingConstants.INTERFACE_ID, resource.getInterfaceId());
+        if (appModules != null && !appModules.isEmpty()){
+            description.setApplicationModules(getAppModuleIds(appModules));
+        }
+
+        ApplicationInputAppCatalogResourceAppCat inputResource = new ApplicationInputAppCatalogResourceAppCat();
+        List<AppCatalogResource> appInputs = inputResource.get(AppCatAbstractResource.AppInputConstants.INTERFACE_ID, resource.getInterfaceId());
+        if (appInputs != null && !appInputs.isEmpty()){
+            description.setApplicationInputs(getAppInputs(appInputs));
+        }
+
+        ApplicationOutputAppCatalogResourceAppCat outputResource = new ApplicationOutputAppCatalogResourceAppCat();
+        List<AppCatalogResource> appOutputs = outputResource.get(AppCatAbstractResource.AppOutputConstants.INTERFACE_ID, resource.getInterfaceId());
+        if (appOutputs != null && !appOutputs.isEmpty()){
+            description.setApplicationOutputs(getAppOutputs(appOutputs));
+        }
+        return description;
+    }
+
+    public static List<String> getAppModuleIds (List<AppCatalogResource> appModuleMappings){
+        List<String> modules = new ArrayList<String>();
+        for (AppCatalogResource resource : appModuleMappings){
+            modules.add(((AppModuleMappingAppCatalogResourceAppCat)resource).getModuleId());
+        }
+        return modules;
+    }
+
+    public static List<ApplicationModule> getAppModules (List<AppCatalogResource> appModules){
+        List<ApplicationModule> modules = new ArrayList<ApplicationModule>();
+        for (AppCatalogResource resource : appModules){
+            modules.add(getApplicationModuleDesc((AppModuleAppCatalogResourceAppCat) resource));
+        }
+        return modules;
+    }
+
+    public static List<ApplicationInterfaceDescription> getAppInterfaceDescList (List<AppCatalogResource> appInterfaces) throws AppCatalogException {
+        List<ApplicationInterfaceDescription> interfaceDescriptions = new ArrayList<ApplicationInterfaceDescription>();
+        for (AppCatalogResource resource : appInterfaces){
+            interfaceDescriptions.add(getApplicationInterfaceDescription((AppInterfaceAppCatalogResourceAppCat) resource));
+        }
+        return interfaceDescriptions;
+    }
+
+    public static List<InputDataObjectType> getAppInputs (List<AppCatalogResource> resources){
+        List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
+        for (AppCatalogResource resource : resources){
+            inputs.add(getInputDataObjType((ApplicationInputAppCatalogResourceAppCat) resource));
+        }
+        return inputs;
+    }
+
+    public static InputDataObjectType getInputDataObjType (ApplicationInputAppCatalogResourceAppCat input){
+        InputDataObjectType inputDataObjectType = new InputDataObjectType();
+        inputDataObjectType.setName(input.getInputKey());
+        inputDataObjectType.setValue(input.getInputVal());
+        inputDataObjectType.setApplicationArgument(input.getAppArgument());
+        inputDataObjectType.setInputOrder(input.getInputOrder());
+        inputDataObjectType.setMetaData(input.getMetadata());
+        inputDataObjectType.setType(DataType.valueOf(input.getDataType()));
+        inputDataObjectType.setStandardInput(input.isStandardInput());
+        inputDataObjectType.setUserFriendlyDescription(input.getUserFriendlyDesc());
+        inputDataObjectType.setIsRequired(input.getRequired());
+        inputDataObjectType.setRequiredToAddedToCommandLine(input.getRequiredToCMD());
+        inputDataObjectType.setDataStaged(input.isDataStaged());
+        return inputDataObjectType;
+    }
+
+    public static List<OutputDataObjectType> getAppOutputs (List<AppCatalogResource> resources){
+        List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
+        for (AppCatalogResource resource : resources){
+            outputs.add(getOutputDataObjType((ApplicationOutputAppCatalogResourceAppCat) resource));
+        }
+        return outputs;
+    }
+    public static OutputDataObjectType getOutputDataObjType (ApplicationOutputAppCatalogResourceAppCat output){
+        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
+        outputDataObjectType.setName(output.getOutputKey());
+        outputDataObjectType.setValue(output.getOutputVal());
+        outputDataObjectType.setType(DataType.valueOf(output.getDataType()));
+        outputDataObjectType.setIsRequired(output.getRequired());
+        outputDataObjectType.setRequiredToAddedToCommandLine(output.getRequiredToCMD());
+        outputDataObjectType.setDataMovement(output.isDataMovement());
+        outputDataObjectType.setLocation(output.getDataNameLocation());
+        outputDataObjectType.setSearchQuery(output.getSearchQuery());
+        outputDataObjectType.setApplicationArgument(output.getAppArgument());
+        return outputDataObjectType;
+    }
+
+    public static ApplicationDeploymentDescription getApplicationDeploymentDescription (AppDeploymentAppCatalogResourceAppCat resource) throws AppCatalogException {
+        ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
+        description.setAppDeploymentId(resource.getDeploymentId());
+        description.setAppModuleId(resource.getAppModuleId());
+        description.setComputeHostId(resource.getHostId());
+        description.setExecutablePath(resource.getExecutablePath());
+        if (resource.getParallelism() != null){
+            description.setParallelism(ApplicationParallelismType.valueOf(resource.getParallelism()));
+        }
+        description.setAppDeploymentDescription(resource.getAppDes());
+        ModuleLoadCmdAppCatalogResourceAppCat cmdResource = new ModuleLoadCmdAppCatalogResourceAppCat();
+        List<AppCatalogResource> moduleLoadCmds = cmdResource.get(AppCatAbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, resource.getDeploymentId());
+        if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
+            for (AppCatalogResource moduleLoadCmd : moduleLoadCmds){
+                description.addToModuleLoadCmds(((ModuleLoadCmdAppCatalogResourceAppCat) moduleLoadCmd).getCmd());
+            }
+        }
+        LibraryPrepandPathAppCatalogResourceAppCat prepandPathResource = new LibraryPrepandPathAppCatalogResourceAppCat();
+        List<AppCatalogResource> libPrepandPaths = prepandPathResource.get(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+        if (libPrepandPaths != null && !libPrepandPaths.isEmpty()){
+            description.setLibPrependPaths(getLibPrepandPaths(libPrepandPaths));
+        }
+
+        LibraryApendPathAppCatalogResourceAppCat apendPathResource = new LibraryApendPathAppCatalogResourceAppCat();
+        List<AppCatalogResource> libApendPaths = apendPathResource.get(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+        if (libApendPaths != null && !libApendPaths.isEmpty()){
+            description.setLibAppendPaths(getLibApendPaths(libApendPaths));
+        }
+
+        AppEnvironmentAppCatalogResourceAppCat appEnvironmentResource = new AppEnvironmentAppCatalogResourceAppCat();
+        List<AppCatalogResource> appEnvList = appEnvironmentResource.get(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+        if (appEnvList != null && !appEnvList.isEmpty()){
+            description.setSetEnvironment(getAppEnvPaths(appEnvList));
+        }
+        PreJobCommandAppCatalogResourceAppCat preJobCommandResource = new PreJobCommandAppCatalogResourceAppCat();
+        List<AppCatalogResource> preJobCommands = preJobCommandResource.get(AppCatAbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+        if (preJobCommands != null && !preJobCommands.isEmpty()){
+            for (AppCatalogResource prejobCommand : preJobCommands){
+                description.addToPreJobCommands(((PreJobCommandAppCatalogResourceAppCat) prejobCommand).getCommand());
+            }
+        }
+        PostJobCommandAppCatalogResourceAppCat postJobCommandResource = new PostJobCommandAppCatalogResourceAppCat();
+        List<AppCatalogResource> postJobCommands = postJobCommandResource.get(AppCatAbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, resource.getDeploymentId());
+        if (postJobCommands != null && !postJobCommands.isEmpty()){
+            for (AppCatalogResource postjobCommand : postJobCommands){
+                description.addToPostJobCommands(((PostJobCommandAppCatalogResourceAppCat) postjobCommand).getCommand());
+            }
+        }
+        return description;
+    }
+
+    public static List<ApplicationDeploymentDescription> getAppDepDescList (List<AppCatalogResource> resources) throws AppCatalogException {
+        List<ApplicationDeploymentDescription> appList = new ArrayList<ApplicationDeploymentDescription>();
+        for (AppCatalogResource resource : resources){
+            appList.add(getApplicationDeploymentDescription((AppDeploymentAppCatalogResourceAppCat)resource));
+        }
+        return appList;
+    }
+
+    public static SetEnvPaths getSetEnvPath(AppCatalogResource resource){
+        SetEnvPaths envPaths = new SetEnvPaths();
+        if (resource instanceof LibraryPrepandPathAppCatalogResourceAppCat){
+            envPaths.setName(((LibraryPrepandPathAppCatalogResourceAppCat) resource).getName());
+            envPaths.setValue(((LibraryPrepandPathAppCatalogResourceAppCat) resource).getValue());
+            return envPaths;
+        }else if (resource instanceof LibraryApendPathAppCatalogResourceAppCat){
+            envPaths.setName(((LibraryApendPathAppCatalogResourceAppCat) resource).getName());
+            envPaths.setValue(((LibraryApendPathAppCatalogResourceAppCat) resource).getValue());
+            return envPaths;
+        }else if (resource instanceof AppEnvironmentAppCatalogResourceAppCat){
+            envPaths.setName(((AppEnvironmentAppCatalogResourceAppCat) resource).getName());
+            envPaths.setValue(((AppEnvironmentAppCatalogResourceAppCat) resource).getValue());
+            return envPaths;
+        }else {
+            return null;
+        }
+    }
+
+    public static List<SetEnvPaths> getLibPrepandPaths (List<AppCatalogResource> prepandPaths){
+        List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
+        for (AppCatalogResource resource : prepandPaths){
+            pathList.add(getSetEnvPath(resource));
+        }
+        return pathList;
+    }
+
+    public static List<SetEnvPaths> getLibApendPaths (List<AppCatalogResource> appendPaths){
+        List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
+        for (AppCatalogResource resource : appendPaths){
+            pathList.add(getSetEnvPath(resource));
+        }
+        return pathList;
+    }
+
+    public static List<SetEnvPaths> getAppEnvPaths (List<AppCatalogResource> appEnvPaths){
+        List<SetEnvPaths> pathList = new ArrayList<SetEnvPaths>();
+        for (AppCatalogResource resource : appEnvPaths){
+            pathList.add(getSetEnvPath(resource));
+        }
+        return pathList;
+    }
+
+    public static ComputeResourcePreference getComputeResourcePreference (ComputeHostPreferenceAppCatalogResourceAppCat resource){
+        ComputeResourcePreference preference = new ComputeResourcePreference();
+        preference.setComputeResourceId(resource.getResourceId());
+        preference.setOverridebyAiravata(resource.getOverrideByAiravata());
+        if (resource.getPreferredJobProtocol() != null){
+            preference.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.valueOf(resource.getPreferredJobProtocol()));
+        }
+        if (resource.getPreferedDMProtocol() != null){
+            preference.setPreferredDataMovementProtocol(DataMovementProtocol.valueOf(resource.getPreferedDMProtocol()));
+        }
+        preference.setPreferredBatchQueue(resource.getBatchQueue());
+        preference.setScratchLocation(resource.getScratchLocation());
+        preference.setAllocationProjectNumber(resource.getProjectNumber());
+        preference.setLoginUserName(resource.getLoginUserName());
+        return preference;
+    }
+
+    public static List<ComputeResourcePreference> getComputeResourcePreferences (List<AppCatalogResource> resources){
+        List<ComputeResourcePreference> preferences = new ArrayList<ComputeResourcePreference>();
+        if (resources != null && !resources.isEmpty()){
+            for (AppCatalogResource resource : resources){
+                 preferences.add(getComputeResourcePreference((ComputeHostPreferenceAppCatalogResourceAppCat)resource));
+            }
+        }
+        return preferences;
+    }
+
+    public static InputDataObjectType getWorkflowInput (WorkflowInputAppCatalogResourceAppCat resource){
+        InputDataObjectType input = new InputDataObjectType();
+        input.setName(resource.getInputKey());
+        input.setApplicationArgument(resource.getAppArgument());
+        input.setInputOrder(resource.getInputOrder());
+        input.setType(DataType.valueOf(resource.getDataType()));
+        input.setMetaData(resource.getMetadata());
+        input.setUserFriendlyDescription(resource.getUserFriendlyDesc());
+        input.setIsRequired(resource.getRequired());
+        input.setRequiredToAddedToCommandLine(resource.getRequiredToCMD());
+        input.setDataStaged(resource.isDataStaged());
+        return input;
+    }
+
+    public static List<InputDataObjectType> getWFInputs(List<AppCatalogResource> resources){
+        List<InputDataObjectType> inputResources = new ArrayList<InputDataObjectType>();
+        if (resources != null && !resources.isEmpty()){
+            for (AppCatalogResource resource : resources){
+                inputResources.add(getWorkflowInput((WorkflowInputAppCatalogResourceAppCat) resource));
+            }
+        }
+        return inputResources;
+    }
+
+    public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileAppCatalogResourceAppCat gw, List<ComputeResourcePreference> preferences){
+        GatewayResourceProfile gatewayProfile = new GatewayResourceProfile();
+        gatewayProfile.setGatewayID(gw.getGatewayID());
+        gatewayProfile.setComputeResourcePreferences(preferences);
+        return gatewayProfile;
+    }
+
+    public static Workflow getWorkflow (WorkflowAppCatalogResourceAppCat resource) throws AppCatalogException {
+        Workflow workflow = new Workflow();
+        workflow.setTemplateId(resource.getWfTemplateId());
+        workflow.setGraph(resource.getGraph());
+        workflow.setName(resource.getWfName());
+        if (resource.getImage() != null){
+            workflow.setImage(resource.getImage().getBytes());
+        }
+        WorkflowInputAppCatalogResourceAppCat inputResource = new WorkflowInputAppCatalogResourceAppCat();
+        List<AppCatalogResource> resources = inputResource.get(AppCatAbstractResource.WFInputConstants.WF_TEMPLATE_ID, resource.getWfTemplateId());
+        workflow.setWorkflowInputs(getWFInputs(resources));
+
+        return workflow;
+    }
+}

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/util/AppCatalogUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogUtils.java
new file mode 100644
index 0000000..d4bb3b1
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogUtils.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.util;
+
+import java.util.UUID;
+
+public class AppCatalogUtils {
+    public static String getID (String name){
+        String pro = name.replaceAll("\\s", "");
+        return pro + "_" + UUID.randomUUID();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
new file mode 100644
index 0000000..ad96e67
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExpCatResourceUtils.java
@@ -0,0 +1,526 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.registry.core.experiment.catalog.model.*;
+import org.apache.airavata.registry.core.experiment.catalog.resources.*;
+import org.apache.airavata.registry.core.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ExpCatResourceUtils {
+    private final static Logger logger = LoggerFactory.getLogger(ExpCatResourceUtils.class);
+    private static final String PERSISTENCE_UNIT_NAME = "experiment_data";
+    protected static EntityManagerFactory factory;
+
+    public static void reset(){
+    	factory=null;
+    }
+    
+    public static EntityManager getEntityManager(){
+        if (factory == null) {
+            String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" + Utils.getJDBCURL() + "?autoReconnect=true,," +
+                    "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() + ",validationQuery=" +
+            Utils.getValidationQuery();
+            System.out.println(connectionProperties);
+            Map<String, String> properties = new HashMap<String, String>();
+            properties.put("persistenceXmlLocation", "META-INF/experiment-catalog.xml");
+            properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+            properties.put("openjpa.ConnectionProperties", connectionProperties);
+            properties.put("openjpa.DynamicEnhancementAgent", "true");
+            properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
+            properties.put("openjpa.DataCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
+            properties.put("openjpa.QueryCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
+            properties.put("openjpa.RemoteCommitProvider","sjvm");
+            properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+            properties.put("openjpa.jdbc.DBDictionary","SupportsMultipleNontransactionalResultSets=false");
+//            properties.put("openjpa.ReadLockLevel", "none");
+//            properties.put("openjpa.WriteLockLevel", "none");
+//            properties.put("openjpa.LockTimeout", "30000");
+//            properties.put("openjpa.LockManager", "none");
+            properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+            properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000,  autoReconnect=true");
+			properties.put("openjpa.jdbc.QuerySQLCache", "false");
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+        }
+		return factory.createEntityManager();
+    }
+
+    /**
+     * @param gatewayId
+     * @return
+     */
+    public static ExperimentCatResource createGateway(String gatewayId) throws RegistryException {
+        if (!isGatewayExist(gatewayId)) {
+            GatewayExperimentCatResource gatewayResource = new GatewayExperimentCatResource();
+            gatewayResource.setGatewayId(gatewayId);
+            return gatewayResource;
+        }else {
+            return getGateway(gatewayId);
+        }
+    }
+
+    public static UserExperimentCatResource createUser(String username, String password) throws RegistryException {
+        if (!isUserExist(username)) {
+            UserExperimentCatResource userResource = new UserExperimentCatResource();
+            userResource.setUserName(username);
+            userResource.setPassword(password);
+            return userResource;
+        }else {
+            return (UserExperimentCatResource)getUser(username);
+        }
+
+    }
+
+    public static ExperimentCatResource getGateway(String gatewayId) throws RegistryException{
+        EntityManager em = null;
+        try {
+            if (isGatewayExist(gatewayId)) {
+                em = getEntityManager();
+                Gateway gateway = em.find(Gateway.class, gatewayId);
+                GatewayExperimentCatResource gatewayResource = (GatewayExperimentCatResource)Utils.getResource(ResourceType.GATEWAY, gateway);
+                em.close();
+                return gatewayResource;
+            }
+        }catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return null;
+    }
+
+    public static void addUser (String userName, String password) throws RegistryException{
+        UserExperimentCatResource resource = new UserExperimentCatResource();
+        resource.setUserName(userName);
+        resource.setPassword(password);
+        resource.save();
+    }
+
+    public static boolean isUserExist (String username) throws RegistryException{
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            em.getTransaction().begin();
+            QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.USERS);
+            generator.setParameter(AbstractExperimentCatResource.UserConstants.USERNAME, username);
+            Query q = generator.selectQuery(em);
+            int size = q.getResultList().size();
+            em.getTransaction().commit();
+            em.close();
+            return size>0;
+        } catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+
+    public static ExperimentCatResource getUser(String userName) throws RegistryException{
+        EntityManager em = null;
+        try {
+            if (isUserExist(userName)) {
+                em = getEntityManager();
+                Users user =  em.find(Users.class, userName);
+                UserExperimentCatResource userResource = (UserExperimentCatResource)Utils.getResource(ResourceType.USER, user);
+                em.close();
+                return userResource;
+            }
+        }catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return null;
+
+    }
+
+    public static ExperimentCatResource getWorker(String gatewayId, String userName) throws RegistryException{
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            Gateway_Worker gatewayWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, userName));
+            WorkerExperimentCatResource workerResource = (WorkerExperimentCatResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+            em.close();
+            return workerResource;
+        }catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+
+
+    }
+
+
+    /**
+     * @param gatewayId
+     * @return
+     */
+    public static boolean isGatewayExist(String gatewayId) throws RegistryException{
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            em.getTransaction().begin();
+            QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY);
+            generator.setParameter(AbstractExperimentCatResource.GatewayConstants.GATEWAY_ID, gatewayId);
+            Query q = generator.selectQuery(em);
+            int size = q.getResultList().size();
+            em.getTransaction().commit();
+            em.close();
+            return size>0;
+        }catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+
+    }
+
+    public static List<ExperimentCatResource> getAllGateways() throws RegistryException{
+        List<ExperimentCatResource> resourceList = new ArrayList<ExperimentCatResource>();
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            em.getTransaction().begin();
+            QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY);
+            Query q = generator.selectQuery(em);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Gateway gateway = (Gateway) result;
+                    GatewayExperimentCatResource gatewayResource =
+                            (GatewayExperimentCatResource) Utils.getResource(ResourceType.GATEWAY, gateway);
+                    resourceList.add(gatewayResource);
+                }
+            }
+            em.getTransaction().commit();
+            em.close();
+        }catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return resourceList;
+    }
+
+    /**
+     * @param gatewayId
+     * @return
+     */
+    public static boolean removeGateway(String gatewayId) {
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            em.getTransaction().begin();
+            QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY);
+            generator.setParameter(AbstractExperimentCatResource.GatewayConstants.GATEWAY_ID, gatewayId);
+            Query q = generator.deleteQuery(em);
+            q.executeUpdate();
+            em.getTransaction().commit();
+            em.close();
+            return true;
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return false;
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    /**
+     * @param gatewayResource
+     * @param userResource
+     */
+    public static WorkerExperimentCatResource addGatewayWorker(GatewayExperimentCatResource gatewayResource, UserExperimentCatResource userResource) throws RegistryException{
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            em.getTransaction().begin();
+            if (!isGatewayExist(gatewayResource.getGatewayName())){
+                gatewayResource.save();
+            }
+            if (!isUserExist(userResource.getUserName())){
+                userResource.save();
+            }
+            Gateway gateway = em.find(Gateway.class, gatewayResource.getGatewayId());
+            Users user = em.find(Users.class, userResource.getUserName());
+            Gateway_Worker gatewayWorker = new Gateway_Worker();
+            gatewayWorker.setGateway(gateway);
+            gatewayWorker.setUser(user);
+            em.persist(gatewayWorker);
+            em.getTransaction().commit();
+            em.close();
+            return (WorkerExperimentCatResource)Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+        } catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    /**
+     * @param gatewayResource
+     * @param userResource
+     * @return
+     */
+    public static boolean removeGatewayWorker(GatewayExperimentCatResource gatewayResource, UserExperimentCatResource userResource) {
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            em.getTransaction().begin();
+            QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.GATEWAY_WORKER);
+            generator.setParameter(AbstractExperimentCatResource.GatewayWorkerConstants.GATEWAY_ID,
+                    gatewayResource.getGatewayName());
+            generator.setParameter(AbstractExperimentCatResource.UserConstants.USERNAME, userResource.getUserName());
+            Query q = generator.deleteQuery(em);
+            q.executeUpdate();
+            em.getTransaction().commit();
+            em.close();
+            return true;
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return false;
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+
+    }
+
+    /**
+     * @param configKey
+     * @return
+     */
+    public static List<ConfigurationExperimentCatResource> getConfigurations(String configKey){
+        List<ConfigurationExperimentCatResource> list = new ArrayList<ConfigurationExperimentCatResource>();
+        EntityManager em = null;
+        try {
+            em = getEntityManager();
+            em.getTransaction().begin();
+            QueryGenerator generator = new QueryGenerator(AbstractExperimentCatResource.CONFIGURATION);
+            generator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_KEY, configKey);
+            Query q = generator.selectQuery(em);
+            List<?> resultList = q.getResultList();
+            if (resultList.size() != 0) {
+                for (Object result : resultList) {
+                    ConfigurationExperimentCatResource configurationResource = createConfigurationResourceObject(result);
+                    list.add(configurationResource);
+                }
+            }
+            em.getTransaction().commit();
+            em.close();
+        }catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return list;
+    }
+
+    /**
+     * @param configKey
+     * @return
+     */
+    public static ConfigurationExperimentCatResource getConfiguration(String configKey){
+        List<ConfigurationExperimentCatResource> configurations = getConfigurations(configKey);
+        return (configurations != null && configurations.size() > 0) ? configurations.get(0) : null;
+    }
+
+    /**
+     * @param configKey
+     * @return
+     */
+    public static boolean isConfigurationExist(String configKey){
+        List<ConfigurationExperimentCatResource> configurations = getConfigurations(configKey);
+        return (configurations != null && configurations.size() > 0);
+    }
+
+    /**
+     * @param configKey
+     * @return
+     */
+    public static ConfigurationExperimentCatResource createConfiguration(String configKey) {
+        ConfigurationExperimentCatResource config = new ConfigurationExperimentCatResource();
+        config.setConfigKey(configKey);
+        return config;
+    }
+
+    /**
+     * @param result
+     * @return
+     */
+    private static ConfigurationExperimentCatResource createConfigurationResourceObject(
+            Object result) {
+        Configuration configuration = (Configuration) result;
+        ConfigurationExperimentCatResource configurationResource = new ConfigurationExperimentCatResource(configuration.getConfig_key(), configuration.getConfig_val());
+        configurationResource.setExpireDate(configuration.getExpire_date());
+        return configurationResource;
+    }
+
+    /**
+     * @param configkey
+     * @param configValue
+     */
+    public static void removeConfiguration(String configkey, String configValue) throws RegistryException{
+        QueryGenerator queryGenerator = new QueryGenerator(AbstractExperimentCatResource.CONFIGURATION);
+        queryGenerator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_KEY, configkey);
+        queryGenerator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_VAL, configValue);
+        EntityManager em = null;
+        try {
+            if(isConfigurationExists(configkey, configValue)){
+                em = getEntityManager();
+                em.getTransaction().begin();
+                Query q = queryGenerator.deleteQuery(em);
+                q.executeUpdate();
+                em.getTransaction().commit();
+                em.close();
+            }
+        }catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    /**
+     * @param configkey
+     */
+    public static void removeConfiguration(String configkey) throws RegistryException{
+        QueryGenerator queryGenerator = new QueryGenerator(AbstractExperimentCatResource.CONFIGURATION);
+        queryGenerator.setParameter(AbstractExperimentCatResource.ConfigurationConstants.CONFIG_KEY, configkey);
+        EntityManager em = null;
+        try {
+            if(isConfigurationExist(configkey)){
+                em = getEntityManager();
+                em.getTransaction().begin();
+                Query q = queryGenerator.deleteQuery(em);
+                q.executeUpdate();
+                em.getTransaction().commit();
+                em.close();
+            }
+        }catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+
+    public static boolean isConfigurationExists(String configKey, String configVal) throws RegistryException{
+        EntityManager em = null;
+        try{
+            //Currently categoryID is hardcoded value
+            em = ExpCatResourceUtils.getEntityManager();
+            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, AbstractExperimentCatResource.ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE));
+            em.close();
+            return existing!= null;
+        } catch (Exception e){
+            logger.error(e.getMessage(), e);
+            throw new RegistryException(e);
+        }finally {
+            if (em != null && em.isOpen()){
+                if (em.getTransaction().isActive()){
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java
new file mode 100644
index 0000000..ead6d13
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ExperimentCatResource.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.registry.cpi.RegistryException;
+
+import java.util.List;
+
+public interface ExperimentCatResource {
+    /**
+     * This method will create associate resource objects for the given resource type.
+     * @param type child resource type
+     * @return associate child resource
+     */
+    ExperimentCatResource create(ResourceType type) throws RegistryException, RegistryException;
+
+    /**
+     * This method will remove the given child resource from the database
+     * @param type child resource type
+     * @param name child resource name
+     */
+    void remove(ResourceType type, Object name) throws RegistryException;
+
+    /**
+     *  This method will return the given child resource from the database
+     * @param type child resource type
+     * @param name child resource name
+     * @return associate child resource
+     */
+    ExperimentCatResource get(ResourceType type, Object name) throws RegistryException;
+
+    /**
+     * This method will list all the child resources for the given resource type
+     * @param type child resource type
+     * @return list of child resources of the given child resource type
+     */
+    List<ExperimentCatResource> get(ResourceType type) throws RegistryException;
+
+    /**
+     * This method will save the resource to the database.
+     */
+    void save() throws RegistryException;
+
+    /**
+     * This method will check whether an entry from the given resource type and resource name
+     * exists in the database
+     * @param type child resource type
+     * @param name child resource name
+     * @return whether the entry exists in the database or not
+     */
+    boolean isExists(ResourceType type, Object name) throws RegistryException;
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java
new file mode 100644
index 0000000..359c02c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/JPAConstants.java
@@ -0,0 +1,32 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.registry.core.experiment.catalog;
+public class JPAConstants {
+	public static final String KEY_JDBC_URL = "registry.jdbc.url";
+	public static final String KEY_JDBC_USER = "registry.jdbc.user";
+	public static final String KEY_JDBC_PASSWORD = "registry.jdbc.password";
+	public static final String KEY_JDBC_DRIVER = "registry.jdbc.driver";
+	public static final String KEY_DERBY_START_ENABLE = "start.derby.server.mode";
+    public static final String VALIDATION_QUERY = "validationQuery";
+    public static final String JPA_CACHE_SIZE = "jpa.cache.size";
+    public static final String ENABLE_CACHING = "cache.enable";
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ec8c6202/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java
new file mode 100644
index 0000000..8224cf3
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/ResourceType.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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.experiment.catalog;
+public enum ResourceType {
+    GATEWAY,
+    PROJECT,
+    USER,
+    PROJECT_USER,
+    CONFIGURATION,
+    GATEWAY_WORKER,
+    EXPERIMENT,
+    EXPERIMENT_SUMMARY,
+    NOTIFICATION_EMAIL,
+    EXPERIMENT_INPUT,
+    EXPERIMENT_OUTPUT,
+    WORKFLOW_NODE_DETAIL,
+    TASK_DETAIL,
+    ERROR_DETAIL,
+    APPLICATION_INPUT,
+    APPLICATION_OUTPUT,
+    NODE_INPUT,
+    NODE_OUTPUT,
+    JOB_DETAIL,
+    DATA_TRANSFER_DETAIL,
+    STATUS,
+    CONFIG_DATA,
+    COMPUTATIONAL_RESOURCE_SCHEDULING,
+    ADVANCE_INPUT_DATA_HANDLING,
+    ADVANCE_OUTPUT_DATA_HANDLING,
+    QOS_PARAM
+}


Mime
View raw message