airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [13/52] [abbrv] [partial] airavata git commit: registry refactoring
Date Thu, 04 Jun 2015 20:36:59 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/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..5bf98e4
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemAppCatalogResourceAppCat.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResourceFileSystem;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResourceFileSystem_PK;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ComputeResourceFileSystemAppCatalogResourceAppCat extends AppCatAbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(ComputeResourceFileSystemAppCatalogResourceAppCat.class);
+	private String computeResourceId;
+	private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+	private String path;
+	private String fileSystem;
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public AppCatalogResource get(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+			Query q = generator.selectQuery(em);
+			ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
+			ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = (ComputeResourceFileSystemAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+			em.getTransaction().commit();
+			em.close();
+			return computeResourceFileSystemResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+		List<AppCatalogResource> computeResourceFileSystemResources = new ArrayList<AppCatalogResource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			Query q;
+			if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+					ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = (ComputeResourceFileSystemAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+					computeResourceFileSystemResources.add(computeResourceFileSystemResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return computeResourceFileSystemResources;
+	}
+
+    @Override
+    public List<AppCatalogResource> getAll() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+    public List<String> getAllIds() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			Query q;
+			if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+					ComputeResourceFileSystemAppCatalogResourceAppCat computeResourceFileSystemResource = (ComputeResourceFileSystemAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+					computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return computeResourceFileSystemResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
+			em.close();
+			ComputeResourceFileSystem computeResourceFileSystem;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingComputeResourceFileSystem == null) {
+				computeResourceFileSystem = new ComputeResourceFileSystem();
+			} else {
+				computeResourceFileSystem = existingComputeResourceFileSystem;
+			}
+			computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
+			ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+			computeResourceFileSystem.setComputeResource(computeResource);
+			computeResourceFileSystem.setPath(getPath());
+			computeResourceFileSystem.setFileSystem(getFileSystem());
+			if (existingComputeResourceFileSystem == null) {
+				em.persist(computeResourceFileSystem);
+			} else {
+				em.merge(computeResourceFileSystem);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ComputeResourceFileSystem computeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID), ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM)));
+			em.close();
+			return computeResourceFileSystem != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getComputeResourceId() {
+		return computeResourceId;
+	}
+	
+	public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+		return computeHostResource;
+	}
+	
+	public String getPath() {
+		return path;
+	}
+	
+	public String getFileSystem() {
+		return fileSystem;
+	}
+	
+	public void setComputeResourceId(String computeResourceId) {
+		this.computeResourceId=computeResourceId;
+	}
+	
+	public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+		this.computeHostResource=computeHostResource;
+	}
+	
+	public void setPath(String path) {
+		this.path=path;
+	}
+	
+	public void setFileSystem(String fileSystem) {
+		this.fileSystem=fileSystem;
+	}
+}

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/resources/ComputeResourceFileSystemResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
new file mode 100644
index 0000000..7cbaac2
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
@@ -0,0 +1,307 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ComputeResourceFileSystemResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(ComputeResourceFileSystemResource.class);
+	private String computeResourceId;
+	private ComputeResourceResource computeHostResource;
+	private String path;
+	private String fileSystem;
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
+			Query q = generator.selectQuery(em);
+			ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
+			ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+			em.getTransaction().commit();
+			em.close();
+			return computeResourceFileSystemResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> computeResourceFileSystemResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			Query q;
+			if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+					ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+					computeResourceFileSystemResources.add(computeResourceFileSystemResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return computeResourceFileSystemResources;
+	}
+
+    @Override
+    public List<Resource> getAll() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+    public List<String> getAllIds() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
+			Query q;
+			if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
+					ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
+					computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return computeResourceFileSystemResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
+			em.close();
+			ComputeResourceFileSystem computeResourceFileSystem;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingComputeResourceFileSystem == null) {
+				computeResourceFileSystem = new ComputeResourceFileSystem();
+			} else {
+				computeResourceFileSystem = existingComputeResourceFileSystem;
+			}
+			computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
+			ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+			computeResourceFileSystem.setComputeResource(computeResource);
+			computeResourceFileSystem.setPath(getPath());
+			computeResourceFileSystem.setFileSystem(getFileSystem());
+			if (existingComputeResourceFileSystem == null) {
+				em.persist(computeResourceFileSystem);
+			} else {
+				em.merge(computeResourceFileSystem);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ComputeResourceFileSystem computeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID), ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM)));
+			em.close();
+			return computeResourceFileSystem != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getComputeResourceId() {
+		return computeResourceId;
+	}
+	
+	public ComputeResourceResource getComputeHostResource() {
+		return computeHostResource;
+	}
+	
+	public String getPath() {
+		return path;
+	}
+	
+	public String getFileSystem() {
+		return fileSystem;
+	}
+	
+	public void setComputeResourceId(String computeResourceId) {
+		this.computeResourceId=computeResourceId;
+	}
+	
+	public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+		this.computeHostResource=computeHostResource;
+	}
+	
+	public void setPath(String path) {
+		this.path=path;
+	}
+	
+	public void setFileSystem(String fileSystem) {
+		this.fileSystem=fileSystem;
+	}
+}

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/resources/ComputeResourceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
new file mode 100644
index 0000000..932713b
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
@@ -0,0 +1,351 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ComputeResourceResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(ComputeResourceResource.class);
+	private String resourceDescription;
+	private String resourceId;
+	private String hostName;
+    private Timestamp createdTime;
+    private Timestamp updatedTime;
+    private int maxMemoryPerNode;
+
+    public int getMaxMemoryPerNode() {
+        return maxMemoryPerNode;
+    }
+
+    public void setMaxMemoryPerNode(int maxMemoryPerNode) {
+        this.maxMemoryPerNode = maxMemoryPerNode;
+    }
+
+    public Timestamp getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Timestamp createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public Timestamp getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Timestamp updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+	public void remove(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+			generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+			generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
+			Query q = generator.selectQuery(em);
+			ComputeResource computeResource = (ComputeResource) q.getSingleResult();
+			ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+			em.getTransaction().commit();
+			em.close();
+			return computeResourceResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> computeResourceResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+			Query q;
+			if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ComputeResource computeResource = (ComputeResource) result;
+					ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+					computeResourceResources.add(computeResourceResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return computeResourceResources;
+	}
+
+    @Override
+    public List<Resource> getAll() throws AppCatalogException {
+        List<Resource> computeResourceResources = new ArrayList<Resource>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+            Query q = generator.selectQuery(em);
+            List<?> results = q.getResultList();
+            for (Object result : results) {
+                ComputeResource computeResource = (ComputeResource) result;
+                ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+                computeResourceResources.add(computeResourceResource);
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return computeResourceResources;
+    }
+
+    @Override
+    public List<String> getAllIds() throws AppCatalogException {
+        List<String> computeResourceResources = new ArrayList<String>();
+        EntityManager em = null;
+        try {
+            em = AppCatalogJPAUtils.getEntityManager();
+            em.getTransaction().begin();
+            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+            Query q = generator.selectQuery(em);
+            List<?> results = q.getResultList();
+            for (Object result : results) {
+                ComputeResource computeResource = (ComputeResource) result;
+                computeResourceResources.add(computeResource.getResourceId());
+            }
+            em.getTransaction().commit();
+            em.close();
+        } catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+            throw new AppCatalogException(e);
+        } finally {
+            if (em != null && em.isOpen()) {
+                if (em.getTransaction().isActive()) {
+                    em.getTransaction().rollback();
+                }
+                em.close();
+            }
+        }
+        return computeResourceResources;
+    }
+
+    @Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> computeResourceResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
+			Query q;
+			if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					ComputeResource computeResource = (ComputeResource) result;
+					ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
+					computeResourceResourceIDs.add(computeResourceResource.getResourceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return computeResourceResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ComputeResource existingComputeResource = em.find(ComputeResource.class, resourceId);
+			em.close();
+			ComputeResource computeResource;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingComputeResource == null) {
+				computeResource = new ComputeResource();
+                computeResource.setCreationTime(AiravataUtils.getCurrentTimestamp());
+			} else {
+				computeResource = existingComputeResource;
+                computeResource.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+			}
+			computeResource.setResourceDescription(getResourceDescription());
+			computeResource.setResourceId(getResourceId());
+			computeResource.setHostName(getHostName());
+			computeResource.setMaxMemoryPerNode(getMaxMemoryPerNode());
+			if (existingComputeResource == null) {
+				em.persist(computeResource);
+			} else {
+				em.merge(computeResource);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			ComputeResource computeResource = em.find(ComputeResource.class, identifier);
+			em.close();
+			return computeResource != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getResourceDescription() {
+		return resourceDescription;
+	}
+	
+	public String getResourceId() {
+		return resourceId;
+	}
+	
+	public String getHostName() {
+		return hostName;
+	}
+	
+	public void setResourceDescription(String resourceDescription) {
+		this.resourceDescription=resourceDescription;
+	}
+	
+	public void setResourceId(String resourceId) {
+		this.resourceId=resourceId;
+	}
+	
+	public void setHostName(String hostName) {
+		this.hostName=hostName;
+	}
+}
\ No newline at end of file

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/resources/DataMovementInterfaceAppCatalogResourceAppCat.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceAppCatalogResourceAppCat.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceAppCatalogResourceAppCat.java
new file mode 100644
index 0000000..3d24829
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceAppCatalogResourceAppCat.java
@@ -0,0 +1,339 @@
+/*
+ *
+ * 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.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.registry.core.app.catalog.model.ComputeResource;
+import org.apache.airavata.registry.core.app.catalog.model.DataMovementInterface;
+import org.apache.airavata.registry.core.app.catalog.model.DataMovementInterface_PK;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator;
+import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataMovementInterfaceAppCatalogResourceAppCat extends AppCatAbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(DataMovementInterfaceAppCatalogResourceAppCat.class);
+	private String computeResourceId;
+	private ComputeResourceAppCatalogResourceAppCat computeHostResource;
+	private String dataMovementProtocol;
+	private String dataMovementInterfaceId;
+	private int priorityOrder;
+    private Timestamp createdTime;
+    private Timestamp updatedTime;
+
+    public Timestamp getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Timestamp createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public Timestamp getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Timestamp updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public AppCatalogResource get(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+			Query q = generator.selectQuery(em);
+			DataMovementInterface dataMovementInterface = (DataMovementInterface) q.getSingleResult();
+			DataMovementInterfaceAppCatalogResourceAppCat dataMovementInterfaceResource = (DataMovementInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+			em.getTransaction().commit();
+			em.close();
+			return dataMovementInterfaceResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<AppCatalogResource> get(String fieldName, Object value) throws AppCatalogException {
+		List<AppCatalogResource> dataMovementInterfaceResources = new ArrayList<AppCatalogResource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			Query q;
+			if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+					DataMovementInterfaceAppCatalogResourceAppCat dataMovementInterfaceResource = (DataMovementInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+					dataMovementInterfaceResources.add(dataMovementInterfaceResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return dataMovementInterfaceResources;
+	}
+
+    @Override
+    public List<AppCatalogResource> getAll() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+    public List<String> getAllIds() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> dataMovementInterfaceResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			Query q;
+			if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+					DataMovementInterfaceAppCatalogResourceAppCat dataMovementInterfaceResource = (DataMovementInterfaceAppCatalogResourceAppCat) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+					dataMovementInterfaceResourceIDs.add(dataMovementInterfaceResource.getComputeResourceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return dataMovementInterfaceResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
+			em.close();
+			DataMovementInterface dataMovementInterface;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingDataMovementInterface == null) {
+				dataMovementInterface = new DataMovementInterface();
+                dataMovementInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+			} else {
+				dataMovementInterface = existingDataMovementInterface;
+                dataMovementInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+			}
+			dataMovementInterface.setComputeResourceId(getComputeResourceId());
+			ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+			dataMovementInterface.setComputeResource(computeResource);
+			dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
+			dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
+			dataMovementInterface.setPriorityOrder(getPriorityOrder());
+			if (existingDataMovementInterface == null) {
+				em.persist(dataMovementInterface);
+			} else {
+				em.merge(dataMovementInterface);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID), ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)));
+			em.close();
+			return dataMovementInterface != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getComputeResourceId() {
+		return computeResourceId;
+	}
+	
+	public ComputeResourceAppCatalogResourceAppCat getComputeHostResource() {
+		return computeHostResource;
+	}
+	
+	public String getDataMovementProtocol() {
+		return dataMovementProtocol;
+	}
+	
+	public String getDataMovementInterfaceId() {
+		return dataMovementInterfaceId;
+	}
+	
+	public int getPriorityOrder() {
+		return priorityOrder;
+	}
+	
+	public void setComputeResourceId(String computeResourceId) {
+		this.computeResourceId=computeResourceId;
+	}
+	
+	public void setComputeHostResource(ComputeResourceAppCatalogResourceAppCat computeHostResource) {
+		this.computeHostResource=computeHostResource;
+	}
+	
+	public void setDataMovementProtocol(String dataMovementProtocol) {
+		this.dataMovementProtocol=dataMovementProtocol;
+	}
+	
+	public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+		this.dataMovementInterfaceId=dataMovementInterfaceId;
+	}
+	
+	public void setPriorityOrder(int priorityOrder) {
+		this.priorityOrder=priorityOrder;
+	}
+}

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/resources/DataMovementInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
new file mode 100644
index 0000000..267cd23
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
@@ -0,0 +1,339 @@
+/*
+ *
+ * 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.aiaravata.application.catalog.data.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface;
+import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface_PK;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataMovementInterfaceResource extends AbstractResource {
+	private final static Logger logger = LoggerFactory.getLogger(DataMovementInterfaceResource.class);
+	private String computeResourceId;
+	private ComputeResourceResource computeHostResource;
+	private String dataMovementProtocol;
+	private String dataMovementInterfaceId;
+	private int priorityOrder;
+    private Timestamp createdTime;
+    private Timestamp updatedTime;
+
+    public Timestamp getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Timestamp createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public Timestamp getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Timestamp updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+	
+	@Override
+	public void remove(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+			Query q = generator.deleteQuery(em);
+			q.executeUpdate();
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public Resource get(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
+			generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
+			Query q = generator.selectQuery(em);
+			DataMovementInterface dataMovementInterface = (DataMovementInterface) q.getSingleResult();
+			DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+			em.getTransaction().commit();
+			em.close();
+			return dataMovementInterfaceResource;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+		List<Resource> dataMovementInterfaceResources = new ArrayList<Resource>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			Query q;
+			if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+					DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+					dataMovementInterfaceResources.add(dataMovementInterfaceResource);
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return dataMovementInterfaceResources;
+	}
+
+    @Override
+    public List<Resource> getAll() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+    public List<String> getAllIds() throws AppCatalogException {
+        return null;
+    }
+
+    @Override
+	public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+		List<String> dataMovementInterfaceResourceIDs = new ArrayList<String>();
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
+			Query q;
+			if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
+				generator.setParameter(fieldName, value);
+				q = generator.selectQuery(em);
+				List<?> results = q.getResultList();
+				for (Object result : results) {
+					DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
+					DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
+					dataMovementInterfaceResourceIDs.add(dataMovementInterfaceResource.getComputeResourceId());
+				}
+			} else {
+				em.getTransaction().commit();
+					em.close();
+				logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
+				throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+		return dataMovementInterfaceResourceIDs;
+	}
+	
+	@Override
+	public void save() throws AppCatalogException {
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
+			em.close();
+			DataMovementInterface dataMovementInterface;
+			em = AppCatalogJPAUtils.getEntityManager();
+			em.getTransaction().begin();
+			if (existingDataMovementInterface == null) {
+				dataMovementInterface = new DataMovementInterface();
+                dataMovementInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
+			} else {
+				dataMovementInterface = existingDataMovementInterface;
+                dataMovementInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+			}
+			dataMovementInterface.setComputeResourceId(getComputeResourceId());
+			ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
+			dataMovementInterface.setComputeResource(computeResource);
+			dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
+			dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
+			dataMovementInterface.setPriorityOrder(getPriorityOrder());
+			if (existingDataMovementInterface == null) {
+				em.persist(dataMovementInterface);
+			} else {
+				em.merge(dataMovementInterface);
+			}
+			em.getTransaction().commit();
+			em.close();
+		} catch (Exception e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	@Override
+	public boolean isExists(Object identifier) throws AppCatalogException {
+		HashMap<String, String> ids;
+		if (identifier instanceof Map) {
+			ids = (HashMap<String, String>) identifier;
+		} else {
+			logger.error("Identifier should be a map with the field name and it's value");
+			throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+		}
+		EntityManager em = null;
+		try {
+			em = AppCatalogJPAUtils.getEntityManager();
+			DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID), ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)));
+			em.close();
+			return dataMovementInterface != null;
+		} catch (ApplicationSettingsException e) {
+			logger.error(e.getMessage(), e);
+			throw new AppCatalogException(e);
+		} finally {
+			if (em != null && em.isOpen()) {
+				if (em.getTransaction().isActive()) {
+					em.getTransaction().rollback();
+				}
+				em.close();
+			}
+		}
+	}
+	
+	public String getComputeResourceId() {
+		return computeResourceId;
+	}
+	
+	public ComputeResourceResource getComputeHostResource() {
+		return computeHostResource;
+	}
+	
+	public String getDataMovementProtocol() {
+		return dataMovementProtocol;
+	}
+	
+	public String getDataMovementInterfaceId() {
+		return dataMovementInterfaceId;
+	}
+	
+	public int getPriorityOrder() {
+		return priorityOrder;
+	}
+	
+	public void setComputeResourceId(String computeResourceId) {
+		this.computeResourceId=computeResourceId;
+	}
+	
+	public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+		this.computeHostResource=computeHostResource;
+	}
+	
+	public void setDataMovementProtocol(String dataMovementProtocol) {
+		this.dataMovementProtocol=dataMovementProtocol;
+	}
+	
+	public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
+		this.dataMovementInterfaceId=dataMovementInterfaceId;
+	}
+	
+	public void setPriorityOrder(int priorityOrder) {
+		this.priorityOrder=priorityOrder;
+	}
+}

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/resources/DataMovementProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
new file mode 100644
index 0000000..441b56c
--- /dev/null
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
@@ -0,0 +1,360 @@
+///**
+// * 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.aiaravata.application.catalog.data.resources;
+//
+//import org.apache.airavata.registry.cpi.AppCatalogException;
+//import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocol;
+//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocolPK;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
+//import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
+//import org.apache.airavata.common.exception.ApplicationSettingsException;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//import javax.persistence.EntityManager;
+//import javax.persistence.Query;
+//import java.util.ArrayList;
+//import java.util.HashMap;
+//import java.util.List;
+//import java.util.Map;
+//
+//public class DataMovementProtocolResource extends AbstractResource {
+//
+//    private final static Logger logger = LoggerFactory.getLogger(DataMovementProtocolResource.class);
+//
+//    private String resourceID;
+//    private String dataMoveID;
+//    private String dataMoveType;
+//    private ComputeResourceResource computeHostResource;
+//
+//    public void remove(Object identifier) throws AppCatalogException {
+//        HashMap<String, String> ids;
+//        if (identifier instanceof Map) {
+//            ids = (HashMap) identifier;
+//        } else {
+//            logger.error("Identifier should be a map with the field name and it's value");
+//            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+//        }
+//
+//        EntityManager em = null;
+//        try {
+//            em = AppCatalogJPAUtils.getEntityManager();
+//            em.getTransaction().begin();
+//            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
+//            generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
+//            generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
+//            generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_ID));
+//            Query q = generator.deleteQuery(em);
+//            q.executeUpdate();
+//            em.getTransaction().commit();
+//            em.close();
+//        } catch (ApplicationSettingsException e) {
+//            logger.error(e.getMessage(), e);
+//            throw new AppCatalogException(e);
+//        } finally {
+//            if (em != null && em.isOpen()) {
+//                if (em.getTransaction().isActive()) {
+//                    em.getTransaction().rollback();
+//                }
+//                em.close();
+//            }
+//        }
+//    }
+//
+//    public Resource get(Object identifier) throws AppCatalogException {
+//        HashMap<String, String> ids;
+//        if (identifier instanceof Map) {
+//            ids = (HashMap) identifier;
+//        } else {
+//            logger.error("Identifier should be a map with the field name and it's value");
+//            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+//        }
+//
+//        EntityManager em = null;
+//        try {
+//            em = AppCatalogJPAUtils.getEntityManager();
+//            em.getTransaction().begin();
+//            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
+//            generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
+//            generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
+//            generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_ID));
+//            Query q = generator.selectQuery(em);
+//            DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) q.getSingleResult();
+//            DataMovementProtocolResource dataMovementProtocolResource =
+//                    (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+//            em.getTransaction().commit();
+//            em.close();
+//            return dataMovementProtocolResource;
+//        } catch (ApplicationSettingsException e) {
+//            logger.error(e.getMessage(), e);
+//            throw new AppCatalogException(e);
+//        } finally {
+//            if (em != null && em.isOpen()) {
+//                if (em.getTransaction().isActive()) {
+//                    em.getTransaction().rollback();
+//                }
+//                em.close();
+//            }
+//        }
+//    }
+//
+//    public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
+//        List<Resource> dataMoveProtocolResourcesList = new ArrayList<Resource>();
+//        EntityManager em = null;
+//        try {
+//            em = AppCatalogJPAUtils.getEntityManager();
+//            em.getTransaction().begin();
+//            Query q;
+//            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
+//            List results;
+//            if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
+//                generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+//                        DataMovementProtocolResource dataMovementProtocolResource =
+//                                (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+//                        dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
+//                    }
+//                }
+//            } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
+//                generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+//                        DataMovementProtocolResource dataMovementProtocolResource =
+//                                (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+//                        dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
+//                    }
+//                }
+//            } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
+//                generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+//                        DataMovementProtocolResource dataMovementProtocolResource =
+//                                (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
+//                        dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
+//                    }
+//                }
+//            } else {
+//                em.getTransaction().commit();
+//                em.close();
+//                logger.error("Unsupported field name for Data Movement Protocol Resource.", new IllegalArgumentException());
+//                throw new IllegalArgumentException("Unsupported field name for Data Movement Protocol Resource.");
+//            }
+//            em.getTransaction().commit();
+//            em.close();
+//        } catch (Exception e) {
+//            logger.error(e.getMessage(), e);
+//            throw new AppCatalogException(e);
+//        } finally {
+//            if (em != null && em.isOpen()) {
+//                if (em.getTransaction().isActive()) {
+//                    em.getTransaction().rollback();
+//                }
+//                em.close();
+//            }
+//        }
+//        return dataMoveProtocolResourcesList;
+//    }
+//
+//    @Override
+//    public List<Resource> getAll() throws AppCatalogException {
+//        return null;
+//    }
+//
+//    @Override
+//    public List<String> getAllIds() throws AppCatalogException {
+//        return null;
+//    }
+//
+//    public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
+//        List<String> dataMovementProtocolIDs = new ArrayList<String>();
+//        EntityManager em = null;
+//        try {
+//            em = AppCatalogJPAUtils.getEntityManager();
+//            em.getTransaction().begin();
+//            Query q;
+//            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
+//            List results;
+//            if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
+//                generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+//                        dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
+//                    }
+//                }
+//            } else if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
+//                generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+//                        dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
+//                    }
+//                }
+//            } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
+//                generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
+//                q = generator.selectQuery(em);
+//                results = q.getResultList();
+//                if (results.size() != 0) {
+//                    for (Object result : results) {
+//                        DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
+//                        dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
+//                    }
+//                }
+//            } else {
+//                em.getTransaction().commit();
+//                em.close();
+//                logger.error("Unsupported field name for Data Move Protocol resource.", new IllegalArgumentException());
+//                throw new IllegalArgumentException("Unsupported field name for Data Move Protocol Resource.");
+//            }
+//            em.getTransaction().commit();
+//            em.close();
+//        } catch (Exception e) {
+//            logger.error(e.getMessage(), e);
+//            throw new AppCatalogException(e);
+//        } finally {
+//            if (em != null && em.isOpen()) {
+//                if (em.getTransaction().isActive()) {
+//                    em.getTransaction().rollback();
+//                }
+//                em.close();
+//            }
+//        }
+//        return dataMovementProtocolIDs;
+//    }
+//
+//    public void save() throws AppCatalogException {
+//        EntityManager em = null;
+//        try {
+//            em = AppCatalogJPAUtils.getEntityManager();
+//            DataMovementProtocol existingDataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(resourceID, dataMoveID, dataMoveType));
+//            em.close();
+//
+//            em = AppCatalogJPAUtils.getEntityManager();
+//            em.getTransaction().begin();
+//            if (existingDataMovementProtocol != null) {
+//                existingDataMovementProtocol.setDataMoveID(dataMoveType);
+//                existingDataMovementProtocol.setDataMoveID(dataMoveID);
+//                ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+//                existingDataMovementProtocol.setComputeResource(computeResource);
+//                existingDataMovementProtocol.setResourceID(resourceID);
+//                em.merge(existingDataMovementProtocol);
+//            } else {
+//                DataMovementProtocol dataMovementProtocol = new DataMovementProtocol();
+//                dataMovementProtocol.setDataMoveType(dataMoveType);
+//                dataMovementProtocol.setDataMoveID(dataMoveID);
+//                dataMovementProtocol.setResourceID(resourceID);
+//                ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
+//                dataMovementProtocol.setComputeResource(computeResource);
+//                em.persist(dataMovementProtocol);
+//            }
+//            em.getTransaction().commit();
+//            em.close();
+//        } catch (Exception e) {
+//            logger.error(e.getMessage(), e);
+//            throw new AppCatalogException(e);
+//        } finally {
+//            if (em != null && em.isOpen()) {
+//                if (em.getTransaction().isActive()) {
+//                    em.getTransaction().rollback();
+//                }
+//                em.close();
+//            }
+//        }
+//    }
+//
+//    public boolean isExists(Object identifier) throws AppCatalogException {
+//        HashMap<String, String> ids;
+//        if (identifier instanceof Map) {
+//            ids = (HashMap) identifier;
+//        } else {
+//            logger.error("Identifier should be a map with the field name and it's value");
+//            throw new AppCatalogException("Identifier should be a map with the field name and it's value");
+//        }
+//
+//        EntityManager em = null;
+//        try {
+//            em = AppCatalogJPAUtils.getEntityManager();
+//            DataMovementProtocol dataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(
+//                    ids.get(DataMoveProtocolConstants.RESOURCE_ID),
+//                    ids.get(DataMoveProtocolConstants.DATA_MOVE_ID), ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE)));
+//
+//            em.close();
+//            return dataMovementProtocol != null;
+//        } catch (ApplicationSettingsException e) {
+//            logger.error(e.getMessage(), e);
+//            throw new AppCatalogException(e);
+//        } finally {
+//            if (em != null && em.isOpen()) {
+//                if (em.getTransaction().isActive()) {
+//                    em.getTransaction().rollback();
+//                }
+//                em.close();
+//            }
+//        }
+//    }
+//
+//    public String getResourceID() {
+//        return resourceID;
+//    }
+//
+//    public void setResourceID(String resourceID) {
+//        this.resourceID = resourceID;
+//    }
+//
+//    public String getDataMoveID() {
+//        return dataMoveID;
+//    }
+//
+//    public void setDataMoveID(String dataMoveID) {
+//        this.dataMoveID = dataMoveID;
+//    }
+//
+//    public String getDataMoveType() {
+//        return dataMoveType;
+//    }
+//
+//    public void setDataMoveType(String dataMoveType) {
+//        this.dataMoveType = dataMoveType;
+//    }
+//
+//    public ComputeResourceResource getComputeHostResource() {
+//        return computeHostResource;
+//    }
+//
+//    public void setComputeHostResource(ComputeResourceResource computeHostResource) {
+//        this.computeHostResource = computeHostResource;
+//    }
+//}


Mime
View raw message