You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2017/11/17 23:57:32 UTC

[airavata-sandbox] branch master updated (816f733 -> 50534be)

This is an automated email from the ASF dual-hosted git repository.

smarru pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git.


    from 816f733  Merge pull request #11 from nikchett/master
     new 03fe760  Added Added initial files for entities,repositories for allocation manager module
     new 9a46bf2  Revert "Added Added initial files for entities,repositories for allocation manager module"
     new 08d3b60  Added entities,repositories,utils and updated pom file
     new 676140d  Revert "Added entities,repositories,utils and updated pom file"
     new 50534be  Added entities,repositories,utils and updated pom file

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                                         |  34 ++--
 .../airavata-allocation-manager-server/pom.xml     |  64 ++++--
 .../manager/db/entities/DomainEntity.java          | 116 +++++++++++
 .../manager/db/entities/RequestStatusEntity.java   |  78 ++++++++
 .../db/entities/UserAllocationDetailEntity.java    | 205 ++++++++++++++++++++
 .../db/entities/UserAllocationDetailEntityPK.java  |  57 ++++++
 .../manager/db/entities/UserDetailEntity.java      |  78 ++++++++
 .../db/repositories/AbstractRepository.java        | 163 ++++++++++++++++
 .../manager/db/repositories/DomainRepository.java  |  25 +--
 .../db/repositories/RequestStatusRepository.java   |  14 ++
 .../UserAllocationDetailPKRepository.java          |  14 ++
 .../UserAllocationDetailRepository.java            |  14 ++
 .../db/repositories/UserDetailRepository.java      |  19 ++
 .../allocation/manager/db/utils/Committer.java     |  13 +-
 .../manager/db}/utils/ConnectionPool.java          |  24 +--
 .../allocation/manager/db/utils/DBConstants.java   | 106 ++++++++++
 .../manager/db}/utils/DatabaseCreator.java         |  46 +++--
 .../allocation/manager/db/utils/JPAUtils.java      | 215 +++++++++++++++++++++
 .../allocation/manager/db}/utils/JdbcStorage.java  |  20 +-
 .../manager/db/utils/ObjectMapperSingleton.java    |  26 +--
 .../airavata/allocation/manager/models/Domain.java |   5 +
 21 files changed, 1228 insertions(+), 108 deletions(-)
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
 copy orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/ExperimentRequest.java => allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java (69%)
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
 copy gfac-refactoring/gfac-schema/src/main/java/org/apache/airavata/commons/gfac/type/Type.java => allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java (85%)
 copy {registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services => allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db}/utils/ConnectionPool.java (95%)
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java
 copy {registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services => allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db}/utils/DatabaseCreator.java (90%)
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java
 copy {registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services => allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db}/utils/JdbcStorage.java (95%)
 copy orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/ExperimentRequest.java => allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java (67%)
 create mode 100644 allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java

-- 
To stop receiving notification emails like this one, please contact
['"commits@airavata.apache.org" <co...@airavata.apache.org>'].

[airavata-sandbox] 03/05: Added entities, repositories, utils and updated pom file

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git

commit 08d3b60460520eab19a35e297d230521b7d24d89
Author: Harsha Phulwani <ha...@gmail.com>
AuthorDate: Fri Nov 17 18:10:58 2017 -0500

    Added entities,repositories,utils and updated pom file
---
 .gitignore                                         |  30 +-
 .../airavata-allocation-manager-server/pom.xml     |  64 +++-
 .../manager/db/entities/DomainEntity.java          | 116 +++++++
 .../manager/db/entities/RequestStatusEntity.java   |  78 +++++
 .../db/entities/UserAllocationDetailEntity.java    | 205 +++++++++++
 .../db/entities/UserAllocationDetailEntityPK.java  |  57 +++
 .../manager/db/entities/UserDetailEntity.java      |  78 +++++
 .../db/repositories/AbstractRepository.java        | 163 +++++++++
 .../manager/db/repositories/DomainRepository.java  |  33 ++
 .../db/repositories/RequestStatusRepository.java   |  14 +
 .../UserAllocationDetailPKRepository.java          |  14 +
 .../UserAllocationDetailRepository.java            |  14 +
 .../db/repositories/UserDetailRepository.java      |  19 +
 .../allocation/manager/db/utils/Committer.java     |  26 ++
 .../manager/db/utils/ConnectionPool.java           | 381 +++++++++++++++++++++
 .../allocation/manager/db/utils/DBConstants.java   | 106 ++++++
 .../manager/db/utils/DatabaseCreator.java          | 352 +++++++++++++++++++
 .../allocation/manager/db/utils/JPAUtils.java      | 215 ++++++++++++
 .../allocation/manager/db/utils/JdbcStorage.java   | 174 ++++++++++
 .../manager/db/utils/ObjectMapperSingleton.java    |  38 ++
 .../airavata/allocation/manager/models/Domain.java |   5 +
 bin/README.txt                                     |  16 +
 bin/build.xml                                      |  53 +++
 bin/db.config                                      |  24 ++
 .../airavata/jobsubmission/gram/errors.properties  | 176 ++++++++++
 25 files changed, 2424 insertions(+), 27 deletions(-)

diff --git a/.gitignore b/.gitignore
index d6e588b..db19882 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,11 @@
+# Compiled class file
 *.class
-*id_rsa*
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
 
 # Mobile Tools for Java (J2ME)
 .mtj.tmp/
@@ -8,18 +14,18 @@
 *.jar
 *.war
 *.ear
-
-
-target/
-.idea/
-tmp/
-logs/
-gaussian_sample/
-*.ser
-*.iml
-*.gen
+*.zip
+*.tar.gz
+*.rar
 
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*
-solr-server/logs/solr.log
+
+# Ignore files ending with target
+*target/
+
+# Ignore files starting with dot
+.*
+!.gitignore
+
 
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
index 86dd4fc..8cb41b4 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
@@ -1,21 +1,55 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.airavata</groupId>
-    <artifactId>airavata-allocation-manager</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-  </parent>
-  <artifactId>airavata-allocation-manager-server</artifactId>
-  <dependencies>
-		<dependency>
-			<groupId>org.apache.thrift</groupId>
-			<artifactId>libthrift</artifactId>
-			<version>0.10.0</version>
-		</dependency>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.airavata</groupId>
+		<artifactId>airavata-allocation-manager</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>
+	<artifactId>airavata-allocation-manager-server</artifactId>
+	<dependencies>
 		<dependency>
 			<groupId>org.apache.airavata</groupId>
 			<artifactId>airavata-allocation-manager-stubs</artifactId>
 			<version>0.0.1-SNAPSHOT</version>
 		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.7.10</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.dozer</groupId>
+			<artifactId>dozer</artifactId>
+			<version>5.4.0</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.slf4j</groupId>
+					<artifactId>slf4j-log4j12</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.openjpa</groupId>
+			<artifactId>openjpa-all</artifactId>
+			<version>2.2.0</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.34</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
+		<dependency>
+			<groupId>org.apache.thrift</groupId>
+			<artifactId>libthrift</artifactId>
+			<version>0.10.0</version>
+			<type>pom</type>
+		</dependency>
 	</dependencies>
-</project>
\ No newline at end of file
+	<properties>
+		<maven.compiler.source>1.8</maven.compiler.source>
+		<maven.compiler.target>1.8</maven.compiler.target>
+	</properties>
+</project> 
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java
new file mode 100644
index 0000000..2aed6f9
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java
@@ -0,0 +1,116 @@
+/**
+ *
+ * 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.allocation.manager.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "DOMAIN", schema = "" )
+public class DomainEntity {
+    private final static Logger logger = LoggerFactory.getLogger(DomainEntity.class);
+    private String domainId;
+    private String name;
+    private String description;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        DomainEntity that = (DomainEntity) o;
+
+        if (getDomainId() != null ? !getDomainId().equals(that.getDomainId()) : that.getDomainId() != null)
+            return false;
+        if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;
+        if (getDescription() != null ? !getDescription().equals(that.getDescription()) : that.getDescription() != null)
+            return false;
+        if (getCreatedTime() != null ? !getCreatedTime().equals(that.getCreatedTime()) : that.getCreatedTime() != null)
+            return false;
+        if (getUpdatedTime() != null ? !getUpdatedTime().equals(that.getUpdatedTime()) : that.getUpdatedTime() != null)
+            return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = getDomainId() != null ? getDomainId().hashCode() : 0;
+        result = 31 * result + (getName() != null ? getName().hashCode() : 0);
+        result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
+        result = 31 * result + (getCreatedTime() != null ? getCreatedTime().hashCode() : 0);
+        result = 31 * result + (getUpdatedTime() != null ? getUpdatedTime().hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
new file mode 100644
index 0000000..42ccc4a
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
@@ -0,0 +1,78 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the REQUEST_STATUS database table.
+ * 
+ */
+@Entity
+@Table(name="REQUEST_STATUS")
+@NamedQuery(name="RequestStatusEntity.findAll", query="SELECT r FROM RequestStatusEntity r")
+public class RequestStatusEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="PROJECT_ID")
+	private String projectId;
+
+	@Column(name="END_DATE")
+	private BigInteger endDate;
+
+	@Lob
+	@Column(name="REVIEWERS")
+	private String reviewers;
+
+	@Column(name="START_DATE")
+	private BigInteger startDate;
+
+	@Column(name="STATUS")
+	private String status;
+
+	public RequestStatusEntity() {
+	}
+
+	public String getProjectId() {
+		return this.projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+
+	public BigInteger getEndDate() {
+		return this.endDate;
+	}
+
+	public void setEndDate(BigInteger endDate) {
+		this.endDate = endDate;
+	}
+
+	public String getReviewers() {
+		return this.reviewers;
+	}
+
+	public void setReviewers(String reviewers) {
+		this.reviewers = reviewers;
+	}
+
+	public BigInteger getStartDate() {
+		return this.startDate;
+	}
+
+	public void setStartDate(BigInteger startDate) {
+		this.startDate = startDate;
+	}
+
+	public String getStatus() {
+		return this.status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
new file mode 100644
index 0000000..35ab18d
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
@@ -0,0 +1,205 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the USER_ALLOCATION_DETAILS database table.
+ * 
+ */
+@Entity
+@Table(name="USER_ALLOCATION_DETAILS")
+@NamedQuery(name="UserAllocationDetailEntity.findAll", query="SELECT u FROM UserAllocationDetailEntity u")
+public class UserAllocationDetailEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@EmbeddedId
+	private UserAllocationDetailEntityPK id;
+
+	@Lob
+	@Column(name="APPLICATIONS_TO_BE_USED")
+	private String applicationsToBeUsed;
+
+	@Column(name="DISK_USAGE_RANGE_PER_JOB")
+	private BigInteger diskUsageRangePerJob;
+
+	@Lob
+	@Column(name="DOCUMENTS")
+	private byte[] documents;
+
+	@Lob
+	@Column(name="FIELD_OF_SCIENCE")
+	private String fieldOfScience;
+
+	@Lob
+	@Column(name="KEYWORDS")
+	private String keywords;
+
+	@Column(name="MAX_MEMORY_PER_CPU")
+	private BigInteger maxMemoryPerCpu;
+
+	@Column(name="NUMBER_OF_CPU_PER_JOB")
+	private BigInteger numberOfCpuPerJob;
+
+	@Lob
+	@Column(name="PROJECT_DESCRIPTION")
+	private String projectDescription;
+
+	@Lob
+	@Column(name="PROJECT_REVIEWED_AND_FUNDED_BY")
+	private String projectReviewedAndFundedBy;
+
+	@Column(name="REQ_DATE")
+	private BigInteger reqDate;
+
+	@Column(name="SERVICE_UNITS")
+	private BigInteger serviceUnits;
+
+	@Lob
+	@Column(name="SPECIFIC_RESOURCE_SELECTION")
+	private String specificResourceSelection;
+
+	@Lob
+	@Column(name="TITLE")
+	private String title;
+
+	@Column(name="TYPE_OF_ALLOCATION")
+	private String typeOfAllocation;
+
+	@Column(name="TYPICAL_SU_PER_JOB")
+	private BigInteger typicalSuPerJob;
+
+	public UserAllocationDetailEntity() {
+	}
+
+	public UserAllocationDetailEntityPK getId() {
+		return this.id;
+	}
+
+	public void setId(UserAllocationDetailEntityPK id) {
+		this.id = id;
+	}
+
+	public String getApplicationsToBeUsed() {
+		return this.applicationsToBeUsed;
+	}
+
+	public void setApplicationsToBeUsed(String applicationsToBeUsed) {
+		this.applicationsToBeUsed = applicationsToBeUsed;
+	}
+
+	public BigInteger getDiskUsageRangePerJob() {
+		return this.diskUsageRangePerJob;
+	}
+
+	public void setDiskUsageRangePerJob(BigInteger diskUsageRangePerJob) {
+		this.diskUsageRangePerJob = diskUsageRangePerJob;
+	}
+
+	public byte[] getDocuments() {
+		return this.documents;
+	}
+
+	public void setDocuments(byte[] documents) {
+		this.documents = documents;
+	}
+
+	public String getFieldOfScience() {
+		return this.fieldOfScience;
+	}
+
+	public void setFieldOfScience(String fieldOfScience) {
+		this.fieldOfScience = fieldOfScience;
+	}
+
+	public String getKeywords() {
+		return this.keywords;
+	}
+
+	public void setKeywords(String keywords) {
+		this.keywords = keywords;
+	}
+
+	public BigInteger getMaxMemoryPerCpu() {
+		return this.maxMemoryPerCpu;
+	}
+
+	public void setMaxMemoryPerCpu(BigInteger maxMemoryPerCpu) {
+		this.maxMemoryPerCpu = maxMemoryPerCpu;
+	}
+
+	public BigInteger getNumberOfCpuPerJob() {
+		return this.numberOfCpuPerJob;
+	}
+
+	public void setNumberOfCpuPerJob(BigInteger numberOfCpuPerJob) {
+		this.numberOfCpuPerJob = numberOfCpuPerJob;
+	}
+
+	public String getProjectDescription() {
+		return this.projectDescription;
+	}
+
+	public void setProjectDescription(String projectDescription) {
+		this.projectDescription = projectDescription;
+	}
+
+	public String getProjectReviewedAndFundedBy() {
+		return this.projectReviewedAndFundedBy;
+	}
+
+	public void setProjectReviewedAndFundedBy(String projectReviewedAndFundedBy) {
+		this.projectReviewedAndFundedBy = projectReviewedAndFundedBy;
+	}
+
+	public BigInteger getReqDate() {
+		return this.reqDate;
+	}
+
+	public void setReqDate(BigInteger reqDate) {
+		this.reqDate = reqDate;
+	}
+
+	public BigInteger getServiceUnits() {
+		return this.serviceUnits;
+	}
+
+	public void setServiceUnits(BigInteger serviceUnits) {
+		this.serviceUnits = serviceUnits;
+	}
+
+	public String getSpecificResourceSelection() {
+		return this.specificResourceSelection;
+	}
+
+	public void setSpecificResourceSelection(String specificResourceSelection) {
+		this.specificResourceSelection = specificResourceSelection;
+	}
+
+	public String getTitle() {
+		return this.title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getTypeOfAllocation() {
+		return this.typeOfAllocation;
+	}
+
+	public void setTypeOfAllocation(String typeOfAllocation) {
+		this.typeOfAllocation = typeOfAllocation;
+	}
+
+	public BigInteger getTypicalSuPerJob() {
+		return this.typicalSuPerJob;
+	}
+
+	public void setTypicalSuPerJob(BigInteger typicalSuPerJob) {
+		this.typicalSuPerJob = typicalSuPerJob;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java
new file mode 100644
index 0000000..e768883
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java
@@ -0,0 +1,57 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+/**
+ * The primary key class for the USER_ALLOCATION_DETAILS database table.
+ * 
+ */
+@Embeddable
+public class UserAllocationDetailEntityPK implements Serializable {
+	//default serial version id, required for serializable classes.
+	private static final long serialVersionUID = 1L;
+
+	@Column(name="PROJECT_ID")
+	private String projectId;
+
+	@Column(name="USERNAME")
+	private String username;
+
+	public UserAllocationDetailEntityPK() {
+	}
+	public String getProjectId() {
+		return this.projectId;
+	}
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+	public String getUsername() {
+		return this.username;
+	}
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof UserAllocationDetailEntityPK)) {
+			return false;
+		}
+		UserAllocationDetailEntityPK castOther = (UserAllocationDetailEntityPK)other;
+		return 
+			this.projectId.equals(castOther.projectId)
+			&& this.username.equals(castOther.username);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.projectId.hashCode();
+		hash = hash * prime + this.username.hashCode();
+		
+		return hash;
+	}
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
new file mode 100644
index 0000000..9eb04fc
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
@@ -0,0 +1,78 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+
+/**
+ * The persistent class for the USER_DETAILS database table.
+ * 
+ */
+@Entity
+@Table(name="USER_DETAILS")
+@NamedQuery(name="UserDetailEntity.findAll", query="SELECT u FROM UserDetailEntity u")
+public class UserDetailEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="USERNAME")
+	private String username;
+
+	@Lob
+	@Column(name="EMAIL")
+	private String email;
+
+	@Lob
+	@Column(name="FULL_NAME")
+	private String fullName;
+
+	@Column(name="PASSWORD")
+	private String password;
+
+	@Column(name="USER_TYPE")
+	private String userType;
+
+	public UserDetailEntity() {
+	}
+
+	public String getUsername() {
+		return this.username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getEmail() {
+		return this.email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public String getFullName() {
+		return this.fullName;
+	}
+
+	public void setFullName(String fullName) {
+		this.fullName = fullName;
+	}
+
+	public String getPassword() {
+		return this.password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public String getUserType() {
+		return this.userType;
+	}
+
+	public void setUserType(String userType) {
+		this.userType = userType;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
new file mode 100644
index 0000000..6449b4a
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
@@ -0,0 +1,163 @@
+/**
+ *
+ * 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.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.utils.Committer;
+import org.apache.airavata.allocation.manager.db.utils.DBConstants;
+import org.apache.airavata.allocation.manager.db.utils.JPAUtils;
+import org.apache.airavata.allocation.manager.db.utils.ObjectMapperSingleton;
+import org.apache.airavata.allocation.manager.models.AllocationManagerException;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractRepository<T, E, Id> {
+    private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
+
+    private Class<T> thriftGenericClass;
+    private Class<E> dbEntityGenericClass;
+
+    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
+        this.thriftGenericClass = thriftGenericClass;
+        this.dbEntityGenericClass = dbEntityGenericClass;
+    }
+
+    public T create(T t) throws Exception {
+        return update(t);
+    }
+
+    //FIXME do a bulk insert
+    public List<T> create(List<T> tList) throws Exception {
+        return update(tList);
+    }
+
+    public  T update(T t) throws Exception {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        E entity = mapper.map(t, dbEntityGenericClass);
+        E persistedCopy = execute(entityManager -> entityManager.merge(entity));
+        return mapper.map(persistedCopy, thriftGenericClass);
+    }
+
+    //FIXME do a bulk update
+    public  List<T> update(List<T> tList) throws Exception {
+        List<T> returnList = new ArrayList<T>();
+        for(T temp : tList)
+            returnList.add(update(temp));
+        return returnList;
+    }
+
+    public boolean delete(Id id) throws Exception {
+        execute(entityManager -> {
+             E entity = entityManager.find(dbEntityGenericClass, id);
+             entityManager.remove(entity);
+             return entity;
+         });
+        return true;
+    }
+
+    public boolean delete(List<Id> idList) throws Exception {
+        for(Id id : idList)
+            delete(id);
+        return true;
+    }
+
+    public T get(Id id) throws Exception {
+        E entity = execute(entityManager -> entityManager
+                .find(dbEntityGenericClass, id));
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        if(entity == null)
+            return null;
+        return mapper.map(entity, thriftGenericClass);
+    }
+
+    public boolean isExists(Id id) throws Exception {
+        return get(id) != null;
+    }
+
+    public List<T> get(List<Id> idList) throws Exception {
+        List<T> returnList = new ArrayList<>();
+        for(Id id : idList)
+            returnList.add(get(id));
+        return returnList;
+    }
+
+    public List<T> select(Map<String, String> filters, int offset, int limit) throws Exception {
+        String query = "SELECT DISTINCT p from " + dbEntityGenericClass.getSimpleName() + " as p";
+        ArrayList<String> parameters = new ArrayList<>();
+        int parameterCount = 1;
+        if (filters != null && filters.size() != 0) {
+            query += " WHERE ";
+            for (String k : filters.keySet()) {
+                query += "p." + k + " = ?" + parameterCount + " AND ";
+                parameters.add(filters.get(k));
+                parameterCount++;
+            }
+            query = query.substring(0, query.length() - 5);
+        }
+
+        query += " ORDER BY p.createdTime DESC";
+        String queryString = query;
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            javax.persistence.Query q = entityManager.createQuery(queryString);
+            for (int i = 0; i < parameters.size(); i++) {
+                q.setParameter(i + 1, parameters.get(i));
+            }
+            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public List<T> select(String queryString, Map<String,Object> queryParameters, int offset, int limit) throws Exception {
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            Query q =  entityManager.createQuery(queryString);
+            for(Map.Entry<String, Object> queryParam : queryParameters.entrySet()){
+                q.setParameter(queryParam.getKey(), queryParam.getValue());
+            }
+            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public <R> R execute(Committer<EntityManager, R> committer) throws Exception {
+        EntityManager entityManager = JPAUtils.getEntityManager();
+        try {
+            entityManager.getTransaction().begin();
+            R r = committer.commit(entityManager);
+            entityManager.getTransaction().commit();
+            return r;
+        } finally {
+            entityManager.close();
+        }
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java
new file mode 100644
index 0000000..c86d85b
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java
@@ -0,0 +1,33 @@
+/**
+ *
+ * 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.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.DomainEntity;
+import org.apache.airavata.allocation.manager.models.Domain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DomainRepository extends AbstractRepository<Domain, DomainEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public DomainRepository(){
+        super(Domain.class, DomainEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
new file mode 100644
index 0000000..71cbba8
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity;
+import org.apache.airavata.allocation.manager.models.RequestStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RequestStatusRepository extends AbstractRepository<RequestStatus, RequestStatusEntity,String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public RequestStatusRepository(){
+        super(RequestStatus.class, RequestStatusEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
new file mode 100644
index 0000000..265e063
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntityPK;
+import org.apache.airavata.allocation.manager.models.UserAllocationDetailPK;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailPKRepository extends AbstractRepository<UserAllocationDetailPK, UserAllocationDetailPK, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailPKRepository(){
+        super(UserAllocationDetailPK.class, UserAllocationDetailPK.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
new file mode 100644
index 0000000..adfd6d2
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
+import org.apache.airavata.allocation.manager.models.UserAllocationDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailRepository extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailRepository(){
+        super(UserAllocationDetail.class, UserAllocationDetailEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
new file mode 100644
index 0000000..c05ff5c
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
@@ -0,0 +1,19 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserDetailEntity;
+import org.apache.airavata.allocation.manager.models.UserDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserDetailRepository extends AbstractRepository<UserDetail, UserDetailEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserDetailRepository(){
+        super(UserDetail.class, UserDetailEntity.class);
+    }
+
+    public static void main(String args[])
+    {
+
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java
new file mode 100644
index 0000000..64e9abc
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java
@@ -0,0 +1,26 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+@FunctionalInterface
+public interface Committer<T, R>  {
+
+    R commit(T t);
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java
new file mode 100644
index 0000000..2d3a64e
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java
@@ -0,0 +1,381 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Stack;
+import java.util.concurrent.Semaphore;
+
+
+/**
+ * A class for preallocating, recycling, and managing JDBC connections.
+ */
+public class ConnectionPool {
+    private static final Logger logger = LoggerFactory.getLogger(ConnectionPool.class);
+
+    private long MAX_IDLE_TIME = 5 * 60 * 1000; // 5 minutes
+
+    private String driver;
+    private String url;
+    private String username;
+    private String password;
+    private String jdbcUrl;
+
+    private int maxConnections;
+
+    private boolean autoCommit = true;
+    private boolean waitIfBusy;
+
+    private Semaphore needConnection = new Semaphore(0);
+    private boolean stop;
+
+    private Stack<Connection> availableConnections;
+    private Stack<Connection> busyConnections;
+
+    private HashMap<Connection, Long> lastAccessTimeRecord = new HashMap<Connection, Long>();
+
+    private String urlType = "";
+
+    private DataSource datasource;
+
+    private int transactionIsolation = Connection.TRANSACTION_NONE;
+
+    private Thread clenupThread;
+    private Thread producerThread;
+
+    public ConnectionPool(String driver, String url, String username, String password, int initialConnections,
+                          int maxConnections, boolean waitIfBusy) throws SQLException {
+        this.driver = driver;
+        this.url = url;
+        this.username = username;
+        this.password = password;
+        this.urlType = "speratedURL";
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections,
+                          boolean waitIfBusy, boolean autoCommit, int transactionIsolation) throws SQLException {
+        this.driver = driver;
+        this.jdbcUrl = jdbcUrl;
+        this.urlType = "simpleURL";
+        this.autoCommit = autoCommit;
+        this.transactionIsolation = transactionIsolation;
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections, boolean waitIfBusy)
+            throws SQLException {
+        this.driver = driver;
+        this.jdbcUrl = jdbcUrl;
+        this.urlType = "simpleURL";
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    public ConnectionPool(DataSource dataSource, int initialConnections, int maxConnections, boolean waitIfBusy)
+            throws SQLException {
+        this.urlType = "dataSource";
+        this.datasource = dataSource;
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    /**
+     * Check if this connection pool is auto commit or not
+     *
+     * @return
+     */
+    public boolean isAutoCommit() {
+        return this.autoCommit;
+    }
+
+    private void initialize(int initialConnections, int maxConnections, boolean waitIfBusy) throws SQLException {
+        this.maxConnections = maxConnections;
+        this.waitIfBusy = waitIfBusy;
+
+        int sizeOfConnections = (initialConnections > maxConnections) ? maxConnections : initialConnections;
+
+        availableConnections = new Stack<Connection>();
+        busyConnections = new Stack<Connection>();
+
+        for (int i = 0; i < sizeOfConnections; i++) {
+            Connection con = makeNewConnection();
+            setTimeStamp(con);
+            availableConnections.push(con);
+
+        }
+
+        producerThread = new Thread(new FillUpThread());
+        producerThread.start();
+
+        clenupThread = new Thread(new CleanUpThread());
+        clenupThread.start();
+    }
+
+    public synchronized Connection getConnection() throws SQLException {
+        if (!availableConnections.isEmpty()) {
+            Connection existingConnection = availableConnections.pop();
+
+            // If connection on available list is closed (e.g.,
+            // it timed out), then remove it from available list
+            // and race for a connection again.
+            if (existingConnection.isClosed()) {
+                lastAccessTimeRecord.remove(existingConnection);
+                // notifyAll for fairness
+                notifyAll();
+            } else {
+                busyConnections.push(existingConnection);
+                setTimeStamp(existingConnection);
+                return existingConnection;
+            }
+        } else if (!waitIfBusy && busyConnections.size() >= maxConnections) {
+            // You reached maxConnections limit and waitIfBusy flag is false.
+            // Throw SQLException in such a case.
+            throw new SQLException("Connection limit reached");
+        } else {
+
+            if (busyConnections.size() < maxConnections) {
+                // available connection is empty, but total number of connection
+                // doesn't reach maxConnection. Request for more connection
+                needConnection.release();
+            }
+
+            try {
+                // wait for free connection
+                wait();
+            } catch (InterruptedException ie) {
+            }
+        }
+        // always race for connection forever
+        return getConnection();
+    }
+
+    // This explicitly makes a new connection. Called in
+    // the foreground when initializing the ConnectionPool,
+    // and called in the background when running.
+    private Connection makeNewConnection() throws SQLException {
+        try {
+            // Load database driver if not already loaded
+            Class.forName(driver);
+            Connection connection;
+            // Establish network connection to database
+            if (urlType.equals("speratedURL")) {
+                connection = DriverManager.getConnection(url, username, password);
+            } else if (urlType.equals("simpleURL")) {
+                connection = DriverManager.getConnection(jdbcUrl);
+            } else { // if(urlType.equals("dataSource")){
+                connection = datasource.getConnection();
+            }
+            connection.setTransactionIsolation(this.transactionIsolation);
+            connection.setAutoCommit(this.autoCommit);
+            return connection;
+        } catch (ClassNotFoundException cnfe) {
+            // Simplify try/catch blocks of people using this by
+            // throwing only one exception type.
+            throw new SQLException("Can't find class for driver: " + driver);
+        }
+    }
+
+    private synchronized void fillUpConnection(Connection conn) {
+        setTimeStamp(conn);
+        availableConnections.push(conn);
+
+        // notify all since new connection is created
+        notifyAll();
+    }
+
+    private void setTimeStamp(Connection connection) {
+        lastAccessTimeRecord.put(connection, System.currentTimeMillis());
+    }
+
+    // The database connection cannot be left idle for too long, otherwise TCP
+    // connection will be broken.
+    /**
+     * From http://forums.mysql.com/read.php?39,28450,57460#msg-57460 Okay, then it looks like wait_timeout on the
+     * server is killing your connection (it is set to 8 hours of idle time by default). Either set that value higher on
+     * your server, or configure your connection pool to not hold connections idle that long (I prefer the latter). Most
+     * folks I know that run MySQL with a connection pool in high-load production environments only let connections sit
+     * idle for a matter of minutes, since it only takes a few milliseconds to open a connection, and the longer one
+     * sits idle the more chance it will go "bad" because of a network hiccup or the MySQL server being restarted.
+     *
+     * @throws java.sql.SQLException
+     */
+    private boolean isConnectionStale(Connection connection) {
+        long currentTime = System.currentTimeMillis();
+        long lastAccess = lastAccessTimeRecord.get(connection);
+        if (currentTime - lastAccess > MAX_IDLE_TIME) {
+            return true;
+        } else
+            return false;
+    }
+
+    private synchronized void closeStaleConnections() {
+        // close idle connections
+        Iterator<Connection> iter = availableConnections.iterator();
+        while (iter.hasNext()) {
+            Connection existingConnection = iter.next();
+            if (isConnectionStale(existingConnection)) {
+                try {
+                    existingConnection.close();
+                    iter.remove();
+                } catch (SQLException sql) {
+                    logger.error(sql.getMessage(), sql);
+                }
+            }
+        }
+        // close busy connections that have been checked out for too long.
+        // This should not happen since this means program has bug for not
+        // releasing connections .
+        iter = busyConnections.iterator();
+        while (iter.hasNext()) {
+            Connection busyConnection = iter.next();
+            if (isConnectionStale(busyConnection)) {
+                try {
+                    busyConnection.close();
+                    iter.remove();
+                    logger.warn("****Connection has checked out too long. Forced release. Check the program for calling release connection [free(Connection) method]");
+                } catch (SQLException sql) {
+                    logger.error(sql.getMessage(), sql);
+                }
+            }
+        }
+    }
+
+    public synchronized void free(Connection connection) {
+        busyConnections.removeElement(connection);
+        availableConnections.addElement(connection);
+        // Wake up threads that are waiting for a connection
+        notifyAll();
+    }
+
+    /**
+     * Close all the connections. Use with caution: be sure no connections are in use before calling. Note that you are
+     * not <I>required</I> to call this when done with a ConnectionPool, since connections are guaranteed to be closed
+     * when garbage collected. But this method gives more control regarding when the connections are closed.
+     */
+    public synchronized void dispose() {
+        logger.info("Connection Pool Shutting down");
+
+        // stop clean up thread
+        this.stop = true;
+        this.clenupThread.interrupt();
+
+        // stop producer up thread
+        this.producerThread.interrupt();
+
+        // close all connection
+        closeConnections(availableConnections);
+        availableConnections = new Stack<Connection>();
+        closeConnections(busyConnections);
+        busyConnections = new Stack<Connection>();
+        lastAccessTimeRecord.clear();
+
+        logger.info("All connection is closed");
+
+        try {
+            this.clenupThread.join();
+            this.producerThread.join();
+        } catch (Exception e) {
+            logger.error("Cannot shutdown cleanup thread", e);
+        }
+
+        logger.info("Connection Pool Shutdown");
+    }
+
+    private void closeConnections(Stack<Connection> connections) {
+        while (!connections.isEmpty()) {
+            Connection connection = connections.pop();
+            try {
+                if (!connection.isClosed()) {
+                    connection.close();
+                }
+            } catch (SQLException sqle) {
+                // Ignore errors; garbage collect anyhow
+                logger.warn(sqle.getMessage());
+            }
+        }
+    }
+
+    public synchronized String toString() {
+        String info = "ConnectionPool(" + url + "," + username + ")" + ", available=" + availableConnections.size()
+                + ", busy=" + busyConnections.size() + ", max=" + maxConnections;
+        return (info);
+    }
+
+    class CleanUpThread implements Runnable {
+        public void run() {
+            while (!stop) {
+                try {
+                    Thread.sleep(MAX_IDLE_TIME);
+                    closeStaleConnections();
+                } catch (InterruptedException e) {
+                    logger.info("Clean up thread is interrupted to close");
+                }
+            }
+        }
+    }
+
+    class FillUpThread implements Runnable {
+        public void run() {
+            while (!stop) {
+                try {
+                    // block until get
+                    needConnection.acquire();
+
+                    Connection conn = makeNewConnection();
+                    fillUpConnection(conn);
+                } catch (SQLException e) {
+                    // cannot create connection (increase semaphore value back)
+                    needConnection.release();
+                    logger.error(e.getMessage(), e);
+                } catch (InterruptedException e) {
+                    logger.info("Fill up thread is interrupted to close");
+                    break;
+                }
+            }
+        }
+    }
+
+    public void shutdown() throws SQLException{
+        for (Connection c : availableConnections) {
+            try {
+                c.close();
+            } catch (SQLException e) {
+                logger.error("Error while closing the connection", e);
+                throw new SQLException("Error while closing the connection", e);
+            }
+        }
+
+        for (Connection c : busyConnections) {
+            try {
+                c.close();
+            } catch (SQLException e) {
+                logger.error("Error while closing the connection", e);
+                throw new SQLException("Error while closing the connection", e);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java
new file mode 100644
index 0000000..1de1363
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java
@@ -0,0 +1,106 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DBConstants {
+    private final static Logger logger = LoggerFactory.getLogger(DBConstants.class);
+
+    public static int SELECT_MAX_ROWS = 1000;
+
+    public static class DomainTable {
+        public static final String DOMAIN_ID = "domainId";
+        public static final String NAME = "name";
+        public static final String DESCRIPTION = "description";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class UserTable {
+        public static final String USER_ID = "userId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String USER_NAME = "userName";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class UserGroupTable {
+        public static final String GROUP_ID = "groupId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String NAME = "name";
+        public static final String DESCRIPTION = "description";
+        public static final String OWNER_ID = "ownerId";
+        public static final String GROUP_TYPE = "groupType";
+        public static final String GROUP_CARDINALITY = "groupCardinality";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class GroupMembershipTable {
+        public static final String PARENT_ID = "parentId";
+        public static final String CHILD_ID = "childId";
+        public static final String CHILD_TYPE = "childType";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class EntityTypeTable {
+        public static final String ENTITY_TYPE_ID = "entityTypeId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class PermissionTypeTable {
+        public static final String ENTITY_TYPE_ID = "permissionTypeId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String NAME = "name";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class EntityTable {
+        public static final String ENTITY_ID = "entityId";
+        public static final String PARENT_ENTITY_ID = "parentEntityId";
+        public static final String ENTITY_TYPE_ID = "entityTypeId";
+        public static final String NAME = "name";
+        public static final String DESCRIPTION = "description";
+        public static final String FULL_TEXT = "fullText";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String ORIGINAL_ENTITY_CREATION_TIME = "originalEntityCreationTime";
+        public static final String SHARED = "shared";
+    }
+
+    public static class SharingTable {
+        public static final String DOMAIN_ID = "domainId";
+        public static final String PERMISSION_TYPE_ID = "permissionTypeId";
+        public static final String ENTITY_ID = "entityId";
+        public static final String GROUP_ID = "groupId";
+        public static final String INHERITED_PARENT_ID = "inheritedParentId";
+        public static final String SHARING_TYPE = "sharingType";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java
new file mode 100644
index 0000000..d8368f5
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java
@@ -0,0 +1,352 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+/**
+ * This class creates the database tables required for airavata with default configuration this
+ * class creates derby database in server mode. User can specify required database in appropriate
+ * properties files.
+ */
+public class DatabaseCreator {
+    private final static Logger logger = LoggerFactory.getLogger(DatabaseCreator.class);
+
+    public enum DatabaseType {
+        derby("(?i).*derby.*"), mysql("(?i).*mysql.*"), other("");
+
+        private String pattern;
+
+        private DatabaseType(String matchingPattern) {
+            this.pattern = matchingPattern;
+        }
+
+        public String getMatchingPattern() {
+            return this.pattern;
+        }
+    }
+
+    private static DatabaseType[] supportedDatabase = new DatabaseType[] { DatabaseType.derby, DatabaseType.mysql };
+
+    private static Logger log = LoggerFactory.getLogger(DatabaseCreator.class);
+    private static final String delimiter = ";";
+
+    /**
+     * Creates database
+     *
+     * @throws Exception
+     */
+    public static void createRegistryDatabase(String prefix, Connection conn) throws Exception {
+        createDatabase(prefix, conn);
+    }
+
+
+
+    /**
+     * Checks whether database tables are created by using select * on given table name
+     *
+     * @param tableName
+     *            Table which should be existed
+     * @return <code>true</core> if checkSQL is success, else <code>false</code> .
+     */
+    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+        try {
+
+            log.debug("Running a query to test the database tables existence.");
+
+            // check whether the tables are already created with a query
+            Statement statement = null;
+            try {
+                statement = conn.createStatement();
+                ResultSet rs = statement.executeQuery("select * from " + tableName);
+                if (rs != null) {
+                    rs.close();
+                }
+            } finally {
+                try {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                } catch (SQLException e) {
+                    return false;
+                }
+            }
+        } catch (SQLException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * executes given sql
+     *
+     * @param sql
+     * @throws Exception
+     */
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        // Check and ignore empty statements
+        if ("".equals(sql.trim())) {
+            return;
+        }
+
+        Statement statement = null;
+        try {
+            log.debug("SQL : " + sql);
+
+            boolean ret;
+            int updateCount = 0, updateCountTotal = 0;
+            statement = conn.createStatement();
+            ret = statement.execute(sql);
+            updateCount = statement.getUpdateCount();
+            do {
+                if (!ret) {
+                    if (updateCount != -1) {
+                        updateCountTotal += updateCount;
+                    }
+                }
+                ret = statement.getMoreResults();
+                if (ret) {
+                    updateCount = statement.getUpdateCount();
+                }
+            } while (ret);
+
+            log.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                log.info(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                // eliminating the table already exception for the derby
+                // database
+                log.info("Table Already Exists", e);
+            } else {
+                throw new Exception("Error occurred while executing : " + sql, e);
+            }
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    log.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * computes relatational database type using database name
+     *
+     * @return DatabaseType
+     * @throws Exception
+     *
+     */
+    public static DatabaseType getDatabaseType(Connection conn) throws Exception {
+        try {
+            if (conn != null && (!conn.isClosed())) {
+                DatabaseMetaData metaData = conn.getMetaData();
+                String databaseProductName = metaData.getDatabaseProductName();
+                return checkType(databaseProductName);
+            }
+        } catch (SQLException e) {
+            String msg = "Failed to create Airavata database." + e.getMessage();
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        return DatabaseType.other;
+    }
+
+    /**
+     * Overloaded method with String input
+     *
+     * @return DatabaseType
+     * @throws Exception
+     *
+     */
+    public static DatabaseType getDatabaseType(String dbUrl) throws Exception {
+        return checkType(dbUrl);
+    }
+
+    private static DatabaseType checkType(String text) throws Exception {
+        try {
+            if (text != null) {
+                for (DatabaseType type : supportedDatabase) {
+                    if (text.matches(type.getMatchingPattern()))
+                        return type;
+                }
+            }
+            String msg = "Unsupported database: " + text
+                    + ". Database will not be created automatically by the Airavata. "
+                    + "Please create the database using appropriate database scripts for " + "the database.";
+            throw new Exception(msg);
+
+        } catch (SQLException e) {
+            String msg = "Failed to create Airavatadatabase." + e.getMessage();
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+
+    /**
+     * Get scripts location which is prefix + "-" + databaseType + ".sql"
+     *
+     * @param prefix
+     * @param databaseType
+     * @return script location
+     */
+    private static String getScriptLocation(String prefix, DatabaseType databaseType) {
+        String scriptName = prefix + "-" + databaseType + ".sql";
+        log.debug("Loading database script from :" + scriptName);
+        return  scriptName;
+    }
+
+    private static void createDatabase(String prefix, Connection conn) throws Exception {
+        Statement statement = null;
+        try {
+            conn.setAutoCommit(false);
+            statement = conn.createStatement();
+            executeSQLScript(getScriptLocation(prefix, DatabaseCreator.getDatabaseType(conn)), conn);
+            conn.commit();
+            log.debug("Tables are created successfully.");
+        } catch (SQLException e) {
+            String msg = "Failed to create database tables for Airavata resource store. " + e.getMessage();
+            log.error(msg, e);
+            conn.rollback();
+            throw new Exception(msg, e);
+        } finally {
+            conn.setAutoCommit(true);
+            try {
+                if (statement != null) {
+                    statement.close();
+                }
+            } catch (SQLException e) {
+                log.error("Failed to close statement.", e);
+            }
+        }
+    }
+
+    private static void executeSQLScript(String dbscriptName, Connection conn) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+
+        try {
+            InputStream is = DatabaseCreator.class.getClassLoader().getResourceAsStream(dbscriptName);
+            if(is == null) {
+                logger.info("Script file not found at " + dbscriptName + ". Uses default database script file");
+                DatabaseType databaseType = DatabaseCreator.getDatabaseType(conn);
+                if(databaseType.equals(DatabaseType.derby)){
+                    is = DatabaseCreator.class.getClassLoader().getResourceAsStream("sharing-registry-derby.sql");
+                }else if(databaseType.equals(DatabaseType.mysql)){
+                    is = DatabaseCreator.class.getClassLoader().getResourceAsStream("sharing-registry-mysql.sql");
+                }
+            }
+            reader = new BufferedReader(new InputStreamReader(is));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+                if (line.startsWith("//")) {
+                    continue;
+                }
+                if (line.startsWith("--")) {
+                    continue;
+                }
+                StringTokenizer st = new StringTokenizer(line);
+                if (st.hasMoreTokens()) {
+                    String token = st.nextToken();
+                    if ("REM".equalsIgnoreCase(token)) {
+                        continue;
+                    }
+                }
+                sql.append(" ").append(line);
+
+                // SQL defines "--" as a comment to EOL
+                // and in Oracle it may contain a hint
+                // so we cannot just remove it, instead we must end it
+                if (line.indexOf("--") >= 0) {
+                    sql.append("\n");
+                }
+                if ((checkStringBufferEndsWith(sql, delimiter))) {
+                    executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                    sql.replace(0, sql.length(), "");
+                }
+            }
+            // Catch any statements not followed by ;
+            if (sql.length() > 0) {
+                executeSQL(sql.toString(), conn);
+            }
+        } catch (IOException e) {
+            log.error("Error occurred while executing SQL script for creating Airavata database", e);
+            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+
+        } finally {
+            if (reader != null) {
+                reader.close();
+            }
+        }
+    }
+
+    /**
+     * Checks that a string buffer ends up with a given string. It may sound trivial with the existing JDK API but the
+     * various implementation among JDKs can make those methods extremely resource intensive and perform poorly due to
+     * massive memory allocation and copying. See
+     *
+     * @param buffer
+     *            the buffer to perform the check on
+     * @param suffix
+     *            the suffix
+     * @return <code>true</code> if the character sequence represented by the argument is a suffix of the character
+     *         sequence represented by the StringBuffer object; <code>false</code> otherwise. Note that the result will
+     *         be <code>true</code> if the argument is the empty string.
+     */
+    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+        if (suffix.length() > buffer.length()) {
+            return false;
+        }
+        // this loop is done on purpose to avoid memory allocation performance
+        // problems on various JDKs
+        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+        // implementation is ok though does allocation/copying
+        // StringBuffer.toString().endsWith() does massive memory
+        // allocation/copying on JDK 1.5
+        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+        int endIndex = suffix.length() - 1;
+        int bufferIndex = buffer.length() - 1;
+        while (endIndex >= 0) {
+            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+                return false;
+            }
+            bufferIndex--;
+            endIndex--;
+        }
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java
new file mode 100644
index 0000000..3781c4b
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java
@@ -0,0 +1,215 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.allocation.manager.models.AllocationManagerException;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class JPAUtils {
+    private final static Logger logger = LoggerFactory.getLogger(JPAUtils.class);
+
+    public static final String PERSISTENCE_UNIT_NAME = "airavata-sharing-registry";
+    public static final String SHARING_REG_JDBC_DRIVER = "sharingcatalog.jdbc.driver";
+    public static final String SHARING_REG_JDBC_URL = "sharingcatalog.jdbc.url";
+    public static final String SHARING_REG_JDBC_USER = "sharingcatalog.jdbc.user";
+    public static final String SHARING_REG_JDBC_PWD = "sharingcatalog.jdbc.password";
+    public static final String SHARING_REG_VALIDATION_QUERY = "sharingcatalog.validationQuery";
+    public static final String JPA_CACHE_SIZE = "jpa.cache.size";
+    public static final String JPA_CACHE_ENABLED = "cache.enable";
+
+    public static final String CONFIGURATION = "CONFIGURATION";
+    public static final String START_DERBY_ENABLE = "start.derby.server.mode";
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    private static NetworkServerControl server;
+    private static JdbcStorage db;
+    private static String jdbcURl;
+    private static String jdbcDriver;
+    private static String jdbcUser;
+    private static String jdbcPassword;
+
+    @PersistenceUnit(unitName = PERSISTENCE_UNIT_NAME)
+    protected static EntityManagerFactory factory;
+    @PersistenceContext(unitName = PERSISTENCE_UNIT_NAME)
+    private static EntityManager entityManager;
+
+    public synchronized static EntityManager getEntityManager() throws Exception {
+        if (factory == null) {
+            String connectionProperties = "DriverClassName=" + readServerProperties(SHARING_REG_JDBC_DRIVER) + "," +
+                    "Url=" + readServerProperties(SHARING_REG_JDBC_URL) + "?autoReconnect=true," +
+                    "Username=" + readServerProperties(SHARING_REG_JDBC_USER) + "," +
+                    "Password=" + readServerProperties(SHARING_REG_JDBC_PWD) +
+                    ",validationQuery=" + readServerProperties(SHARING_REG_VALIDATION_QUERY);
+
+//            String connectionProperties = "DriverClassName=com.mysql.jdbc.Driver," +
+//                    "Url=jdbc:mysql://localhost:3306/airavata_sharing_catalog?autoReconnect=true," +
+//                    "Username=root," +
+//                    "Password=," +
+//                    ",validationQuery=SELECT 1 FROM CONFIGURATION";
+
+            Map<String, String> properties = new HashMap<String, String>();
+            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", "" + readServerProperties(JPA_CACHE_ENABLED)
+//                    + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+//            properties.put("openjpa.QueryCache", "" + readServerProperties(JPA_CACHE_ENABLED)
+//                    + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+
+            properties.put("openjpa.RemoteCommitProvider", "sjvm");
+            properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+            properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+            properties.put("openjpa.jdbc.QuerySQLCache", "false");
+//            properties.put("openjpa.Multithreaded", "true");
+            properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," +
+                    " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000,  autoReconnect=true");
+            properties.put("openjpa.RuntimeUnenhancedClasses", "warn");
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+        }
+
+        entityManager = factory.createEntityManager();
+        return entityManager;
+    }
+
+    public static void initializeDB() throws Exception {
+        jdbcDriver = readServerProperties(SHARING_REG_JDBC_DRIVER);
+        jdbcURl = readServerProperties(SHARING_REG_JDBC_URL);
+        jdbcUser = readServerProperties(SHARING_REG_JDBC_USER);
+        jdbcPassword = readServerProperties(SHARING_REG_JDBC_PWD);
+        jdbcURl = jdbcURl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+
+        if (getDBType(jdbcURl).equals("derby") && isDerbyStartEnabled()) {
+            startDerbyInServerMode();
+        }
+        db = new JdbcStorage(10, 50, jdbcURl, jdbcDriver, true);
+
+        Connection conn = null;
+        try {
+            conn = db.connect();
+            if (!DatabaseCreator.isDatabaseStructureCreated(CONFIGURATION, conn)) {
+                DatabaseCreator.createRegistryDatabase("database_scripts/sharing-registry", conn);
+                logger.info("New Database created for Sharing Catalog !!! ");
+            } else {
+                logger.info("Database already created for Sharing Catalog !!!");
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            db.closeConnection(conn);
+            try {
+                if(conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error("Error while closing database connection...", e.getMessage(), e);
+            }
+        }
+    }
+
+    public static String getDBType(String jdbcUrl){
+        try{
+            String cleanURI = jdbcUrl.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getScheme();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+    }
+
+    public static boolean isDerbyStartEnabled(){
+        try {
+            String s = ServerSettings.getSetting(START_DERBY_ENABLE);
+            if("true".equals(s)){
+                return true;
+            }
+        }  catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata server properties", e.getMessage(), e);
+            return false;
+        }
+        return false;
+    }
+
+    public static void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+                    getPort(jdbcURl),
+                    jdbcUser, jdbcPassword);
+            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+            server.start(consoleWriter);
+        } catch (IOException e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        } catch (Exception e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        }
+    }
+
+    public static void stopDerbyInServerMode() {
+        System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "false");
+        if (server!=null){
+            try {
+                server.shutdown();
+            } catch (Exception e) {
+                logger.error("Error when stopping the derby server : "+e.getLocalizedMessage());
+            }
+        }
+    }
+
+    public static int getPort(String jdbcURL){
+        try{
+            String cleanURI = jdbcURL.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getPort();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return -1;
+        }
+    }
+
+    public static String readServerProperties(String propertyName) throws Exception {
+        try {
+            return ServerSettings.getSetting(propertyName);
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server.properties...", e);
+            throw new Exception("Unable to read airavata-server.properties...");
+        }
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java
new file mode 100644
index 0000000..ea3a360
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java
@@ -0,0 +1,174 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.*;
+
+public class JdbcStorage {
+    private static Logger log = LoggerFactory.getLogger(JdbcStorage.class);
+
+    private ConnectionPool connectionPool;
+
+    public JdbcStorage(String jdbcUrl, String jdbcDriver) {
+        // default init connection and max connection
+        this(3, 50, jdbcUrl, jdbcDriver, true);
+    }
+
+    public JdbcStorage(int initCon, int maxCon, String url, String driver, boolean enableTransactions) {
+        try {
+            if (enableTransactions) {
+                connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true, false,
+                        Connection.TRANSACTION_SERIALIZABLE);
+            } else {
+                connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to create database connection pool.", e);
+        }
+    }
+
+    /**
+     * Check if this connection pool is auto commit or not
+     *
+     * @return
+     */
+    public boolean isAutoCommit() {
+        return connectionPool.isAutoCommit();
+    }
+
+    public void commit(Connection conn) {
+        try {
+            if (conn != null && !conn.getAutoCommit()) {
+                conn.commit();
+            }
+        } catch (SQLException sqle) {
+            log.error("Cannot commit data", sqle);
+        }
+    }
+
+    public void commitAndFree(Connection conn) {
+        commit(conn);
+        closeConnection(conn);
+    }
+
+    public void rollback(Connection conn) {
+        try {
+            if (conn != null && !conn.getAutoCommit()) {
+                conn.rollback();
+            }
+        } catch (SQLException sqle) {
+            log.error("Cannot Rollback data", sqle);
+        }
+    }
+
+    public void rollbackAndFree(Connection conn) {
+        rollback(conn);
+        closeConnection(conn);
+    }
+
+    public Connection connect() {
+
+        Connection conn = null;
+        try {
+            conn = connectionPool.getConnection();
+        } catch (SQLException e) {
+            log.error(e.getMessage(), e);
+        }
+        return conn;
+    }
+
+    /**
+     * This method is provided so that you can have better control over the statement. For example: You can use
+     * stmt.setString to convert quotation mark automatically in an UPDATE statement
+     *
+     * NOTE: Statement is closed after execution
+     */
+    public int executeUpdateAndClose(PreparedStatement stmt) throws SQLException {
+        int rows = 0;
+        try {
+            rows = stmt.executeUpdate();
+            if (rows == 0) {
+                log.info("Problem: 0 rows affected by insert/update/delete statement.");
+            }
+        } finally {
+            stmt.close();
+        }
+        return rows;
+    }
+
+    public int countRow(String tableName, String columnName) throws SQLException {
+        String query = new String("SELECT COUNT(" + columnName + ") FROM " + tableName);
+        int count = -1;
+        Connection conn = null;
+        PreparedStatement stmt = null;
+        try {
+            conn = connectionPool.getConnection();
+            stmt = conn.prepareStatement(query);
+            ResultSet rs = stmt.executeQuery();
+            rs.next();
+            count = rs.getInt(1);
+            commit(conn);
+        } catch (SQLException sql) {
+            rollback(conn);
+            throw sql;
+        } finally {
+            try {
+                if (stmt != null && !stmt.isClosed()) {
+                    stmt.close();
+                }
+            } finally {
+                closeConnection(conn);
+            }
+        }
+        return count;
+    }
+
+    public void quietlyClose(Connection conn, Statement... stmts) {
+        if (stmts != null) {
+            for (Statement stmt : stmts) {
+                try {
+                    if (stmt != null && !stmt.isClosed()) {
+                        stmt.close();
+                    }
+                } catch (SQLException sql) {
+                    log.error(sql.getMessage(), sql);
+                }
+            }
+        }
+        closeConnection(conn);
+    }
+
+    public void closeConnection(Connection conn) {
+        if (conn != null) {
+            connectionPool.free(conn);
+        }
+    }
+
+    public void closeAllConnections() {
+        if (connectionPool != null)
+            connectionPool.dispose();
+    }
+
+    public void shutdown() throws SQLException {
+        connectionPool.shutdown();
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java
new file mode 100644
index 0000000..b5f6c00
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.dozer.DozerBeanMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObjectMapperSingleton extends DozerBeanMapper{
+    private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
+
+    private static ObjectMapperSingleton instance;
+
+    private ObjectMapperSingleton(){}
+
+    public static ObjectMapperSingleton getInstance(){
+        if(instance == null)
+            instance = new ObjectMapperSingleton();
+        return instance;
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
new file mode 100644
index 0000000..2eccf05
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
@@ -0,0 +1,5 @@
+package org.apache.airavata.allocation.manager.models;
+
+public class Domain {
+// Placeholder file for Madrina to create
+}
diff --git a/bin/README.txt b/bin/README.txt
new file mode 100644
index 0000000..a5d51f6
--- /dev/null
+++ b/bin/README.txt
@@ -0,0 +1,16 @@
+
+
+## Temporarily using ANT compile the Aurora Management code.
+## TODO: integrate with maven build system, instead of using ANT
+
+#In the following directory run the compilation command:
+airavata/modules/cloud/AuroraIntegration/src
+
+#Compilation command
+ant all
+
+#Run command
+## TODO: add the command to run and test the code
+
+## Add sample output that shows the Aurora code working
+
diff --git a/bin/build.xml b/bin/build.xml
new file mode 100644
index 0000000..5533336
--- /dev/null
+++ b/bin/build.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project name="aurora" default="compile_all" basedir="..">
+
+  <property name="BUILD.compiler"       value="modern"/>
+  <property name="src"                  value="src"/>
+  <property name="BUILD"                value="BUILD"/>
+  <property name="classes"              value="${BUILD}/classes"/>
+
+
+  <target name="all" depends="compile_all"/>
+
+  <target name="compile_all"
+          depends="org"/>
+
+  <target name="clean">
+       <delete dir="${BUILD}"/>
+  </target>
+
+  <!-- Prepare target directories -->
+  <target name="prepare">
+        <mkdir dir="${BUILD}"/>
+        <mkdir dir="${classes}"/>
+  </target>
+
+
+ <target name="jar">
+        <mkdir dir="${BUILD}/jar"/>
+        <jar destfile="${BUILD}/jar/auroraDriverl.jar" basedir="${BUILD}/classes">
+            <manifest>
+                <attribute name="Main-Class" value="org.apache.airavata.cloud.aurora.driver.AuroraAdminDriver"/>
+            </manifest>
+        </jar>
+    </target>
+
+
+
+  <!-- ** means all subdirectories as well -->
+  <!-- * means all files in the current directory -->
+  <!-- for just java files use *.java -->
+
+  <target name="org" depends="prepare">
+    <javac srcdir="${src}"
+           includes="org/**"
+           excludes="**/package.html"
+           destdir="${classes}"
+           classpath="${classes}"
+           debug="on"
+           optimize="on"
+           deprecation="off"/>
+  </target>
+
+
+</project>
diff --git a/bin/db.config b/bin/db.config
new file mode 100644
index 0000000..b2c7b9d
--- /dev/null
+++ b/bin/db.config
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+#database connection string
+
+##mySQL
+jdbcDriver=com.mysql.jdbc.Driver
+
+#jdbcUrl=jdbc:mysql://localhost:3306/wsnt?user=wsnt2&password=PASSWORD
\ No newline at end of file
diff --git a/bin/org/apache/airavata/jobsubmission/gram/errors.properties b/bin/org/apache/airavata/jobsubmission/gram/errors.properties
new file mode 100644
index 0000000..3e4382b
--- /dev/null
+++ b/bin/org/apache/airavata/jobsubmission/gram/errors.properties
@@ -0,0 +1,176 @@
+1 = Parameter not supported
+2 = The RSL length is greater than the maximum allowed
+3 = No resources available
+4 = Bad directory specified
+5 = The executable does not exist
+6 = Insufficient funds
+7 = Authentication with the remote server failed
+8 = Job cancelled by user
+9 = Job cancelled by system
+
+10 = Data transfer to the server failed
+11 = The stdin file does not exist
+12 = The connection to the server failed (check host and port)
+13 = The provided RSL 'maxtime' value is invalid (not an integer or must be greater than 0)
+14 = The provided RSL 'count' value is invalid (not an integer or must be greater than 0)
+15 = The job manager received an invalid RSL
+16 = Could not connect to job manager
+17 = The job failed when the job manager attempted to run it
+18 = Paradyn error
+19 = The provided RSL 'jobtype' value is invalid
+
+20 = The provided RSL 'myjob' value is invalid
+21 = The job manager failed to locate an internal script argument file
+22 = The job manager failed to create an internal script argument file
+23 = The job manager detected an invalid job state
+24 = The job manager detected an invalid script response
+25 = The job manager detected an invalid job state
+26 = The provided RSL 'jobtype' value is not supported by this job manager
+27 = Unimplemented
+28 = The job manager failed to create an internal script submission file
+29 = The job manager cannot find the user proxy
+
+30 = The job manager failed to open the user proxy
+31 = The job manager failed to cancel the job as requested
+32 = System memory allocation failed
+33 = The interprocess job communication initialization failed
+34 = The interprocess job communication setup failed
+35 = The provided RSL 'host count' value is invalid
+36 = One of the provided RSL parameters is unsupported
+37 = The provided RSL 'queue' parameter is invalid
+38 = The provided RSL 'project' parameter is invalid
+39 = The provided RSL string includes variables that could not be identified
+
+40 = The provided RSL 'environment' parameter is invalid
+41 = The provided RSL 'dryrun' parameter is invalid
+42 = The provided RSL is invalid (an empty string)
+43 = The job manager failed to stage the executable
+44 = The job manager failed to stage the stdin file
+45 = The requested job manager type is invalid
+46 = The provided RSL 'arguments' parameter is invalid
+47 = The gatekeeper failed to run the job manager
+48 = The provided RSL could not be properly parsed
+49 = There is a version mismatch between GRAM components
+
+50 = The provided RSL 'arguments' parameter is invalid
+51 = The provided RSL 'count' parameter is invalid
+52 = The provided RSL 'directory' parameter is invalid
+53 = The provided RSL 'dryrun' parameter is invalid
+54 = The provided RSL 'environment' parameter is invalid
+55 = The provided RSL 'executable' parameter is invalid
+56 = The provided RSL 'host_count' parameter is invalid
+57 = The provided RSL 'jobtype' parameter is invalid
+58 = The provided RSL 'maxtime' parameter is invalid
+59 = The provided RSL 'myjob' parameter is invalid
+
+60 = The provided RSL 'paradyn' parameter is invalid
+61 = The provided RSL 'project' parameter is invalid
+62 = The provided RSL 'queue' parameter is invalid
+63 = The provided RSL 'stderr' parameter is invalid
+64 = The provided RSL 'stdin' parameter is invalid
+65 = The provided RSL 'stdout' parameter is invalid
+66 = The job manager failed to locate an internal script
+67 = The job manager failed on the system call pipe()
+68 = The job manager failed on the system call fcntl()
+69 = The job manager failed to create the temporary stdout filename
+
+70 = The job manager failed to create the temporary stderr filename
+71 = The job manager failed on the system call fork()
+72 = The executable file permissions do not allow execution
+73 = The job manager failed to open stdout
+74 = The job manager failed to open stderr
+75 = The cache file could not be opened in order to relocate the user proxy
+76 = Cannot access cache files in ~/.globus/.gass_cache, check permissions, quota, and disk space
+77 = The job manager failed to insert the contact in the client contact list
+78 = The contact was not found in the job manager's client contact list
+79 = Connecting to the job manager failed.  Possible reasons: job terminated, invalid job contact, network problems, ...
+
+80 = The syntax of the job contact is invalid
+81 = The executable parameter in the RSL is undefined
+82 = The job manager service is misconfigured.  condor arch undefined
+83 = The job manager service is misconfigured.  condor os undefined
+84 = The provided RSL 'min_memory' parameter is invalid
+85 = The provided RSL 'max_memory' parameter is invalid
+86 = The RSL 'min_memory' value is not zero or greater
+87 = The RSL 'max_memory' value is not zero or greater
+88 = The creation of a HTTP message failed
+89 = Parsing incoming HTTP message failed
+
+90 = The packing of information into a HTTP message failed
+91 = An incoming HTTP message did not contain the expected information
+92 = The job manager does not support the service that the client requested
+93 = The gatekeeper failed to find the requested service
+94 = The jobmanager does not accept any new requests (shutting down)
+95 = The client failed to close the listener associated with the callback URL
+96 = The gatekeeper contact cannot be parsed
+97 = The job manager could not find the 'poe' command
+98 = The job manager could not find the 'mpirun' command
+99 = The provided RSL 'start_time' parameter is invalid"
+100 = The provided RSL 'reservation_handle' parameter is invalid
+
+101 = The provided RSL 'max_wall_time' parameter is invalid
+102 = The RSL 'max_wall_time' value is not zero or greater
+103 = The provided RSL 'max_cpu_time' parameter is invalid
+104 = The RSL 'max_cpu_time' value is not zero or greater
+105 = The job manager is misconfigured, a scheduler script is missing
+106 = The job manager is misconfigured, a scheduler script has invalid permissions
+107 = The job manager failed to signal the job
+108 = The job manager did not recognize/support the signal type
+109 = The job manager failed to get the job id from the local scheduler
+
+110 = The job manager is waiting for a commit signal
+111 = The job manager timed out while waiting for a commit signal
+112 = The provided RSL 'save_state' parameter is invalid
+113 = The provided RSL 'restart' parameter is invalid
+114 = The provided RSL 'two_phase' parameter is invalid
+115 = The RSL 'two_phase' value is not zero or greater
+116 = The provided RSL 'stdout_position' parameter is invalid
+117 = The RSL 'stdout_position' value is not zero or greater
+118 = The provided RSL 'stderr_position' parameter is invalid
+119 = The RSL 'stderr_position' value is not zero or greater
+
+120 = The job manager restart attempt failed
+121 = The job state file doesn't exist
+122 = Could not read the job state file
+123 = Could not write the job state file
+124 = The old job manager is still alive
+125 = The job manager state file TTL expired
+126 = It is unknown if the job was submitted
+127 = The provided RSL 'remote_io_url' parameter is invalid
+128 = Could not write the remote io url file
+129 = The standard output/error size is different
+
+130 = The job manager was sent a stop signal (job is still running)
+131 = The user proxy expired (job is still running)
+132 = The job was not submitted by original jobmanager
+133 = The job manager is not waiting for that commit signal
+134 = The provided RSL scheduler specific parameter is invalid
+135 = The job manager could not stage in a file
+136 = The scratch directory could not be created
+137 = The provided 'gass_cache' parameter is invalid
+138 = The RSL contains attributes which are not valid for job submission
+139 = The RSL contains attributes which are not valid for stdio update
+
+140 = The RSL contains attributes which are not valid for job restart
+141 = The provided RSL 'file_stage_in' parameter is invalid
+142 = The provided RSL 'file_stage_in_shared' parameter is invalid
+143 = The provided RSL 'file_stage_out' parameter is invalid
+144 = The provided RSL 'gass_cache' parameter is invalid
+145 = The provided RSL 'file_cleanup' parameter is invalid
+146 = The provided RSL 'scratch_dir' parameter is invalid
+147 = The provided scheduler-specific RSL parameter is invalid
+148 = A required RSL attribute was not defined in the RSL spec
+149 = The gass_cache attribute points to an invalid cache directory
+
+150 = The provided RSL 'save_state' parameter has an invalid value
+151 = The job manager could not open the RSL attribute validation file
+152 = The  job manager could not read the RSL attribute validation file
+153 = The provided RSL 'proxy_timeout' is invalid
+154 = The RSL 'proxy_timeout' value is not greater than zero
+155 = The job manager could not stage out a file
+156 = The job contact string does not match any which the job manager is handling
+157 = Proxy delegation failed
+158 = The job manager could not lock the state lock file
+
+1000 = Failed to start up callback handler
+1003 = Job contact not set

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata-sandbox] 01/05: Added Added initial files for entities, repositories for allocation manager module

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git

commit 03fe760eaf35d961d6847a3f2b70c0f0df5de5c6
Author: Harsha Phulwani <ha...@gmail.com>
AuthorDate: Mon Nov 13 01:56:30 2017 -0500

    Added Added initial files for entities,repositories for allocation manager module
---
 .../manager/db/entities/RequestStatusEntity.java   |  87 +++++++++
 .../db/entities/UserAllocationDetailEntity.java    | 202 +++++++++++++++++++++
 .../db/entities/UserAllocationDetailPKEntity.java  |  56 ++++++
 .../manager/db/entities/UserDetailEntity.java      |  75 ++++++++
 .../db/repositories/AbstractRepository.java        | 170 +++++++++++++++++
 .../db/repositories/RequestStatusRepository.java   |  14 ++
 .../UserAllocationDetailPKRepository.java          |  14 ++
 .../UserAllocationDetailRepository.java            |  14 ++
 .../db/repositories/UserDetailRepository.java      |  19 ++
 .../src/main/resources/META-INF/persistence.xml    |  11 ++
 .../main/resources/allocation-manager-mysql.sql    |  58 ++++++
 11 files changed, 720 insertions(+)

diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
new file mode 100644
index 0000000..4263468
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
@@ -0,0 +1,87 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the request_status database table.
+ * 
+ */
+@Entity
+@Table(name="request_status")
+@NamedQuery(name="RequestStatus.findAll", query="SELECT r FROM RequestStatus r")
+public class RequestStatus implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="PROJECT_ID")
+	private String projectId;
+
+	@Column(name="AWARD_ALLOCATION")
+	private BigInteger awardAllocation;
+
+	@Column(name="END_DATE")
+	private BigInteger endDate;
+
+	@Lob
+	private String reviewers;
+
+	@Column(name="START_DATE")
+	private BigInteger startDate;
+
+	private String status;
+
+	public RequestStatus() {
+	}
+
+	public String getProjectId() {
+		return this.projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+
+	public BigInteger getAwardAllocation() {
+		return this.awardAllocation;
+	}
+
+	public void setAwardAllocation(BigInteger awardAllocation) {
+		this.awardAllocation = awardAllocation;
+	}
+
+	public BigInteger getEndDate() {
+		return this.endDate;
+	}
+
+	public void setEndDate(BigInteger endDate) {
+		this.endDate = endDate;
+	}
+
+	public String getReviewers() {
+		return this.reviewers;
+	}
+
+	public void setReviewers(String reviewers) {
+		this.reviewers = reviewers;
+	}
+
+	public BigInteger getStartDate() {
+		return this.startDate;
+	}
+
+	public void setStartDate(BigInteger startDate) {
+		this.startDate = startDate;
+	}
+
+	public String getStatus() {
+		return this.status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
new file mode 100644
index 0000000..7d40899
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
@@ -0,0 +1,202 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the user_allocation_details database table.
+ * 
+ */
+@Entity
+@Table(name="user_allocation_details")
+@NamedQuery(name="UserAllocationDetail.findAll", query="SELECT u FROM UserAllocationDetail u")
+public class UserAllocationDetail implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@EmbeddedId
+	private UserAllocationDetailPK id;
+
+	@Lob
+	@Column(name="APPLICATIONS_TO_BE_USED")
+	private String applicationsToBeUsed;
+
+	@Column(name="DISK_USAGE_RANGE_PER_JOB")
+	private BigInteger diskUsageRangePerJob;
+
+	@Lob
+	private byte[] documents;
+
+	@Lob
+	@Column(name="FIELD_OF_SCIENCE")
+	private String fieldOfScience;
+
+	@Lob
+	private String keywords;
+
+	@Column(name="MAX_MEMORY_PER_CPU")
+	private BigInteger maxMemoryPerCpu;
+
+	@Column(name="NUMBER_OF_CPU_PER_JOB")
+	private BigInteger numberOfCpuPerJob;
+
+	@Lob
+	@Column(name="PROJECT_DESCRIPTION")
+	private String projectDescription;
+
+	@Lob
+	@Column(name="PROJECT_REVIEWED_AND_FUNDED_BY")
+	private String projectReviewedAndFundedBy;
+
+	@Column(name="REQUESTED_DATE")
+	private BigInteger requestedDate;
+
+	@Column(name="SERVICE_UNITS")
+	private BigInteger serviceUnits;
+
+	@Lob
+	@Column(name="SPECIFIC_RESOURCE_SELECTION")
+	private String specificResourceSelection;
+
+	@Lob
+	private String title;
+
+	@Column(name="TYPE_OF_ALLOCATION")
+	private String typeOfAllocation;
+
+	@Column(name="TYPICAL_SU_PER_JOB")
+	private BigInteger typicalSuPerJob;
+
+	public UserAllocationDetail() {
+	}
+
+	public UserAllocationDetailPK getId() {
+		return this.id;
+	}
+
+	public void setId(UserAllocationDetailPK id) {
+		this.id = id;
+	}
+
+	public String getApplicationsToBeUsed() {
+		return this.applicationsToBeUsed;
+	}
+
+	public void setApplicationsToBeUsed(String applicationsToBeUsed) {
+		this.applicationsToBeUsed = applicationsToBeUsed;
+	}
+
+	public BigInteger getDiskUsageRangePerJob() {
+		return this.diskUsageRangePerJob;
+	}
+
+	public void setDiskUsageRangePerJob(BigInteger diskUsageRangePerJob) {
+		this.diskUsageRangePerJob = diskUsageRangePerJob;
+	}
+
+	public byte[] getDocuments() {
+		return this.documents;
+	}
+
+	public void setDocuments(byte[] documents) {
+		this.documents = documents;
+	}
+
+	public String getFieldOfScience() {
+		return this.fieldOfScience;
+	}
+
+	public void setFieldOfScience(String fieldOfScience) {
+		this.fieldOfScience = fieldOfScience;
+	}
+
+	public String getKeywords() {
+		return this.keywords;
+	}
+
+	public void setKeywords(String keywords) {
+		this.keywords = keywords;
+	}
+
+	public BigInteger getMaxMemoryPerCpu() {
+		return this.maxMemoryPerCpu;
+	}
+
+	public void setMaxMemoryPerCpu(BigInteger maxMemoryPerCpu) {
+		this.maxMemoryPerCpu = maxMemoryPerCpu;
+	}
+
+	public BigInteger getNumberOfCpuPerJob() {
+		return this.numberOfCpuPerJob;
+	}
+
+	public void setNumberOfCpuPerJob(BigInteger numberOfCpuPerJob) {
+		this.numberOfCpuPerJob = numberOfCpuPerJob;
+	}
+
+	public String getProjectDescription() {
+		return this.projectDescription;
+	}
+
+	public void setProjectDescription(String projectDescription) {
+		this.projectDescription = projectDescription;
+	}
+
+	public String getProjectReviewedAndFundedBy() {
+		return this.projectReviewedAndFundedBy;
+	}
+
+	public void setProjectReviewedAndFundedBy(String projectReviewedAndFundedBy) {
+		this.projectReviewedAndFundedBy = projectReviewedAndFundedBy;
+	}
+
+	public BigInteger getRequestedDate() {
+		return this.requestedDate;
+	}
+
+	public void setRequestedDate(BigInteger requestedDate) {
+		this.requestedDate = requestedDate;
+	}
+
+	public BigInteger getServiceUnits() {
+		return this.serviceUnits;
+	}
+
+	public void setServiceUnits(BigInteger serviceUnits) {
+		this.serviceUnits = serviceUnits;
+	}
+
+	public String getSpecificResourceSelection() {
+		return this.specificResourceSelection;
+	}
+
+	public void setSpecificResourceSelection(String specificResourceSelection) {
+		this.specificResourceSelection = specificResourceSelection;
+	}
+
+	public String getTitle() {
+		return this.title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getTypeOfAllocation() {
+		return this.typeOfAllocation;
+	}
+
+	public void setTypeOfAllocation(String typeOfAllocation) {
+		this.typeOfAllocation = typeOfAllocation;
+	}
+
+	public BigInteger getTypicalSuPerJob() {
+		return this.typicalSuPerJob;
+	}
+
+	public void setTypicalSuPerJob(BigInteger typicalSuPerJob) {
+		this.typicalSuPerJob = typicalSuPerJob;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java
new file mode 100644
index 0000000..93f8502
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java
@@ -0,0 +1,56 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+/**
+ * The primary key class for the user_allocation_details database table.
+ * 
+ */
+@Embeddable
+public class UserAllocationDetailPK implements Serializable {
+	//default serial version id, required for serializable classes.
+	private static final long serialVersionUID = 1L;
+
+	@Column(name="PROJECT_ID")
+	private String projectId;
+
+	private String username;
+
+	public UserAllocationDetailPK() {
+	}
+	public String getProjectId() {
+		return this.projectId;
+	}
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+	public String getUsername() {
+		return this.username;
+	}
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof UserAllocationDetailPK)) {
+			return false;
+		}
+		UserAllocationDetailPK castOther = (UserAllocationDetailPK)other;
+		return 
+			this.projectId.equals(castOther.projectId)
+			&& this.username.equals(castOther.username);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.projectId.hashCode();
+		hash = hash * prime + this.username.hashCode();
+		
+		return hash;
+	}
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
new file mode 100644
index 0000000..b27a6bc
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
@@ -0,0 +1,75 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+
+/**
+ * The persistent class for the user_details database table.
+ * 
+ */
+@Entity
+@Table(name="user_details")
+@NamedQuery(name="UserDetail.findAll", query="SELECT u FROM UserDetail u")
+public class UserDetail implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	private String username;
+
+	@Lob
+	private String email;
+
+	@Lob
+	@Column(name="FULL_NAME")
+	private String fullName;
+
+	private String password;
+
+	@Column(name="USER_TYPE")
+	private String userType;
+
+	public UserDetail() {
+	}
+
+	public String getUsername() {
+		return this.username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getEmail() {
+		return this.email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public String getFullName() {
+		return this.fullName;
+	}
+
+	public void setFullName(String fullName) {
+		this.fullName = fullName;
+	}
+
+	public String getPassword() {
+		return this.password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public String getUserType() {
+		return this.userType;
+	}
+
+	public void setUserType(String userType) {
+		this.userType = userType;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
new file mode 100644
index 0000000..0ca393e
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
@@ -0,0 +1,170 @@
+/**
+ *
+ * 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.sharing.registry.db.repositories;
+
+import org.apache.airavata.sharing.registry.db.utils.Committer;
+import org.apache.airavata.sharing.registry.db.utils.DBConstants;
+import org.apache.airavata.sharing.registry.db.utils.JPAUtils;
+import org.apache.airavata.sharing.registry.db.utils.ObjectMapperSingleton;
+import org.apache.airavata.sharing.registry.models.SharingRegistryException;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractRepository<T, E, Id> {
+    private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
+
+    private Class<T> thriftGenericClass;
+    private Class<E> dbEntityGenericClass;
+
+    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
+        this.thriftGenericClass = thriftGenericClass;
+        this.dbEntityGenericClass = dbEntityGenericClass;
+    }
+
+    public T create(T t) throws SharingRegistryException {
+        return update(t);
+    }
+
+    //FIXME do a bulk insert
+    public List<T> create(List<T> tList) throws SharingRegistryException {
+        return update(tList);
+    }
+    
+    public List<T> create(String query) throws SharingRegistryException {
+       // String query = "INSERT INTO " + dbEntityGenericClass.getSimpleName() + " values("+values+")";
+       execute(entityManager -> {
+            javax.persistence.Query q = entityManager.createQuery(query);
+        });
+    }
+
+    public  T update(T t) throws SharingRegistryException {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        E entity = mapper.map(t, dbEntityGenericClass);
+        E persistedCopy = execute(entityManager -> entityManager.merge(entity));
+        return mapper.map(persistedCopy, thriftGenericClass);
+    }
+
+    //FIXME do a bulk update
+    public  List<T> update(List<T> tList) throws SharingRegistryException {
+        List<T> returnList = new ArrayList<>();
+        for(T temp : tList)
+            returnList.add(update(temp));
+        return returnList;
+    }
+
+    public boolean delete(Id id) throws SharingRegistryException {
+        execute(entityManager -> {
+             E entity = entityManager.find(dbEntityGenericClass, id);
+             entityManager.remove(entity);
+             return entity;
+         });
+        return true;
+    }
+
+    public boolean delete(List<Id> idList) throws SharingRegistryException {
+        for(Id id : idList)
+            delete(id);
+        return true;
+    }
+
+    public T get(Id id) throws SharingRegistryException {
+        E entity = execute(entityManager -> entityManager
+                .find(dbEntityGenericClass, id));
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        if(entity == null)
+            return null;
+        return mapper.map(entity, thriftGenericClass);
+    }
+
+    public boolean isExists(Id id) throws SharingRegistryException {
+        return get(id) != null;
+    }
+
+    public List<T> get(List<Id> idList) throws SharingRegistryException {
+        List<T> returnList = new ArrayList<>();
+        for(Id id : idList)
+            returnList.add(get(id));
+        return returnList;
+    }
+
+    public List<T> select(Map<String, String> filters, int offset, int limit) throws SharingRegistryException {
+        String query = "SELECT DISTINCT p from " + dbEntityGenericClass.getSimpleName() + " as p";
+        ArrayList<String> parameters = new ArrayList<>();
+        int parameterCount = 1;
+        if (filters != null && filters.size() != 0) {
+            query += " WHERE ";
+            for (String k : filters.keySet()) {
+                query += "p." + k + " = ?" + parameterCount + " AND ";
+                parameters.add(filters.get(k));
+                parameterCount++;
+            }
+            query = query.substring(0, query.length() - 5);
+        }
+
+        query += " ORDER BY p.createdTime DESC";
+        String queryString = query;
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            javax.persistence.Query q = entityManager.createQuery(queryString);
+            for (int i = 0; i < parameters.size(); i++) {
+                q.setParameter(i + 1, parameters.get(i));
+            }
+            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public List<T> select(String queryString, Map<String,Object> queryParameters, int offset, int limit) throws SharingRegistryException {
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            Query q =  entityManager.createQuery(queryString);
+            for(Map.Entry<String, Object> queryParam : queryParameters.entrySet()){
+                q.setParameter(queryParam.getKey(), queryParam.getValue());
+            }
+            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public <R> R execute(Committer<EntityManager, R> committer) throws SharingRegistryException {
+        EntityManager entityManager = JPAUtils.getEntityManager();
+        try {
+            entityManager.getTransaction().begin();
+            R r = committer.commit(entityManager);
+            entityManager.getTransaction().commit();
+            return r;
+        } finally {
+            entityManager.close();
+        }
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
new file mode 100644
index 0000000..52a2c4e
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity;
+import org.apache.airavata.sharing.registry.models.RequestStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RequestStatusRepository extends AbstractRepository<RequestStatus, RequestStatusEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public RequestStatusRepository(){
+        super(RequestStatus.class, RequestStatusEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
new file mode 100644
index 0000000..0644f8a
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailPKEntity;
+import org.apache.airavata.sharing.registry.models.UserAllocationDetailPK;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailPKRepository extends AbstractRepository<UserAllocationDetailPK, UserAllocationDetailPKEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailPKRepository(){
+        super(UserAllocationDetailPK.class, UserAllocationDetailPKEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
new file mode 100644
index 0000000..35366d6
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
+import org.apache.airavata.sharing.registry.models.UserAllocationDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailRepository extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailRepository(){
+        super(UserAllocationDetail.class, UserAllocationDetailEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
new file mode 100644
index 0000000..55cd888
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
@@ -0,0 +1,19 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserDetailEntity;
+import org.apache.airavata.sharing.registry.models.UserDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserDetailRepository extends AbstractRepository<UserDetail, UserAllocationEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserDetailRepository(){
+        super(UserDetail.class, UserDetailEntity.class);
+    }
+
+    public static void main(String args[])
+    {
+
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml b/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..a006ad6
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
+
+    <persistence-unit name="airavata-allocation-manager">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity</class>
+        <class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailPKEntity</class>
+        <class>org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity</class>
+        <class>org.apache.airavata.allocation.manager.db.entities.UserDetailEntity</class>
+    </persistence-unit>
+</persistence>
diff --git a/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql b/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
new file mode 100644
index 0000000..20824f6
--- /dev/null
+++ b/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+CREATE TABLE IF NOT EXISTS USER_ALLOCATION_DETAILS (
+    REQUESTED_DATE BIGINT NOT NULL,
+    TITLE TEXT NOT NULL,
+    PROJECT_DESCRIPTION TEXT NOT NULL,
+    KEYWORDS TEXT,
+    FIELD_OF_SCIENCE TEXT,
+    DOCUMENTS BLOB,
+    TYPE_OF_ALLOCATION VARCHAR (255) NOT NULL,
+    USERNAME VARCHAR (255) NOT NULL,
+    PROJECT_ID VARCHAR (255) ,
+    APPLICATIONS_TO_BE_USED TEXT,
+    SPECIFIC_RESOURCE_SELECTION TEXT,
+    SERVICE_UNITS BIGINT default 1,
+    TYPICAL_SU_PER_JOB BIGINT,
+    MAX_MEMORY_PER_CPU BIGINT,
+    DISK_USAGE_RANGE_PER_JOB BIGINT,
+    NUMBER_OF_CPU_PER_JOB BIGINT,
+    PROJECT_REVIEWED_AND_FUNDED_BY TEXT,
+    PRIMARY KEY (PROJECT_ID, USERNAME)
+);
+
+CREATE TABLE IF NOT EXISTS USER_DETAILS (
+    USERNAME VARCHAR (255) PRIMARY KEY,
+    PASSWORD VARCHAR (255) NOT NULL,
+    FULL_NAME TEXT,
+    EMAIL TEXT NOT NULL,
+    USER_TYPE VARCHAR (255) NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS REQUEST_STATUS (
+    PROJECT_ID VARCHAR (255) PRIMARY KEY,
+    STATUS VARCHAR (255) NOT NULL,
+    REVIEWERS TEXT,
+    START_DATE BIGINT,
+    END_DATE BIGINT,
+    AWARD_ALLOCATION BIGINT
+);

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata-sandbox] 05/05: Added entities, repositories, utils and updated pom file

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git

commit 50534be30e135e5c8b73cbb62051a92c1ddabf48
Author: Harsha Phulwani <ha...@gmail.com>
AuthorDate: Fri Nov 17 18:44:12 2017 -0500

    Added entities,repositories,utils and updated pom file
---
 .gitignore                                         |  34 +-
 .../airavata-allocation-manager-server/pom.xml     |  64 +++-
 .../manager/db/entities/DomainEntity.java          | 116 +++++++
 .../manager/db/entities/RequestStatusEntity.java   |  78 +++++
 .../db/entities/UserAllocationDetailEntity.java    | 205 +++++++++++
 .../db/entities/UserAllocationDetailEntityPK.java  |  57 +++
 .../manager/db/entities/UserDetailEntity.java      |  78 +++++
 .../db/repositories/AbstractRepository.java        | 163 +++++++++
 .../manager/db/repositories/DomainRepository.java  |  33 ++
 .../db/repositories/RequestStatusRepository.java   |  14 +
 .../UserAllocationDetailPKRepository.java          |  14 +
 .../UserAllocationDetailRepository.java            |  14 +
 .../db/repositories/UserDetailRepository.java      |  19 +
 .../allocation/manager/db/utils/Committer.java     |  26 ++
 .../manager/db/utils/ConnectionPool.java           | 381 +++++++++++++++++++++
 .../allocation/manager/db/utils/DBConstants.java   | 106 ++++++
 .../manager/db/utils/DatabaseCreator.java          | 352 +++++++++++++++++++
 .../allocation/manager/db/utils/JPAUtils.java      | 215 ++++++++++++
 .../allocation/manager/db/utils/JdbcStorage.java   | 174 ++++++++++
 .../manager/db/utils/ObjectMapperSingleton.java    |  38 ++
 .../airavata/allocation/manager/models/Domain.java |   5 +
 21 files changed, 2159 insertions(+), 27 deletions(-)

diff --git a/.gitignore b/.gitignore
index d6e588b..2d2d74f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,11 @@
+# Compiled class file
 *.class
-*id_rsa*
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
 
 # Mobile Tools for Java (J2ME)
 .mtj.tmp/
@@ -8,18 +14,22 @@
 *.jar
 *.war
 *.ear
-
-
-target/
-.idea/
-tmp/
-logs/
-gaussian_sample/
-*.ser
-*.iml
-*.gen
+*.zip
+*.tar.gz
+*.rar
 
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*
-solr-server/logs/solr.log
 
+# Ignore files ending with target
+*target/
+
+# Ignore files starting with bin
+bin/*
+
+# Ignore files starting with dot
+.*
+!.gitignore
+
+
+/bin/
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
index 86dd4fc..8cb41b4 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
@@ -1,21 +1,55 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.airavata</groupId>
-    <artifactId>airavata-allocation-manager</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-  </parent>
-  <artifactId>airavata-allocation-manager-server</artifactId>
-  <dependencies>
-		<dependency>
-			<groupId>org.apache.thrift</groupId>
-			<artifactId>libthrift</artifactId>
-			<version>0.10.0</version>
-		</dependency>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.airavata</groupId>
+		<artifactId>airavata-allocation-manager</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>
+	<artifactId>airavata-allocation-manager-server</artifactId>
+	<dependencies>
 		<dependency>
 			<groupId>org.apache.airavata</groupId>
 			<artifactId>airavata-allocation-manager-stubs</artifactId>
 			<version>0.0.1-SNAPSHOT</version>
 		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.7.10</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.dozer</groupId>
+			<artifactId>dozer</artifactId>
+			<version>5.4.0</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.slf4j</groupId>
+					<artifactId>slf4j-log4j12</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.openjpa</groupId>
+			<artifactId>openjpa-all</artifactId>
+			<version>2.2.0</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.34</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
+		<dependency>
+			<groupId>org.apache.thrift</groupId>
+			<artifactId>libthrift</artifactId>
+			<version>0.10.0</version>
+			<type>pom</type>
+		</dependency>
 	</dependencies>
-</project>
\ No newline at end of file
+	<properties>
+		<maven.compiler.source>1.8</maven.compiler.source>
+		<maven.compiler.target>1.8</maven.compiler.target>
+	</properties>
+</project> 
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java
new file mode 100644
index 0000000..2aed6f9
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java
@@ -0,0 +1,116 @@
+/**
+ *
+ * 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.allocation.manager.db.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "DOMAIN", schema = "" )
+public class DomainEntity {
+    private final static Logger logger = LoggerFactory.getLogger(DomainEntity.class);
+    private String domainId;
+    private String name;
+    private String description;
+    private Long createdTime;
+    private Long updatedTime;
+
+    @Id
+    @Column(name = "DOMAIN_ID")
+    public String getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(String domainId) {
+        this.domainId = domainId;
+    }
+
+    @Basic
+    @Column(name = "NAME")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Basic
+    @Column(name = "DESCRIPTION")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Basic
+    @Column(name = "CREATED_TIME")
+    public Long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(Long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    @Basic
+    @Column(name = "UPDATED_TIME")
+    public Long getUpdatedTime() {
+        return updatedTime;
+    }
+
+    public void setUpdatedTime(Long updatedTime) {
+        this.updatedTime = updatedTime;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        DomainEntity that = (DomainEntity) o;
+
+        if (getDomainId() != null ? !getDomainId().equals(that.getDomainId()) : that.getDomainId() != null)
+            return false;
+        if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;
+        if (getDescription() != null ? !getDescription().equals(that.getDescription()) : that.getDescription() != null)
+            return false;
+        if (getCreatedTime() != null ? !getCreatedTime().equals(that.getCreatedTime()) : that.getCreatedTime() != null)
+            return false;
+        if (getUpdatedTime() != null ? !getUpdatedTime().equals(that.getUpdatedTime()) : that.getUpdatedTime() != null)
+            return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = getDomainId() != null ? getDomainId().hashCode() : 0;
+        result = 31 * result + (getName() != null ? getName().hashCode() : 0);
+        result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
+        result = 31 * result + (getCreatedTime() != null ? getCreatedTime().hashCode() : 0);
+        result = 31 * result + (getUpdatedTime() != null ? getUpdatedTime().hashCode() : 0);
+        return result;
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
new file mode 100644
index 0000000..42ccc4a
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
@@ -0,0 +1,78 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the REQUEST_STATUS database table.
+ * 
+ */
+@Entity
+@Table(name="REQUEST_STATUS")
+@NamedQuery(name="RequestStatusEntity.findAll", query="SELECT r FROM RequestStatusEntity r")
+public class RequestStatusEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="PROJECT_ID")
+	private String projectId;
+
+	@Column(name="END_DATE")
+	private BigInteger endDate;
+
+	@Lob
+	@Column(name="REVIEWERS")
+	private String reviewers;
+
+	@Column(name="START_DATE")
+	private BigInteger startDate;
+
+	@Column(name="STATUS")
+	private String status;
+
+	public RequestStatusEntity() {
+	}
+
+	public String getProjectId() {
+		return this.projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+
+	public BigInteger getEndDate() {
+		return this.endDate;
+	}
+
+	public void setEndDate(BigInteger endDate) {
+		this.endDate = endDate;
+	}
+
+	public String getReviewers() {
+		return this.reviewers;
+	}
+
+	public void setReviewers(String reviewers) {
+		this.reviewers = reviewers;
+	}
+
+	public BigInteger getStartDate() {
+		return this.startDate;
+	}
+
+	public void setStartDate(BigInteger startDate) {
+		this.startDate = startDate;
+	}
+
+	public String getStatus() {
+		return this.status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
new file mode 100644
index 0000000..35ab18d
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
@@ -0,0 +1,205 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+import java.math.BigInteger;
+
+
+/**
+ * The persistent class for the USER_ALLOCATION_DETAILS database table.
+ * 
+ */
+@Entity
+@Table(name="USER_ALLOCATION_DETAILS")
+@NamedQuery(name="UserAllocationDetailEntity.findAll", query="SELECT u FROM UserAllocationDetailEntity u")
+public class UserAllocationDetailEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@EmbeddedId
+	private UserAllocationDetailEntityPK id;
+
+	@Lob
+	@Column(name="APPLICATIONS_TO_BE_USED")
+	private String applicationsToBeUsed;
+
+	@Column(name="DISK_USAGE_RANGE_PER_JOB")
+	private BigInteger diskUsageRangePerJob;
+
+	@Lob
+	@Column(name="DOCUMENTS")
+	private byte[] documents;
+
+	@Lob
+	@Column(name="FIELD_OF_SCIENCE")
+	private String fieldOfScience;
+
+	@Lob
+	@Column(name="KEYWORDS")
+	private String keywords;
+
+	@Column(name="MAX_MEMORY_PER_CPU")
+	private BigInteger maxMemoryPerCpu;
+
+	@Column(name="NUMBER_OF_CPU_PER_JOB")
+	private BigInteger numberOfCpuPerJob;
+
+	@Lob
+	@Column(name="PROJECT_DESCRIPTION")
+	private String projectDescription;
+
+	@Lob
+	@Column(name="PROJECT_REVIEWED_AND_FUNDED_BY")
+	private String projectReviewedAndFundedBy;
+
+	@Column(name="REQ_DATE")
+	private BigInteger reqDate;
+
+	@Column(name="SERVICE_UNITS")
+	private BigInteger serviceUnits;
+
+	@Lob
+	@Column(name="SPECIFIC_RESOURCE_SELECTION")
+	private String specificResourceSelection;
+
+	@Lob
+	@Column(name="TITLE")
+	private String title;
+
+	@Column(name="TYPE_OF_ALLOCATION")
+	private String typeOfAllocation;
+
+	@Column(name="TYPICAL_SU_PER_JOB")
+	private BigInteger typicalSuPerJob;
+
+	public UserAllocationDetailEntity() {
+	}
+
+	public UserAllocationDetailEntityPK getId() {
+		return this.id;
+	}
+
+	public void setId(UserAllocationDetailEntityPK id) {
+		this.id = id;
+	}
+
+	public String getApplicationsToBeUsed() {
+		return this.applicationsToBeUsed;
+	}
+
+	public void setApplicationsToBeUsed(String applicationsToBeUsed) {
+		this.applicationsToBeUsed = applicationsToBeUsed;
+	}
+
+	public BigInteger getDiskUsageRangePerJob() {
+		return this.diskUsageRangePerJob;
+	}
+
+	public void setDiskUsageRangePerJob(BigInteger diskUsageRangePerJob) {
+		this.diskUsageRangePerJob = diskUsageRangePerJob;
+	}
+
+	public byte[] getDocuments() {
+		return this.documents;
+	}
+
+	public void setDocuments(byte[] documents) {
+		this.documents = documents;
+	}
+
+	public String getFieldOfScience() {
+		return this.fieldOfScience;
+	}
+
+	public void setFieldOfScience(String fieldOfScience) {
+		this.fieldOfScience = fieldOfScience;
+	}
+
+	public String getKeywords() {
+		return this.keywords;
+	}
+
+	public void setKeywords(String keywords) {
+		this.keywords = keywords;
+	}
+
+	public BigInteger getMaxMemoryPerCpu() {
+		return this.maxMemoryPerCpu;
+	}
+
+	public void setMaxMemoryPerCpu(BigInteger maxMemoryPerCpu) {
+		this.maxMemoryPerCpu = maxMemoryPerCpu;
+	}
+
+	public BigInteger getNumberOfCpuPerJob() {
+		return this.numberOfCpuPerJob;
+	}
+
+	public void setNumberOfCpuPerJob(BigInteger numberOfCpuPerJob) {
+		this.numberOfCpuPerJob = numberOfCpuPerJob;
+	}
+
+	public String getProjectDescription() {
+		return this.projectDescription;
+	}
+
+	public void setProjectDescription(String projectDescription) {
+		this.projectDescription = projectDescription;
+	}
+
+	public String getProjectReviewedAndFundedBy() {
+		return this.projectReviewedAndFundedBy;
+	}
+
+	public void setProjectReviewedAndFundedBy(String projectReviewedAndFundedBy) {
+		this.projectReviewedAndFundedBy = projectReviewedAndFundedBy;
+	}
+
+	public BigInteger getReqDate() {
+		return this.reqDate;
+	}
+
+	public void setReqDate(BigInteger reqDate) {
+		this.reqDate = reqDate;
+	}
+
+	public BigInteger getServiceUnits() {
+		return this.serviceUnits;
+	}
+
+	public void setServiceUnits(BigInteger serviceUnits) {
+		this.serviceUnits = serviceUnits;
+	}
+
+	public String getSpecificResourceSelection() {
+		return this.specificResourceSelection;
+	}
+
+	public void setSpecificResourceSelection(String specificResourceSelection) {
+		this.specificResourceSelection = specificResourceSelection;
+	}
+
+	public String getTitle() {
+		return this.title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getTypeOfAllocation() {
+		return this.typeOfAllocation;
+	}
+
+	public void setTypeOfAllocation(String typeOfAllocation) {
+		this.typeOfAllocation = typeOfAllocation;
+	}
+
+	public BigInteger getTypicalSuPerJob() {
+		return this.typicalSuPerJob;
+	}
+
+	public void setTypicalSuPerJob(BigInteger typicalSuPerJob) {
+		this.typicalSuPerJob = typicalSuPerJob;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java
new file mode 100644
index 0000000..e768883
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java
@@ -0,0 +1,57 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+/**
+ * The primary key class for the USER_ALLOCATION_DETAILS database table.
+ * 
+ */
+@Embeddable
+public class UserAllocationDetailEntityPK implements Serializable {
+	//default serial version id, required for serializable classes.
+	private static final long serialVersionUID = 1L;
+
+	@Column(name="PROJECT_ID")
+	private String projectId;
+
+	@Column(name="USERNAME")
+	private String username;
+
+	public UserAllocationDetailEntityPK() {
+	}
+	public String getProjectId() {
+		return this.projectId;
+	}
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+	public String getUsername() {
+		return this.username;
+	}
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof UserAllocationDetailEntityPK)) {
+			return false;
+		}
+		UserAllocationDetailEntityPK castOther = (UserAllocationDetailEntityPK)other;
+		return 
+			this.projectId.equals(castOther.projectId)
+			&& this.username.equals(castOther.username);
+	}
+
+	public int hashCode() {
+		final int prime = 31;
+		int hash = 17;
+		hash = hash * prime + this.projectId.hashCode();
+		hash = hash * prime + this.username.hashCode();
+		
+		return hash;
+	}
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
new file mode 100644
index 0000000..9eb04fc
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
@@ -0,0 +1,78 @@
+package org.apache.airavata.allocation.manager.db.entities;
+
+import java.io.Serializable;
+import javax.persistence.*;
+
+
+/**
+ * The persistent class for the USER_DETAILS database table.
+ * 
+ */
+@Entity
+@Table(name="USER_DETAILS")
+@NamedQuery(name="UserDetailEntity.findAll", query="SELECT u FROM UserDetailEntity u")
+public class UserDetailEntity implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name="USERNAME")
+	private String username;
+
+	@Lob
+	@Column(name="EMAIL")
+	private String email;
+
+	@Lob
+	@Column(name="FULL_NAME")
+	private String fullName;
+
+	@Column(name="PASSWORD")
+	private String password;
+
+	@Column(name="USER_TYPE")
+	private String userType;
+
+	public UserDetailEntity() {
+	}
+
+	public String getUsername() {
+		return this.username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getEmail() {
+		return this.email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public String getFullName() {
+		return this.fullName;
+	}
+
+	public void setFullName(String fullName) {
+		this.fullName = fullName;
+	}
+
+	public String getPassword() {
+		return this.password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public String getUserType() {
+		return this.userType;
+	}
+
+	public void setUserType(String userType) {
+		this.userType = userType;
+	}
+
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
new file mode 100644
index 0000000..6449b4a
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
@@ -0,0 +1,163 @@
+/**
+ *
+ * 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.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.utils.Committer;
+import org.apache.airavata.allocation.manager.db.utils.DBConstants;
+import org.apache.airavata.allocation.manager.db.utils.JPAUtils;
+import org.apache.airavata.allocation.manager.db.utils.ObjectMapperSingleton;
+import org.apache.airavata.allocation.manager.models.AllocationManagerException;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractRepository<T, E, Id> {
+    private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
+
+    private Class<T> thriftGenericClass;
+    private Class<E> dbEntityGenericClass;
+
+    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
+        this.thriftGenericClass = thriftGenericClass;
+        this.dbEntityGenericClass = dbEntityGenericClass;
+    }
+
+    public T create(T t) throws Exception {
+        return update(t);
+    }
+
+    //FIXME do a bulk insert
+    public List<T> create(List<T> tList) throws Exception {
+        return update(tList);
+    }
+
+    public  T update(T t) throws Exception {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        E entity = mapper.map(t, dbEntityGenericClass);
+        E persistedCopy = execute(entityManager -> entityManager.merge(entity));
+        return mapper.map(persistedCopy, thriftGenericClass);
+    }
+
+    //FIXME do a bulk update
+    public  List<T> update(List<T> tList) throws Exception {
+        List<T> returnList = new ArrayList<T>();
+        for(T temp : tList)
+            returnList.add(update(temp));
+        return returnList;
+    }
+
+    public boolean delete(Id id) throws Exception {
+        execute(entityManager -> {
+             E entity = entityManager.find(dbEntityGenericClass, id);
+             entityManager.remove(entity);
+             return entity;
+         });
+        return true;
+    }
+
+    public boolean delete(List<Id> idList) throws Exception {
+        for(Id id : idList)
+            delete(id);
+        return true;
+    }
+
+    public T get(Id id) throws Exception {
+        E entity = execute(entityManager -> entityManager
+                .find(dbEntityGenericClass, id));
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        if(entity == null)
+            return null;
+        return mapper.map(entity, thriftGenericClass);
+    }
+
+    public boolean isExists(Id id) throws Exception {
+        return get(id) != null;
+    }
+
+    public List<T> get(List<Id> idList) throws Exception {
+        List<T> returnList = new ArrayList<>();
+        for(Id id : idList)
+            returnList.add(get(id));
+        return returnList;
+    }
+
+    public List<T> select(Map<String, String> filters, int offset, int limit) throws Exception {
+        String query = "SELECT DISTINCT p from " + dbEntityGenericClass.getSimpleName() + " as p";
+        ArrayList<String> parameters = new ArrayList<>();
+        int parameterCount = 1;
+        if (filters != null && filters.size() != 0) {
+            query += " WHERE ";
+            for (String k : filters.keySet()) {
+                query += "p." + k + " = ?" + parameterCount + " AND ";
+                parameters.add(filters.get(k));
+                parameterCount++;
+            }
+            query = query.substring(0, query.length() - 5);
+        }
+
+        query += " ORDER BY p.createdTime DESC";
+        String queryString = query;
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            javax.persistence.Query q = entityManager.createQuery(queryString);
+            for (int i = 0; i < parameters.size(); i++) {
+                q.setParameter(i + 1, parameters.get(i));
+            }
+            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public List<T> select(String queryString, Map<String,Object> queryParameters, int offset, int limit) throws Exception {
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+        List resultSet = execute(entityManager -> {
+            Query q =  entityManager.createQuery(queryString);
+            for(Map.Entry<String, Object> queryParam : queryParameters.entrySet()){
+                q.setParameter(queryParam.getKey(), queryParam.getValue());
+            }
+            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public <R> R execute(Committer<EntityManager, R> committer) throws Exception {
+        EntityManager entityManager = JPAUtils.getEntityManager();
+        try {
+            entityManager.getTransaction().begin();
+            R r = committer.commit(entityManager);
+            entityManager.getTransaction().commit();
+            return r;
+        } finally {
+            entityManager.close();
+        }
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java
new file mode 100644
index 0000000..c86d85b
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java
@@ -0,0 +1,33 @@
+/**
+ *
+ * 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.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.DomainEntity;
+import org.apache.airavata.allocation.manager.models.Domain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DomainRepository extends AbstractRepository<Domain, DomainEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public DomainRepository(){
+        super(Domain.class, DomainEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
new file mode 100644
index 0000000..71cbba8
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity;
+import org.apache.airavata.allocation.manager.models.RequestStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RequestStatusRepository extends AbstractRepository<RequestStatus, RequestStatusEntity,String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public RequestStatusRepository(){
+        super(RequestStatus.class, RequestStatusEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
new file mode 100644
index 0000000..265e063
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntityPK;
+import org.apache.airavata.allocation.manager.models.UserAllocationDetailPK;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailPKRepository extends AbstractRepository<UserAllocationDetailPK, UserAllocationDetailPK, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailPKRepository(){
+        super(UserAllocationDetailPK.class, UserAllocationDetailPK.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
new file mode 100644
index 0000000..adfd6d2
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
+import org.apache.airavata.allocation.manager.models.UserAllocationDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserAllocationDetailRepository extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserAllocationDetailRepository(){
+        super(UserAllocationDetail.class, UserAllocationDetailEntity.class);
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
new file mode 100644
index 0000000..c05ff5c
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
@@ -0,0 +1,19 @@
+package org.apache.airavata.allocation.manager.db.repositories;
+
+import org.apache.airavata.allocation.manager.db.entities.UserDetailEntity;
+import org.apache.airavata.allocation.manager.models.UserDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserDetailRepository extends AbstractRepository<UserDetail, UserDetailEntity, String> {
+    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
+
+    public UserDetailRepository(){
+        super(UserDetail.class, UserDetailEntity.class);
+    }
+
+    public static void main(String args[])
+    {
+
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java
new file mode 100644
index 0000000..64e9abc
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java
@@ -0,0 +1,26 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+@FunctionalInterface
+public interface Committer<T, R>  {
+
+    R commit(T t);
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java
new file mode 100644
index 0000000..2d3a64e
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java
@@ -0,0 +1,381 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Stack;
+import java.util.concurrent.Semaphore;
+
+
+/**
+ * A class for preallocating, recycling, and managing JDBC connections.
+ */
+public class ConnectionPool {
+    private static final Logger logger = LoggerFactory.getLogger(ConnectionPool.class);
+
+    private long MAX_IDLE_TIME = 5 * 60 * 1000; // 5 minutes
+
+    private String driver;
+    private String url;
+    private String username;
+    private String password;
+    private String jdbcUrl;
+
+    private int maxConnections;
+
+    private boolean autoCommit = true;
+    private boolean waitIfBusy;
+
+    private Semaphore needConnection = new Semaphore(0);
+    private boolean stop;
+
+    private Stack<Connection> availableConnections;
+    private Stack<Connection> busyConnections;
+
+    private HashMap<Connection, Long> lastAccessTimeRecord = new HashMap<Connection, Long>();
+
+    private String urlType = "";
+
+    private DataSource datasource;
+
+    private int transactionIsolation = Connection.TRANSACTION_NONE;
+
+    private Thread clenupThread;
+    private Thread producerThread;
+
+    public ConnectionPool(String driver, String url, String username, String password, int initialConnections,
+                          int maxConnections, boolean waitIfBusy) throws SQLException {
+        this.driver = driver;
+        this.url = url;
+        this.username = username;
+        this.password = password;
+        this.urlType = "speratedURL";
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections,
+                          boolean waitIfBusy, boolean autoCommit, int transactionIsolation) throws SQLException {
+        this.driver = driver;
+        this.jdbcUrl = jdbcUrl;
+        this.urlType = "simpleURL";
+        this.autoCommit = autoCommit;
+        this.transactionIsolation = transactionIsolation;
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections, boolean waitIfBusy)
+            throws SQLException {
+        this.driver = driver;
+        this.jdbcUrl = jdbcUrl;
+        this.urlType = "simpleURL";
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    public ConnectionPool(DataSource dataSource, int initialConnections, int maxConnections, boolean waitIfBusy)
+            throws SQLException {
+        this.urlType = "dataSource";
+        this.datasource = dataSource;
+        initialize(initialConnections, maxConnections, waitIfBusy);
+    }
+
+    /**
+     * Check if this connection pool is auto commit or not
+     *
+     * @return
+     */
+    public boolean isAutoCommit() {
+        return this.autoCommit;
+    }
+
+    private void initialize(int initialConnections, int maxConnections, boolean waitIfBusy) throws SQLException {
+        this.maxConnections = maxConnections;
+        this.waitIfBusy = waitIfBusy;
+
+        int sizeOfConnections = (initialConnections > maxConnections) ? maxConnections : initialConnections;
+
+        availableConnections = new Stack<Connection>();
+        busyConnections = new Stack<Connection>();
+
+        for (int i = 0; i < sizeOfConnections; i++) {
+            Connection con = makeNewConnection();
+            setTimeStamp(con);
+            availableConnections.push(con);
+
+        }
+
+        producerThread = new Thread(new FillUpThread());
+        producerThread.start();
+
+        clenupThread = new Thread(new CleanUpThread());
+        clenupThread.start();
+    }
+
+    public synchronized Connection getConnection() throws SQLException {
+        if (!availableConnections.isEmpty()) {
+            Connection existingConnection = availableConnections.pop();
+
+            // If connection on available list is closed (e.g.,
+            // it timed out), then remove it from available list
+            // and race for a connection again.
+            if (existingConnection.isClosed()) {
+                lastAccessTimeRecord.remove(existingConnection);
+                // notifyAll for fairness
+                notifyAll();
+            } else {
+                busyConnections.push(existingConnection);
+                setTimeStamp(existingConnection);
+                return existingConnection;
+            }
+        } else if (!waitIfBusy && busyConnections.size() >= maxConnections) {
+            // You reached maxConnections limit and waitIfBusy flag is false.
+            // Throw SQLException in such a case.
+            throw new SQLException("Connection limit reached");
+        } else {
+
+            if (busyConnections.size() < maxConnections) {
+                // available connection is empty, but total number of connection
+                // doesn't reach maxConnection. Request for more connection
+                needConnection.release();
+            }
+
+            try {
+                // wait for free connection
+                wait();
+            } catch (InterruptedException ie) {
+            }
+        }
+        // always race for connection forever
+        return getConnection();
+    }
+
+    // This explicitly makes a new connection. Called in
+    // the foreground when initializing the ConnectionPool,
+    // and called in the background when running.
+    private Connection makeNewConnection() throws SQLException {
+        try {
+            // Load database driver if not already loaded
+            Class.forName(driver);
+            Connection connection;
+            // Establish network connection to database
+            if (urlType.equals("speratedURL")) {
+                connection = DriverManager.getConnection(url, username, password);
+            } else if (urlType.equals("simpleURL")) {
+                connection = DriverManager.getConnection(jdbcUrl);
+            } else { // if(urlType.equals("dataSource")){
+                connection = datasource.getConnection();
+            }
+            connection.setTransactionIsolation(this.transactionIsolation);
+            connection.setAutoCommit(this.autoCommit);
+            return connection;
+        } catch (ClassNotFoundException cnfe) {
+            // Simplify try/catch blocks of people using this by
+            // throwing only one exception type.
+            throw new SQLException("Can't find class for driver: " + driver);
+        }
+    }
+
+    private synchronized void fillUpConnection(Connection conn) {
+        setTimeStamp(conn);
+        availableConnections.push(conn);
+
+        // notify all since new connection is created
+        notifyAll();
+    }
+
+    private void setTimeStamp(Connection connection) {
+        lastAccessTimeRecord.put(connection, System.currentTimeMillis());
+    }
+
+    // The database connection cannot be left idle for too long, otherwise TCP
+    // connection will be broken.
+    /**
+     * From http://forums.mysql.com/read.php?39,28450,57460#msg-57460 Okay, then it looks like wait_timeout on the
+     * server is killing your connection (it is set to 8 hours of idle time by default). Either set that value higher on
+     * your server, or configure your connection pool to not hold connections idle that long (I prefer the latter). Most
+     * folks I know that run MySQL with a connection pool in high-load production environments only let connections sit
+     * idle for a matter of minutes, since it only takes a few milliseconds to open a connection, and the longer one
+     * sits idle the more chance it will go "bad" because of a network hiccup or the MySQL server being restarted.
+     *
+     * @throws java.sql.SQLException
+     */
+    private boolean isConnectionStale(Connection connection) {
+        long currentTime = System.currentTimeMillis();
+        long lastAccess = lastAccessTimeRecord.get(connection);
+        if (currentTime - lastAccess > MAX_IDLE_TIME) {
+            return true;
+        } else
+            return false;
+    }
+
+    private synchronized void closeStaleConnections() {
+        // close idle connections
+        Iterator<Connection> iter = availableConnections.iterator();
+        while (iter.hasNext()) {
+            Connection existingConnection = iter.next();
+            if (isConnectionStale(existingConnection)) {
+                try {
+                    existingConnection.close();
+                    iter.remove();
+                } catch (SQLException sql) {
+                    logger.error(sql.getMessage(), sql);
+                }
+            }
+        }
+        // close busy connections that have been checked out for too long.
+        // This should not happen since this means program has bug for not
+        // releasing connections .
+        iter = busyConnections.iterator();
+        while (iter.hasNext()) {
+            Connection busyConnection = iter.next();
+            if (isConnectionStale(busyConnection)) {
+                try {
+                    busyConnection.close();
+                    iter.remove();
+                    logger.warn("****Connection has checked out too long. Forced release. Check the program for calling release connection [free(Connection) method]");
+                } catch (SQLException sql) {
+                    logger.error(sql.getMessage(), sql);
+                }
+            }
+        }
+    }
+
+    public synchronized void free(Connection connection) {
+        busyConnections.removeElement(connection);
+        availableConnections.addElement(connection);
+        // Wake up threads that are waiting for a connection
+        notifyAll();
+    }
+
+    /**
+     * Close all the connections. Use with caution: be sure no connections are in use before calling. Note that you are
+     * not <I>required</I> to call this when done with a ConnectionPool, since connections are guaranteed to be closed
+     * when garbage collected. But this method gives more control regarding when the connections are closed.
+     */
+    public synchronized void dispose() {
+        logger.info("Connection Pool Shutting down");
+
+        // stop clean up thread
+        this.stop = true;
+        this.clenupThread.interrupt();
+
+        // stop producer up thread
+        this.producerThread.interrupt();
+
+        // close all connection
+        closeConnections(availableConnections);
+        availableConnections = new Stack<Connection>();
+        closeConnections(busyConnections);
+        busyConnections = new Stack<Connection>();
+        lastAccessTimeRecord.clear();
+
+        logger.info("All connection is closed");
+
+        try {
+            this.clenupThread.join();
+            this.producerThread.join();
+        } catch (Exception e) {
+            logger.error("Cannot shutdown cleanup thread", e);
+        }
+
+        logger.info("Connection Pool Shutdown");
+    }
+
+    private void closeConnections(Stack<Connection> connections) {
+        while (!connections.isEmpty()) {
+            Connection connection = connections.pop();
+            try {
+                if (!connection.isClosed()) {
+                    connection.close();
+                }
+            } catch (SQLException sqle) {
+                // Ignore errors; garbage collect anyhow
+                logger.warn(sqle.getMessage());
+            }
+        }
+    }
+
+    public synchronized String toString() {
+        String info = "ConnectionPool(" + url + "," + username + ")" + ", available=" + availableConnections.size()
+                + ", busy=" + busyConnections.size() + ", max=" + maxConnections;
+        return (info);
+    }
+
+    class CleanUpThread implements Runnable {
+        public void run() {
+            while (!stop) {
+                try {
+                    Thread.sleep(MAX_IDLE_TIME);
+                    closeStaleConnections();
+                } catch (InterruptedException e) {
+                    logger.info("Clean up thread is interrupted to close");
+                }
+            }
+        }
+    }
+
+    class FillUpThread implements Runnable {
+        public void run() {
+            while (!stop) {
+                try {
+                    // block until get
+                    needConnection.acquire();
+
+                    Connection conn = makeNewConnection();
+                    fillUpConnection(conn);
+                } catch (SQLException e) {
+                    // cannot create connection (increase semaphore value back)
+                    needConnection.release();
+                    logger.error(e.getMessage(), e);
+                } catch (InterruptedException e) {
+                    logger.info("Fill up thread is interrupted to close");
+                    break;
+                }
+            }
+        }
+    }
+
+    public void shutdown() throws SQLException{
+        for (Connection c : availableConnections) {
+            try {
+                c.close();
+            } catch (SQLException e) {
+                logger.error("Error while closing the connection", e);
+                throw new SQLException("Error while closing the connection", e);
+            }
+        }
+
+        for (Connection c : busyConnections) {
+            try {
+                c.close();
+            } catch (SQLException e) {
+                logger.error("Error while closing the connection", e);
+                throw new SQLException("Error while closing the connection", e);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java
new file mode 100644
index 0000000..1de1363
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java
@@ -0,0 +1,106 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DBConstants {
+    private final static Logger logger = LoggerFactory.getLogger(DBConstants.class);
+
+    public static int SELECT_MAX_ROWS = 1000;
+
+    public static class DomainTable {
+        public static final String DOMAIN_ID = "domainId";
+        public static final String NAME = "name";
+        public static final String DESCRIPTION = "description";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class UserTable {
+        public static final String USER_ID = "userId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String USER_NAME = "userName";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class UserGroupTable {
+        public static final String GROUP_ID = "groupId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String NAME = "name";
+        public static final String DESCRIPTION = "description";
+        public static final String OWNER_ID = "ownerId";
+        public static final String GROUP_TYPE = "groupType";
+        public static final String GROUP_CARDINALITY = "groupCardinality";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class GroupMembershipTable {
+        public static final String PARENT_ID = "parentId";
+        public static final String CHILD_ID = "childId";
+        public static final String CHILD_TYPE = "childType";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class EntityTypeTable {
+        public static final String ENTITY_TYPE_ID = "entityTypeId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class PermissionTypeTable {
+        public static final String ENTITY_TYPE_ID = "permissionTypeId";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String NAME = "name";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+
+    public static class EntityTable {
+        public static final String ENTITY_ID = "entityId";
+        public static final String PARENT_ENTITY_ID = "parentEntityId";
+        public static final String ENTITY_TYPE_ID = "entityTypeId";
+        public static final String NAME = "name";
+        public static final String DESCRIPTION = "description";
+        public static final String FULL_TEXT = "fullText";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+        public static final String DOMAIN_ID = "domainId";
+        public static final String ORIGINAL_ENTITY_CREATION_TIME = "originalEntityCreationTime";
+        public static final String SHARED = "shared";
+    }
+
+    public static class SharingTable {
+        public static final String DOMAIN_ID = "domainId";
+        public static final String PERMISSION_TYPE_ID = "permissionTypeId";
+        public static final String ENTITY_ID = "entityId";
+        public static final String GROUP_ID = "groupId";
+        public static final String INHERITED_PARENT_ID = "inheritedParentId";
+        public static final String SHARING_TYPE = "sharingType";
+        public static final String CREATED_TIME = "createdTime";
+        public static final String UPDATED_TIME = "updatedTime";
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java
new file mode 100644
index 0000000..d8368f5
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java
@@ -0,0 +1,352 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+/**
+ * This class creates the database tables required for airavata with default configuration this
+ * class creates derby database in server mode. User can specify required database in appropriate
+ * properties files.
+ */
+public class DatabaseCreator {
+    private final static Logger logger = LoggerFactory.getLogger(DatabaseCreator.class);
+
+    public enum DatabaseType {
+        derby("(?i).*derby.*"), mysql("(?i).*mysql.*"), other("");
+
+        private String pattern;
+
+        private DatabaseType(String matchingPattern) {
+            this.pattern = matchingPattern;
+        }
+
+        public String getMatchingPattern() {
+            return this.pattern;
+        }
+    }
+
+    private static DatabaseType[] supportedDatabase = new DatabaseType[] { DatabaseType.derby, DatabaseType.mysql };
+
+    private static Logger log = LoggerFactory.getLogger(DatabaseCreator.class);
+    private static final String delimiter = ";";
+
+    /**
+     * Creates database
+     *
+     * @throws Exception
+     */
+    public static void createRegistryDatabase(String prefix, Connection conn) throws Exception {
+        createDatabase(prefix, conn);
+    }
+
+
+
+    /**
+     * Checks whether database tables are created by using select * on given table name
+     *
+     * @param tableName
+     *            Table which should be existed
+     * @return <code>true</core> if checkSQL is success, else <code>false</code> .
+     */
+    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+        try {
+
+            log.debug("Running a query to test the database tables existence.");
+
+            // check whether the tables are already created with a query
+            Statement statement = null;
+            try {
+                statement = conn.createStatement();
+                ResultSet rs = statement.executeQuery("select * from " + tableName);
+                if (rs != null) {
+                    rs.close();
+                }
+            } finally {
+                try {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                } catch (SQLException e) {
+                    return false;
+                }
+            }
+        } catch (SQLException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * executes given sql
+     *
+     * @param sql
+     * @throws Exception
+     */
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        // Check and ignore empty statements
+        if ("".equals(sql.trim())) {
+            return;
+        }
+
+        Statement statement = null;
+        try {
+            log.debug("SQL : " + sql);
+
+            boolean ret;
+            int updateCount = 0, updateCountTotal = 0;
+            statement = conn.createStatement();
+            ret = statement.execute(sql);
+            updateCount = statement.getUpdateCount();
+            do {
+                if (!ret) {
+                    if (updateCount != -1) {
+                        updateCountTotal += updateCount;
+                    }
+                }
+                ret = statement.getMoreResults();
+                if (ret) {
+                    updateCount = statement.getUpdateCount();
+                }
+            } while (ret);
+
+            log.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                log.info(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                // eliminating the table already exception for the derby
+                // database
+                log.info("Table Already Exists", e);
+            } else {
+                throw new Exception("Error occurred while executing : " + sql, e);
+            }
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    log.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * computes relatational database type using database name
+     *
+     * @return DatabaseType
+     * @throws Exception
+     *
+     */
+    public static DatabaseType getDatabaseType(Connection conn) throws Exception {
+        try {
+            if (conn != null && (!conn.isClosed())) {
+                DatabaseMetaData metaData = conn.getMetaData();
+                String databaseProductName = metaData.getDatabaseProductName();
+                return checkType(databaseProductName);
+            }
+        } catch (SQLException e) {
+            String msg = "Failed to create Airavata database." + e.getMessage();
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        return DatabaseType.other;
+    }
+
+    /**
+     * Overloaded method with String input
+     *
+     * @return DatabaseType
+     * @throws Exception
+     *
+     */
+    public static DatabaseType getDatabaseType(String dbUrl) throws Exception {
+        return checkType(dbUrl);
+    }
+
+    private static DatabaseType checkType(String text) throws Exception {
+        try {
+            if (text != null) {
+                for (DatabaseType type : supportedDatabase) {
+                    if (text.matches(type.getMatchingPattern()))
+                        return type;
+                }
+            }
+            String msg = "Unsupported database: " + text
+                    + ". Database will not be created automatically by the Airavata. "
+                    + "Please create the database using appropriate database scripts for " + "the database.";
+            throw new Exception(msg);
+
+        } catch (SQLException e) {
+            String msg = "Failed to create Airavatadatabase." + e.getMessage();
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+
+    /**
+     * Get scripts location which is prefix + "-" + databaseType + ".sql"
+     *
+     * @param prefix
+     * @param databaseType
+     * @return script location
+     */
+    private static String getScriptLocation(String prefix, DatabaseType databaseType) {
+        String scriptName = prefix + "-" + databaseType + ".sql";
+        log.debug("Loading database script from :" + scriptName);
+        return  scriptName;
+    }
+
+    private static void createDatabase(String prefix, Connection conn) throws Exception {
+        Statement statement = null;
+        try {
+            conn.setAutoCommit(false);
+            statement = conn.createStatement();
+            executeSQLScript(getScriptLocation(prefix, DatabaseCreator.getDatabaseType(conn)), conn);
+            conn.commit();
+            log.debug("Tables are created successfully.");
+        } catch (SQLException e) {
+            String msg = "Failed to create database tables for Airavata resource store. " + e.getMessage();
+            log.error(msg, e);
+            conn.rollback();
+            throw new Exception(msg, e);
+        } finally {
+            conn.setAutoCommit(true);
+            try {
+                if (statement != null) {
+                    statement.close();
+                }
+            } catch (SQLException e) {
+                log.error("Failed to close statement.", e);
+            }
+        }
+    }
+
+    private static void executeSQLScript(String dbscriptName, Connection conn) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+
+        try {
+            InputStream is = DatabaseCreator.class.getClassLoader().getResourceAsStream(dbscriptName);
+            if(is == null) {
+                logger.info("Script file not found at " + dbscriptName + ". Uses default database script file");
+                DatabaseType databaseType = DatabaseCreator.getDatabaseType(conn);
+                if(databaseType.equals(DatabaseType.derby)){
+                    is = DatabaseCreator.class.getClassLoader().getResourceAsStream("sharing-registry-derby.sql");
+                }else if(databaseType.equals(DatabaseType.mysql)){
+                    is = DatabaseCreator.class.getClassLoader().getResourceAsStream("sharing-registry-mysql.sql");
+                }
+            }
+            reader = new BufferedReader(new InputStreamReader(is));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+                if (line.startsWith("//")) {
+                    continue;
+                }
+                if (line.startsWith("--")) {
+                    continue;
+                }
+                StringTokenizer st = new StringTokenizer(line);
+                if (st.hasMoreTokens()) {
+                    String token = st.nextToken();
+                    if ("REM".equalsIgnoreCase(token)) {
+                        continue;
+                    }
+                }
+                sql.append(" ").append(line);
+
+                // SQL defines "--" as a comment to EOL
+                // and in Oracle it may contain a hint
+                // so we cannot just remove it, instead we must end it
+                if (line.indexOf("--") >= 0) {
+                    sql.append("\n");
+                }
+                if ((checkStringBufferEndsWith(sql, delimiter))) {
+                    executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                    sql.replace(0, sql.length(), "");
+                }
+            }
+            // Catch any statements not followed by ;
+            if (sql.length() > 0) {
+                executeSQL(sql.toString(), conn);
+            }
+        } catch (IOException e) {
+            log.error("Error occurred while executing SQL script for creating Airavata database", e);
+            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+
+        } finally {
+            if (reader != null) {
+                reader.close();
+            }
+        }
+    }
+
+    /**
+     * Checks that a string buffer ends up with a given string. It may sound trivial with the existing JDK API but the
+     * various implementation among JDKs can make those methods extremely resource intensive and perform poorly due to
+     * massive memory allocation and copying. See
+     *
+     * @param buffer
+     *            the buffer to perform the check on
+     * @param suffix
+     *            the suffix
+     * @return <code>true</code> if the character sequence represented by the argument is a suffix of the character
+     *         sequence represented by the StringBuffer object; <code>false</code> otherwise. Note that the result will
+     *         be <code>true</code> if the argument is the empty string.
+     */
+    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+        if (suffix.length() > buffer.length()) {
+            return false;
+        }
+        // this loop is done on purpose to avoid memory allocation performance
+        // problems on various JDKs
+        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+        // implementation is ok though does allocation/copying
+        // StringBuffer.toString().endsWith() does massive memory
+        // allocation/copying on JDK 1.5
+        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+        int endIndex = suffix.length() - 1;
+        int bufferIndex = buffer.length() - 1;
+        while (endIndex >= 0) {
+            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+                return false;
+            }
+            bufferIndex--;
+            endIndex--;
+        }
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java
new file mode 100644
index 0000000..3781c4b
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java
@@ -0,0 +1,215 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.allocation.manager.models.AllocationManagerException;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class JPAUtils {
+    private final static Logger logger = LoggerFactory.getLogger(JPAUtils.class);
+
+    public static final String PERSISTENCE_UNIT_NAME = "airavata-sharing-registry";
+    public static final String SHARING_REG_JDBC_DRIVER = "sharingcatalog.jdbc.driver";
+    public static final String SHARING_REG_JDBC_URL = "sharingcatalog.jdbc.url";
+    public static final String SHARING_REG_JDBC_USER = "sharingcatalog.jdbc.user";
+    public static final String SHARING_REG_JDBC_PWD = "sharingcatalog.jdbc.password";
+    public static final String SHARING_REG_VALIDATION_QUERY = "sharingcatalog.validationQuery";
+    public static final String JPA_CACHE_SIZE = "jpa.cache.size";
+    public static final String JPA_CACHE_ENABLED = "cache.enable";
+
+    public static final String CONFIGURATION = "CONFIGURATION";
+    public static final String START_DERBY_ENABLE = "start.derby.server.mode";
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    private static NetworkServerControl server;
+    private static JdbcStorage db;
+    private static String jdbcURl;
+    private static String jdbcDriver;
+    private static String jdbcUser;
+    private static String jdbcPassword;
+
+    @PersistenceUnit(unitName = PERSISTENCE_UNIT_NAME)
+    protected static EntityManagerFactory factory;
+    @PersistenceContext(unitName = PERSISTENCE_UNIT_NAME)
+    private static EntityManager entityManager;
+
+    public synchronized static EntityManager getEntityManager() throws Exception {
+        if (factory == null) {
+            String connectionProperties = "DriverClassName=" + readServerProperties(SHARING_REG_JDBC_DRIVER) + "," +
+                    "Url=" + readServerProperties(SHARING_REG_JDBC_URL) + "?autoReconnect=true," +
+                    "Username=" + readServerProperties(SHARING_REG_JDBC_USER) + "," +
+                    "Password=" + readServerProperties(SHARING_REG_JDBC_PWD) +
+                    ",validationQuery=" + readServerProperties(SHARING_REG_VALIDATION_QUERY);
+
+//            String connectionProperties = "DriverClassName=com.mysql.jdbc.Driver," +
+//                    "Url=jdbc:mysql://localhost:3306/airavata_sharing_catalog?autoReconnect=true," +
+//                    "Username=root," +
+//                    "Password=," +
+//                    ",validationQuery=SELECT 1 FROM CONFIGURATION";
+
+            Map<String, String> properties = new HashMap<String, String>();
+            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", "" + readServerProperties(JPA_CACHE_ENABLED)
+//                    + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+//            properties.put("openjpa.QueryCache", "" + readServerProperties(JPA_CACHE_ENABLED)
+//                    + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
+
+            properties.put("openjpa.RemoteCommitProvider", "sjvm");
+            properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+            properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+            properties.put("openjpa.jdbc.QuerySQLCache", "false");
+//            properties.put("openjpa.Multithreaded", "true");
+            properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," +
+                    " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000,  autoReconnect=true");
+            properties.put("openjpa.RuntimeUnenhancedClasses", "warn");
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+        }
+
+        entityManager = factory.createEntityManager();
+        return entityManager;
+    }
+
+    public static void initializeDB() throws Exception {
+        jdbcDriver = readServerProperties(SHARING_REG_JDBC_DRIVER);
+        jdbcURl = readServerProperties(SHARING_REG_JDBC_URL);
+        jdbcUser = readServerProperties(SHARING_REG_JDBC_USER);
+        jdbcPassword = readServerProperties(SHARING_REG_JDBC_PWD);
+        jdbcURl = jdbcURl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+
+        if (getDBType(jdbcURl).equals("derby") && isDerbyStartEnabled()) {
+            startDerbyInServerMode();
+        }
+        db = new JdbcStorage(10, 50, jdbcURl, jdbcDriver, true);
+
+        Connection conn = null;
+        try {
+            conn = db.connect();
+            if (!DatabaseCreator.isDatabaseStructureCreated(CONFIGURATION, conn)) {
+                DatabaseCreator.createRegistryDatabase("database_scripts/sharing-registry", conn);
+                logger.info("New Database created for Sharing Catalog !!! ");
+            } else {
+                logger.info("Database already created for Sharing Catalog !!!");
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            db.closeConnection(conn);
+            try {
+                if(conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error("Error while closing database connection...", e.getMessage(), e);
+            }
+        }
+    }
+
+    public static String getDBType(String jdbcUrl){
+        try{
+            String cleanURI = jdbcUrl.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getScheme();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+    }
+
+    public static boolean isDerbyStartEnabled(){
+        try {
+            String s = ServerSettings.getSetting(START_DERBY_ENABLE);
+            if("true".equals(s)){
+                return true;
+            }
+        }  catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata server properties", e.getMessage(), e);
+            return false;
+        }
+        return false;
+    }
+
+    public static void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+                    getPort(jdbcURl),
+                    jdbcUser, jdbcPassword);
+            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+            server.start(consoleWriter);
+        } catch (IOException e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        } catch (Exception e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        }
+    }
+
+    public static void stopDerbyInServerMode() {
+        System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "false");
+        if (server!=null){
+            try {
+                server.shutdown();
+            } catch (Exception e) {
+                logger.error("Error when stopping the derby server : "+e.getLocalizedMessage());
+            }
+        }
+    }
+
+    public static int getPort(String jdbcURL){
+        try{
+            String cleanURI = jdbcURL.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getPort();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return -1;
+        }
+    }
+
+    public static String readServerProperties(String propertyName) throws Exception {
+        try {
+            return ServerSettings.getSetting(propertyName);
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server.properties...", e);
+            throw new Exception("Unable to read airavata-server.properties...");
+        }
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java
new file mode 100644
index 0000000..ea3a360
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java
@@ -0,0 +1,174 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.*;
+
+public class JdbcStorage {
+    private static Logger log = LoggerFactory.getLogger(JdbcStorage.class);
+
+    private ConnectionPool connectionPool;
+
+    public JdbcStorage(String jdbcUrl, String jdbcDriver) {
+        // default init connection and max connection
+        this(3, 50, jdbcUrl, jdbcDriver, true);
+    }
+
+    public JdbcStorage(int initCon, int maxCon, String url, String driver, boolean enableTransactions) {
+        try {
+            if (enableTransactions) {
+                connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true, false,
+                        Connection.TRANSACTION_SERIALIZABLE);
+            } else {
+                connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to create database connection pool.", e);
+        }
+    }
+
+    /**
+     * Check if this connection pool is auto commit or not
+     *
+     * @return
+     */
+    public boolean isAutoCommit() {
+        return connectionPool.isAutoCommit();
+    }
+
+    public void commit(Connection conn) {
+        try {
+            if (conn != null && !conn.getAutoCommit()) {
+                conn.commit();
+            }
+        } catch (SQLException sqle) {
+            log.error("Cannot commit data", sqle);
+        }
+    }
+
+    public void commitAndFree(Connection conn) {
+        commit(conn);
+        closeConnection(conn);
+    }
+
+    public void rollback(Connection conn) {
+        try {
+            if (conn != null && !conn.getAutoCommit()) {
+                conn.rollback();
+            }
+        } catch (SQLException sqle) {
+            log.error("Cannot Rollback data", sqle);
+        }
+    }
+
+    public void rollbackAndFree(Connection conn) {
+        rollback(conn);
+        closeConnection(conn);
+    }
+
+    public Connection connect() {
+
+        Connection conn = null;
+        try {
+            conn = connectionPool.getConnection();
+        } catch (SQLException e) {
+            log.error(e.getMessage(), e);
+        }
+        return conn;
+    }
+
+    /**
+     * This method is provided so that you can have better control over the statement. For example: You can use
+     * stmt.setString to convert quotation mark automatically in an UPDATE statement
+     *
+     * NOTE: Statement is closed after execution
+     */
+    public int executeUpdateAndClose(PreparedStatement stmt) throws SQLException {
+        int rows = 0;
+        try {
+            rows = stmt.executeUpdate();
+            if (rows == 0) {
+                log.info("Problem: 0 rows affected by insert/update/delete statement.");
+            }
+        } finally {
+            stmt.close();
+        }
+        return rows;
+    }
+
+    public int countRow(String tableName, String columnName) throws SQLException {
+        String query = new String("SELECT COUNT(" + columnName + ") FROM " + tableName);
+        int count = -1;
+        Connection conn = null;
+        PreparedStatement stmt = null;
+        try {
+            conn = connectionPool.getConnection();
+            stmt = conn.prepareStatement(query);
+            ResultSet rs = stmt.executeQuery();
+            rs.next();
+            count = rs.getInt(1);
+            commit(conn);
+        } catch (SQLException sql) {
+            rollback(conn);
+            throw sql;
+        } finally {
+            try {
+                if (stmt != null && !stmt.isClosed()) {
+                    stmt.close();
+                }
+            } finally {
+                closeConnection(conn);
+            }
+        }
+        return count;
+    }
+
+    public void quietlyClose(Connection conn, Statement... stmts) {
+        if (stmts != null) {
+            for (Statement stmt : stmts) {
+                try {
+                    if (stmt != null && !stmt.isClosed()) {
+                        stmt.close();
+                    }
+                } catch (SQLException sql) {
+                    log.error(sql.getMessage(), sql);
+                }
+            }
+        }
+        closeConnection(conn);
+    }
+
+    public void closeConnection(Connection conn) {
+        if (conn != null) {
+            connectionPool.free(conn);
+        }
+    }
+
+    public void closeAllConnections() {
+        if (connectionPool != null)
+            connectionPool.dispose();
+    }
+
+    public void shutdown() throws SQLException {
+        connectionPool.shutdown();
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java
new file mode 100644
index 0000000..b5f6c00
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.allocation.manager.db.utils;
+
+import org.dozer.DozerBeanMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObjectMapperSingleton extends DozerBeanMapper{
+    private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
+
+    private static ObjectMapperSingleton instance;
+
+    private ObjectMapperSingleton(){}
+
+    public static ObjectMapperSingleton getInstance(){
+        if(instance == null)
+            instance = new ObjectMapperSingleton();
+        return instance;
+    }
+}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
new file mode 100644
index 0000000..2eccf05
--- /dev/null
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
@@ -0,0 +1,5 @@
+package org.apache.airavata.allocation.manager.models;
+
+public class Domain {
+// Placeholder file for Madrina to create
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata-sandbox] 04/05: Revert "Added entities, repositories, utils and updated pom file"

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git

commit 676140dfcaaea634d03d33828cfa4daaa029f261
Author: Harsha Phulwani <ha...@gmail.com>
AuthorDate: Fri Nov 17 18:30:32 2017 -0500

    Revert "Added entities,repositories,utils and updated pom file"
    
    This reverts commit 9859fd79e659db94e86489cdb2611e84a3c398c4.
---
 .gitignore                                         |  30 +-
 .../airavata-allocation-manager-server/pom.xml     |  64 +---
 .../manager/db/entities/DomainEntity.java          | 116 -------
 .../manager/db/entities/RequestStatusEntity.java   |  78 -----
 .../db/entities/UserAllocationDetailEntity.java    | 205 -----------
 .../db/entities/UserAllocationDetailEntityPK.java  |  57 ---
 .../manager/db/entities/UserDetailEntity.java      |  78 -----
 .../db/repositories/AbstractRepository.java        | 163 ---------
 .../manager/db/repositories/DomainRepository.java  |  33 --
 .../db/repositories/RequestStatusRepository.java   |  14 -
 .../UserAllocationDetailPKRepository.java          |  14 -
 .../UserAllocationDetailRepository.java            |  14 -
 .../db/repositories/UserDetailRepository.java      |  19 -
 .../allocation/manager/db/utils/Committer.java     |  26 --
 .../manager/db/utils/ConnectionPool.java           | 381 ---------------------
 .../allocation/manager/db/utils/DBConstants.java   | 106 ------
 .../manager/db/utils/DatabaseCreator.java          | 352 -------------------
 .../allocation/manager/db/utils/JPAUtils.java      | 215 ------------
 .../allocation/manager/db/utils/JdbcStorage.java   | 174 ----------
 .../manager/db/utils/ObjectMapperSingleton.java    |  38 --
 .../airavata/allocation/manager/models/Domain.java |   5 -
 bin/README.txt                                     |  16 -
 bin/build.xml                                      |  53 ---
 bin/db.config                                      |  24 --
 .../airavata/jobsubmission/gram/errors.properties  | 176 ----------
 25 files changed, 27 insertions(+), 2424 deletions(-)

diff --git a/.gitignore b/.gitignore
index db19882..d6e588b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,5 @@
-# Compiled class file
 *.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
+*id_rsa*
 
 # Mobile Tools for Java (J2ME)
 .mtj.tmp/
@@ -14,18 +8,18 @@
 *.jar
 *.war
 *.ear
-*.zip
-*.tar.gz
-*.rar
 
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
 
-# Ignore files ending with target
-*target/
-
-# Ignore files starting with dot
-.*
-!.gitignore
+target/
+.idea/
+tmp/
+logs/
+gaussian_sample/
+*.ser
+*.iml
+*.gen
 
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+solr-server/logs/solr.log
 
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
index 8cb41b4..86dd4fc 100644
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
+++ b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/pom.xml
@@ -1,55 +1,21 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.apache.airavata</groupId>
-		<artifactId>airavata-allocation-manager</artifactId>
-		<version>0.0.1-SNAPSHOT</version>
-	</parent>
-	<artifactId>airavata-allocation-manager-server</artifactId>
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.airavata</groupId>
-			<artifactId>airavata-allocation-manager-stubs</artifactId>
-			<version>0.0.1-SNAPSHOT</version>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-api</artifactId>
-			<version>1.7.10</version>
-		</dependency>
-		<dependency>
-			<groupId>net.sf.dozer</groupId>
-			<artifactId>dozer</artifactId>
-			<version>5.4.0</version>
-			<exclusions>
-				<exclusion>
-					<groupId>org.slf4j</groupId>
-					<artifactId>slf4j-log4j12</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.openjpa</groupId>
-			<artifactId>openjpa-all</artifactId>
-			<version>2.2.0</version>
-		</dependency>
-		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
-		<dependency>
-			<groupId>mysql</groupId>
-			<artifactId>mysql-connector-java</artifactId>
-			<version>5.1.34</version>
-		</dependency>
-		<!-- https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.airavata</groupId>
+    <artifactId>airavata-allocation-manager</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>airavata-allocation-manager-server</artifactId>
+  <dependencies>
 		<dependency>
 			<groupId>org.apache.thrift</groupId>
 			<artifactId>libthrift</artifactId>
 			<version>0.10.0</version>
-			<type>pom</type>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.airavata</groupId>
+			<artifactId>airavata-allocation-manager-stubs</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
 		</dependency>
 	</dependencies>
-	<properties>
-		<maven.compiler.source>1.8</maven.compiler.source>
-		<maven.compiler.target>1.8</maven.compiler.target>
-	</properties>
-</project> 
\ No newline at end of file
+</project>
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java
deleted file mode 100644
index 2aed6f9..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/DomainEntity.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.entities;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "DOMAIN", schema = "" )
-public class DomainEntity {
-    private final static Logger logger = LoggerFactory.getLogger(DomainEntity.class);
-    private String domainId;
-    private String name;
-    private String description;
-    private Long createdTime;
-    private Long updatedTime;
-
-    @Id
-    @Column(name = "DOMAIN_ID")
-    public String getDomainId() {
-        return domainId;
-    }
-
-    public void setDomainId(String domainId) {
-        this.domainId = domainId;
-    }
-
-    @Basic
-    @Column(name = "NAME")
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Basic
-    @Column(name = "DESCRIPTION")
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    @Basic
-    @Column(name = "CREATED_TIME")
-    public Long getCreatedTime() {
-        return createdTime;
-    }
-
-    public void setCreatedTime(Long createdTime) {
-        this.createdTime = createdTime;
-    }
-
-    @Basic
-    @Column(name = "UPDATED_TIME")
-    public Long getUpdatedTime() {
-        return updatedTime;
-    }
-
-    public void setUpdatedTime(Long updatedTime) {
-        this.updatedTime = updatedTime;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        DomainEntity that = (DomainEntity) o;
-
-        if (getDomainId() != null ? !getDomainId().equals(that.getDomainId()) : that.getDomainId() != null)
-            return false;
-        if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;
-        if (getDescription() != null ? !getDescription().equals(that.getDescription()) : that.getDescription() != null)
-            return false;
-        if (getCreatedTime() != null ? !getCreatedTime().equals(that.getCreatedTime()) : that.getCreatedTime() != null)
-            return false;
-        if (getUpdatedTime() != null ? !getUpdatedTime().equals(that.getUpdatedTime()) : that.getUpdatedTime() != null)
-            return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = getDomainId() != null ? getDomainId().hashCode() : 0;
-        result = 31 * result + (getName() != null ? getName().hashCode() : 0);
-        result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0);
-        result = 31 * result + (getCreatedTime() != null ? getCreatedTime().hashCode() : 0);
-        result = 31 * result + (getUpdatedTime() != null ? getUpdatedTime().hashCode() : 0);
-        return result;
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
deleted file mode 100644
index 42ccc4a..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-import java.math.BigInteger;
-
-
-/**
- * The persistent class for the REQUEST_STATUS database table.
- * 
- */
-@Entity
-@Table(name="REQUEST_STATUS")
-@NamedQuery(name="RequestStatusEntity.findAll", query="SELECT r FROM RequestStatusEntity r")
-public class RequestStatusEntity implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	@Id
-	@Column(name="PROJECT_ID")
-	private String projectId;
-
-	@Column(name="END_DATE")
-	private BigInteger endDate;
-
-	@Lob
-	@Column(name="REVIEWERS")
-	private String reviewers;
-
-	@Column(name="START_DATE")
-	private BigInteger startDate;
-
-	@Column(name="STATUS")
-	private String status;
-
-	public RequestStatusEntity() {
-	}
-
-	public String getProjectId() {
-		return this.projectId;
-	}
-
-	public void setProjectId(String projectId) {
-		this.projectId = projectId;
-	}
-
-	public BigInteger getEndDate() {
-		return this.endDate;
-	}
-
-	public void setEndDate(BigInteger endDate) {
-		this.endDate = endDate;
-	}
-
-	public String getReviewers() {
-		return this.reviewers;
-	}
-
-	public void setReviewers(String reviewers) {
-		this.reviewers = reviewers;
-	}
-
-	public BigInteger getStartDate() {
-		return this.startDate;
-	}
-
-	public void setStartDate(BigInteger startDate) {
-		this.startDate = startDate;
-	}
-
-	public String getStatus() {
-		return this.status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
deleted file mode 100644
index 35ab18d..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-import java.math.BigInteger;
-
-
-/**
- * The persistent class for the USER_ALLOCATION_DETAILS database table.
- * 
- */
-@Entity
-@Table(name="USER_ALLOCATION_DETAILS")
-@NamedQuery(name="UserAllocationDetailEntity.findAll", query="SELECT u FROM UserAllocationDetailEntity u")
-public class UserAllocationDetailEntity implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	@EmbeddedId
-	private UserAllocationDetailEntityPK id;
-
-	@Lob
-	@Column(name="APPLICATIONS_TO_BE_USED")
-	private String applicationsToBeUsed;
-
-	@Column(name="DISK_USAGE_RANGE_PER_JOB")
-	private BigInteger diskUsageRangePerJob;
-
-	@Lob
-	@Column(name="DOCUMENTS")
-	private byte[] documents;
-
-	@Lob
-	@Column(name="FIELD_OF_SCIENCE")
-	private String fieldOfScience;
-
-	@Lob
-	@Column(name="KEYWORDS")
-	private String keywords;
-
-	@Column(name="MAX_MEMORY_PER_CPU")
-	private BigInteger maxMemoryPerCpu;
-
-	@Column(name="NUMBER_OF_CPU_PER_JOB")
-	private BigInteger numberOfCpuPerJob;
-
-	@Lob
-	@Column(name="PROJECT_DESCRIPTION")
-	private String projectDescription;
-
-	@Lob
-	@Column(name="PROJECT_REVIEWED_AND_FUNDED_BY")
-	private String projectReviewedAndFundedBy;
-
-	@Column(name="REQ_DATE")
-	private BigInteger reqDate;
-
-	@Column(name="SERVICE_UNITS")
-	private BigInteger serviceUnits;
-
-	@Lob
-	@Column(name="SPECIFIC_RESOURCE_SELECTION")
-	private String specificResourceSelection;
-
-	@Lob
-	@Column(name="TITLE")
-	private String title;
-
-	@Column(name="TYPE_OF_ALLOCATION")
-	private String typeOfAllocation;
-
-	@Column(name="TYPICAL_SU_PER_JOB")
-	private BigInteger typicalSuPerJob;
-
-	public UserAllocationDetailEntity() {
-	}
-
-	public UserAllocationDetailEntityPK getId() {
-		return this.id;
-	}
-
-	public void setId(UserAllocationDetailEntityPK id) {
-		this.id = id;
-	}
-
-	public String getApplicationsToBeUsed() {
-		return this.applicationsToBeUsed;
-	}
-
-	public void setApplicationsToBeUsed(String applicationsToBeUsed) {
-		this.applicationsToBeUsed = applicationsToBeUsed;
-	}
-
-	public BigInteger getDiskUsageRangePerJob() {
-		return this.diskUsageRangePerJob;
-	}
-
-	public void setDiskUsageRangePerJob(BigInteger diskUsageRangePerJob) {
-		this.diskUsageRangePerJob = diskUsageRangePerJob;
-	}
-
-	public byte[] getDocuments() {
-		return this.documents;
-	}
-
-	public void setDocuments(byte[] documents) {
-		this.documents = documents;
-	}
-
-	public String getFieldOfScience() {
-		return this.fieldOfScience;
-	}
-
-	public void setFieldOfScience(String fieldOfScience) {
-		this.fieldOfScience = fieldOfScience;
-	}
-
-	public String getKeywords() {
-		return this.keywords;
-	}
-
-	public void setKeywords(String keywords) {
-		this.keywords = keywords;
-	}
-
-	public BigInteger getMaxMemoryPerCpu() {
-		return this.maxMemoryPerCpu;
-	}
-
-	public void setMaxMemoryPerCpu(BigInteger maxMemoryPerCpu) {
-		this.maxMemoryPerCpu = maxMemoryPerCpu;
-	}
-
-	public BigInteger getNumberOfCpuPerJob() {
-		return this.numberOfCpuPerJob;
-	}
-
-	public void setNumberOfCpuPerJob(BigInteger numberOfCpuPerJob) {
-		this.numberOfCpuPerJob = numberOfCpuPerJob;
-	}
-
-	public String getProjectDescription() {
-		return this.projectDescription;
-	}
-
-	public void setProjectDescription(String projectDescription) {
-		this.projectDescription = projectDescription;
-	}
-
-	public String getProjectReviewedAndFundedBy() {
-		return this.projectReviewedAndFundedBy;
-	}
-
-	public void setProjectReviewedAndFundedBy(String projectReviewedAndFundedBy) {
-		this.projectReviewedAndFundedBy = projectReviewedAndFundedBy;
-	}
-
-	public BigInteger getReqDate() {
-		return this.reqDate;
-	}
-
-	public void setReqDate(BigInteger reqDate) {
-		this.reqDate = reqDate;
-	}
-
-	public BigInteger getServiceUnits() {
-		return this.serviceUnits;
-	}
-
-	public void setServiceUnits(BigInteger serviceUnits) {
-		this.serviceUnits = serviceUnits;
-	}
-
-	public String getSpecificResourceSelection() {
-		return this.specificResourceSelection;
-	}
-
-	public void setSpecificResourceSelection(String specificResourceSelection) {
-		this.specificResourceSelection = specificResourceSelection;
-	}
-
-	public String getTitle() {
-		return this.title;
-	}
-
-	public void setTitle(String title) {
-		this.title = title;
-	}
-
-	public String getTypeOfAllocation() {
-		return this.typeOfAllocation;
-	}
-
-	public void setTypeOfAllocation(String typeOfAllocation) {
-		this.typeOfAllocation = typeOfAllocation;
-	}
-
-	public BigInteger getTypicalSuPerJob() {
-		return this.typicalSuPerJob;
-	}
-
-	public void setTypicalSuPerJob(BigInteger typicalSuPerJob) {
-		this.typicalSuPerJob = typicalSuPerJob;
-	}
-
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java
deleted file mode 100644
index e768883..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntityPK.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-
-/**
- * The primary key class for the USER_ALLOCATION_DETAILS database table.
- * 
- */
-@Embeddable
-public class UserAllocationDetailEntityPK implements Serializable {
-	//default serial version id, required for serializable classes.
-	private static final long serialVersionUID = 1L;
-
-	@Column(name="PROJECT_ID")
-	private String projectId;
-
-	@Column(name="USERNAME")
-	private String username;
-
-	public UserAllocationDetailEntityPK() {
-	}
-	public String getProjectId() {
-		return this.projectId;
-	}
-	public void setProjectId(String projectId) {
-		this.projectId = projectId;
-	}
-	public String getUsername() {
-		return this.username;
-	}
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	public boolean equals(Object other) {
-		if (this == other) {
-			return true;
-		}
-		if (!(other instanceof UserAllocationDetailEntityPK)) {
-			return false;
-		}
-		UserAllocationDetailEntityPK castOther = (UserAllocationDetailEntityPK)other;
-		return 
-			this.projectId.equals(castOther.projectId)
-			&& this.username.equals(castOther.username);
-	}
-
-	public int hashCode() {
-		final int prime = 31;
-		int hash = 17;
-		hash = hash * prime + this.projectId.hashCode();
-		hash = hash * prime + this.username.hashCode();
-		
-		return hash;
-	}
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
deleted file mode 100644
index 9eb04fc..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-
-
-/**
- * The persistent class for the USER_DETAILS database table.
- * 
- */
-@Entity
-@Table(name="USER_DETAILS")
-@NamedQuery(name="UserDetailEntity.findAll", query="SELECT u FROM UserDetailEntity u")
-public class UserDetailEntity implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	@Id
-	@Column(name="USERNAME")
-	private String username;
-
-	@Lob
-	@Column(name="EMAIL")
-	private String email;
-
-	@Lob
-	@Column(name="FULL_NAME")
-	private String fullName;
-
-	@Column(name="PASSWORD")
-	private String password;
-
-	@Column(name="USER_TYPE")
-	private String userType;
-
-	public UserDetailEntity() {
-	}
-
-	public String getUsername() {
-		return this.username;
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	public String getEmail() {
-		return this.email;
-	}
-
-	public void setEmail(String email) {
-		this.email = email;
-	}
-
-	public String getFullName() {
-		return this.fullName;
-	}
-
-	public void setFullName(String fullName) {
-		this.fullName = fullName;
-	}
-
-	public String getPassword() {
-		return this.password;
-	}
-
-	public void setPassword(String password) {
-		this.password = password;
-	}
-
-	public String getUserType() {
-		return this.userType;
-	}
-
-	public void setUserType(String userType) {
-		this.userType = userType;
-	}
-
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
deleted file mode 100644
index 6449b4a..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.utils.Committer;
-import org.apache.airavata.allocation.manager.db.utils.DBConstants;
-import org.apache.airavata.allocation.manager.db.utils.JPAUtils;
-import org.apache.airavata.allocation.manager.db.utils.ObjectMapperSingleton;
-import org.apache.airavata.allocation.manager.models.AllocationManagerException;
-import org.dozer.Mapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public abstract class AbstractRepository<T, E, Id> {
-    private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
-
-    private Class<T> thriftGenericClass;
-    private Class<E> dbEntityGenericClass;
-
-    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
-        this.thriftGenericClass = thriftGenericClass;
-        this.dbEntityGenericClass = dbEntityGenericClass;
-    }
-
-    public T create(T t) throws Exception {
-        return update(t);
-    }
-
-    //FIXME do a bulk insert
-    public List<T> create(List<T> tList) throws Exception {
-        return update(tList);
-    }
-
-    public  T update(T t) throws Exception {
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        E entity = mapper.map(t, dbEntityGenericClass);
-        E persistedCopy = execute(entityManager -> entityManager.merge(entity));
-        return mapper.map(persistedCopy, thriftGenericClass);
-    }
-
-    //FIXME do a bulk update
-    public  List<T> update(List<T> tList) throws Exception {
-        List<T> returnList = new ArrayList<T>();
-        for(T temp : tList)
-            returnList.add(update(temp));
-        return returnList;
-    }
-
-    public boolean delete(Id id) throws Exception {
-        execute(entityManager -> {
-             E entity = entityManager.find(dbEntityGenericClass, id);
-             entityManager.remove(entity);
-             return entity;
-         });
-        return true;
-    }
-
-    public boolean delete(List<Id> idList) throws Exception {
-        for(Id id : idList)
-            delete(id);
-        return true;
-    }
-
-    public T get(Id id) throws Exception {
-        E entity = execute(entityManager -> entityManager
-                .find(dbEntityGenericClass, id));
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        if(entity == null)
-            return null;
-        return mapper.map(entity, thriftGenericClass);
-    }
-
-    public boolean isExists(Id id) throws Exception {
-        return get(id) != null;
-    }
-
-    public List<T> get(List<Id> idList) throws Exception {
-        List<T> returnList = new ArrayList<>();
-        for(Id id : idList)
-            returnList.add(get(id));
-        return returnList;
-    }
-
-    public List<T> select(Map<String, String> filters, int offset, int limit) throws Exception {
-        String query = "SELECT DISTINCT p from " + dbEntityGenericClass.getSimpleName() + " as p";
-        ArrayList<String> parameters = new ArrayList<>();
-        int parameterCount = 1;
-        if (filters != null && filters.size() != 0) {
-            query += " WHERE ";
-            for (String k : filters.keySet()) {
-                query += "p." + k + " = ?" + parameterCount + " AND ";
-                parameters.add(filters.get(k));
-                parameterCount++;
-            }
-            query = query.substring(0, query.length() - 5);
-        }
-
-        query += " ORDER BY p.createdTime DESC";
-        String queryString = query;
-        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
-        List resultSet = execute(entityManager -> {
-            javax.persistence.Query q = entityManager.createQuery(queryString);
-            for (int i = 0; i < parameters.size(); i++) {
-                q.setParameter(i + 1, parameters.get(i));
-            }
-            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
-        });
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        List<T> gatewayList = new ArrayList<>();
-        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
-        return gatewayList;
-    }
-
-    public List<T> select(String queryString, Map<String,Object> queryParameters, int offset, int limit) throws Exception {
-        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
-        List resultSet = execute(entityManager -> {
-            Query q =  entityManager.createQuery(queryString);
-            for(Map.Entry<String, Object> queryParam : queryParameters.entrySet()){
-                q.setParameter(queryParam.getKey(), queryParam.getValue());
-            }
-            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
-        });
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        List<T> gatewayList = new ArrayList<>();
-        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
-        return gatewayList;
-    }
-
-    public <R> R execute(Committer<EntityManager, R> committer) throws Exception {
-        EntityManager entityManager = JPAUtils.getEntityManager();
-        try {
-            entityManager.getTransaction().begin();
-            R r = committer.commit(entityManager);
-            entityManager.getTransaction().commit();
-            return r;
-        } finally {
-            entityManager.close();
-        }
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java
deleted file mode 100644
index c86d85b..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/DomainRepository.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.DomainEntity;
-import org.apache.airavata.allocation.manager.models.Domain;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DomainRepository extends AbstractRepository<Domain, DomainEntity, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public DomainRepository(){
-        super(Domain.class, DomainEntity.class);
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
deleted file mode 100644
index 71cbba8..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity;
-import org.apache.airavata.allocation.manager.models.RequestStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RequestStatusRepository extends AbstractRepository<RequestStatus, RequestStatusEntity,String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public RequestStatusRepository(){
-        super(RequestStatus.class, RequestStatusEntity.class);
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
deleted file mode 100644
index 265e063..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntityPK;
-import org.apache.airavata.allocation.manager.models.UserAllocationDetailPK;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserAllocationDetailPKRepository extends AbstractRepository<UserAllocationDetailPK, UserAllocationDetailPK, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public UserAllocationDetailPKRepository(){
-        super(UserAllocationDetailPK.class, UserAllocationDetailPK.class);
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
deleted file mode 100644
index adfd6d2..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
-import org.apache.airavata.allocation.manager.models.UserAllocationDetail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserAllocationDetailRepository extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public UserAllocationDetailRepository(){
-        super(UserAllocationDetail.class, UserAllocationDetailEntity.class);
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
deleted file mode 100644
index c05ff5c..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.UserDetailEntity;
-import org.apache.airavata.allocation.manager.models.UserDetail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserDetailRepository extends AbstractRepository<UserDetail, UserDetailEntity, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public UserDetailRepository(){
-        super(UserDetail.class, UserDetailEntity.class);
-    }
-
-    public static void main(String args[])
-    {
-
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java
deleted file mode 100644
index 64e9abc..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/Committer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.utils;
-
-@FunctionalInterface
-public interface Committer<T, R>  {
-
-    R commit(T t);
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java
deleted file mode 100644
index 2d3a64e..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ConnectionPool.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Stack;
-import java.util.concurrent.Semaphore;
-
-
-/**
- * A class for preallocating, recycling, and managing JDBC connections.
- */
-public class ConnectionPool {
-    private static final Logger logger = LoggerFactory.getLogger(ConnectionPool.class);
-
-    private long MAX_IDLE_TIME = 5 * 60 * 1000; // 5 minutes
-
-    private String driver;
-    private String url;
-    private String username;
-    private String password;
-    private String jdbcUrl;
-
-    private int maxConnections;
-
-    private boolean autoCommit = true;
-    private boolean waitIfBusy;
-
-    private Semaphore needConnection = new Semaphore(0);
-    private boolean stop;
-
-    private Stack<Connection> availableConnections;
-    private Stack<Connection> busyConnections;
-
-    private HashMap<Connection, Long> lastAccessTimeRecord = new HashMap<Connection, Long>();
-
-    private String urlType = "";
-
-    private DataSource datasource;
-
-    private int transactionIsolation = Connection.TRANSACTION_NONE;
-
-    private Thread clenupThread;
-    private Thread producerThread;
-
-    public ConnectionPool(String driver, String url, String username, String password, int initialConnections,
-                          int maxConnections, boolean waitIfBusy) throws SQLException {
-        this.driver = driver;
-        this.url = url;
-        this.username = username;
-        this.password = password;
-        this.urlType = "speratedURL";
-        initialize(initialConnections, maxConnections, waitIfBusy);
-    }
-
-    public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections,
-                          boolean waitIfBusy, boolean autoCommit, int transactionIsolation) throws SQLException {
-        this.driver = driver;
-        this.jdbcUrl = jdbcUrl;
-        this.urlType = "simpleURL";
-        this.autoCommit = autoCommit;
-        this.transactionIsolation = transactionIsolation;
-        initialize(initialConnections, maxConnections, waitIfBusy);
-    }
-
-    public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections, boolean waitIfBusy)
-            throws SQLException {
-        this.driver = driver;
-        this.jdbcUrl = jdbcUrl;
-        this.urlType = "simpleURL";
-        initialize(initialConnections, maxConnections, waitIfBusy);
-    }
-
-    public ConnectionPool(DataSource dataSource, int initialConnections, int maxConnections, boolean waitIfBusy)
-            throws SQLException {
-        this.urlType = "dataSource";
-        this.datasource = dataSource;
-        initialize(initialConnections, maxConnections, waitIfBusy);
-    }
-
-    /**
-     * Check if this connection pool is auto commit or not
-     *
-     * @return
-     */
-    public boolean isAutoCommit() {
-        return this.autoCommit;
-    }
-
-    private void initialize(int initialConnections, int maxConnections, boolean waitIfBusy) throws SQLException {
-        this.maxConnections = maxConnections;
-        this.waitIfBusy = waitIfBusy;
-
-        int sizeOfConnections = (initialConnections > maxConnections) ? maxConnections : initialConnections;
-
-        availableConnections = new Stack<Connection>();
-        busyConnections = new Stack<Connection>();
-
-        for (int i = 0; i < sizeOfConnections; i++) {
-            Connection con = makeNewConnection();
-            setTimeStamp(con);
-            availableConnections.push(con);
-
-        }
-
-        producerThread = new Thread(new FillUpThread());
-        producerThread.start();
-
-        clenupThread = new Thread(new CleanUpThread());
-        clenupThread.start();
-    }
-
-    public synchronized Connection getConnection() throws SQLException {
-        if (!availableConnections.isEmpty()) {
-            Connection existingConnection = availableConnections.pop();
-
-            // If connection on available list is closed (e.g.,
-            // it timed out), then remove it from available list
-            // and race for a connection again.
-            if (existingConnection.isClosed()) {
-                lastAccessTimeRecord.remove(existingConnection);
-                // notifyAll for fairness
-                notifyAll();
-            } else {
-                busyConnections.push(existingConnection);
-                setTimeStamp(existingConnection);
-                return existingConnection;
-            }
-        } else if (!waitIfBusy && busyConnections.size() >= maxConnections) {
-            // You reached maxConnections limit and waitIfBusy flag is false.
-            // Throw SQLException in such a case.
-            throw new SQLException("Connection limit reached");
-        } else {
-
-            if (busyConnections.size() < maxConnections) {
-                // available connection is empty, but total number of connection
-                // doesn't reach maxConnection. Request for more connection
-                needConnection.release();
-            }
-
-            try {
-                // wait for free connection
-                wait();
-            } catch (InterruptedException ie) {
-            }
-        }
-        // always race for connection forever
-        return getConnection();
-    }
-
-    // This explicitly makes a new connection. Called in
-    // the foreground when initializing the ConnectionPool,
-    // and called in the background when running.
-    private Connection makeNewConnection() throws SQLException {
-        try {
-            // Load database driver if not already loaded
-            Class.forName(driver);
-            Connection connection;
-            // Establish network connection to database
-            if (urlType.equals("speratedURL")) {
-                connection = DriverManager.getConnection(url, username, password);
-            } else if (urlType.equals("simpleURL")) {
-                connection = DriverManager.getConnection(jdbcUrl);
-            } else { // if(urlType.equals("dataSource")){
-                connection = datasource.getConnection();
-            }
-            connection.setTransactionIsolation(this.transactionIsolation);
-            connection.setAutoCommit(this.autoCommit);
-            return connection;
-        } catch (ClassNotFoundException cnfe) {
-            // Simplify try/catch blocks of people using this by
-            // throwing only one exception type.
-            throw new SQLException("Can't find class for driver: " + driver);
-        }
-    }
-
-    private synchronized void fillUpConnection(Connection conn) {
-        setTimeStamp(conn);
-        availableConnections.push(conn);
-
-        // notify all since new connection is created
-        notifyAll();
-    }
-
-    private void setTimeStamp(Connection connection) {
-        lastAccessTimeRecord.put(connection, System.currentTimeMillis());
-    }
-
-    // The database connection cannot be left idle for too long, otherwise TCP
-    // connection will be broken.
-    /**
-     * From http://forums.mysql.com/read.php?39,28450,57460#msg-57460 Okay, then it looks like wait_timeout on the
-     * server is killing your connection (it is set to 8 hours of idle time by default). Either set that value higher on
-     * your server, or configure your connection pool to not hold connections idle that long (I prefer the latter). Most
-     * folks I know that run MySQL with a connection pool in high-load production environments only let connections sit
-     * idle for a matter of minutes, since it only takes a few milliseconds to open a connection, and the longer one
-     * sits idle the more chance it will go "bad" because of a network hiccup or the MySQL server being restarted.
-     *
-     * @throws java.sql.SQLException
-     */
-    private boolean isConnectionStale(Connection connection) {
-        long currentTime = System.currentTimeMillis();
-        long lastAccess = lastAccessTimeRecord.get(connection);
-        if (currentTime - lastAccess > MAX_IDLE_TIME) {
-            return true;
-        } else
-            return false;
-    }
-
-    private synchronized void closeStaleConnections() {
-        // close idle connections
-        Iterator<Connection> iter = availableConnections.iterator();
-        while (iter.hasNext()) {
-            Connection existingConnection = iter.next();
-            if (isConnectionStale(existingConnection)) {
-                try {
-                    existingConnection.close();
-                    iter.remove();
-                } catch (SQLException sql) {
-                    logger.error(sql.getMessage(), sql);
-                }
-            }
-        }
-        // close busy connections that have been checked out for too long.
-        // This should not happen since this means program has bug for not
-        // releasing connections .
-        iter = busyConnections.iterator();
-        while (iter.hasNext()) {
-            Connection busyConnection = iter.next();
-            if (isConnectionStale(busyConnection)) {
-                try {
-                    busyConnection.close();
-                    iter.remove();
-                    logger.warn("****Connection has checked out too long. Forced release. Check the program for calling release connection [free(Connection) method]");
-                } catch (SQLException sql) {
-                    logger.error(sql.getMessage(), sql);
-                }
-            }
-        }
-    }
-
-    public synchronized void free(Connection connection) {
-        busyConnections.removeElement(connection);
-        availableConnections.addElement(connection);
-        // Wake up threads that are waiting for a connection
-        notifyAll();
-    }
-
-    /**
-     * Close all the connections. Use with caution: be sure no connections are in use before calling. Note that you are
-     * not <I>required</I> to call this when done with a ConnectionPool, since connections are guaranteed to be closed
-     * when garbage collected. But this method gives more control regarding when the connections are closed.
-     */
-    public synchronized void dispose() {
-        logger.info("Connection Pool Shutting down");
-
-        // stop clean up thread
-        this.stop = true;
-        this.clenupThread.interrupt();
-
-        // stop producer up thread
-        this.producerThread.interrupt();
-
-        // close all connection
-        closeConnections(availableConnections);
-        availableConnections = new Stack<Connection>();
-        closeConnections(busyConnections);
-        busyConnections = new Stack<Connection>();
-        lastAccessTimeRecord.clear();
-
-        logger.info("All connection is closed");
-
-        try {
-            this.clenupThread.join();
-            this.producerThread.join();
-        } catch (Exception e) {
-            logger.error("Cannot shutdown cleanup thread", e);
-        }
-
-        logger.info("Connection Pool Shutdown");
-    }
-
-    private void closeConnections(Stack<Connection> connections) {
-        while (!connections.isEmpty()) {
-            Connection connection = connections.pop();
-            try {
-                if (!connection.isClosed()) {
-                    connection.close();
-                }
-            } catch (SQLException sqle) {
-                // Ignore errors; garbage collect anyhow
-                logger.warn(sqle.getMessage());
-            }
-        }
-    }
-
-    public synchronized String toString() {
-        String info = "ConnectionPool(" + url + "," + username + ")" + ", available=" + availableConnections.size()
-                + ", busy=" + busyConnections.size() + ", max=" + maxConnections;
-        return (info);
-    }
-
-    class CleanUpThread implements Runnable {
-        public void run() {
-            while (!stop) {
-                try {
-                    Thread.sleep(MAX_IDLE_TIME);
-                    closeStaleConnections();
-                } catch (InterruptedException e) {
-                    logger.info("Clean up thread is interrupted to close");
-                }
-            }
-        }
-    }
-
-    class FillUpThread implements Runnable {
-        public void run() {
-            while (!stop) {
-                try {
-                    // block until get
-                    needConnection.acquire();
-
-                    Connection conn = makeNewConnection();
-                    fillUpConnection(conn);
-                } catch (SQLException e) {
-                    // cannot create connection (increase semaphore value back)
-                    needConnection.release();
-                    logger.error(e.getMessage(), e);
-                } catch (InterruptedException e) {
-                    logger.info("Fill up thread is interrupted to close");
-                    break;
-                }
-            }
-        }
-    }
-
-    public void shutdown() throws SQLException{
-        for (Connection c : availableConnections) {
-            try {
-                c.close();
-            } catch (SQLException e) {
-                logger.error("Error while closing the connection", e);
-                throw new SQLException("Error while closing the connection", e);
-            }
-        }
-
-        for (Connection c : busyConnections) {
-            try {
-                c.close();
-            } catch (SQLException e) {
-                logger.error("Error while closing the connection", e);
-                throw new SQLException("Error while closing the connection", e);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java
deleted file mode 100644
index 1de1363..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DBConstants.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DBConstants {
-    private final static Logger logger = LoggerFactory.getLogger(DBConstants.class);
-
-    public static int SELECT_MAX_ROWS = 1000;
-
-    public static class DomainTable {
-        public static final String DOMAIN_ID = "domainId";
-        public static final String NAME = "name";
-        public static final String DESCRIPTION = "description";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-    }
-
-    public static class UserTable {
-        public static final String USER_ID = "userId";
-        public static final String DOMAIN_ID = "domainId";
-        public static final String USER_NAME = "userName";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-    }
-
-    public static class UserGroupTable {
-        public static final String GROUP_ID = "groupId";
-        public static final String DOMAIN_ID = "domainId";
-        public static final String NAME = "name";
-        public static final String DESCRIPTION = "description";
-        public static final String OWNER_ID = "ownerId";
-        public static final String GROUP_TYPE = "groupType";
-        public static final String GROUP_CARDINALITY = "groupCardinality";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-    }
-
-    public static class GroupMembershipTable {
-        public static final String PARENT_ID = "parentId";
-        public static final String CHILD_ID = "childId";
-        public static final String CHILD_TYPE = "childType";
-        public static final String DOMAIN_ID = "domainId";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-    }
-
-    public static class EntityTypeTable {
-        public static final String ENTITY_TYPE_ID = "entityTypeId";
-        public static final String DOMAIN_ID = "domainId";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-    }
-
-    public static class PermissionTypeTable {
-        public static final String ENTITY_TYPE_ID = "permissionTypeId";
-        public static final String DOMAIN_ID = "domainId";
-        public static final String NAME = "name";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-    }
-
-    public static class EntityTable {
-        public static final String ENTITY_ID = "entityId";
-        public static final String PARENT_ENTITY_ID = "parentEntityId";
-        public static final String ENTITY_TYPE_ID = "entityTypeId";
-        public static final String NAME = "name";
-        public static final String DESCRIPTION = "description";
-        public static final String FULL_TEXT = "fullText";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-        public static final String DOMAIN_ID = "domainId";
-        public static final String ORIGINAL_ENTITY_CREATION_TIME = "originalEntityCreationTime";
-        public static final String SHARED = "shared";
-    }
-
-    public static class SharingTable {
-        public static final String DOMAIN_ID = "domainId";
-        public static final String PERMISSION_TYPE_ID = "permissionTypeId";
-        public static final String ENTITY_ID = "entityId";
-        public static final String GROUP_ID = "groupId";
-        public static final String INHERITED_PARENT_ID = "inheritedParentId";
-        public static final String SHARING_TYPE = "sharingType";
-        public static final String CREATED_TIME = "createdTime";
-        public static final String UPDATED_TIME = "updatedTime";
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java
deleted file mode 100644
index d8368f5..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/DatabaseCreator.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.sql.*;
-import java.util.StringTokenizer;
-
-/**
- * This class creates the database tables required for airavata with default configuration this
- * class creates derby database in server mode. User can specify required database in appropriate
- * properties files.
- */
-public class DatabaseCreator {
-    private final static Logger logger = LoggerFactory.getLogger(DatabaseCreator.class);
-
-    public enum DatabaseType {
-        derby("(?i).*derby.*"), mysql("(?i).*mysql.*"), other("");
-
-        private String pattern;
-
-        private DatabaseType(String matchingPattern) {
-            this.pattern = matchingPattern;
-        }
-
-        public String getMatchingPattern() {
-            return this.pattern;
-        }
-    }
-
-    private static DatabaseType[] supportedDatabase = new DatabaseType[] { DatabaseType.derby, DatabaseType.mysql };
-
-    private static Logger log = LoggerFactory.getLogger(DatabaseCreator.class);
-    private static final String delimiter = ";";
-
-    /**
-     * Creates database
-     *
-     * @throws Exception
-     */
-    public static void createRegistryDatabase(String prefix, Connection conn) throws Exception {
-        createDatabase(prefix, conn);
-    }
-
-
-
-    /**
-     * Checks whether database tables are created by using select * on given table name
-     *
-     * @param tableName
-     *            Table which should be existed
-     * @return <code>true</core> if checkSQL is success, else <code>false</code> .
-     */
-    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
-        try {
-
-            log.debug("Running a query to test the database tables existence.");
-
-            // check whether the tables are already created with a query
-            Statement statement = null;
-            try {
-                statement = conn.createStatement();
-                ResultSet rs = statement.executeQuery("select * from " + tableName);
-                if (rs != null) {
-                    rs.close();
-                }
-            } finally {
-                try {
-                    if (statement != null) {
-                        statement.close();
-                    }
-                } catch (SQLException e) {
-                    return false;
-                }
-            }
-        } catch (SQLException e) {
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * executes given sql
-     *
-     * @param sql
-     * @throws Exception
-     */
-    private static void executeSQL(String sql, Connection conn) throws Exception {
-        // Check and ignore empty statements
-        if ("".equals(sql.trim())) {
-            return;
-        }
-
-        Statement statement = null;
-        try {
-            log.debug("SQL : " + sql);
-
-            boolean ret;
-            int updateCount = 0, updateCountTotal = 0;
-            statement = conn.createStatement();
-            ret = statement.execute(sql);
-            updateCount = statement.getUpdateCount();
-            do {
-                if (!ret) {
-                    if (updateCount != -1) {
-                        updateCountTotal += updateCount;
-                    }
-                }
-                ret = statement.getMoreResults();
-                if (ret) {
-                    updateCount = statement.getUpdateCount();
-                }
-            } while (ret);
-
-            log.debug(sql + " : " + updateCountTotal + " rows affected");
-
-            SQLWarning warning = conn.getWarnings();
-            while (warning != null) {
-                log.info(warning + " sql warning");
-                warning = warning.getNextWarning();
-            }
-            conn.clearWarnings();
-        } catch (SQLException e) {
-            if (e.getSQLState().equals("X0Y32")) {
-                // eliminating the table already exception for the derby
-                // database
-                log.info("Table Already Exists", e);
-            } else {
-                throw new Exception("Error occurred while executing : " + sql, e);
-            }
-        } finally {
-            if (statement != null) {
-                try {
-                    statement.close();
-                } catch (SQLException e) {
-                    log.error("Error occurred while closing result set.", e);
-                }
-            }
-        }
-    }
-
-    /**
-     * computes relatational database type using database name
-     *
-     * @return DatabaseType
-     * @throws Exception
-     *
-     */
-    public static DatabaseType getDatabaseType(Connection conn) throws Exception {
-        try {
-            if (conn != null && (!conn.isClosed())) {
-                DatabaseMetaData metaData = conn.getMetaData();
-                String databaseProductName = metaData.getDatabaseProductName();
-                return checkType(databaseProductName);
-            }
-        } catch (SQLException e) {
-            String msg = "Failed to create Airavata database." + e.getMessage();
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        return DatabaseType.other;
-    }
-
-    /**
-     * Overloaded method with String input
-     *
-     * @return DatabaseType
-     * @throws Exception
-     *
-     */
-    public static DatabaseType getDatabaseType(String dbUrl) throws Exception {
-        return checkType(dbUrl);
-    }
-
-    private static DatabaseType checkType(String text) throws Exception {
-        try {
-            if (text != null) {
-                for (DatabaseType type : supportedDatabase) {
-                    if (text.matches(type.getMatchingPattern()))
-                        return type;
-                }
-            }
-            String msg = "Unsupported database: " + text
-                    + ". Database will not be created automatically by the Airavata. "
-                    + "Please create the database using appropriate database scripts for " + "the database.";
-            throw new Exception(msg);
-
-        } catch (SQLException e) {
-            String msg = "Failed to create Airavatadatabase." + e.getMessage();
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-    }
-
-    /**
-     * Get scripts location which is prefix + "-" + databaseType + ".sql"
-     *
-     * @param prefix
-     * @param databaseType
-     * @return script location
-     */
-    private static String getScriptLocation(String prefix, DatabaseType databaseType) {
-        String scriptName = prefix + "-" + databaseType + ".sql";
-        log.debug("Loading database script from :" + scriptName);
-        return  scriptName;
-    }
-
-    private static void createDatabase(String prefix, Connection conn) throws Exception {
-        Statement statement = null;
-        try {
-            conn.setAutoCommit(false);
-            statement = conn.createStatement();
-            executeSQLScript(getScriptLocation(prefix, DatabaseCreator.getDatabaseType(conn)), conn);
-            conn.commit();
-            log.debug("Tables are created successfully.");
-        } catch (SQLException e) {
-            String msg = "Failed to create database tables for Airavata resource store. " + e.getMessage();
-            log.error(msg, e);
-            conn.rollback();
-            throw new Exception(msg, e);
-        } finally {
-            conn.setAutoCommit(true);
-            try {
-                if (statement != null) {
-                    statement.close();
-                }
-            } catch (SQLException e) {
-                log.error("Failed to close statement.", e);
-            }
-        }
-    }
-
-    private static void executeSQLScript(String dbscriptName, Connection conn) throws Exception {
-        StringBuffer sql = new StringBuffer();
-        BufferedReader reader = null;
-
-        try {
-            InputStream is = DatabaseCreator.class.getClassLoader().getResourceAsStream(dbscriptName);
-            if(is == null) {
-                logger.info("Script file not found at " + dbscriptName + ". Uses default database script file");
-                DatabaseType databaseType = DatabaseCreator.getDatabaseType(conn);
-                if(databaseType.equals(DatabaseType.derby)){
-                    is = DatabaseCreator.class.getClassLoader().getResourceAsStream("sharing-registry-derby.sql");
-                }else if(databaseType.equals(DatabaseType.mysql)){
-                    is = DatabaseCreator.class.getClassLoader().getResourceAsStream("sharing-registry-mysql.sql");
-                }
-            }
-            reader = new BufferedReader(new InputStreamReader(is));
-            String line;
-            while ((line = reader.readLine()) != null) {
-                line = line.trim();
-                if (line.startsWith("//")) {
-                    continue;
-                }
-                if (line.startsWith("--")) {
-                    continue;
-                }
-                StringTokenizer st = new StringTokenizer(line);
-                if (st.hasMoreTokens()) {
-                    String token = st.nextToken();
-                    if ("REM".equalsIgnoreCase(token)) {
-                        continue;
-                    }
-                }
-                sql.append(" ").append(line);
-
-                // SQL defines "--" as a comment to EOL
-                // and in Oracle it may contain a hint
-                // so we cannot just remove it, instead we must end it
-                if (line.indexOf("--") >= 0) {
-                    sql.append("\n");
-                }
-                if ((checkStringBufferEndsWith(sql, delimiter))) {
-                    executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
-                    sql.replace(0, sql.length(), "");
-                }
-            }
-            // Catch any statements not followed by ;
-            if (sql.length() > 0) {
-                executeSQL(sql.toString(), conn);
-            }
-        } catch (IOException e) {
-            log.error("Error occurred while executing SQL script for creating Airavata database", e);
-            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
-
-        } finally {
-            if (reader != null) {
-                reader.close();
-            }
-        }
-    }
-
-    /**
-     * Checks that a string buffer ends up with a given string. It may sound trivial with the existing JDK API but the
-     * various implementation among JDKs can make those methods extremely resource intensive and perform poorly due to
-     * massive memory allocation and copying. See
-     *
-     * @param buffer
-     *            the buffer to perform the check on
-     * @param suffix
-     *            the suffix
-     * @return <code>true</code> if the character sequence represented by the argument is a suffix of the character
-     *         sequence represented by the StringBuffer object; <code>false</code> otherwise. Note that the result will
-     *         be <code>true</code> if the argument is the empty string.
-     */
-    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
-        if (suffix.length() > buffer.length()) {
-            return false;
-        }
-        // this loop is done on purpose to avoid memory allocation performance
-        // problems on various JDKs
-        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
-        // implementation is ok though does allocation/copying
-        // StringBuffer.toString().endsWith() does massive memory
-        // allocation/copying on JDK 1.5
-        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
-        int endIndex = suffix.length() - 1;
-        int bufferIndex = buffer.length() - 1;
-        while (endIndex >= 0) {
-            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
-                return false;
-            }
-            bufferIndex--;
-            endIndex--;
-        }
-        return true;
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java
deleted file mode 100644
index 3781c4b..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JPAUtils.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.utils;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.allocation.manager.models.AllocationManagerException;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.*;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-
-public class JPAUtils {
-    private final static Logger logger = LoggerFactory.getLogger(JPAUtils.class);
-
-    public static final String PERSISTENCE_UNIT_NAME = "airavata-sharing-registry";
-    public static final String SHARING_REG_JDBC_DRIVER = "sharingcatalog.jdbc.driver";
-    public static final String SHARING_REG_JDBC_URL = "sharingcatalog.jdbc.url";
-    public static final String SHARING_REG_JDBC_USER = "sharingcatalog.jdbc.user";
-    public static final String SHARING_REG_JDBC_PWD = "sharingcatalog.jdbc.password";
-    public static final String SHARING_REG_VALIDATION_QUERY = "sharingcatalog.validationQuery";
-    public static final String JPA_CACHE_SIZE = "jpa.cache.size";
-    public static final String JPA_CACHE_ENABLED = "cache.enable";
-
-    public static final String CONFIGURATION = "CONFIGURATION";
-    public static final String START_DERBY_ENABLE = "start.derby.server.mode";
-    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
-    private static NetworkServerControl server;
-    private static JdbcStorage db;
-    private static String jdbcURl;
-    private static String jdbcDriver;
-    private static String jdbcUser;
-    private static String jdbcPassword;
-
-    @PersistenceUnit(unitName = PERSISTENCE_UNIT_NAME)
-    protected static EntityManagerFactory factory;
-    @PersistenceContext(unitName = PERSISTENCE_UNIT_NAME)
-    private static EntityManager entityManager;
-
-    public synchronized static EntityManager getEntityManager() throws Exception {
-        if (factory == null) {
-            String connectionProperties = "DriverClassName=" + readServerProperties(SHARING_REG_JDBC_DRIVER) + "," +
-                    "Url=" + readServerProperties(SHARING_REG_JDBC_URL) + "?autoReconnect=true," +
-                    "Username=" + readServerProperties(SHARING_REG_JDBC_USER) + "," +
-                    "Password=" + readServerProperties(SHARING_REG_JDBC_PWD) +
-                    ",validationQuery=" + readServerProperties(SHARING_REG_VALIDATION_QUERY);
-
-//            String connectionProperties = "DriverClassName=com.mysql.jdbc.Driver," +
-//                    "Url=jdbc:mysql://localhost:3306/airavata_sharing_catalog?autoReconnect=true," +
-//                    "Username=root," +
-//                    "Password=," +
-//                    ",validationQuery=SELECT 1 FROM CONFIGURATION";
-
-            Map<String, String> properties = new HashMap<String, String>();
-            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", "" + readServerProperties(JPA_CACHE_ENABLED)
-//                    + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
-//            properties.put("openjpa.QueryCache", "" + readServerProperties(JPA_CACHE_ENABLED)
-//                    + "(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE)) + ", SoftReferenceSize=0)");
-
-            properties.put("openjpa.RemoteCommitProvider", "sjvm");
-            properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
-            properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
-            properties.put("openjpa.jdbc.QuerySQLCache", "false");
-//            properties.put("openjpa.Multithreaded", "true");
-            properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," +
-                    " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000,  autoReconnect=true");
-            properties.put("openjpa.RuntimeUnenhancedClasses", "warn");
-            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
-        }
-
-        entityManager = factory.createEntityManager();
-        return entityManager;
-    }
-
-    public static void initializeDB() throws Exception {
-        jdbcDriver = readServerProperties(SHARING_REG_JDBC_DRIVER);
-        jdbcURl = readServerProperties(SHARING_REG_JDBC_URL);
-        jdbcUser = readServerProperties(SHARING_REG_JDBC_USER);
-        jdbcPassword = readServerProperties(SHARING_REG_JDBC_PWD);
-        jdbcURl = jdbcURl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
-
-        if (getDBType(jdbcURl).equals("derby") && isDerbyStartEnabled()) {
-            startDerbyInServerMode();
-        }
-        db = new JdbcStorage(10, 50, jdbcURl, jdbcDriver, true);
-
-        Connection conn = null;
-        try {
-            conn = db.connect();
-            if (!DatabaseCreator.isDatabaseStructureCreated(CONFIGURATION, conn)) {
-                DatabaseCreator.createRegistryDatabase("database_scripts/sharing-registry", conn);
-                logger.info("New Database created for Sharing Catalog !!! ");
-            } else {
-                logger.info("Database already created for Sharing Catalog !!!");
-            }
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new RuntimeException("Database failure", e);
-        } finally {
-            db.closeConnection(conn);
-            try {
-                if(conn != null){
-                    if (!conn.getAutoCommit()) {
-                        conn.commit();
-                    }
-                    conn.close();
-                }
-            } catch (SQLException e) {
-                logger.error("Error while closing database connection...", e.getMessage(), e);
-            }
-        }
-    }
-
-    public static String getDBType(String jdbcUrl){
-        try{
-            String cleanURI = jdbcUrl.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getScheme();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return null;
-        }
-    }
-
-    public static boolean isDerbyStartEnabled(){
-        try {
-            String s = ServerSettings.getSetting(START_DERBY_ENABLE);
-            if("true".equals(s)){
-                return true;
-            }
-        }  catch (ApplicationSettingsException e) {
-            logger.error("Unable to read airavata server properties", e.getMessage(), e);
-            return false;
-        }
-        return false;
-    }
-
-    public static void startDerbyInServerMode() {
-        try {
-            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
-            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
-                    getPort(jdbcURl),
-                    jdbcUser, jdbcPassword);
-            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
-            server.start(consoleWriter);
-        } catch (IOException e) {
-            logger.error("Unable to start Apache derby in the server mode! Check whether " +
-                    "specified port is available");
-        } catch (Exception e) {
-            logger.error("Unable to start Apache derby in the server mode! Check whether " +
-                    "specified port is available");
-        }
-    }
-
-    public static void stopDerbyInServerMode() {
-        System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "false");
-        if (server!=null){
-            try {
-                server.shutdown();
-            } catch (Exception e) {
-                logger.error("Error when stopping the derby server : "+e.getLocalizedMessage());
-            }
-        }
-    }
-
-    public static int getPort(String jdbcURL){
-        try{
-            String cleanURI = jdbcURL.substring(5);
-            URI uri = URI.create(cleanURI);
-            return uri.getPort();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            return -1;
-        }
-    }
-
-    public static String readServerProperties(String propertyName) throws Exception {
-        try {
-            return ServerSettings.getSetting(propertyName);
-        } catch (ApplicationSettingsException e) {
-            logger.error("Unable to read airavata-server.properties...", e);
-            throw new Exception("Unable to read airavata-server.properties...");
-        }
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java
deleted file mode 100644
index ea3a360..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/JdbcStorage.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.*;
-
-public class JdbcStorage {
-    private static Logger log = LoggerFactory.getLogger(JdbcStorage.class);
-
-    private ConnectionPool connectionPool;
-
-    public JdbcStorage(String jdbcUrl, String jdbcDriver) {
-        // default init connection and max connection
-        this(3, 50, jdbcUrl, jdbcDriver, true);
-    }
-
-    public JdbcStorage(int initCon, int maxCon, String url, String driver, boolean enableTransactions) {
-        try {
-            if (enableTransactions) {
-                connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true, false,
-                        Connection.TRANSACTION_SERIALIZABLE);
-            } else {
-                connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true);
-            }
-        } catch (Exception e) {
-            throw new RuntimeException("Failed to create database connection pool.", e);
-        }
-    }
-
-    /**
-     * Check if this connection pool is auto commit or not
-     *
-     * @return
-     */
-    public boolean isAutoCommit() {
-        return connectionPool.isAutoCommit();
-    }
-
-    public void commit(Connection conn) {
-        try {
-            if (conn != null && !conn.getAutoCommit()) {
-                conn.commit();
-            }
-        } catch (SQLException sqle) {
-            log.error("Cannot commit data", sqle);
-        }
-    }
-
-    public void commitAndFree(Connection conn) {
-        commit(conn);
-        closeConnection(conn);
-    }
-
-    public void rollback(Connection conn) {
-        try {
-            if (conn != null && !conn.getAutoCommit()) {
-                conn.rollback();
-            }
-        } catch (SQLException sqle) {
-            log.error("Cannot Rollback data", sqle);
-        }
-    }
-
-    public void rollbackAndFree(Connection conn) {
-        rollback(conn);
-        closeConnection(conn);
-    }
-
-    public Connection connect() {
-
-        Connection conn = null;
-        try {
-            conn = connectionPool.getConnection();
-        } catch (SQLException e) {
-            log.error(e.getMessage(), e);
-        }
-        return conn;
-    }
-
-    /**
-     * This method is provided so that you can have better control over the statement. For example: You can use
-     * stmt.setString to convert quotation mark automatically in an UPDATE statement
-     *
-     * NOTE: Statement is closed after execution
-     */
-    public int executeUpdateAndClose(PreparedStatement stmt) throws SQLException {
-        int rows = 0;
-        try {
-            rows = stmt.executeUpdate();
-            if (rows == 0) {
-                log.info("Problem: 0 rows affected by insert/update/delete statement.");
-            }
-        } finally {
-            stmt.close();
-        }
-        return rows;
-    }
-
-    public int countRow(String tableName, String columnName) throws SQLException {
-        String query = new String("SELECT COUNT(" + columnName + ") FROM " + tableName);
-        int count = -1;
-        Connection conn = null;
-        PreparedStatement stmt = null;
-        try {
-            conn = connectionPool.getConnection();
-            stmt = conn.prepareStatement(query);
-            ResultSet rs = stmt.executeQuery();
-            rs.next();
-            count = rs.getInt(1);
-            commit(conn);
-        } catch (SQLException sql) {
-            rollback(conn);
-            throw sql;
-        } finally {
-            try {
-                if (stmt != null && !stmt.isClosed()) {
-                    stmt.close();
-                }
-            } finally {
-                closeConnection(conn);
-            }
-        }
-        return count;
-    }
-
-    public void quietlyClose(Connection conn, Statement... stmts) {
-        if (stmts != null) {
-            for (Statement stmt : stmts) {
-                try {
-                    if (stmt != null && !stmt.isClosed()) {
-                        stmt.close();
-                    }
-                } catch (SQLException sql) {
-                    log.error(sql.getMessage(), sql);
-                }
-            }
-        }
-        closeConnection(conn);
-    }
-
-    public void closeConnection(Connection conn) {
-        if (conn != null) {
-            connectionPool.free(conn);
-        }
-    }
-
-    public void closeAllConnections() {
-        if (connectionPool != null)
-            connectionPool.dispose();
-    }
-
-    public void shutdown() throws SQLException {
-        connectionPool.shutdown();
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java
deleted file mode 100644
index b5f6c00..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/utils/ObjectMapperSingleton.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * 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.allocation.manager.db.utils;
-
-import org.dozer.DozerBeanMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ObjectMapperSingleton extends DozerBeanMapper{
-    private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
-
-    private static ObjectMapperSingleton instance;
-
-    private ObjectMapperSingleton(){}
-
-    public static ObjectMapperSingleton getInstance(){
-        if(instance == null)
-            instance = new ObjectMapperSingleton();
-        return instance;
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java b/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
deleted file mode 100644
index 2eccf05..0000000
--- a/allocation-manager/airavata-allocation-manager/airavata-allocation-manager-stubs/src/main/java/org/apache/airavata/allocation/manager/models/Domain.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.airavata.allocation.manager.models;
-
-public class Domain {
-// Placeholder file for Madrina to create
-}
diff --git a/bin/README.txt b/bin/README.txt
deleted file mode 100644
index a5d51f6..0000000
--- a/bin/README.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-## Temporarily using ANT compile the Aurora Management code.
-## TODO: integrate with maven build system, instead of using ANT
-
-#In the following directory run the compilation command:
-airavata/modules/cloud/AuroraIntegration/src
-
-#Compilation command
-ant all
-
-#Run command
-## TODO: add the command to run and test the code
-
-## Add sample output that shows the Aurora code working
-
diff --git a/bin/build.xml b/bin/build.xml
deleted file mode 100644
index 5533336..0000000
--- a/bin/build.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project name="aurora" default="compile_all" basedir="..">
-
-  <property name="BUILD.compiler"       value="modern"/>
-  <property name="src"                  value="src"/>
-  <property name="BUILD"                value="BUILD"/>
-  <property name="classes"              value="${BUILD}/classes"/>
-
-
-  <target name="all" depends="compile_all"/>
-
-  <target name="compile_all"
-          depends="org"/>
-
-  <target name="clean">
-       <delete dir="${BUILD}"/>
-  </target>
-
-  <!-- Prepare target directories -->
-  <target name="prepare">
-        <mkdir dir="${BUILD}"/>
-        <mkdir dir="${classes}"/>
-  </target>
-
-
- <target name="jar">
-        <mkdir dir="${BUILD}/jar"/>
-        <jar destfile="${BUILD}/jar/auroraDriverl.jar" basedir="${BUILD}/classes">
-            <manifest>
-                <attribute name="Main-Class" value="org.apache.airavata.cloud.aurora.driver.AuroraAdminDriver"/>
-            </manifest>
-        </jar>
-    </target>
-
-
-
-  <!-- ** means all subdirectories as well -->
-  <!-- * means all files in the current directory -->
-  <!-- for just java files use *.java -->
-
-  <target name="org" depends="prepare">
-    <javac srcdir="${src}"
-           includes="org/**"
-           excludes="**/package.html"
-           destdir="${classes}"
-           classpath="${classes}"
-           debug="on"
-           optimize="on"
-           deprecation="off"/>
-  </target>
-
-
-</project>
diff --git a/bin/db.config b/bin/db.config
deleted file mode 100644
index b2c7b9d..0000000
--- a/bin/db.config
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# 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.
-#
-#database connection string
-
-##mySQL
-jdbcDriver=com.mysql.jdbc.Driver
-
-#jdbcUrl=jdbc:mysql://localhost:3306/wsnt?user=wsnt2&password=PASSWORD
\ No newline at end of file
diff --git a/bin/org/apache/airavata/jobsubmission/gram/errors.properties b/bin/org/apache/airavata/jobsubmission/gram/errors.properties
deleted file mode 100644
index 3e4382b..0000000
--- a/bin/org/apache/airavata/jobsubmission/gram/errors.properties
+++ /dev/null
@@ -1,176 +0,0 @@
-1 = Parameter not supported
-2 = The RSL length is greater than the maximum allowed
-3 = No resources available
-4 = Bad directory specified
-5 = The executable does not exist
-6 = Insufficient funds
-7 = Authentication with the remote server failed
-8 = Job cancelled by user
-9 = Job cancelled by system
-
-10 = Data transfer to the server failed
-11 = The stdin file does not exist
-12 = The connection to the server failed (check host and port)
-13 = The provided RSL 'maxtime' value is invalid (not an integer or must be greater than 0)
-14 = The provided RSL 'count' value is invalid (not an integer or must be greater than 0)
-15 = The job manager received an invalid RSL
-16 = Could not connect to job manager
-17 = The job failed when the job manager attempted to run it
-18 = Paradyn error
-19 = The provided RSL 'jobtype' value is invalid
-
-20 = The provided RSL 'myjob' value is invalid
-21 = The job manager failed to locate an internal script argument file
-22 = The job manager failed to create an internal script argument file
-23 = The job manager detected an invalid job state
-24 = The job manager detected an invalid script response
-25 = The job manager detected an invalid job state
-26 = The provided RSL 'jobtype' value is not supported by this job manager
-27 = Unimplemented
-28 = The job manager failed to create an internal script submission file
-29 = The job manager cannot find the user proxy
-
-30 = The job manager failed to open the user proxy
-31 = The job manager failed to cancel the job as requested
-32 = System memory allocation failed
-33 = The interprocess job communication initialization failed
-34 = The interprocess job communication setup failed
-35 = The provided RSL 'host count' value is invalid
-36 = One of the provided RSL parameters is unsupported
-37 = The provided RSL 'queue' parameter is invalid
-38 = The provided RSL 'project' parameter is invalid
-39 = The provided RSL string includes variables that could not be identified
-
-40 = The provided RSL 'environment' parameter is invalid
-41 = The provided RSL 'dryrun' parameter is invalid
-42 = The provided RSL is invalid (an empty string)
-43 = The job manager failed to stage the executable
-44 = The job manager failed to stage the stdin file
-45 = The requested job manager type is invalid
-46 = The provided RSL 'arguments' parameter is invalid
-47 = The gatekeeper failed to run the job manager
-48 = The provided RSL could not be properly parsed
-49 = There is a version mismatch between GRAM components
-
-50 = The provided RSL 'arguments' parameter is invalid
-51 = The provided RSL 'count' parameter is invalid
-52 = The provided RSL 'directory' parameter is invalid
-53 = The provided RSL 'dryrun' parameter is invalid
-54 = The provided RSL 'environment' parameter is invalid
-55 = The provided RSL 'executable' parameter is invalid
-56 = The provided RSL 'host_count' parameter is invalid
-57 = The provided RSL 'jobtype' parameter is invalid
-58 = The provided RSL 'maxtime' parameter is invalid
-59 = The provided RSL 'myjob' parameter is invalid
-
-60 = The provided RSL 'paradyn' parameter is invalid
-61 = The provided RSL 'project' parameter is invalid
-62 = The provided RSL 'queue' parameter is invalid
-63 = The provided RSL 'stderr' parameter is invalid
-64 = The provided RSL 'stdin' parameter is invalid
-65 = The provided RSL 'stdout' parameter is invalid
-66 = The job manager failed to locate an internal script
-67 = The job manager failed on the system call pipe()
-68 = The job manager failed on the system call fcntl()
-69 = The job manager failed to create the temporary stdout filename
-
-70 = The job manager failed to create the temporary stderr filename
-71 = The job manager failed on the system call fork()
-72 = The executable file permissions do not allow execution
-73 = The job manager failed to open stdout
-74 = The job manager failed to open stderr
-75 = The cache file could not be opened in order to relocate the user proxy
-76 = Cannot access cache files in ~/.globus/.gass_cache, check permissions, quota, and disk space
-77 = The job manager failed to insert the contact in the client contact list
-78 = The contact was not found in the job manager's client contact list
-79 = Connecting to the job manager failed.  Possible reasons: job terminated, invalid job contact, network problems, ...
-
-80 = The syntax of the job contact is invalid
-81 = The executable parameter in the RSL is undefined
-82 = The job manager service is misconfigured.  condor arch undefined
-83 = The job manager service is misconfigured.  condor os undefined
-84 = The provided RSL 'min_memory' parameter is invalid
-85 = The provided RSL 'max_memory' parameter is invalid
-86 = The RSL 'min_memory' value is not zero or greater
-87 = The RSL 'max_memory' value is not zero or greater
-88 = The creation of a HTTP message failed
-89 = Parsing incoming HTTP message failed
-
-90 = The packing of information into a HTTP message failed
-91 = An incoming HTTP message did not contain the expected information
-92 = The job manager does not support the service that the client requested
-93 = The gatekeeper failed to find the requested service
-94 = The jobmanager does not accept any new requests (shutting down)
-95 = The client failed to close the listener associated with the callback URL
-96 = The gatekeeper contact cannot be parsed
-97 = The job manager could not find the 'poe' command
-98 = The job manager could not find the 'mpirun' command
-99 = The provided RSL 'start_time' parameter is invalid"
-100 = The provided RSL 'reservation_handle' parameter is invalid
-
-101 = The provided RSL 'max_wall_time' parameter is invalid
-102 = The RSL 'max_wall_time' value is not zero or greater
-103 = The provided RSL 'max_cpu_time' parameter is invalid
-104 = The RSL 'max_cpu_time' value is not zero or greater
-105 = The job manager is misconfigured, a scheduler script is missing
-106 = The job manager is misconfigured, a scheduler script has invalid permissions
-107 = The job manager failed to signal the job
-108 = The job manager did not recognize/support the signal type
-109 = The job manager failed to get the job id from the local scheduler
-
-110 = The job manager is waiting for a commit signal
-111 = The job manager timed out while waiting for a commit signal
-112 = The provided RSL 'save_state' parameter is invalid
-113 = The provided RSL 'restart' parameter is invalid
-114 = The provided RSL 'two_phase' parameter is invalid
-115 = The RSL 'two_phase' value is not zero or greater
-116 = The provided RSL 'stdout_position' parameter is invalid
-117 = The RSL 'stdout_position' value is not zero or greater
-118 = The provided RSL 'stderr_position' parameter is invalid
-119 = The RSL 'stderr_position' value is not zero or greater
-
-120 = The job manager restart attempt failed
-121 = The job state file doesn't exist
-122 = Could not read the job state file
-123 = Could not write the job state file
-124 = The old job manager is still alive
-125 = The job manager state file TTL expired
-126 = It is unknown if the job was submitted
-127 = The provided RSL 'remote_io_url' parameter is invalid
-128 = Could not write the remote io url file
-129 = The standard output/error size is different
-
-130 = The job manager was sent a stop signal (job is still running)
-131 = The user proxy expired (job is still running)
-132 = The job was not submitted by original jobmanager
-133 = The job manager is not waiting for that commit signal
-134 = The provided RSL scheduler specific parameter is invalid
-135 = The job manager could not stage in a file
-136 = The scratch directory could not be created
-137 = The provided 'gass_cache' parameter is invalid
-138 = The RSL contains attributes which are not valid for job submission
-139 = The RSL contains attributes which are not valid for stdio update
-
-140 = The RSL contains attributes which are not valid for job restart
-141 = The provided RSL 'file_stage_in' parameter is invalid
-142 = The provided RSL 'file_stage_in_shared' parameter is invalid
-143 = The provided RSL 'file_stage_out' parameter is invalid
-144 = The provided RSL 'gass_cache' parameter is invalid
-145 = The provided RSL 'file_cleanup' parameter is invalid
-146 = The provided RSL 'scratch_dir' parameter is invalid
-147 = The provided scheduler-specific RSL parameter is invalid
-148 = A required RSL attribute was not defined in the RSL spec
-149 = The gass_cache attribute points to an invalid cache directory
-
-150 = The provided RSL 'save_state' parameter has an invalid value
-151 = The job manager could not open the RSL attribute validation file
-152 = The  job manager could not read the RSL attribute validation file
-153 = The provided RSL 'proxy_timeout' is invalid
-154 = The RSL 'proxy_timeout' value is not greater than zero
-155 = The job manager could not stage out a file
-156 = The job contact string does not match any which the job manager is handling
-157 = Proxy delegation failed
-158 = The job manager could not lock the state lock file
-
-1000 = Failed to start up callback handler
-1003 = Job contact not set

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata-sandbox] 02/05: Revert "Added Added initial files for entities, repositories for allocation manager module"

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git

commit 9a46bf21c1732a7a0c411d3775d28e0b543a9f55
Author: Harsha Phulwani <ha...@gmail.com>
AuthorDate: Fri Nov 17 17:10:27 2017 -0500

    Revert "Added Added initial files for entities,repositories for allocation manager module"
    
    This reverts commit 645c7fc51f2855e1149bc506c20d13501ce39515.
---
 .../manager/db/entities/RequestStatusEntity.java   |  87 ---------
 .../db/entities/UserAllocationDetailEntity.java    | 202 ---------------------
 .../db/entities/UserAllocationDetailPKEntity.java  |  56 ------
 .../manager/db/entities/UserDetailEntity.java      |  75 --------
 .../db/repositories/AbstractRepository.java        | 170 -----------------
 .../db/repositories/RequestStatusRepository.java   |  14 --
 .../UserAllocationDetailPKRepository.java          |  14 --
 .../UserAllocationDetailRepository.java            |  14 --
 .../db/repositories/UserDetailRepository.java      |  19 --
 .../src/main/resources/META-INF/persistence.xml    |  11 --
 .../main/resources/allocation-manager-mysql.sql    |  58 ------
 11 files changed, 720 deletions(-)

diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
deleted file mode 100644
index 4263468..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/RequestStatusEntity.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-import java.math.BigInteger;
-
-
-/**
- * The persistent class for the request_status database table.
- * 
- */
-@Entity
-@Table(name="request_status")
-@NamedQuery(name="RequestStatus.findAll", query="SELECT r FROM RequestStatus r")
-public class RequestStatus implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	@Id
-	@Column(name="PROJECT_ID")
-	private String projectId;
-
-	@Column(name="AWARD_ALLOCATION")
-	private BigInteger awardAllocation;
-
-	@Column(name="END_DATE")
-	private BigInteger endDate;
-
-	@Lob
-	private String reviewers;
-
-	@Column(name="START_DATE")
-	private BigInteger startDate;
-
-	private String status;
-
-	public RequestStatus() {
-	}
-
-	public String getProjectId() {
-		return this.projectId;
-	}
-
-	public void setProjectId(String projectId) {
-		this.projectId = projectId;
-	}
-
-	public BigInteger getAwardAllocation() {
-		return this.awardAllocation;
-	}
-
-	public void setAwardAllocation(BigInteger awardAllocation) {
-		this.awardAllocation = awardAllocation;
-	}
-
-	public BigInteger getEndDate() {
-		return this.endDate;
-	}
-
-	public void setEndDate(BigInteger endDate) {
-		this.endDate = endDate;
-	}
-
-	public String getReviewers() {
-		return this.reviewers;
-	}
-
-	public void setReviewers(String reviewers) {
-		this.reviewers = reviewers;
-	}
-
-	public BigInteger getStartDate() {
-		return this.startDate;
-	}
-
-	public void setStartDate(BigInteger startDate) {
-		this.startDate = startDate;
-	}
-
-	public String getStatus() {
-		return this.status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
deleted file mode 100644
index 7d40899..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailEntity.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-import java.math.BigInteger;
-
-
-/**
- * The persistent class for the user_allocation_details database table.
- * 
- */
-@Entity
-@Table(name="user_allocation_details")
-@NamedQuery(name="UserAllocationDetail.findAll", query="SELECT u FROM UserAllocationDetail u")
-public class UserAllocationDetail implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	@EmbeddedId
-	private UserAllocationDetailPK id;
-
-	@Lob
-	@Column(name="APPLICATIONS_TO_BE_USED")
-	private String applicationsToBeUsed;
-
-	@Column(name="DISK_USAGE_RANGE_PER_JOB")
-	private BigInteger diskUsageRangePerJob;
-
-	@Lob
-	private byte[] documents;
-
-	@Lob
-	@Column(name="FIELD_OF_SCIENCE")
-	private String fieldOfScience;
-
-	@Lob
-	private String keywords;
-
-	@Column(name="MAX_MEMORY_PER_CPU")
-	private BigInteger maxMemoryPerCpu;
-
-	@Column(name="NUMBER_OF_CPU_PER_JOB")
-	private BigInteger numberOfCpuPerJob;
-
-	@Lob
-	@Column(name="PROJECT_DESCRIPTION")
-	private String projectDescription;
-
-	@Lob
-	@Column(name="PROJECT_REVIEWED_AND_FUNDED_BY")
-	private String projectReviewedAndFundedBy;
-
-	@Column(name="REQUESTED_DATE")
-	private BigInteger requestedDate;
-
-	@Column(name="SERVICE_UNITS")
-	private BigInteger serviceUnits;
-
-	@Lob
-	@Column(name="SPECIFIC_RESOURCE_SELECTION")
-	private String specificResourceSelection;
-
-	@Lob
-	private String title;
-
-	@Column(name="TYPE_OF_ALLOCATION")
-	private String typeOfAllocation;
-
-	@Column(name="TYPICAL_SU_PER_JOB")
-	private BigInteger typicalSuPerJob;
-
-	public UserAllocationDetail() {
-	}
-
-	public UserAllocationDetailPK getId() {
-		return this.id;
-	}
-
-	public void setId(UserAllocationDetailPK id) {
-		this.id = id;
-	}
-
-	public String getApplicationsToBeUsed() {
-		return this.applicationsToBeUsed;
-	}
-
-	public void setApplicationsToBeUsed(String applicationsToBeUsed) {
-		this.applicationsToBeUsed = applicationsToBeUsed;
-	}
-
-	public BigInteger getDiskUsageRangePerJob() {
-		return this.diskUsageRangePerJob;
-	}
-
-	public void setDiskUsageRangePerJob(BigInteger diskUsageRangePerJob) {
-		this.diskUsageRangePerJob = diskUsageRangePerJob;
-	}
-
-	public byte[] getDocuments() {
-		return this.documents;
-	}
-
-	public void setDocuments(byte[] documents) {
-		this.documents = documents;
-	}
-
-	public String getFieldOfScience() {
-		return this.fieldOfScience;
-	}
-
-	public void setFieldOfScience(String fieldOfScience) {
-		this.fieldOfScience = fieldOfScience;
-	}
-
-	public String getKeywords() {
-		return this.keywords;
-	}
-
-	public void setKeywords(String keywords) {
-		this.keywords = keywords;
-	}
-
-	public BigInteger getMaxMemoryPerCpu() {
-		return this.maxMemoryPerCpu;
-	}
-
-	public void setMaxMemoryPerCpu(BigInteger maxMemoryPerCpu) {
-		this.maxMemoryPerCpu = maxMemoryPerCpu;
-	}
-
-	public BigInteger getNumberOfCpuPerJob() {
-		return this.numberOfCpuPerJob;
-	}
-
-	public void setNumberOfCpuPerJob(BigInteger numberOfCpuPerJob) {
-		this.numberOfCpuPerJob = numberOfCpuPerJob;
-	}
-
-	public String getProjectDescription() {
-		return this.projectDescription;
-	}
-
-	public void setProjectDescription(String projectDescription) {
-		this.projectDescription = projectDescription;
-	}
-
-	public String getProjectReviewedAndFundedBy() {
-		return this.projectReviewedAndFundedBy;
-	}
-
-	public void setProjectReviewedAndFundedBy(String projectReviewedAndFundedBy) {
-		this.projectReviewedAndFundedBy = projectReviewedAndFundedBy;
-	}
-
-	public BigInteger getRequestedDate() {
-		return this.requestedDate;
-	}
-
-	public void setRequestedDate(BigInteger requestedDate) {
-		this.requestedDate = requestedDate;
-	}
-
-	public BigInteger getServiceUnits() {
-		return this.serviceUnits;
-	}
-
-	public void setServiceUnits(BigInteger serviceUnits) {
-		this.serviceUnits = serviceUnits;
-	}
-
-	public String getSpecificResourceSelection() {
-		return this.specificResourceSelection;
-	}
-
-	public void setSpecificResourceSelection(String specificResourceSelection) {
-		this.specificResourceSelection = specificResourceSelection;
-	}
-
-	public String getTitle() {
-		return this.title;
-	}
-
-	public void setTitle(String title) {
-		this.title = title;
-	}
-
-	public String getTypeOfAllocation() {
-		return this.typeOfAllocation;
-	}
-
-	public void setTypeOfAllocation(String typeOfAllocation) {
-		this.typeOfAllocation = typeOfAllocation;
-	}
-
-	public BigInteger getTypicalSuPerJob() {
-		return this.typicalSuPerJob;
-	}
-
-	public void setTypicalSuPerJob(BigInteger typicalSuPerJob) {
-		this.typicalSuPerJob = typicalSuPerJob;
-	}
-
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java
deleted file mode 100644
index 93f8502..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserAllocationDetailPKEntity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-
-/**
- * The primary key class for the user_allocation_details database table.
- * 
- */
-@Embeddable
-public class UserAllocationDetailPK implements Serializable {
-	//default serial version id, required for serializable classes.
-	private static final long serialVersionUID = 1L;
-
-	@Column(name="PROJECT_ID")
-	private String projectId;
-
-	private String username;
-
-	public UserAllocationDetailPK() {
-	}
-	public String getProjectId() {
-		return this.projectId;
-	}
-	public void setProjectId(String projectId) {
-		this.projectId = projectId;
-	}
-	public String getUsername() {
-		return this.username;
-	}
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	public boolean equals(Object other) {
-		if (this == other) {
-			return true;
-		}
-		if (!(other instanceof UserAllocationDetailPK)) {
-			return false;
-		}
-		UserAllocationDetailPK castOther = (UserAllocationDetailPK)other;
-		return 
-			this.projectId.equals(castOther.projectId)
-			&& this.username.equals(castOther.username);
-	}
-
-	public int hashCode() {
-		final int prime = 31;
-		int hash = 17;
-		hash = hash * prime + this.projectId.hashCode();
-		hash = hash * prime + this.username.hashCode();
-		
-		return hash;
-	}
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
deleted file mode 100644
index b27a6bc..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/entities/UserDetailEntity.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.apache.airavata.allocation.manager.db.entities;
-
-import java.io.Serializable;
-import javax.persistence.*;
-
-
-/**
- * The persistent class for the user_details database table.
- * 
- */
-@Entity
-@Table(name="user_details")
-@NamedQuery(name="UserDetail.findAll", query="SELECT u FROM UserDetail u")
-public class UserDetail implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	@Id
-	private String username;
-
-	@Lob
-	private String email;
-
-	@Lob
-	@Column(name="FULL_NAME")
-	private String fullName;
-
-	private String password;
-
-	@Column(name="USER_TYPE")
-	private String userType;
-
-	public UserDetail() {
-	}
-
-	public String getUsername() {
-		return this.username;
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	public String getEmail() {
-		return this.email;
-	}
-
-	public void setEmail(String email) {
-		this.email = email;
-	}
-
-	public String getFullName() {
-		return this.fullName;
-	}
-
-	public void setFullName(String fullName) {
-		this.fullName = fullName;
-	}
-
-	public String getPassword() {
-		return this.password;
-	}
-
-	public void setPassword(String password) {
-		this.password = password;
-	}
-
-	public String getUserType() {
-		return this.userType;
-	}
-
-	public void setUserType(String userType) {
-		this.userType = userType;
-	}
-
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
deleted file mode 100644
index 0ca393e..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/AbstractRepository.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- *
- * 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.sharing.registry.db.repositories;
-
-import org.apache.airavata.sharing.registry.db.utils.Committer;
-import org.apache.airavata.sharing.registry.db.utils.DBConstants;
-import org.apache.airavata.sharing.registry.db.utils.JPAUtils;
-import org.apache.airavata.sharing.registry.db.utils.ObjectMapperSingleton;
-import org.apache.airavata.sharing.registry.models.SharingRegistryException;
-import org.dozer.Mapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public abstract class AbstractRepository<T, E, Id> {
-    private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
-
-    private Class<T> thriftGenericClass;
-    private Class<E> dbEntityGenericClass;
-
-    public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
-        this.thriftGenericClass = thriftGenericClass;
-        this.dbEntityGenericClass = dbEntityGenericClass;
-    }
-
-    public T create(T t) throws SharingRegistryException {
-        return update(t);
-    }
-
-    //FIXME do a bulk insert
-    public List<T> create(List<T> tList) throws SharingRegistryException {
-        return update(tList);
-    }
-    
-    public List<T> create(String query) throws SharingRegistryException {
-       // String query = "INSERT INTO " + dbEntityGenericClass.getSimpleName() + " values("+values+")";
-       execute(entityManager -> {
-            javax.persistence.Query q = entityManager.createQuery(query);
-        });
-    }
-
-    public  T update(T t) throws SharingRegistryException {
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        E entity = mapper.map(t, dbEntityGenericClass);
-        E persistedCopy = execute(entityManager -> entityManager.merge(entity));
-        return mapper.map(persistedCopy, thriftGenericClass);
-    }
-
-    //FIXME do a bulk update
-    public  List<T> update(List<T> tList) throws SharingRegistryException {
-        List<T> returnList = new ArrayList<>();
-        for(T temp : tList)
-            returnList.add(update(temp));
-        return returnList;
-    }
-
-    public boolean delete(Id id) throws SharingRegistryException {
-        execute(entityManager -> {
-             E entity = entityManager.find(dbEntityGenericClass, id);
-             entityManager.remove(entity);
-             return entity;
-         });
-        return true;
-    }
-
-    public boolean delete(List<Id> idList) throws SharingRegistryException {
-        for(Id id : idList)
-            delete(id);
-        return true;
-    }
-
-    public T get(Id id) throws SharingRegistryException {
-        E entity = execute(entityManager -> entityManager
-                .find(dbEntityGenericClass, id));
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        if(entity == null)
-            return null;
-        return mapper.map(entity, thriftGenericClass);
-    }
-
-    public boolean isExists(Id id) throws SharingRegistryException {
-        return get(id) != null;
-    }
-
-    public List<T> get(List<Id> idList) throws SharingRegistryException {
-        List<T> returnList = new ArrayList<>();
-        for(Id id : idList)
-            returnList.add(get(id));
-        return returnList;
-    }
-
-    public List<T> select(Map<String, String> filters, int offset, int limit) throws SharingRegistryException {
-        String query = "SELECT DISTINCT p from " + dbEntityGenericClass.getSimpleName() + " as p";
-        ArrayList<String> parameters = new ArrayList<>();
-        int parameterCount = 1;
-        if (filters != null && filters.size() != 0) {
-            query += " WHERE ";
-            for (String k : filters.keySet()) {
-                query += "p." + k + " = ?" + parameterCount + " AND ";
-                parameters.add(filters.get(k));
-                parameterCount++;
-            }
-            query = query.substring(0, query.length() - 5);
-        }
-
-        query += " ORDER BY p.createdTime DESC";
-        String queryString = query;
-        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
-        List resultSet = execute(entityManager -> {
-            javax.persistence.Query q = entityManager.createQuery(queryString);
-            for (int i = 0; i < parameters.size(); i++) {
-                q.setParameter(i + 1, parameters.get(i));
-            }
-            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
-        });
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        List<T> gatewayList = new ArrayList<>();
-        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
-        return gatewayList;
-    }
-
-    public List<T> select(String queryString, Map<String,Object> queryParameters, int offset, int limit) throws SharingRegistryException {
-        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
-        List resultSet = execute(entityManager -> {
-            Query q =  entityManager.createQuery(queryString);
-            for(Map.Entry<String, Object> queryParam : queryParameters.entrySet()){
-                q.setParameter(queryParam.getKey(), queryParam.getValue());
-            }
-            return q.setFirstResult(offset).setMaxResults(newLimit).getResultList();
-        });
-        Mapper mapper = ObjectMapperSingleton.getInstance();
-        List<T> gatewayList = new ArrayList<>();
-        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
-        return gatewayList;
-    }
-
-    public <R> R execute(Committer<EntityManager, R> committer) throws SharingRegistryException {
-        EntityManager entityManager = JPAUtils.getEntityManager();
-        try {
-            entityManager.getTransaction().begin();
-            R r = committer.commit(entityManager);
-            entityManager.getTransaction().commit();
-            return r;
-        } finally {
-            entityManager.close();
-        }
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
deleted file mode 100644
index 52a2c4e..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/RequestStatusRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity;
-import org.apache.airavata.sharing.registry.models.RequestStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RequestStatusRepository extends AbstractRepository<RequestStatus, RequestStatusEntity, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public RequestStatusRepository(){
-        super(RequestStatus.class, RequestStatusEntity.class);
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
deleted file mode 100644
index 0644f8a..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailPKRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailPKEntity;
-import org.apache.airavata.sharing.registry.models.UserAllocationDetailPK;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserAllocationDetailPKRepository extends AbstractRepository<UserAllocationDetailPK, UserAllocationDetailPKEntity, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public UserAllocationDetailPKRepository(){
-        super(UserAllocationDetailPK.class, UserAllocationDetailPKEntity.class);
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
deleted file mode 100644
index 35366d6..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserAllocationDetailRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity;
-import org.apache.airavata.sharing.registry.models.UserAllocationDetail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserAllocationDetailRepository extends AbstractRepository<UserAllocationDetail, UserAllocationDetailEntity, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public UserAllocationDetailRepository(){
-        super(UserAllocationDetail.class, UserAllocationDetailEntity.class);
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java b/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
deleted file mode 100644
index 55cd888..0000000
--- a/allocation-manager/allocation-manager-server/src/main/java/org/apache/airavata/allocation/manager/db/repositories/UserDetailRepository.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.apache.airavata.allocation.manager.db.repositories;
-
-import org.apache.airavata.allocation.manager.db.entities.UserDetailEntity;
-import org.apache.airavata.sharing.registry.models.UserDetail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserDetailRepository extends AbstractRepository<UserDetail, UserAllocationEntity, String> {
-    private final static Logger logger = LoggerFactory.getLogger(DomainRepository.class);
-
-    public UserDetailRepository(){
-        super(UserDetail.class, UserDetailEntity.class);
-    }
-
-    public static void main(String args[])
-    {
-
-    }
-}
\ No newline at end of file
diff --git a/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml b/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index a006ad6..0000000
--- a/allocation-manager/allocation-manager-server/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
-
-    <persistence-unit name="airavata-allocation-manager">
-        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
-        <class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailEntity</class>
-        <class>org.apache.airavata.allocation.manager.db.entities.UserAllocationDetailPKEntity</class>
-        <class>org.apache.airavata.allocation.manager.db.entities.RequestStatusEntity</class>
-        <class>org.apache.airavata.allocation.manager.db.entities.UserDetailEntity</class>
-    </persistence-unit>
-</persistence>
diff --git a/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql b/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
deleted file mode 100644
index 20824f6..0000000
--- a/allocation-manager/allocation-manager-server/src/main/resources/allocation-manager-mysql.sql
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-CREATE TABLE IF NOT EXISTS USER_ALLOCATION_DETAILS (
-    REQUESTED_DATE BIGINT NOT NULL,
-    TITLE TEXT NOT NULL,
-    PROJECT_DESCRIPTION TEXT NOT NULL,
-    KEYWORDS TEXT,
-    FIELD_OF_SCIENCE TEXT,
-    DOCUMENTS BLOB,
-    TYPE_OF_ALLOCATION VARCHAR (255) NOT NULL,
-    USERNAME VARCHAR (255) NOT NULL,
-    PROJECT_ID VARCHAR (255) ,
-    APPLICATIONS_TO_BE_USED TEXT,
-    SPECIFIC_RESOURCE_SELECTION TEXT,
-    SERVICE_UNITS BIGINT default 1,
-    TYPICAL_SU_PER_JOB BIGINT,
-    MAX_MEMORY_PER_CPU BIGINT,
-    DISK_USAGE_RANGE_PER_JOB BIGINT,
-    NUMBER_OF_CPU_PER_JOB BIGINT,
-    PROJECT_REVIEWED_AND_FUNDED_BY TEXT,
-    PRIMARY KEY (PROJECT_ID, USERNAME)
-);
-
-CREATE TABLE IF NOT EXISTS USER_DETAILS (
-    USERNAME VARCHAR (255) PRIMARY KEY,
-    PASSWORD VARCHAR (255) NOT NULL,
-    FULL_NAME TEXT,
-    EMAIL TEXT NOT NULL,
-    USER_TYPE VARCHAR (255) NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS REQUEST_STATUS (
-    PROJECT_ID VARCHAR (255) PRIMARY KEY,
-    STATUS VARCHAR (255) NOT NULL,
-    REVIEWERS TEXT,
-    START_DATE BIGINT,
-    END_DATE BIGINT,
-    AWARD_ALLOCATION BIGINT
-);

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.