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

[1/4] airavata git commit: add registry-tools

Repository: airavata
Updated Branches:
  refs/heads/master c75d40685 -> 6c1eebe31


http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/pom.xml b/modules/registry/registry-tools/registry-tool/pom.xml
new file mode 100644
index 0000000..e006551
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--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. -->
+
+<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/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata-registry-tools</artifactId>
+        <version>0.16-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>registry-tool</artifactId>
+    <packaging>jar</packaging>
+    <name>registry-tool</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>10.9.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbyclient</artifactId>
+            <version>10.9.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbynet</artifactId>
+            <version>10.9.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derbytools</artifactId>
+            <version>10.9.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <version>1.6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+            <version>1.1</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java b/modules/registry/registry-tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java
new file mode 100644
index 0000000..487af1c
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java
@@ -0,0 +1,375 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.registry.tool;
+
+import org.apache.commons.cli.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.*;
+import java.net.URI;
+import java.sql.*;
+import java.text.DecimalFormat;
+import java.util.*;
+import java.util.Date;
+
+public class DBMigrator {
+    private static final Logger logger = LoggerFactory.getLogger(DBMigrator.class);
+    private static final String delimiter = ";";
+    private static final String MIGRATE_SQL_DERBY = "migrate_derby.sql";
+    private static final String MIGRATE_SQL_MYSQL = "migrate_mysql.sql";
+    private static final String REGISTRY_VERSION = "registry.version";
+    private static final String AIRAVATA_VERSION = "0.5";
+    private static String currentAiravataVersion;
+    private static String relativePath;
+    private static String SELECT_QUERY;
+    private static String INSERT_QUERY;
+    private static String UPDATE_QUERY;
+    private static String jdbcURL;
+    private static String jdbcUser;
+    private static String jdbcPwd;
+
+    public static void main(String[] args) {
+        parseArguments(args);
+        generateConfigTableQueries();
+        updateDB(jdbcURL, jdbcUser, jdbcPwd);
+    }
+
+    public static void generateConfigTableQueries(){
+        SELECT_QUERY = "SELECT * FROM CONFIGURATION WHERE config_key='" + REGISTRY_VERSION + "' and category_id='SYSTEM'";
+        INSERT_QUERY = "INSERT INTO CONFIGURATION (config_key, config_val, expire_date, category_id) VALUES('" +
+                REGISTRY_VERSION + "', '" + getIncrementedVersion(currentAiravataVersion) + "', '" + getCurrentDate() +
+                "','SYSTEM')";
+        UPDATE_QUERY = "UPDATE CONFIGURATION SET config_val='" + getIncrementedVersion(currentAiravataVersion) + "', expire_date='" + getCurrentDate() +
+                        "' WHERE config_key='" + REGISTRY_VERSION + "' and category_id='SYSTEM'";
+    }
+
+    //we assume given database is up and running
+    public static void updateDB (String jdbcUrl, String jdbcUser, String jdbcPwd){
+        relativePath = "db-scripts/" + getIncrementedVersion(currentAiravataVersion) + "/";
+        InputStream sqlStream = null;
+        Scanner in = new Scanner(System.in);
+        if (jdbcUrl == null || jdbcUrl.equals("")){
+            System.out.println("Enter JDBC URL : ");
+            jdbcUrl = in.next();
+        }
+        if (jdbcUser == null || jdbcUser.equals("")){
+            System.out.println("Enter JDBC Username : ");
+            jdbcUser = in.next();
+        }
+        if (jdbcPwd == null || jdbcPwd.equals("")){
+            System.out.println("Enter JDBC password : ");
+            jdbcPwd = in.next();
+        }
+
+        String dbType = getDBType(jdbcUrl);
+        String jdbcDriver = null;
+
+        Connection connection;
+        try {
+            File file = null;
+            if (dbType.contains("derby")){
+                jdbcDriver = "org.apache.derby.jdbc.ClientDriver";
+                sqlStream = DBMigrator.class.getClassLoader().getResourceAsStream(relativePath + MIGRATE_SQL_DERBY);
+            } else if (dbType.contains("mysql")){
+                jdbcDriver = "com.mysql.jdbc.Driver";
+                sqlStream = DBMigrator.class.getClassLoader().getResourceAsStream(relativePath + MIGRATE_SQL_MYSQL);
+            }
+            Class.forName(jdbcDriver).newInstance();
+            connection = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPwd);
+            if (canUpdated(connection)){
+                executeSQLScript(connection, sqlStream);
+                //update configuration table with airavata version
+                updateConfigTable(connection);
+            }
+        } catch (ClassNotFoundException e) {
+           logger.error("Unable to find SQL scripts..." , e);
+        } catch (InstantiationException e) {
+            logger.error("Error while updating the database..." , e);
+        } catch (IllegalAccessException e) {
+            logger.error("Error while updating the database..." , e);
+        } catch (SQLException e) {
+            logger.error("Error while updating the database..." , e);
+        } catch (Exception e) {
+            logger.error("Error while updating the database..." , e);
+        }
+    }
+
+    private static boolean canUpdated (Connection conn){
+        if (!currentAiravataVersion.equals(AIRAVATA_VERSION)){
+            String config = executeSelectQuery(conn);
+            if (config != null){
+                if (config.equals(getIncrementedVersion(currentAiravataVersion))) {
+                    return false;
+                } else {
+                    return true;
+                }
+            }
+        } else if (currentAiravataVersion.equals(AIRAVATA_VERSION)){
+            return true;
+        }
+        return false;
+    }
+
+    private static void updateConfigTable (Connection connection){
+        // if existing need to update, otherwise insert
+        if (executeSelectQuery(connection) != null){
+            executeQuery(connection, UPDATE_QUERY);
+        } else {
+            executeQuery(connection, INSERT_QUERY);
+        }
+    }
+
+    private static Timestamp getCurrentDate (){
+        Calendar cal = Calendar.getInstance();
+        Date date = cal.getTime();
+        Timestamp d = new Timestamp(date.getTime());
+        return d;
+    }
+
+    private static String getIncrementedVersion (String currentVersion){
+
+        DecimalFormat decimalFormat = new DecimalFormat("#,##0.0");
+        Double currentVer = Double.parseDouble(currentVersion);
+        double v = currentVer + .1;
+        String formattedVal = decimalFormat.format(v);
+        return formattedVal;
+    }
+
+    private static String executeSelectQuery (Connection conn){
+        try {
+            Statement statement = conn.createStatement();
+            ResultSet rs = statement.executeQuery(SELECT_QUERY);
+            if (rs != null){
+                while (rs.next()) {
+                    currentAiravataVersion = rs.getString(2);
+                    return currentAiravataVersion;
+                }
+            }
+        } catch (SQLException e) {
+            logger.error(e.getMessage() , e);
+        }
+        return null;
+    }
+
+    private static void executeQuery (Connection conn, String query){
+        try {
+            Statement statement = conn.createStatement();
+            statement.execute(query) ;
+        } catch (SQLException e) {
+            logger.error(e.getMessage() , e);
+        }
+    }
+
+    private static void executeSQLScript(Connection conn, InputStream inputStream) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+        try{
+            reader = new BufferedReader(new InputStreamReader(inputStream));
+            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))) {
+                    String sqlString = sql.substring(0, sql.length() - delimiter.length());
+                    executeSQL(sqlString, conn);
+                    sql.replace(0, sql.length(), "");
+                }
+            }
+            System.out.println(sql.toString());
+            // Catch any statements not followed by ;
+            if (sql.length() > 0) {
+                executeSQL(sql.toString(), conn);
+            }
+        }catch (IOException e){
+            logger.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();
+            }
+
+        }
+    }
+
+    private 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 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;
+    }
+
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        if ("".equals(sql.trim())) {
+            return;
+        }
+        Statement statement = null;
+        try {
+            logger.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);
+
+            logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                logger.warn(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                logger.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) {
+                    logger.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    public static void parseArguments(String[] args){
+        try{
+            Options options = new Options();
+            options.addOption("url", true , "JDBC URL");
+            options.addOption("user", true, "JDBC Username");
+            options.addOption("pwd", true, "JDBC Password");
+            options.addOption("v", true, "Airavata Current Version");
+            CommandLineParser parser = new PosixParser();
+            CommandLine cmd = parser.parse( options, args);
+            jdbcURL = cmd.getOptionValue("url");
+            if (jdbcURL == null){
+                logger.info("You should enter JDBC URL and JDBC Credentials as parameters...");
+            }
+            jdbcUser = cmd.getOptionValue("user");
+            if (jdbcUser ==  null){
+                logger.info("You should enter JDBC URL and JDBC Credentials as parameters...");
+            }
+            jdbcPwd = cmd.getOptionValue("pwd");
+            currentAiravataVersion = cmd.getOptionValue("v");
+            if (currentAiravataVersion == null){
+                logger.info("You should enter current Airavata version you are using...");
+            }
+        } catch (ParseException e) {
+            logger.error("Error while reading command line parameters" , e);
+        }
+    }
+
+    protected static InputStream readFile(File file) {
+        StringBuilder fileContentsBuilder = new StringBuilder();
+        BufferedReader bufferedReader = null;
+        try {
+            char[] buffer = new char[32767];
+            bufferedReader = new BufferedReader(new FileReader(file));
+            int read = 0;
+
+            do {
+                read = bufferedReader.read(buffer);
+                if (read > 0) {
+                    fileContentsBuilder.append(buffer, 0, read);
+                }
+            } while (read > 0);
+        } catch (Exception e) {
+            logger.error("Failed to read file " + file.getPath(), e);
+        } finally {
+            if (bufferedReader != null) {
+                try {
+                    bufferedReader.close();
+                } catch (IOException e) {
+                    logger.error("Unable to close BufferedReader for " + file.getPath(), e);
+                }
+            }
+        }
+        System.out.println(fileContentsBuilder.toString());
+        InputStream is = new ByteArrayInputStream(fileContentsBuilder.toString().getBytes());
+
+        return is;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/resources/db-migrate.sh
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/resources/db-migrate.sh b/modules/registry/registry-tools/registry-tool/src/main/resources/db-migrate.sh
new file mode 100755
index 0000000..c390837
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/resources/db-migrate.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# 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.
+
+. `dirname $0`/setenv.sh
+cd $AIRAVATA_HOME/bin
+
+# update classpath
+REG_MIGRATE_CLASSPATH="$AIRAVATA_HOME/lib"
+for f in $AIRAVATA_HOME/lib/*.jar
+do
+  REG_MIGRATE_CLASSPATH=$REG_MIGRATE_CLASSPATH:$f
+done
+
+$JAVA_HOME/bin/java -server -Xms128M -Xmx128M \
+   $XDEBUG \
+   $TEMP_PROPS \
+   -Djava.endorsed.dirs=$AIRAVATA_HOME/lib/endorsed \
+   -classpath $REG_MIGRATE_CLASSPATH \
+   -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5000,suspend=n \
+   org.apache.airavata.registry.tool.DBMigrator $*

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql
new file mode 100644
index 0000000..1e6a605
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+ALTER TABLE Configuration ADD category_id varchar(255) NOT NULL DEFAULT 'SYSTEM';
+
+ALTER TABLE Configuration DROP PRIMARY KEY;
+
+ALTER TABLE Configuration ADD PRIMARY KEY(config_key, config_val, category_id);
+
+ALTER TABLE Node_Data
+ADD execution_index int NOT NULL DEFAULT 0;
+
+ALTER TABLE Node_Data DROP PRIMARY KEY;
+
+ALTER TABLE Node_Data ADD PRIMARY KEY(workflow_instanceID, node_id, execution_index);
+
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql
new file mode 100644
index 0000000..be3d66e
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql
@@ -0,0 +1,32 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+ALTER TABLE Configuration
+ADD category_id varchar(255);
+
+UPDATE Configuration SET category_id="SYSTEM" ;
+
+ALTER TABLE Configuration DROP PRIMARY KEY, ADD PRIMARY KEY(config_key, config_val, category_id);
+
+ALTER TABLE Node_Data
+ADD execution_index int NOT NULL;
+
+ALTER TABLE Node_Data DROP PRIMARY KEY, ADD PRIMARY KEY(workflow_instanceID, node_id, execution_index);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql
new file mode 100644
index 0000000..0528e10
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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 community_user
+(
+        GATEWAY_NAME VARCHAR(256) NOT NULL,
+        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+        TOKEN_ID VARCHAR(256) NOT NULL,
+        COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
+);
+
+
+CREATE TABLE credentials
+(
+        GATEWAY_ID VARCHAR(256) NOT NULL,
+        TOKEN_ID VARCHAR(256) NOT NULL,
+        CREDENTIAL BLOB NOT NULL,
+        PORTAL_USER_ID VARCHAR(256) NOT NULL,
+        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql
new file mode 100644
index 0000000..6b47ed5
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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 community_user
+(
+  GATEWAY_NAME VARCHAR(256) NOT NULL,
+  COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+  TOKEN_ID VARCHAR(256) NOT NULL,
+  COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+  PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
+);
+
+
+CREATE TABLE credentials
+(
+  GATEWAY_ID VARCHAR(256) NOT NULL,
+  TOKEN_ID VARCHAR(256) NOT NULL,
+  CREDENTIAL TEXT NOT NULL,
+  PORTAL_USER_ID VARCHAR(256) NOT NULL,
+  TIME_PERSISTED TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+  PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql
new file mode 100644
index 0000000..95b2ccf
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql
@@ -0,0 +1,72 @@
+/*
+ *
+ * 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 Execution_Error
+(
+       error_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       gfacJobID varchar(255),
+       source_type varchar(255),
+       error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+       error_msg CLOB,
+       error_des CLOB,
+       error_code varchar(255),
+       error_reporter varchar(255),
+       error_location varchar(255),
+       action_taken varchar(255),
+       error_reference INTEGER,
+       PRIMARY KEY(error_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE,
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+create table GFac_Job_Data
+(
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       application_descriptor_ID varchar(255),
+       host_descriptor_ID varchar(255),
+       service_descriptor_ID varchar(255),
+       job_data CLOB,
+       local_Job_ID varchar(255),
+       submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       status varchar(255),
+       metadata CLOB,
+       PRIMARY KEY(local_Job_ID),
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID)
+);
+
+create table GFac_Job_Status
+(
+       local_Job_ID varchar(255),
+       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       status varchar(255),
+       FOREIGN KEY (local_Job_ID) REFERENCES GFac_Job_Data(local_Job_ID)
+);
+
+INSERT INTO GFac_Job_Data(experiment_ID, workflow_instanceID, node_id, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID,
+job_data, local_Job_ID, submitted_time, statusUpdateTime, status, metadata) SELECT null, workflow_instanceID, node_id, null, invoked_host,
+null, null, local_Job_ID, null, null, 'UNKNOWN', null FROM Gram_Data;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql
new file mode 100644
index 0000000..40ca48c
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql
@@ -0,0 +1,72 @@
+/*
+ *
+ * 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 Execution_Error
+(
+       error_id INT NOT NULL AUTO_INCREMENT,
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       gfacJobID varchar(255),
+       source_type varchar(255),
+       error_date TIMESTAMP DEFAULT now() on update now(),
+       error_msg LONGTEXT,
+       error_des LONGTEXT,
+       error_code varchar(255),
+       error_reporter varchar(255),
+       error_location varchar(255),
+       action_taken varchar(255),
+       error_reference INTEGER,
+       PRIMARY KEY(error_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE,
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+create table GFac_Job_Data
+(
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       application_descriptor_ID varchar(255),
+       host_descriptor_ID varchar(255),
+       service_descriptor_ID varchar(255),
+       job_data LONGTEXT,
+       local_Job_ID varchar(255),
+       submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       status varchar(255),
+       metadata LONGTEXT,
+       PRIMARY KEY(local_Job_ID)
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID)
+);
+
+create table GFac_Job_Status
+(
+       local_Job_ID varchar(255),
+       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+       status varchar(255),
+       FOREIGN KEY (local_Job_ID) REFERENCES GFac_Job_Data(local_Job_ID)
+);
+
+INSERT INTO GFac_Job_Data(experiment_ID, workflow_instanceID, node_id, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID,
+job_data, local_Job_ID, submitted_time, status_update_time, status, metadata) SELECT null, workflow_instanceID, node_id, null, invoked_host,
+null, null, local_Job_ID, null, null, 'UNKNOWN', null FROM Gram_Data;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/README
----------------------------------------------------------------------
diff --git a/tools/registry-tool/README b/tools/registry-tool/README
deleted file mode 100644
index 40a8e65..0000000
--- a/tools/registry-tool/README
+++ /dev/null
@@ -1,9 +0,0 @@
-0.7 => 0.8
-==============
-
-1. Build registry-tools
-2. Copy registry-tool-0.8-SNAPSHOT.jar and commons-cli-1.1.jar (you will find this in your maven repository) to <AIRAVATA_HOME>/lib
-3. Copy db-migrate.sh file to <AIRAVATA_HOME>/bin
-4. Make sure previous version of airavata database is up and running
-5. Run db-migrate.sh script file
-        ./db-migrate.sh -url jdbc:mysql://localhost:3306/experiment_catalog -user airavata -pwd airavata -v 0.7
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/pom.xml
----------------------------------------------------------------------
diff --git a/tools/registry-tool/pom.xml b/tools/registry-tool/pom.xml
deleted file mode 100644
index c463167..0000000
--- a/tools/registry-tool/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<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/maven-v4_0_0.xsd">
-    <parent>
-        <groupId>org.apache.airavata</groupId>
-        <artifactId>airavata-tools-parent</artifactId>
-        <version>0.16-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>registry-tool</artifactId>
-    <packaging>jar</packaging>
-    <name>registry-tool</name>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <version>10.9.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derbyclient</artifactId>
-            <version>10.9.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derbynet</artifactId>
-            <version>10.9.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derbytools</artifactId>
-            <version>10.9.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <version>1.6.1</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-cli</groupId>
-            <artifactId>commons-cli</artifactId>
-            <version>1.1</version>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java b/tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java
deleted file mode 100644
index 487af1c..0000000
--- a/tools/registry-tool/src/main/java/org/apache/airavata/registry/tool/DBMigrator.java
+++ /dev/null
@@ -1,375 +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.registry.tool;
-
-import org.apache.commons.cli.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.*;
-import java.net.URI;
-import java.sql.*;
-import java.text.DecimalFormat;
-import java.util.*;
-import java.util.Date;
-
-public class DBMigrator {
-    private static final Logger logger = LoggerFactory.getLogger(DBMigrator.class);
-    private static final String delimiter = ";";
-    private static final String MIGRATE_SQL_DERBY = "migrate_derby.sql";
-    private static final String MIGRATE_SQL_MYSQL = "migrate_mysql.sql";
-    private static final String REGISTRY_VERSION = "registry.version";
-    private static final String AIRAVATA_VERSION = "0.5";
-    private static String currentAiravataVersion;
-    private static String relativePath;
-    private static String SELECT_QUERY;
-    private static String INSERT_QUERY;
-    private static String UPDATE_QUERY;
-    private static String jdbcURL;
-    private static String jdbcUser;
-    private static String jdbcPwd;
-
-    public static void main(String[] args) {
-        parseArguments(args);
-        generateConfigTableQueries();
-        updateDB(jdbcURL, jdbcUser, jdbcPwd);
-    }
-
-    public static void generateConfigTableQueries(){
-        SELECT_QUERY = "SELECT * FROM CONFIGURATION WHERE config_key='" + REGISTRY_VERSION + "' and category_id='SYSTEM'";
-        INSERT_QUERY = "INSERT INTO CONFIGURATION (config_key, config_val, expire_date, category_id) VALUES('" +
-                REGISTRY_VERSION + "', '" + getIncrementedVersion(currentAiravataVersion) + "', '" + getCurrentDate() +
-                "','SYSTEM')";
-        UPDATE_QUERY = "UPDATE CONFIGURATION SET config_val='" + getIncrementedVersion(currentAiravataVersion) + "', expire_date='" + getCurrentDate() +
-                        "' WHERE config_key='" + REGISTRY_VERSION + "' and category_id='SYSTEM'";
-    }
-
-    //we assume given database is up and running
-    public static void updateDB (String jdbcUrl, String jdbcUser, String jdbcPwd){
-        relativePath = "db-scripts/" + getIncrementedVersion(currentAiravataVersion) + "/";
-        InputStream sqlStream = null;
-        Scanner in = new Scanner(System.in);
-        if (jdbcUrl == null || jdbcUrl.equals("")){
-            System.out.println("Enter JDBC URL : ");
-            jdbcUrl = in.next();
-        }
-        if (jdbcUser == null || jdbcUser.equals("")){
-            System.out.println("Enter JDBC Username : ");
-            jdbcUser = in.next();
-        }
-        if (jdbcPwd == null || jdbcPwd.equals("")){
-            System.out.println("Enter JDBC password : ");
-            jdbcPwd = in.next();
-        }
-
-        String dbType = getDBType(jdbcUrl);
-        String jdbcDriver = null;
-
-        Connection connection;
-        try {
-            File file = null;
-            if (dbType.contains("derby")){
-                jdbcDriver = "org.apache.derby.jdbc.ClientDriver";
-                sqlStream = DBMigrator.class.getClassLoader().getResourceAsStream(relativePath + MIGRATE_SQL_DERBY);
-            } else if (dbType.contains("mysql")){
-                jdbcDriver = "com.mysql.jdbc.Driver";
-                sqlStream = DBMigrator.class.getClassLoader().getResourceAsStream(relativePath + MIGRATE_SQL_MYSQL);
-            }
-            Class.forName(jdbcDriver).newInstance();
-            connection = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPwd);
-            if (canUpdated(connection)){
-                executeSQLScript(connection, sqlStream);
-                //update configuration table with airavata version
-                updateConfigTable(connection);
-            }
-        } catch (ClassNotFoundException e) {
-           logger.error("Unable to find SQL scripts..." , e);
-        } catch (InstantiationException e) {
-            logger.error("Error while updating the database..." , e);
-        } catch (IllegalAccessException e) {
-            logger.error("Error while updating the database..." , e);
-        } catch (SQLException e) {
-            logger.error("Error while updating the database..." , e);
-        } catch (Exception e) {
-            logger.error("Error while updating the database..." , e);
-        }
-    }
-
-    private static boolean canUpdated (Connection conn){
-        if (!currentAiravataVersion.equals(AIRAVATA_VERSION)){
-            String config = executeSelectQuery(conn);
-            if (config != null){
-                if (config.equals(getIncrementedVersion(currentAiravataVersion))) {
-                    return false;
-                } else {
-                    return true;
-                }
-            }
-        } else if (currentAiravataVersion.equals(AIRAVATA_VERSION)){
-            return true;
-        }
-        return false;
-    }
-
-    private static void updateConfigTable (Connection connection){
-        // if existing need to update, otherwise insert
-        if (executeSelectQuery(connection) != null){
-            executeQuery(connection, UPDATE_QUERY);
-        } else {
-            executeQuery(connection, INSERT_QUERY);
-        }
-    }
-
-    private static Timestamp getCurrentDate (){
-        Calendar cal = Calendar.getInstance();
-        Date date = cal.getTime();
-        Timestamp d = new Timestamp(date.getTime());
-        return d;
-    }
-
-    private static String getIncrementedVersion (String currentVersion){
-
-        DecimalFormat decimalFormat = new DecimalFormat("#,##0.0");
-        Double currentVer = Double.parseDouble(currentVersion);
-        double v = currentVer + .1;
-        String formattedVal = decimalFormat.format(v);
-        return formattedVal;
-    }
-
-    private static String executeSelectQuery (Connection conn){
-        try {
-            Statement statement = conn.createStatement();
-            ResultSet rs = statement.executeQuery(SELECT_QUERY);
-            if (rs != null){
-                while (rs.next()) {
-                    currentAiravataVersion = rs.getString(2);
-                    return currentAiravataVersion;
-                }
-            }
-        } catch (SQLException e) {
-            logger.error(e.getMessage() , e);
-        }
-        return null;
-    }
-
-    private static void executeQuery (Connection conn, String query){
-        try {
-            Statement statement = conn.createStatement();
-            statement.execute(query) ;
-        } catch (SQLException e) {
-            logger.error(e.getMessage() , e);
-        }
-    }
-
-    private static void executeSQLScript(Connection conn, InputStream inputStream) throws Exception {
-        StringBuffer sql = new StringBuffer();
-        BufferedReader reader = null;
-        try{
-            reader = new BufferedReader(new InputStreamReader(inputStream));
-            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))) {
-                    String sqlString = sql.substring(0, sql.length() - delimiter.length());
-                    executeSQL(sqlString, conn);
-                    sql.replace(0, sql.length(), "");
-                }
-            }
-            System.out.println(sql.toString());
-            // Catch any statements not followed by ;
-            if (sql.length() > 0) {
-                executeSQL(sql.toString(), conn);
-            }
-        }catch (IOException e){
-            logger.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();
-            }
-
-        }
-    }
-
-    private 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 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;
-    }
-
-    private static void executeSQL(String sql, Connection conn) throws Exception {
-        if ("".equals(sql.trim())) {
-            return;
-        }
-        Statement statement = null;
-        try {
-            logger.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);
-
-            logger.debug(sql + " : " + updateCountTotal + " rows affected");
-
-            SQLWarning warning = conn.getWarnings();
-            while (warning != null) {
-                logger.warn(warning + " sql warning");
-                warning = warning.getNextWarning();
-            }
-            conn.clearWarnings();
-        } catch (SQLException e) {
-            if (e.getSQLState().equals("X0Y32")) {
-                logger.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) {
-                    logger.error("Error occurred while closing result set.", e);
-                }
-            }
-        }
-    }
-
-    public static void parseArguments(String[] args){
-        try{
-            Options options = new Options();
-            options.addOption("url", true , "JDBC URL");
-            options.addOption("user", true, "JDBC Username");
-            options.addOption("pwd", true, "JDBC Password");
-            options.addOption("v", true, "Airavata Current Version");
-            CommandLineParser parser = new PosixParser();
-            CommandLine cmd = parser.parse( options, args);
-            jdbcURL = cmd.getOptionValue("url");
-            if (jdbcURL == null){
-                logger.info("You should enter JDBC URL and JDBC Credentials as parameters...");
-            }
-            jdbcUser = cmd.getOptionValue("user");
-            if (jdbcUser ==  null){
-                logger.info("You should enter JDBC URL and JDBC Credentials as parameters...");
-            }
-            jdbcPwd = cmd.getOptionValue("pwd");
-            currentAiravataVersion = cmd.getOptionValue("v");
-            if (currentAiravataVersion == null){
-                logger.info("You should enter current Airavata version you are using...");
-            }
-        } catch (ParseException e) {
-            logger.error("Error while reading command line parameters" , e);
-        }
-    }
-
-    protected static InputStream readFile(File file) {
-        StringBuilder fileContentsBuilder = new StringBuilder();
-        BufferedReader bufferedReader = null;
-        try {
-            char[] buffer = new char[32767];
-            bufferedReader = new BufferedReader(new FileReader(file));
-            int read = 0;
-
-            do {
-                read = bufferedReader.read(buffer);
-                if (read > 0) {
-                    fileContentsBuilder.append(buffer, 0, read);
-                }
-            } while (read > 0);
-        } catch (Exception e) {
-            logger.error("Failed to read file " + file.getPath(), e);
-        } finally {
-            if (bufferedReader != null) {
-                try {
-                    bufferedReader.close();
-                } catch (IOException e) {
-                    logger.error("Unable to close BufferedReader for " + file.getPath(), e);
-                }
-            }
-        }
-        System.out.println(fileContentsBuilder.toString());
-        InputStream is = new ByteArrayInputStream(fileContentsBuilder.toString().getBytes());
-
-        return is;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/resources/db-migrate.sh
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/resources/db-migrate.sh b/tools/registry-tool/src/main/resources/db-migrate.sh
deleted file mode 100755
index c390837..0000000
--- a/tools/registry-tool/src/main/resources/db-migrate.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-. `dirname $0`/setenv.sh
-cd $AIRAVATA_HOME/bin
-
-# update classpath
-REG_MIGRATE_CLASSPATH="$AIRAVATA_HOME/lib"
-for f in $AIRAVATA_HOME/lib/*.jar
-do
-  REG_MIGRATE_CLASSPATH=$REG_MIGRATE_CLASSPATH:$f
-done
-
-$JAVA_HOME/bin/java -server -Xms128M -Xmx128M \
-   $XDEBUG \
-   $TEMP_PROPS \
-   -Djava.endorsed.dirs=$AIRAVATA_HOME/lib/endorsed \
-   -classpath $REG_MIGRATE_CLASSPATH \
-   -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5000,suspend=n \
-   org.apache.airavata.registry.tool.DBMigrator $*

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql b/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql
deleted file mode 100644
index 1e6a605..0000000
--- a/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_derby.sql
+++ /dev/null
@@ -1,35 +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.
- *
- */
-
-ALTER TABLE Configuration ADD category_id varchar(255) NOT NULL DEFAULT 'SYSTEM';
-
-ALTER TABLE Configuration DROP PRIMARY KEY;
-
-ALTER TABLE Configuration ADD PRIMARY KEY(config_key, config_val, category_id);
-
-ALTER TABLE Node_Data
-ADD execution_index int NOT NULL DEFAULT 0;
-
-ALTER TABLE Node_Data DROP PRIMARY KEY;
-
-ALTER TABLE Node_Data ADD PRIMARY KEY(workflow_instanceID, node_id, execution_index);
-
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql b/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql
deleted file mode 100644
index be3d66e..0000000
--- a/tools/registry-tool/src/main/resources/db-scripts/0.6/migrate_mysql.sql
+++ /dev/null
@@ -1,32 +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.
- *
- */
-
-ALTER TABLE Configuration
-ADD category_id varchar(255);
-
-UPDATE Configuration SET category_id="SYSTEM" ;
-
-ALTER TABLE Configuration DROP PRIMARY KEY, ADD PRIMARY KEY(config_key, config_val, category_id);
-
-ALTER TABLE Node_Data
-ADD execution_index int NOT NULL;
-
-ALTER TABLE Node_Data DROP PRIMARY KEY, ADD PRIMARY KEY(workflow_instanceID, node_id, execution_index);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql b/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql
deleted file mode 100644
index 0528e10..0000000
--- a/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_derby.sql
+++ /dev/null
@@ -1,40 +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 community_user
-(
-        GATEWAY_NAME VARCHAR(256) NOT NULL,
-        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
-        TOKEN_ID VARCHAR(256) NOT NULL,
-        COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
-        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-
-CREATE TABLE credentials
-(
-        GATEWAY_ID VARCHAR(256) NOT NULL,
-        TOKEN_ID VARCHAR(256) NOT NULL,
-        CREDENTIAL BLOB NOT NULL,
-        PORTAL_USER_ID VARCHAR(256) NOT NULL,
-        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql b/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql
deleted file mode 100644
index 6b47ed5..0000000
--- a/tools/registry-tool/src/main/resources/db-scripts/0.7/migrate_mysql.sql
+++ /dev/null
@@ -1,40 +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 community_user
-(
-  GATEWAY_NAME VARCHAR(256) NOT NULL,
-  COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
-  TOKEN_ID VARCHAR(256) NOT NULL,
-  COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
-  PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-
-CREATE TABLE credentials
-(
-  GATEWAY_ID VARCHAR(256) NOT NULL,
-  TOKEN_ID VARCHAR(256) NOT NULL,
-  CREDENTIAL TEXT NOT NULL,
-  PORTAL_USER_ID VARCHAR(256) NOT NULL,
-  TIME_PERSISTED TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-  PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql b/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql
deleted file mode 100644
index 95b2ccf..0000000
--- a/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_derby.sql
+++ /dev/null
@@ -1,72 +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 Execution_Error
-(
-       error_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
-       experiment_ID varchar(255),
-       workflow_instanceID varchar(255),
-       node_id varchar(255),
-       gfacJobID varchar(255),
-       source_type varchar(255),
-       error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-       error_msg CLOB,
-       error_des CLOB,
-       error_code varchar(255),
-       error_reporter varchar(255),
-       error_location varchar(255),
-       action_taken varchar(255),
-       error_reference INTEGER,
-       PRIMARY KEY(error_id),
-       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE,
-       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
-);
-
-create table GFac_Job_Data
-(
-       experiment_ID varchar(255),
-       workflow_instanceID varchar(255),
-       node_id varchar(255),
-       application_descriptor_ID varchar(255),
-       host_descriptor_ID varchar(255),
-       service_descriptor_ID varchar(255),
-       job_data CLOB,
-       local_Job_ID varchar(255),
-       submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status varchar(255),
-       metadata CLOB,
-       PRIMARY KEY(local_Job_ID),
-       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),
-       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID)
-);
-
-create table GFac_Job_Status
-(
-       local_Job_ID varchar(255),
-       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status varchar(255),
-       FOREIGN KEY (local_Job_ID) REFERENCES GFac_Job_Data(local_Job_ID)
-);
-
-INSERT INTO GFac_Job_Data(experiment_ID, workflow_instanceID, node_id, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID,
-job_data, local_Job_ID, submitted_time, statusUpdateTime, status, metadata) SELECT null, workflow_instanceID, node_id, null, invoked_host,
-null, null, local_Job_ID, null, null, 'UNKNOWN', null FROM Gram_Data;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql
----------------------------------------------------------------------
diff --git a/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql b/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql
deleted file mode 100644
index 40ca48c..0000000
--- a/tools/registry-tool/src/main/resources/db-scripts/0.8/migrate_mysql.sql
+++ /dev/null
@@ -1,72 +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 Execution_Error
-(
-       error_id INT NOT NULL AUTO_INCREMENT,
-       experiment_ID varchar(255),
-       workflow_instanceID varchar(255),
-       node_id varchar(255),
-       gfacJobID varchar(255),
-       source_type varchar(255),
-       error_date TIMESTAMP DEFAULT now() on update now(),
-       error_msg LONGTEXT,
-       error_des LONGTEXT,
-       error_code varchar(255),
-       error_reporter varchar(255),
-       error_location varchar(255),
-       action_taken varchar(255),
-       error_reference INTEGER,
-       PRIMARY KEY(error_id),
-       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE,
-       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
-);
-
-create table GFac_Job_Data
-(
-       experiment_ID varchar(255),
-       workflow_instanceID varchar(255),
-       node_id varchar(255),
-       application_descriptor_ID varchar(255),
-       host_descriptor_ID varchar(255),
-       service_descriptor_ID varchar(255),
-       job_data LONGTEXT,
-       local_Job_ID varchar(255),
-       submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status varchar(255),
-       metadata LONGTEXT,
-       PRIMARY KEY(local_Job_ID)
-       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),
-       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID)
-);
-
-create table GFac_Job_Status
-(
-       local_Job_ID varchar(255),
-       status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status varchar(255),
-       FOREIGN KEY (local_Job_ID) REFERENCES GFac_Job_Data(local_Job_ID)
-);
-
-INSERT INTO GFac_Job_Data(experiment_ID, workflow_instanceID, node_id, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID,
-job_data, local_Job_ID, submitted_time, status_update_time, status, metadata) SELECT null, workflow_instanceID, node_id, null, invoked_host,
-null, null, local_Job_ID, null, null, 'UNKNOWN', null FROM Gram_Data;
\ No newline at end of file


[4/4] airavata git commit: add registry-tools

Posted by ch...@apache.org.
add registry-tools


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6c1eebe3
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6c1eebe3
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6c1eebe3

Branch: refs/heads/master
Commit: 6c1eebe31cdf0e935604503a3c001512ad9bb0d9
Parents: c75d406
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Tue Jun 9 12:44:59 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Tue Jun 9 12:44:59 2015 -0400

----------------------------------------------------------------------
 modules/registry/jpa-gen/pom.xml                |  42 --
 .../computeresource/BatchQueueGenerator.java    |  88 ----
 .../ComputeResourceDescriptionGenerator.java    |  82 ---
 .../DataMovementInterfaceGenerator.java         |  85 ---
 .../computeresource/FileSystemsGenerator.java   |  84 ---
 .../GridFTPDataMovementGenerator.java           |  82 ---
 .../GridFTPEndpointsGenerator.java              |  83 ---
 .../JobManagerCommandGenerator.java             |  84 ---
 .../JobSubmissionInterfaceGenerator.java        |  85 ---
 .../LocalDataMovementGenerator.java             |  80 ---
 .../LocalSubmissionGenerator.java               |  82 ---
 .../computeresource/ModuleCMDGenerator.java     |  82 ---
 .../ResourceJobManagerGenerator.java            |  83 ---
 .../SCPDataMovementGenerator.java               |  83 ---
 .../SSHJobSubmissionGenerator.java              |  85 ---
 .../main/java/generators/AbstractGenerator.java | 119 -----
 .../main/java/generators/JPAClassGenerator.java | 224 --------
 .../generators/JPAResourceClassGenerator.java   | 513 -------------------
 .../src/main/java/generators/SQLGenerator.java  |  77 ---
 .../src/main/java/model/JPAClassField.java      |  47 --
 .../src/main/java/model/JPAClassModel.java      |  34 --
 .../src/main/java/model/JPAPKClassModel.java    |  30 --
 .../main/java/model/JPAResourceClassModel.java  |  28 -
 .../jpa-gen/src/main/java/model/SQLData.java    |  79 ---
 .../jpa-gen/src/main/java/test/Test.java        |  81 ---
 modules/registry/pom.xml                        |   2 +-
 .../app/catalog/util/AppCatalogJPAUtils.java    |   5 +-
 modules/registry/registry-tools/jpa-gen/pom.xml |  42 ++
 .../computeresource/BatchQueueGenerator.java    |  88 ++++
 .../ComputeResourceDescriptionGenerator.java    |  82 +++
 .../DataMovementInterfaceGenerator.java         |  85 +++
 .../computeresource/FileSystemsGenerator.java   |  84 +++
 .../GridFTPDataMovementGenerator.java           |  82 +++
 .../GridFTPEndpointsGenerator.java              |  83 +++
 .../JobManagerCommandGenerator.java             |  84 +++
 .../JobSubmissionInterfaceGenerator.java        |  85 +++
 .../LocalDataMovementGenerator.java             |  80 +++
 .../LocalSubmissionGenerator.java               |  82 +++
 .../computeresource/ModuleCMDGenerator.java     |  82 +++
 .../ResourceJobManagerGenerator.java            |  83 +++
 .../SCPDataMovementGenerator.java               |  83 +++
 .../SSHJobSubmissionGenerator.java              |  85 +++
 .../main/java/generators/AbstractGenerator.java | 119 +++++
 .../main/java/generators/JPAClassGenerator.java | 224 ++++++++
 .../generators/JPAResourceClassGenerator.java   | 513 +++++++++++++++++++
 .../src/main/java/generators/SQLGenerator.java  |  77 +++
 .../src/main/java/model/JPAClassField.java      |  47 ++
 .../src/main/java/model/JPAClassModel.java      |  34 ++
 .../src/main/java/model/JPAPKClassModel.java    |  30 ++
 .../main/java/model/JPAResourceClassModel.java  |  28 +
 .../jpa-gen/src/main/java/model/SQLData.java    |  79 +++
 .../jpa-gen/src/main/java/test/Test.java        |  81 +++
 .../registry-tools/registry-tool/README         |   9 +
 .../registry-tools/registry-tool/pom.xml        |  56 ++
 .../airavata/registry/tool/DBMigrator.java      | 375 ++++++++++++++
 .../src/main/resources/db-migrate.sh            |  36 ++
 .../resources/db-scripts/0.6/migrate_derby.sql  |  35 ++
 .../resources/db-scripts/0.6/migrate_mysql.sql  |  32 ++
 .../resources/db-scripts/0.7/migrate_derby.sql  |  40 ++
 .../resources/db-scripts/0.7/migrate_mysql.sql  |  40 ++
 .../resources/db-scripts/0.8/migrate_derby.sql  |  72 +++
 .../resources/db-scripts/0.8/migrate_mysql.sql  |  72 +++
 tools/registry-tool/README                      |   9 -
 tools/registry-tool/pom.xml                     |  56 --
 .../airavata/registry/tool/DBMigrator.java      | 375 --------------
 .../src/main/resources/db-migrate.sh            |  36 --
 .../resources/db-scripts/0.6/migrate_derby.sql  |  35 --
 .../resources/db-scripts/0.6/migrate_mysql.sql  |  32 --
 .../resources/db-scripts/0.7/migrate_derby.sql  |  40 --
 .../resources/db-scripts/0.7/migrate_mysql.sql  |  40 --
 .../resources/db-scripts/0.8/migrate_derby.sql  |  72 ---
 .../resources/db-scripts/0.8/migrate_mysql.sql  |  72 ---
 72 files changed, 3213 insertions(+), 3212 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/pom.xml b/modules/registry/jpa-gen/pom.xml
deleted file mode 100644
index ee9e0ea..0000000
--- a/modules/registry/jpa-gen/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<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/maven-v4_0_0.xsd">
-
-    <parent>
-        <groupId>org.apache.airavata</groupId>
-        <artifactId>registry</artifactId>
-        <version>0.13-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>jpa-gen</artifactId>
-    <packaging>jar</packaging>
-    <name>JPA Class Data Generator</name>
-    <url>http://airavata.apache.org/</url>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java
deleted file mode 100644
index 9cc6558..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java
+++ /dev/null
@@ -1,88 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class BatchQueueGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("BATCH_QUEUE");
-		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("QUEUE_NAME", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("QUEUE_DESCRIPTION", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
-		data.getFieldData().put("MAX_RUNTIME", Arrays.asList(new String[]{"INTEGER"}));
-		data.getFieldData().put("MAX_NODES", Arrays.asList(new String[]{"INTEGER"}));
-		data.getFieldData().put("MAX_PROCESSORS", Arrays.asList(new String[]{"INTEGER"}));
-		data.getFieldData().put("MAX_JOB_IN_QUEUE", Arrays.asList(new String[]{"INTEGER"}));
-		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
-		data.getPrimaryKeys().add("QUEUE_NAME");
-		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java
deleted file mode 100644
index c61a518..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java
+++ /dev/null
@@ -1,82 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class ComputeResourceDescriptionGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("COMPUTE_RESOURCE");
-		data.getFieldData().put("RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("HOST_NAME", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("RESOURCE_DESCRIPTION", Arrays.asList(new String[]{"VARCHAR", "(255)"}));
-		data.getPrimaryKeys().add("RESOURCE_ID");
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java
deleted file mode 100644
index 21c1028..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java
+++ /dev/null
@@ -1,85 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class DataMovementInterfaceGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("DATA_MOVEMENT_INTERFACE");
-		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("DATA_MOVEMENT_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)","NOT", "NULL"}));
-		data.getFieldData().put("PRIORITY_ORDER", Arrays.asList(new String[]{"INTEGER"}));
-		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
-		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
-		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java
deleted file mode 100644
index 34f07e7..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java
+++ /dev/null
@@ -1,84 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class FileSystemsGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("COMPUTE_RESOURCE_FILE_SYSTEM");
-		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("FILE_SYSTEM", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("PATH", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
-		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
-		data.getPrimaryKeys().add("FILE_SYSTEM");
-		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java
deleted file mode 100644
index 418fadc..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java
+++ /dev/null
@@ -1,82 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class GridFTPDataMovementGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("GRIDFTP_DATA_MOVEMENT");
-		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("SECURITY_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
-		return data;
-	}
-	
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java
deleted file mode 100644
index fc4e6ec..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java
+++ /dev/null
@@ -1,83 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class GridFTPEndpointsGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("GRIDFTP_ENDPOINT");
-		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("ENDPOINT", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
-		data.getPrimaryKeys().add("ENDPOINT");
-		data.getForiegnKeys().put("DATA_MOVEMENT_INTERFACE_ID", new SQLData.ForiegnKeyData("GRIDFTP_DATA_MOVEMENT(DATA_MOVEMENT_INTERFACE_ID)","GridftpDataMovement","GridftpDataMovementResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java
deleted file mode 100644
index 45cdbb6..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java
+++ /dev/null
@@ -1,84 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class JobManagerCommandGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("JOB_MANAGER_COMMAND");
-		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("COMMAND_TYPE", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("COMMAND", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
-		data.getPrimaryKeys().add("RESOURCE_JOB_MANAGER_ID");
-		data.getPrimaryKeys().add("COMMAND_TYPE");
-		data.getForiegnKeys().put("RESOURCE_JOB_MANAGER_ID", new SQLData.ForiegnKeyData("RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)","ResourceJobManager","ResourceJobManagerResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java
deleted file mode 100644
index 16fa903..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java
+++ /dev/null
@@ -1,85 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class JobSubmissionInterfaceGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("JOB_SUBMISSION_INTERFACE");
-		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("JOB_SUBMISSION_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("JOB_SUBMISSION_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)","NOT", "NULL"}));
-		data.getFieldData().put("PRIORITY_ORDER", Arrays.asList(new String[]{"INTEGER"}));
-		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
-		data.getPrimaryKeys().add("JOB_SUBMISSION_INTERFACE_ID");
-		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java
deleted file mode 100644
index 8bfc6ac..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java
+++ /dev/null
@@ -1,80 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class LocalDataMovementGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("LOCAL_DATA_MOVEMENT");
-		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java
deleted file mode 100644
index df1d2ce..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java
+++ /dev/null
@@ -1,82 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class LocalSubmissionGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("LOCAL_SUBMISSION");
-		data.getFieldData().put("JOB_SUBMISSION_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getPrimaryKeys().add("JOB_SUBMISSION_INTERFACE_ID");
-		data.getForiegnKeys().put("RESOURCE_JOB_MANAGER_ID", new SQLData.ForiegnKeyData("RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)","ResourceJobManager","ResourceJobManagerResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
deleted file mode 100644
index 2b08708..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
+++ /dev/null
@@ -1,82 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-import java.util.Arrays;
-
-public class ModuleCMDGenerator {
-    private static SQLData createSQLData() {
-        SQLData data = new SQLData();
-        data.setTableName("MODULE_LOAD_CMD");
-        data.getFieldData().put("CMD", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-        data.getFieldData().put("APP_DEPLOYMENT_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-        data.getPrimaryKeys().add("APP_DEPLOYMENT_ID");
-        data.getPrimaryKeys().add("CMD");
-        data.getForiegnKeys().put("APP_DEPLOYMENT_ID", new SQLData.ForiegnKeyData("APPLICATION_DEPLOYMENT(DEPLOYMENT_ID)","ApplicationDeployment","AppDeploymentResource"));
-        return data;
-    }
-    public static void testSqlGen() {
-        SQLData data = createSQLData();
-        SQLGenerator sqlGenerator = new SQLGenerator();
-        System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-    }
-
-    public static void testJPAClassGen() {
-        SQLData data = createSQLData();
-        JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-        jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-        JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-        System.out.println(jpaClassGenerator.generateJPAClass(model));
-        System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-        System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-    }
-
-    public static void testJPAResourceClassGen() {
-        SQLData data = createSQLData();
-        JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-        JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-        JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-        jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-        jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-        jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-        jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-        JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-        System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-        System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-        System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-        System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-
-    }
-    public static void main(String[] args) {
-        testSqlGen();
-        testJPAClassGen();
-        testJPAResourceClassGen();
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java
deleted file mode 100644
index 3a1a8e0..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java
+++ /dev/null
@@ -1,83 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class ResourceJobManagerGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("RESOURCE_JOB_MANAGER");
-		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("RESOURCE_JOB_MANAGER_TYPE", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("PUSH_MONITORING_ENDPOINT", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
-		data.getFieldData().put("JOB_MANAGER_BIN_PATH", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
-		data.getPrimaryKeys().add("RESOURCE_JOB_MANAGER_ID");
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java
deleted file mode 100644
index 6c196d3..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java
+++ /dev/null
@@ -1,83 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class SCPDataMovementGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("SCP_DATA_MOVEMENT");
-		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("SECURITY_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("ALTERNATIVE_SCP_HOSTNAME", Arrays.asList(new String[]{"VARCHAR", "(255)"}));
-		data.getFieldData().put("SSH_PORT", Arrays.asList(new String[]{"INTEGER"}));
-		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java
deleted file mode 100644
index 50f1fd1..0000000
--- a/modules/registry/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java
+++ /dev/null
@@ -1,85 +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 appcatalog.computeresource;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-public class SSHJobSubmissionGenerator {
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("SSH_JOB_SUBMISSION");
-		data.getFieldData().put("JOB_SUBMISSION_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("SECURITY_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
-		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)","NOT", "NULL"}));
-		data.getFieldData().put("ALTERNATIVE_SSH_HOSTNAME", Arrays.asList(new String[]{"VARCHAR", "(255)"}));
-		data.getFieldData().put("SSH_PORT", Arrays.asList(new String[]{"INTEGER"}));
-		data.getPrimaryKeys().add("JOB_SUBMISSION_INTERFACE_ID");
-		data.getForiegnKeys().put("RESOURCE_JOB_MANAGER_ID", new SQLData.ForiegnKeyData("RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)","ResourceJobManager","ResourceJobManagerResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
-		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
-		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
-		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
-
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testSqlGen();
-		testJPAClassGen();
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/generators/AbstractGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/generators/AbstractGenerator.java b/modules/registry/jpa-gen/src/main/java/generators/AbstractGenerator.java
deleted file mode 100644
index b4fb643..0000000
--- a/modules/registry/jpa-gen/src/main/java/generators/AbstractGenerator.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package generators;
-
-import java.util.List;
-
-/*
- *
- * 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.
- *
- */
-
-public class AbstractGenerator {
-	private static final String TAB="\t";
-	
-	protected String removeLastChar(String s) {
-		return s.substring(0, s.length()-1);
-	}
-	
-	protected String addLines(String s, String...lines){
-		for (String line : lines) {
-			s=((s==null||s.equals(""))?"":s+"\n")+line;
-		}
-		return s;
-	}
-	
-	protected String convertToJavaTitleCaseStringConvention(String s){
-		String result="";
-		String[] split = s.split("_");
-		for (String item : split) {
-			result+=(item.toUpperCase().substring(0,1)+(item.length()>1?item.toLowerCase().substring(1):""));
-		}
-		return result;
-	}
-	
-	protected String convertToJavaVariableNameCaseStringConvention(String s){
-		String result=null;
-		String[] split = s.split("_");
-		for (String item : split) {
-			result=(result==null?item.toLowerCase():result+(item.toUpperCase().substring(0,1)+(item.length()>1?item.toLowerCase().substring(1):"")));
-		}
-		return result;
-	}
-	
-	protected String convertToJavaConstantNameCaseStringConvention(String s){
-		String result="";
-		for (int i = 0; i < s.length(); i++) {
-			String c=String.valueOf(s.charAt(i));
-			result+=((c.toUpperCase().equals(c) && !result.equals(""))?"_"+c:c.toUpperCase());
-		}
-		return result;
-	}
-	
-	protected String convertToTitleCaseString(String s){
-		String result="";
-		for (int i = 0; i < s.length(); i++) {
-			String c=String.valueOf(s.charAt(i));
-			result+=((c.toUpperCase().equals(c) && !result.equals(""))?" ":"")+c;
-		}
-		return result;
-	}
-	
-	protected String tabs(int n){
-		String result="";
-		for (int i = 0; i < n; i++) {
-			result+=TAB;
-		}
-		return result;
-	}
-	
-	protected String commaSeperatedString(List<String> list, String delimiter){
-		String result=null;
-		for (String s : list) {
-			result=(result==null?s:result+delimiter+s);
-		}
-		return result;
-	}
-	
-	protected String createFieldVarString(String dataType, String fieldName){
-		return "private " + dataType + " " + fieldName + ";";
-	}
-	
-	protected String createSetterString(int indents,String fieldName,
-			String dataType, String fieldTitleString) {
-	    String setterString=null;
-		setterString=addLines(setterString, tabs(indents));
-		setterString=addLines(setterString,tabs(indents)+"public void set"+fieldTitleString+"("+dataType+" "+fieldName+") {");
-		setterString=addLines(setterString,tabs(indents+1)+"this."+fieldName+"="+fieldName+";");
-		setterString=addLines(setterString,tabs(indents)+"}");
-		return setterString;
-	}
-
-	protected String createGetterString(int indents, String fieldName,
-			String dataType, String fieldTitleString) {
-	    String getterString=null;
-		getterString=addLines(getterString, tabs(indents));
-		getterString=addLines(getterString,tabs(indents)+"public "+dataType+" get"+fieldTitleString+"() {");
-		getterString=addLines(getterString,tabs(indents+1)+"return "+fieldName+";");
-		getterString=addLines(getterString,tabs(indents)+"}");
-		return getterString;
-	}
-	
-	protected String createVarNameFromClassName(String s){
-		return s.substring(0,1).toLowerCase()+s.substring(1);
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java b/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java
deleted file mode 100644
index a83e43e..0000000
--- a/modules/registry/jpa-gen/src/main/java/generators/JPAClassGenerator.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package generators;
-import java.util.ArrayList;
-import java.util.List;
-
-import model.JPAClassField;
-import model.JPAClassModel;
-import model.JPAPKClassModel;
-import model.SQLData;
-
-
-/*
- *
- * 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.
- *
- */
-
-public class JPAClassGenerator extends AbstractGenerator{
-//    private static final Logger log = LoggerFactory.getLogger(JPAClassGenerator.class);
-	private String jpaClassPackageName;
-	
-    public JPAClassModel createJPAClassModel(SQLData sqlData){
-		JPAClassModel model = new JPAClassModel();
-		model.generatePKClass=sqlData.getPrimaryKeys().size()>1;
-		model.tableName=sqlData.getTableName();
-		model.className = convertToJavaTitleCaseStringConvention(sqlData.getTableName());
-		if (model.generatePKClass) {
-			model.pkClassModel.className=model.className+"_PK";
-		}
-		for (String field : sqlData.getFieldData().keySet()) {
-		    String dataType = null;
-		    SQLGenerator.DataTypes sqlDataType = SQLGenerator.DataTypes.valueOf(sqlData.getFieldData().get(field).get(0));
-		    switch (sqlDataType){
-		    case LONGTEXT:case VARCHAR:
-		    	dataType="String"; break;
-		    case INTEGER: 
-		    	dataType="int"; break;
-		    case SMALLINT:
-		    	dataType="boolean"; break;
-		    case TIMESTAMP: 
-		    	dataType="Timestamp"; break;
-		    case CLOB:
-		    	dataType="String"; break;
-		    }
-		    String fieldTitleString = convertToJavaTitleCaseStringConvention(field);
-		    String fieldName = convertToJavaVariableNameCaseStringConvention(field);
-
-		    
-		    boolean foriegnKey = sqlData.getForiegnKeys().containsKey(field);
-			JPAClassField jpaField = new JPAClassField(field,fieldName,dataType,fieldTitleString,sqlData.getPrimaryKeys().contains(field),
-		    		foriegnKey,(foriegnKey?sqlData.getForiegnKeys().get(field).jpaClassName:null),
-		    		(foriegnKey?sqlData.getForiegnKeys().get(field).jpaResourceClassName:null));
-			model.fields.add(jpaField);
-		    if (model.generatePKClass){
-		    	if (sqlData.getPrimaryKeys().contains(field)){
-		    		model.pkClassModel.pkFields.add(jpaField);
-		    	}
-		    }
-		    
-		}
-		return model;
-	}
-    
-	public String generateJPAClass(JPAClassModel model){
-		String classStr = null;
-		String pkClassName = null;
-		classStr=addLines(classStr,"@DataCache");
-		classStr=addLines(classStr,"@Entity");
-		classStr=addLines(classStr,"@Table(name = \""+model.tableName+"\")");
-		String className = model.className;
-		if (model.generatePKClass) {
-			pkClassName=model.pkClassModel.className;
-			classStr = addLines(classStr,"@IdClass("+pkClassName+".class)");
-		}
-		classStr=addLines(classStr,"public class "+className+" implements Serializable {");
-		
-		List<String> columnFields=new ArrayList<String>();
-		List<String> fieldGetters=new ArrayList<String>();
-		List<String> fieldSetters=new ArrayList<String>();
-		for (JPAClassField jpaField : model.fields) {
-			String field=jpaField.tableColumnName;
-		    String fieldString=null;
-		    
-		    String fieldName = jpaField.fieldName;
-		    String dataType = jpaField.fieldDataType;
-		    String fieldTitleString = jpaField.fieldTitle;
-
-		    
-		    fieldString=addLines(fieldString, tabs(1));
-		    if (jpaField.primaryKey){
-		    	fieldString=addLines(fieldString,tabs(1)+"@Id");	
-		    }
-		    fieldString=addLines(fieldString,tabs(1)+"@Column(name = \""+field+"\")");
-			fieldString=addLines(fieldString,tabs(1)+createFieldVarString(dataType ,fieldName));
-		    columnFields.add(fieldString);
-		    
-		    
-		    fieldGetters.add(createGetterString(1, fieldName,dataType, fieldTitleString));
-
-		    fieldSetters.add(createSetterString(1, fieldName,dataType, fieldTitleString));
-		    
-		    if (jpaField.foriegnKey){
-			    fieldString=null;
-			    
-			    fieldName = createVarNameFromClassName(jpaField.foriegnKeyJPAClass);
-			    dataType = jpaField.foriegnKeyJPAClass;
-			    fieldTitleString = jpaField.foriegnKeyJPAClass;
-			    
-			    
-			    fieldString=addLines(fieldString, tabs(1));
-			    fieldString=addLines(fieldString,tabs(1)+"@ManyToOne(cascade= CascadeType.MERGE)");
-			    fieldString=addLines(fieldString,tabs(1)+"@JoinColumn(name = \""+jpaField.tableColumnName+"\")");
-				fieldString=addLines(fieldString,tabs(1)+createFieldVarString(dataType ,fieldName));
-				columnFields.add(fieldString);
-				
-			    fieldGetters.add(createGetterString(1, fieldName,dataType, fieldTitleString));
-
-			    fieldSetters.add(createSetterString(1, fieldName,dataType, fieldTitleString));
-		    }
-		}
-		classStr=addLines(classStr,columnFields.toArray(new String[]{}));
-		classStr=addLines(classStr,fieldGetters.toArray(new String[]{}));
-		classStr=addLines(classStr,fieldSetters.toArray(new String[]{}));
-		
-		classStr=addLines(classStr,"}");
-		return classStr;
-	}
-
-	public String generateJPAPKClass(JPAPKClassModel model){
-		if (model.pkFields.size()==0){
-			return "";
-		}
-		String classStr=null;
-		classStr=addLines(classStr,"public class "+model.className+" implements Serializable {");
-		
-		List<String> columnFields=new ArrayList<String>();
-		List<String> fieldGetters=new ArrayList<String>();
-		List<String> fieldSetters=new ArrayList<String>();
-		List<String> parameterList=new ArrayList<String>();
-		String constructorMethod=null;
-		for (JPAClassField jpaField : model.pkFields) {
-		    
-		    String dataType = jpaField.fieldDataType;
-		    String fieldTitleString = jpaField.fieldTitle;
-		    String fieldName = jpaField.fieldName;
-		    
-		    String fieldString=tabs(1)+createFieldVarString(dataType ,fieldName);
-		    columnFields.add(fieldString);
-		    
-		    
-		    fieldGetters.add(createGetterString(1, fieldName, dataType, fieldTitleString));
-
-		    fieldSetters.add(createSetterString(1, fieldName,	dataType, fieldTitleString));
-
-		    parameterList.add(dataType+" "+fieldName);
-		    constructorMethod=addLines(constructorMethod, tabs(2)+"this."+fieldName+" = "+fieldName+";");
-		}
-		classStr=addLines(classStr,columnFields.toArray(new String[]{}));
-		String constructorParametersString=commaSeperatedString(parameterList,", ");
-		constructorMethod=addLines(tabs(1), tabs(1)+"public "+model.className+"("+constructorParametersString+"){",constructorMethod);
-		constructorMethod=addLines(constructorMethod, tabs(1)+"}");
-		String emptyConstructorMethod=null;
-		emptyConstructorMethod=addLines(tabs(1),tabs(1)+"public "+model.className+"(){",tabs(1)+"}");
-		
-		classStr=addLines(classStr,emptyConstructorMethod);
-		classStr=addLines(classStr,constructorMethod);
-		
-
-
-
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public boolean equals(Object o) {");
-		classStr=addLines(classStr,tabs(2)+"return false;");
-		classStr=addLines(classStr,tabs(1)+"}");
-
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public int hashCode() {");
-		classStr=addLines(classStr,tabs(2)+"return 1;");
-		classStr=addLines(classStr,tabs(1)+"}");
-	    
-		classStr=addLines(classStr,fieldGetters.toArray(new String[]{}));
-		classStr=addLines(classStr,fieldSetters.toArray(new String[]{}));
-		
-		classStr=addLines(classStr,"}");
-		return classStr;
-	}
-
-	public String generatePersistenceXmlEntry(JPAClassModel model){
-		String xmlEntry=null;
-		xmlEntry=addLines(xmlEntry,"<persistence xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.0\">");
-		xmlEntry=addLines(xmlEntry,tabs(1)+"<persistence-unit name=\"appcatalog_data\">");
-		xmlEntry=addLines(xmlEntry,tabs(2)+"<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>");
-		xmlEntry=addLines(xmlEntry,tabs(2)+"<class>"+getJpaClassPackageName()+"."+model.className+"</class>");
-		xmlEntry=addLines(xmlEntry,tabs(2)+"<exclude-unlisted-classes>true</exclude-unlisted-classes>");
-		xmlEntry=addLines(xmlEntry,tabs(1)+"</persistence-unit>");
-		xmlEntry=addLines(xmlEntry,"</persistence>");
-		return xmlEntry;
-	}
-	
-	public String getJpaClassPackageName() {
-		return jpaClassPackageName;
-	}
-
-	public void setJpaClassPackageName(String jpaClassPackageName) {
-		this.jpaClassPackageName = jpaClassPackageName;
-	}
-	
-}


[2/4] airavata git commit: add registry-tools

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java
new file mode 100644
index 0000000..8bfc6ac
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalDataMovementGenerator.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class LocalDataMovementGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("LOCAL_DATA_MOVEMENT");
+		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java
new file mode 100644
index 0000000..df1d2ce
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/LocalSubmissionGenerator.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class LocalSubmissionGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("LOCAL_SUBMISSION");
+		data.getFieldData().put("JOB_SUBMISSION_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getPrimaryKeys().add("JOB_SUBMISSION_INTERFACE_ID");
+		data.getForiegnKeys().put("RESOURCE_JOB_MANAGER_ID", new SQLData.ForiegnKeyData("RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)","ResourceJobManager","ResourceJobManagerResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
new file mode 100644
index 0000000..2b08708
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ModuleCMDGenerator.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+import java.util.Arrays;
+
+public class ModuleCMDGenerator {
+    private static SQLData createSQLData() {
+        SQLData data = new SQLData();
+        data.setTableName("MODULE_LOAD_CMD");
+        data.getFieldData().put("CMD", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+        data.getFieldData().put("APP_DEPLOYMENT_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+        data.getPrimaryKeys().add("APP_DEPLOYMENT_ID");
+        data.getPrimaryKeys().add("CMD");
+        data.getForiegnKeys().put("APP_DEPLOYMENT_ID", new SQLData.ForiegnKeyData("APPLICATION_DEPLOYMENT(DEPLOYMENT_ID)","ApplicationDeployment","AppDeploymentResource"));
+        return data;
+    }
+    public static void testSqlGen() {
+        SQLData data = createSQLData();
+        SQLGenerator sqlGenerator = new SQLGenerator();
+        System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+    }
+
+    public static void testJPAClassGen() {
+        SQLData data = createSQLData();
+        JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+        jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+        JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+        System.out.println(jpaClassGenerator.generateJPAClass(model));
+        System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+        System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+    }
+
+    public static void testJPAResourceClassGen() {
+        SQLData data = createSQLData();
+        JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+        JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+        JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+        jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+        jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+        jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+        jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+        JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+        System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+        System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+        System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+        System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+
+    }
+    public static void main(String[] args) {
+        testSqlGen();
+        testJPAClassGen();
+        testJPAResourceClassGen();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java
new file mode 100644
index 0000000..3a1a8e0
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ResourceJobManagerGenerator.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class ResourceJobManagerGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("RESOURCE_JOB_MANAGER");
+		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("RESOURCE_JOB_MANAGER_TYPE", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("PUSH_MONITORING_ENDPOINT", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
+		data.getFieldData().put("JOB_MANAGER_BIN_PATH", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
+		data.getPrimaryKeys().add("RESOURCE_JOB_MANAGER_ID");
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java
new file mode 100644
index 0000000..6c196d3
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SCPDataMovementGenerator.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class SCPDataMovementGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("SCP_DATA_MOVEMENT");
+		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("SECURITY_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("ALTERNATIVE_SCP_HOSTNAME", Arrays.asList(new String[]{"VARCHAR", "(255)"}));
+		data.getFieldData().put("SSH_PORT", Arrays.asList(new String[]{"INTEGER"}));
+		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java
new file mode 100644
index 0000000..50f1fd1
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/SSHJobSubmissionGenerator.java
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class SSHJobSubmissionGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("SSH_JOB_SUBMISSION");
+		data.getFieldData().put("JOB_SUBMISSION_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("SECURITY_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)","NOT", "NULL"}));
+		data.getFieldData().put("ALTERNATIVE_SSH_HOSTNAME", Arrays.asList(new String[]{"VARCHAR", "(255)"}));
+		data.getFieldData().put("SSH_PORT", Arrays.asList(new String[]{"INTEGER"}));
+		data.getPrimaryKeys().add("JOB_SUBMISSION_INTERFACE_ID");
+		data.getForiegnKeys().put("RESOURCE_JOB_MANAGER_ID", new SQLData.ForiegnKeyData("RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)","ResourceJobManager","ResourceJobManagerResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/generators/AbstractGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/generators/AbstractGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/AbstractGenerator.java
new file mode 100644
index 0000000..b4fb643
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/AbstractGenerator.java
@@ -0,0 +1,119 @@
+package generators;
+
+import java.util.List;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+public class AbstractGenerator {
+	private static final String TAB="\t";
+	
+	protected String removeLastChar(String s) {
+		return s.substring(0, s.length()-1);
+	}
+	
+	protected String addLines(String s, String...lines){
+		for (String line : lines) {
+			s=((s==null||s.equals(""))?"":s+"\n")+line;
+		}
+		return s;
+	}
+	
+	protected String convertToJavaTitleCaseStringConvention(String s){
+		String result="";
+		String[] split = s.split("_");
+		for (String item : split) {
+			result+=(item.toUpperCase().substring(0,1)+(item.length()>1?item.toLowerCase().substring(1):""));
+		}
+		return result;
+	}
+	
+	protected String convertToJavaVariableNameCaseStringConvention(String s){
+		String result=null;
+		String[] split = s.split("_");
+		for (String item : split) {
+			result=(result==null?item.toLowerCase():result+(item.toUpperCase().substring(0,1)+(item.length()>1?item.toLowerCase().substring(1):"")));
+		}
+		return result;
+	}
+	
+	protected String convertToJavaConstantNameCaseStringConvention(String s){
+		String result="";
+		for (int i = 0; i < s.length(); i++) {
+			String c=String.valueOf(s.charAt(i));
+			result+=((c.toUpperCase().equals(c) && !result.equals(""))?"_"+c:c.toUpperCase());
+		}
+		return result;
+	}
+	
+	protected String convertToTitleCaseString(String s){
+		String result="";
+		for (int i = 0; i < s.length(); i++) {
+			String c=String.valueOf(s.charAt(i));
+			result+=((c.toUpperCase().equals(c) && !result.equals(""))?" ":"")+c;
+		}
+		return result;
+	}
+	
+	protected String tabs(int n){
+		String result="";
+		for (int i = 0; i < n; i++) {
+			result+=TAB;
+		}
+		return result;
+	}
+	
+	protected String commaSeperatedString(List<String> list, String delimiter){
+		String result=null;
+		for (String s : list) {
+			result=(result==null?s:result+delimiter+s);
+		}
+		return result;
+	}
+	
+	protected String createFieldVarString(String dataType, String fieldName){
+		return "private " + dataType + " " + fieldName + ";";
+	}
+	
+	protected String createSetterString(int indents,String fieldName,
+			String dataType, String fieldTitleString) {
+	    String setterString=null;
+		setterString=addLines(setterString, tabs(indents));
+		setterString=addLines(setterString,tabs(indents)+"public void set"+fieldTitleString+"("+dataType+" "+fieldName+") {");
+		setterString=addLines(setterString,tabs(indents+1)+"this."+fieldName+"="+fieldName+";");
+		setterString=addLines(setterString,tabs(indents)+"}");
+		return setterString;
+	}
+
+	protected String createGetterString(int indents, String fieldName,
+			String dataType, String fieldTitleString) {
+	    String getterString=null;
+		getterString=addLines(getterString, tabs(indents));
+		getterString=addLines(getterString,tabs(indents)+"public "+dataType+" get"+fieldTitleString+"() {");
+		getterString=addLines(getterString,tabs(indents+1)+"return "+fieldName+";");
+		getterString=addLines(getterString,tabs(indents)+"}");
+		return getterString;
+	}
+	
+	protected String createVarNameFromClassName(String s){
+		return s.substring(0,1).toLowerCase()+s.substring(1);
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAClassGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAClassGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAClassGenerator.java
new file mode 100644
index 0000000..a83e43e
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAClassGenerator.java
@@ -0,0 +1,224 @@
+package generators;
+import java.util.ArrayList;
+import java.util.List;
+
+import model.JPAClassField;
+import model.JPAClassModel;
+import model.JPAPKClassModel;
+import model.SQLData;
+
+
+/*
+ *
+ * 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.
+ *
+ */
+
+public class JPAClassGenerator extends AbstractGenerator{
+//    private static final Logger log = LoggerFactory.getLogger(JPAClassGenerator.class);
+	private String jpaClassPackageName;
+	
+    public JPAClassModel createJPAClassModel(SQLData sqlData){
+		JPAClassModel model = new JPAClassModel();
+		model.generatePKClass=sqlData.getPrimaryKeys().size()>1;
+		model.tableName=sqlData.getTableName();
+		model.className = convertToJavaTitleCaseStringConvention(sqlData.getTableName());
+		if (model.generatePKClass) {
+			model.pkClassModel.className=model.className+"_PK";
+		}
+		for (String field : sqlData.getFieldData().keySet()) {
+		    String dataType = null;
+		    SQLGenerator.DataTypes sqlDataType = SQLGenerator.DataTypes.valueOf(sqlData.getFieldData().get(field).get(0));
+		    switch (sqlDataType){
+		    case LONGTEXT:case VARCHAR:
+		    	dataType="String"; break;
+		    case INTEGER: 
+		    	dataType="int"; break;
+		    case SMALLINT:
+		    	dataType="boolean"; break;
+		    case TIMESTAMP: 
+		    	dataType="Timestamp"; break;
+		    case CLOB:
+		    	dataType="String"; break;
+		    }
+		    String fieldTitleString = convertToJavaTitleCaseStringConvention(field);
+		    String fieldName = convertToJavaVariableNameCaseStringConvention(field);
+
+		    
+		    boolean foriegnKey = sqlData.getForiegnKeys().containsKey(field);
+			JPAClassField jpaField = new JPAClassField(field,fieldName,dataType,fieldTitleString,sqlData.getPrimaryKeys().contains(field),
+		    		foriegnKey,(foriegnKey?sqlData.getForiegnKeys().get(field).jpaClassName:null),
+		    		(foriegnKey?sqlData.getForiegnKeys().get(field).jpaResourceClassName:null));
+			model.fields.add(jpaField);
+		    if (model.generatePKClass){
+		    	if (sqlData.getPrimaryKeys().contains(field)){
+		    		model.pkClassModel.pkFields.add(jpaField);
+		    	}
+		    }
+		    
+		}
+		return model;
+	}
+    
+	public String generateJPAClass(JPAClassModel model){
+		String classStr = null;
+		String pkClassName = null;
+		classStr=addLines(classStr,"@DataCache");
+		classStr=addLines(classStr,"@Entity");
+		classStr=addLines(classStr,"@Table(name = \""+model.tableName+"\")");
+		String className = model.className;
+		if (model.generatePKClass) {
+			pkClassName=model.pkClassModel.className;
+			classStr = addLines(classStr,"@IdClass("+pkClassName+".class)");
+		}
+		classStr=addLines(classStr,"public class "+className+" implements Serializable {");
+		
+		List<String> columnFields=new ArrayList<String>();
+		List<String> fieldGetters=new ArrayList<String>();
+		List<String> fieldSetters=new ArrayList<String>();
+		for (JPAClassField jpaField : model.fields) {
+			String field=jpaField.tableColumnName;
+		    String fieldString=null;
+		    
+		    String fieldName = jpaField.fieldName;
+		    String dataType = jpaField.fieldDataType;
+		    String fieldTitleString = jpaField.fieldTitle;
+
+		    
+		    fieldString=addLines(fieldString, tabs(1));
+		    if (jpaField.primaryKey){
+		    	fieldString=addLines(fieldString,tabs(1)+"@Id");	
+		    }
+		    fieldString=addLines(fieldString,tabs(1)+"@Column(name = \""+field+"\")");
+			fieldString=addLines(fieldString,tabs(1)+createFieldVarString(dataType ,fieldName));
+		    columnFields.add(fieldString);
+		    
+		    
+		    fieldGetters.add(createGetterString(1, fieldName,dataType, fieldTitleString));
+
+		    fieldSetters.add(createSetterString(1, fieldName,dataType, fieldTitleString));
+		    
+		    if (jpaField.foriegnKey){
+			    fieldString=null;
+			    
+			    fieldName = createVarNameFromClassName(jpaField.foriegnKeyJPAClass);
+			    dataType = jpaField.foriegnKeyJPAClass;
+			    fieldTitleString = jpaField.foriegnKeyJPAClass;
+			    
+			    
+			    fieldString=addLines(fieldString, tabs(1));
+			    fieldString=addLines(fieldString,tabs(1)+"@ManyToOne(cascade= CascadeType.MERGE)");
+			    fieldString=addLines(fieldString,tabs(1)+"@JoinColumn(name = \""+jpaField.tableColumnName+"\")");
+				fieldString=addLines(fieldString,tabs(1)+createFieldVarString(dataType ,fieldName));
+				columnFields.add(fieldString);
+				
+			    fieldGetters.add(createGetterString(1, fieldName,dataType, fieldTitleString));
+
+			    fieldSetters.add(createSetterString(1, fieldName,dataType, fieldTitleString));
+		    }
+		}
+		classStr=addLines(classStr,columnFields.toArray(new String[]{}));
+		classStr=addLines(classStr,fieldGetters.toArray(new String[]{}));
+		classStr=addLines(classStr,fieldSetters.toArray(new String[]{}));
+		
+		classStr=addLines(classStr,"}");
+		return classStr;
+	}
+
+	public String generateJPAPKClass(JPAPKClassModel model){
+		if (model.pkFields.size()==0){
+			return "";
+		}
+		String classStr=null;
+		classStr=addLines(classStr,"public class "+model.className+" implements Serializable {");
+		
+		List<String> columnFields=new ArrayList<String>();
+		List<String> fieldGetters=new ArrayList<String>();
+		List<String> fieldSetters=new ArrayList<String>();
+		List<String> parameterList=new ArrayList<String>();
+		String constructorMethod=null;
+		for (JPAClassField jpaField : model.pkFields) {
+		    
+		    String dataType = jpaField.fieldDataType;
+		    String fieldTitleString = jpaField.fieldTitle;
+		    String fieldName = jpaField.fieldName;
+		    
+		    String fieldString=tabs(1)+createFieldVarString(dataType ,fieldName);
+		    columnFields.add(fieldString);
+		    
+		    
+		    fieldGetters.add(createGetterString(1, fieldName, dataType, fieldTitleString));
+
+		    fieldSetters.add(createSetterString(1, fieldName,	dataType, fieldTitleString));
+
+		    parameterList.add(dataType+" "+fieldName);
+		    constructorMethod=addLines(constructorMethod, tabs(2)+"this."+fieldName+" = "+fieldName+";");
+		}
+		classStr=addLines(classStr,columnFields.toArray(new String[]{}));
+		String constructorParametersString=commaSeperatedString(parameterList,", ");
+		constructorMethod=addLines(tabs(1), tabs(1)+"public "+model.className+"("+constructorParametersString+"){",constructorMethod);
+		constructorMethod=addLines(constructorMethod, tabs(1)+"}");
+		String emptyConstructorMethod=null;
+		emptyConstructorMethod=addLines(tabs(1),tabs(1)+"public "+model.className+"(){",tabs(1)+"}");
+		
+		classStr=addLines(classStr,emptyConstructorMethod);
+		classStr=addLines(classStr,constructorMethod);
+		
+
+
+
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public boolean equals(Object o) {");
+		classStr=addLines(classStr,tabs(2)+"return false;");
+		classStr=addLines(classStr,tabs(1)+"}");
+
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public int hashCode() {");
+		classStr=addLines(classStr,tabs(2)+"return 1;");
+		classStr=addLines(classStr,tabs(1)+"}");
+	    
+		classStr=addLines(classStr,fieldGetters.toArray(new String[]{}));
+		classStr=addLines(classStr,fieldSetters.toArray(new String[]{}));
+		
+		classStr=addLines(classStr,"}");
+		return classStr;
+	}
+
+	public String generatePersistenceXmlEntry(JPAClassModel model){
+		String xmlEntry=null;
+		xmlEntry=addLines(xmlEntry,"<persistence xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.0\">");
+		xmlEntry=addLines(xmlEntry,tabs(1)+"<persistence-unit name=\"appcatalog_data\">");
+		xmlEntry=addLines(xmlEntry,tabs(2)+"<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>");
+		xmlEntry=addLines(xmlEntry,tabs(2)+"<class>"+getJpaClassPackageName()+"."+model.className+"</class>");
+		xmlEntry=addLines(xmlEntry,tabs(2)+"<exclude-unlisted-classes>true</exclude-unlisted-classes>");
+		xmlEntry=addLines(xmlEntry,tabs(1)+"</persistence-unit>");
+		xmlEntry=addLines(xmlEntry,"</persistence>");
+		return xmlEntry;
+	}
+	
+	public String getJpaClassPackageName() {
+		return jpaClassPackageName;
+	}
+
+	public void setJpaClassPackageName(String jpaClassPackageName) {
+		this.jpaClassPackageName = jpaClassPackageName;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java
new file mode 100644
index 0000000..f3f8978
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java
@@ -0,0 +1,513 @@
+package generators;
+import java.util.ArrayList;
+import java.util.List;
+
+import model.JPAClassField;
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+
+
+/*
+ *
+ * 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.
+ *
+ */
+
+public class JPAResourceClassGenerator extends AbstractGenerator {
+	private String exceptionClassName;
+	private String jpaUtilsClassName;
+	private String resourceTypeClassName;
+	private String queryGeneratorClassName;
+	
+	public JPAResourceClassModel createJPAResourceClassModel(JPAClassModel jpaClassModel){
+		JPAResourceClassModel jpaResourceClassModel = new JPAResourceClassModel();
+		jpaResourceClassModel.jpaClassModel=jpaClassModel;
+		jpaResourceClassModel.className=jpaClassModel.className+"Resource";
+		jpaClassModel.classNameConstant=convertToJavaConstantNameCaseStringConvention(jpaClassModel.className);
+		for (JPAClassField jpaField : jpaClassModel.fields) {
+			jpaField.fieldNameConstant=convertToJavaConstantNameCaseStringConvention(jpaField.fieldName);
+		}
+		jpaResourceClassModel.jpaClassConstantClassName=jpaClassModel.className+"Constants";
+		return jpaResourceClassModel;
+	}
+	
+	public String generateJPAResourceClass(JPAResourceClassModel model){
+		String classStr = null;
+		String className = model.className;
+		classStr=addLines(classStr,"public class "+className+" extends AbstractResource {");
+		classStr=addLines(classStr,tabs(1)+"private final static Logger logger = LoggerFactory.getLogger("+className+".class);");
+
+		List<String> columnFields=new ArrayList<String>();
+		List<String> fieldGetters=new ArrayList<String>();
+		List<String> fieldSetters=new ArrayList<String>();
+		for (JPAClassField jpaField : model.jpaClassModel.fields) {
+		    String fieldName = jpaField.fieldName;
+		    String dataType = jpaField.fieldDataType;
+		    String fieldTitleString = jpaField.fieldTitle;
+		    
+			String fieldString=tabs(1)+createFieldVarString(dataType, fieldName);
+		    columnFields.add(fieldString);
+		    
+		    fieldGetters.add(createGetterString(1, fieldName, dataType, fieldTitleString));
+		    fieldSetters.add(createSetterString(1, fieldName, dataType, fieldTitleString));
+		    
+		    if (jpaField.foriegnKey){
+			    fieldName = createVarNameFromClassName(jpaField.foriegnKeyJPAResourceClass);
+			    dataType = jpaField.foriegnKeyJPAResourceClass;
+			    fieldTitleString = jpaField.foriegnKeyJPAResourceClass;
+			    
+				fieldString=tabs(1)+createFieldVarString(dataType ,fieldName);
+				columnFields.add(fieldString);
+				
+			    fieldGetters.add(createGetterString(1, fieldName,dataType, fieldTitleString));
+			    fieldSetters.add(createSetterString(1, fieldName,dataType, fieldTitleString));
+		    }
+		    
+		}
+		classStr=addLines(classStr,columnFields.toArray(new String[]{}));
+		
+		//remove method
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public void remove(Object identifier) throws "+getExceptionClassName()+" {");
+		if (model.jpaClassModel.generatePKClass){
+			classStr=addLines(classStr,tabs(2)+"HashMap<String, String> ids;");
+			classStr=addLines(classStr,tabs(2)+"if (identifier instanceof Map) {");
+			classStr=addLines(classStr,tabs(3)+"ids = (HashMap<String, String>) identifier;");
+			classStr=addLines(classStr,tabs(2)+"} else {");
+			classStr=addLines(classStr,tabs(3)+"logger.error(\"Identifier should be a map with the field name and it's value\");");
+			classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(\"Identifier should be a map with the field name and it's value\");");
+            classStr=addLines(classStr,tabs(2)+"}");	
+		}
+		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
+		classStr=addLines(classStr,tabs(2)+"try {");
+		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
+
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
+		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
+		if (model.jpaClassModel.generatePKClass){
+			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
+				classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", ids.get("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"));");
+			}
+		}else{
+			for(JPAClassField field:model.jpaClassModel.fields){
+				if (field.primaryKey){
+					classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", identifier);");
+				}
+			}
+		}
+		classStr=addLines(classStr,tabs(3)+"Query q = generator.deleteQuery(em);");
+		classStr=addLines(classStr,tabs(3)+"q.executeUpdate();");
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
+		classStr=addLines(classStr,tabs(3)+"em.close();");
+		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
+		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
+		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
+		classStr=addLines(classStr,tabs(2)+"} finally {");
+		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
+		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
+		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(4)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(2)+"}");
+        
+		classStr=addLines(classStr,tabs(1)+"}");
+		
+		//get method for resource class
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public Resource get(Object identifier) throws "+getExceptionClassName()+" {");
+		
+		if (model.jpaClassModel.generatePKClass){
+			classStr=addLines(classStr,tabs(2)+"HashMap<String, String> ids;");
+			classStr=addLines(classStr,tabs(2)+"if (identifier instanceof Map) {");
+			classStr=addLines(classStr,tabs(3)+"ids = (HashMap<String, String>) identifier;");
+			classStr=addLines(classStr,tabs(2)+"} else {");
+			classStr=addLines(classStr,tabs(3)+"logger.error(\"Identifier should be a map with the field name and it's value\");");
+			classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(\"Identifier should be a map with the field name and it's value\");");
+            classStr=addLines(classStr,tabs(2)+"}");	
+		}
+		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
+		classStr=addLines(classStr,tabs(2)+"try {");
+		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
+
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
+		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
+		if (model.jpaClassModel.generatePKClass){
+			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
+				classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", ids.get("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"));");
+			}
+		}else{
+			for(JPAClassField field:model.jpaClassModel.fields){
+				if (field.primaryKey){
+					classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", identifier);");
+				}
+			}
+		}
+
+		classStr=addLines(classStr,tabs(3)+"Query q = generator.selectQuery(em);");
+		String jpaObjVar=createVarNameFromClassName(model.jpaClassModel.className);
+		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+jpaObjVar+" = ("+model.jpaClassModel.className+") q.getSingleResult();");
+		String jpaObjVarResource=createVarNameFromClassName(model.className);
+		classStr=addLines(classStr,tabs(3)+model.className+" "+jpaObjVarResource+" = ("+model.className+") "+getJpaUtilsClassName()+".getResource("+getResourceTypeClassName()+"."+model.jpaClassModel.classNameConstant+", "+jpaObjVar+");");
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
+		classStr=addLines(classStr,tabs(3)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"return "+jpaObjVarResource+";");
+		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
+		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
+		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
+		classStr=addLines(classStr,tabs(2)+"} finally {");
+		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
+		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
+		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(4)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(2)+"}");
+		classStr=addLines(classStr,tabs(1)+"}");
+
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public List<Resource> get(String fieldName, Object value) throws "+getExceptionClassName()+" {");
+		
+		String resultListVarName=createVarNameFromClassName(model.className)+"s";
+		classStr=addLines(classStr,tabs(2)+"List<Resource> "+resultListVarName+" = new ArrayList<Resource>();");
+		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
+		classStr=addLines(classStr,tabs(2)+"try {");
+		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
+
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
+		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
+
+		classStr=addLines(classStr,tabs(3)+"Query q;");
+		List<String> fieldNameValidations=new ArrayList<String>();
+		for(JPAClassField field:model.jpaClassModel.fields){
+			fieldNameValidations.add("(fieldName.equals("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"))");
+		}
+		String fieldNameValidationLogic = commaSeperatedString(fieldNameValidations, " || ");
+		classStr=addLines(classStr,tabs(3)+"if ("+fieldNameValidationLogic+") {");
+		classStr=addLines(classStr,tabs(4)+"generator.setParameter(fieldName, value);");
+		classStr=addLines(classStr,tabs(4)+"q = generator.selectQuery(em);");
+		classStr=addLines(classStr,tabs(4)+"List<?> results = q.getResultList();");
+		classStr=addLines(classStr,tabs(4)+"for (Object result : results) {");
+		classStr=addLines(classStr,tabs(5)+model.jpaClassModel.className+" "+jpaObjVar+" = ("+model.jpaClassModel.className+") result;");
+		classStr=addLines(classStr,tabs(5)+model.className+" "+jpaObjVarResource+" = ("+model.className+") "+getJpaUtilsClassName()+".getResource("+getResourceTypeClassName()+"."+model.jpaClassModel.classNameConstant+", "+jpaObjVar+");");
+		classStr=addLines(classStr,tabs(5)+resultListVarName+".add("+jpaObjVarResource+");");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(3)+"} else {");
+		classStr=addLines(classStr,tabs(4)+"em.getTransaction().commit();");
+		classStr=addLines(classStr,tabs(5)+"em.close();");
+		classStr=addLines(classStr,tabs(4)+"logger.error(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\", new IllegalArgumentException());");
+		classStr=addLines(classStr,tabs(4)+"throw new IllegalArgumentException(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\");");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
+		classStr=addLines(classStr,tabs(3)+"em.close();");
+		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
+		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
+		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
+		classStr=addLines(classStr,tabs(2)+"} finally {");
+		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
+		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
+		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(4)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(2)+"}");
+		classStr=addLines(classStr,tabs(2)+"return "+resultListVarName+";");
+		classStr=addLines(classStr,tabs(1)+"}");
+
+		//id list method
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public List<String> getIds(String fieldName, Object value) throws "+getExceptionClassName()+" {");
+		
+		resultListVarName=createVarNameFromClassName(model.className)+"IDs";
+		classStr=addLines(classStr,tabs(2)+"List<String> "+resultListVarName+" = new ArrayList<String>();");
+		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
+		classStr=addLines(classStr,tabs(2)+"try {");
+		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
+
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
+		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
+
+		classStr=addLines(classStr,tabs(3)+"Query q;");
+		fieldNameValidations=new ArrayList<String>();
+		for(JPAClassField field:model.jpaClassModel.fields){
+			fieldNameValidations.add("(fieldName.equals("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"))");
+		}
+		fieldNameValidationLogic = commaSeperatedString(fieldNameValidations, " || ");
+		classStr=addLines(classStr,tabs(3)+"if ("+fieldNameValidationLogic+") {");
+		classStr=addLines(classStr,tabs(4)+"generator.setParameter(fieldName, value);");
+		classStr=addLines(classStr,tabs(4)+"q = generator.selectQuery(em);");
+		classStr=addLines(classStr,tabs(4)+"List<?> results = q.getResultList();");
+		classStr=addLines(classStr,tabs(4)+"for (Object result : results) {");
+		classStr=addLines(classStr,tabs(5)+model.jpaClassModel.className+" "+jpaObjVar+" = ("+model.jpaClassModel.className+") result;");
+		classStr=addLines(classStr,tabs(5)+model.className+" "+jpaObjVarResource+" = ("+model.className+") "+getJpaUtilsClassName()+".getResource("+getResourceTypeClassName()+"."+model.jpaClassModel.classNameConstant+", "+jpaObjVar+");");
+		String idFieldToAdd=null;
+		if (model.jpaClassModel.generatePKClass){
+			for (JPAClassField field : model.jpaClassModel.fields) {
+				if (field.foriegnKey){
+					idFieldToAdd=jpaObjVarResource+".get"+field.fieldTitle+"()";
+					break;
+				}
+			}
+		}else{
+			for (JPAClassField field : model.jpaClassModel.fields) {
+				if (field.primaryKey){
+					idFieldToAdd=jpaObjVarResource+".get"+field.fieldTitle+"()";
+				}
+			}
+		}
+		classStr=addLines(classStr,tabs(5)+resultListVarName+".add("+idFieldToAdd+");");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(3)+"} else {");
+		classStr=addLines(classStr,tabs(4)+"em.getTransaction().commit();");
+		classStr=addLines(classStr,tabs(5)+"em.close();");
+		classStr=addLines(classStr,tabs(4)+"logger.error(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\", new IllegalArgumentException());");
+		classStr=addLines(classStr,tabs(4)+"throw new IllegalArgumentException(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\");");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
+		classStr=addLines(classStr,tabs(3)+"em.close();");
+		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
+		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
+		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
+		classStr=addLines(classStr,tabs(2)+"} finally {");
+		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
+		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
+		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(4)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(2)+"}");
+		classStr=addLines(classStr,tabs(2)+"return "+resultListVarName+";");
+		
+		
+		classStr=addLines(classStr,tabs(1)+"}");
+		
+		//save method
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public void save() throws "+getExceptionClassName()+" {");
+		
+		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
+		classStr=addLines(classStr,tabs(2)+"try {");
+		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
+		String existingJPAObjVar="existing"+model.jpaClassModel.className;
+		
+		String primaryKeySearchString=null;
+		if (model.jpaClassModel.generatePKClass){
+			List<String> fieldStrings=new ArrayList<String>();
+			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
+				fieldStrings.add(field.fieldName);
+			}
+			primaryKeySearchString="new "+model.jpaClassModel.pkClassModel.className+"("+commaSeperatedString(fieldStrings, ", ")+")";
+		}else{
+			for(JPAClassField field:model.jpaClassModel.fields){
+				if (field.primaryKey){
+					primaryKeySearchString=field.fieldName;
+				}
+			}
+		}
+		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+existingJPAObjVar+" = em.find("+model.jpaClassModel.className+".class, "+primaryKeySearchString+");");
+		classStr=addLines(classStr,tabs(3)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+jpaObjVar+";");
+		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
+		classStr=addLines(classStr,tabs(3)+"if ("+existingJPAObjVar+" == null) {");
+		classStr=addLines(classStr,tabs(4)+jpaObjVar+" = new "+model.jpaClassModel.className+"();");
+		classStr=addLines(classStr,tabs(3)+"} else {");
+		classStr=addLines(classStr,tabs(4)+jpaObjVar+" = "+existingJPAObjVar+";");
+		classStr=addLines(classStr,tabs(3)+"}");
+		for (JPAClassField field : model.jpaClassModel.fields) {
+			classStr=addLines(classStr,tabs(3)+jpaObjVar+".set"+field.fieldTitle+"(get"+field.fieldTitle+"());");
+			if (field.foriegnKey){
+				String varNameForForiegnKeyObj = createVarNameFromClassName(field.foriegnKeyJPAClass);
+				classStr=addLines(classStr,tabs(3)+field.foriegnKeyJPAClass+" "+varNameForForiegnKeyObj+" = em.find("+field.foriegnKeyJPAClass+".class, get"+field.fieldTitle+"());");
+				classStr=addLines(classStr,tabs(3)+jpaObjVar+".set"+field.foriegnKeyJPAClass+"("+varNameForForiegnKeyObj+");");
+			}
+		}
+		classStr=addLines(classStr,tabs(3)+"if ("+existingJPAObjVar+" == null) {");
+		classStr=addLines(classStr,tabs(4)+"em.persist("+jpaObjVar+");");
+		classStr=addLines(classStr,tabs(3)+"} else {");
+		classStr=addLines(classStr,tabs(4)+"em.merge("+jpaObjVar+");");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
+		classStr=addLines(classStr,tabs(3)+"em.close();");
+		classStr=addLines(classStr,tabs(2)+"} catch (Exception e) {");
+		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
+		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
+		classStr=addLines(classStr,tabs(2)+"} finally {");
+		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
+		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
+		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(4)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(2)+"}");
+		classStr=addLines(classStr,tabs(1)+"}");
+		
+		//isexist method
+
+		classStr=addLines(classStr,tabs(1));
+		classStr=addLines(classStr,tabs(1)+"@Override");
+		classStr=addLines(classStr,tabs(1)+"public boolean isExists(Object identifier) throws "+getExceptionClassName()+" {");
+		
+		if (model.jpaClassModel.generatePKClass){
+			classStr=addLines(classStr,tabs(2)+"HashMap<String, String> ids;");
+			classStr=addLines(classStr,tabs(2)+"if (identifier instanceof Map) {");
+			classStr=addLines(classStr,tabs(3)+"ids = (HashMap<String, String>) identifier;");
+			classStr=addLines(classStr,tabs(2)+"} else {");
+			classStr=addLines(classStr,tabs(3)+"logger.error(\"Identifier should be a map with the field name and it's value\");");
+			classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(\"Identifier should be a map with the field name and it's value\");");
+            classStr=addLines(classStr,tabs(2)+"}");	
+		}
+        
+		primaryKeySearchString=null;
+		if (model.jpaClassModel.generatePKClass){
+			List<String> fieldStrings=new ArrayList<String>();
+			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
+				fieldStrings.add("ids.get("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+")");
+			}
+			primaryKeySearchString="new "+model.jpaClassModel.pkClassModel.className+"("+commaSeperatedString(fieldStrings, ", ")+")";
+		}else{
+			for(JPAClassField field:model.jpaClassModel.fields){
+				if (field.primaryKey){
+					primaryKeySearchString="identifier";
+				}
+			}
+		}
+		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
+		classStr=addLines(classStr,tabs(2)+"try {");
+		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
+		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+jpaObjVar+" = em.find("+model.jpaClassModel.className+".class, "+primaryKeySearchString+");");
+
+		classStr=addLines(classStr,tabs(3)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"return "+jpaObjVar+" != null;");
+		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
+		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
+		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
+		classStr=addLines(classStr,tabs(2)+"} finally {");
+		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
+		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
+		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(4)+"em.close();");
+		classStr=addLines(classStr,tabs(3)+"}");
+		classStr=addLines(classStr,tabs(2)+"}");
+		classStr=addLines(classStr,tabs(1)+"}");
+
+		
+		classStr=addLines(classStr,fieldGetters.toArray(new String[]{}));
+		classStr=addLines(classStr,fieldSetters.toArray(new String[]{}));
+		
+		classStr=addLines(classStr,"}");
+		return classStr;
+	}
+	
+	public String generateAbstractResourceClassUpdates(JPAResourceClassModel model){
+		String classStr = null;
+		classStr=addLines(classStr,"public abstract class AbstractResource implements Resource {");
+		
+		classStr=addLines(classStr,tabs(1)+"public static final String "+model.jpaClassModel.classNameConstant+" = \""+model.jpaClassModel.className+"\";");
+		
+		classStr=addLines(classStr,tabs(1)+"// "+convertToTitleCaseString(model.jpaClassModel.className)+" Table");
+		classStr=addLines(classStr,tabs(1)+"public final class "+model.jpaClassConstantClassName+" {");
+		for (JPAClassField jpaField : model.jpaClassModel.fields) {
+			classStr=addLines(classStr,tabs(2)+"public static final String "+jpaField.fieldNameConstant+" = \""+jpaField.fieldName+"\";");
+		}
+		classStr=addLines(classStr,tabs(1)+"}");
+		classStr=addLines(classStr,"}");
+		return classStr;
+	}
+	
+	public String generateAppCatalogJPAUtilUpdates(JPAResourceClassModel model){
+		String classStr = null;
+		String conversionMethodName="create"+model.jpaClassModel.className;
+		classStr=addLines(classStr,"public class "+getJpaUtilsClassName()+" {");
+		classStr=addLines(classStr,tabs(1)+"public static Resource getResource("+getResourceTypeClassName()+" type, Object o) {");
+		classStr=addLines(classStr,tabs(2)+"switch (type){");
+		classStr=addLines(classStr,tabs(3)+"case "+model.jpaClassModel.classNameConstant+":");
+		classStr=addLines(classStr,tabs(4)+"if (o instanceof "+model.jpaClassModel.className+"){");
+		classStr=addLines(classStr,tabs(5)+"return "+conversionMethodName+"(("+model.jpaClassModel.className+") o);");
+		classStr=addLines(classStr,tabs(4)+"}else{");
+		classStr=addLines(classStr,tabs(5)+"logger.error(\"Object should be a "+convertToTitleCaseString(model.jpaClassModel.className)+".\", new IllegalArgumentException());");
+		classStr=addLines(classStr,tabs(5)+"throw new IllegalArgumentException(\"Object should be a "+convertToTitleCaseString(model.jpaClassModel.className)+".\");");
+		classStr=addLines(classStr,tabs(4)+"}");
+		classStr=addLines(classStr,tabs(2)+"}");
+		classStr=addLines(classStr,tabs(1)+"}");
+		classStr=addLines(classStr,tabs(1));
+		
+		String resourceVariableName = createVarNameFromClassName(model.className);
+		classStr=addLines(classStr,tabs(1)+"private static Resource "+conversionMethodName+"("+model.jpaClassModel.className+" o) {");
+		classStr=addLines(classStr,tabs(2)+model.className+" "+resourceVariableName+" = new "+model.className+"();");
+		for(JPAClassField field:model.jpaClassModel.fields){
+			classStr=addLines(classStr,tabs(2)+resourceVariableName+".set"+field.fieldTitle+"(o.get"+field.fieldTitle+"());");
+			if (field.foriegnKey){
+				classStr=addLines(classStr,tabs(2)+resourceVariableName+".set"+field.foriegnKeyJPAResourceClass+"(("+field.foriegnKeyJPAResourceClass+")create"+field.foriegnKeyJPAClass+"(o.get"+field.foriegnKeyJPAClass+"()));");
+			}
+		}
+		classStr=addLines(classStr,tabs(2)+"return "+resourceVariableName+";");
+		classStr=addLines(classStr,tabs(1)+"}");
+		
+		classStr=addLines(classStr,"}");
+		return classStr;
+	}
+	
+	public String generateAppCatalogResourceTypeUpdates(JPAResourceClassModel model){
+		String classStr = null;
+		classStr=addLines(classStr,"public enum "+getResourceTypeClassName()+" {");
+		classStr=addLines(classStr,tabs(1)+model.jpaClassModel.classNameConstant);
+		classStr=addLines(classStr,"}");
+		return classStr;
+	}
+
+	public String getExceptionClassName() {
+		return exceptionClassName;
+	}
+
+	public void setExceptionClassName(String exceptionClassName) {
+		this.exceptionClassName = exceptionClassName;
+	}
+
+	public String getJpaUtilsClassName() {
+		return jpaUtilsClassName;
+	}
+
+	public void setJpaUtilsClassName(String jpaUtilsClassName) {
+		this.jpaUtilsClassName = jpaUtilsClassName;
+	}
+
+	public String getResourceTypeClassName() {
+		return resourceTypeClassName;
+	}
+
+	public void setResourceTypeClassName(String resourceTypeClassName) {
+		this.resourceTypeClassName = resourceTypeClassName;
+	}
+
+	public String getQueryGeneratorClassName() {
+		return queryGeneratorClassName;
+	}
+
+	public void setQueryGeneratorClassName(String queryGeneratorClassName) {
+		this.queryGeneratorClassName = queryGeneratorClassName;
+	}
+	
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/generators/SQLGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/generators/SQLGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/SQLGenerator.java
new file mode 100644
index 0000000..3d326ca
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/generators/SQLGenerator.java
@@ -0,0 +1,77 @@
+package generators;
+import java.util.ArrayList;
+import java.util.List;
+
+import model.SQLData;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+public class SQLGenerator extends AbstractGenerator {
+    private static final Logger log = LoggerFactory.getLogger(SQLGenerator.class);
+    
+	public static enum DataTypes{
+		VARCHAR,
+		TIMESTAMP,
+		INTEGER,
+		LONGTEXT,
+		SMALLINT,
+		CLOB,
+	}
+	
+	public String generateSQLCreateQuery(SQLData sqlData){
+		String sql = null;
+		sql="CREATE TABLE "+sqlData.getTableName()+"\n";
+		sql+="(";
+		for (String fieldName : sqlData.getFieldData().keySet()) {
+			List<String> fieldData = new ArrayList<String>();
+			fieldData.addAll(sqlData.getFieldData().get(fieldName));
+			String dataTypeStr = fieldData.get(0);
+			fieldData.remove(0);
+			DataTypes.valueOf(dataTypeStr);
+			sql+="\n\t"+fieldName+" "+dataTypeStr;
+			for (String data : fieldData) {
+				sql+=" "+data;
+			}
+			sql+=",";
+		}
+		
+		if (sqlData.getPrimaryKeys().size()>0) {
+			sql+="\n\tPRIMARY KEY (";
+			for (String primaryKey : sqlData.getPrimaryKeys()) {
+				sql+=primaryKey+",";
+			}
+			sql=removeLastChar(sql);
+			sql+="),";
+		}
+		for (String foriegnKey : sqlData.getForiegnKeys().keySet()) {
+			sql+="\n\tFOREIGN KEY ";
+			sql+="("+foriegnKey+") REFERENCES "+sqlData.getForiegnKeys().get(foriegnKey).tableAndField+",";
+		}
+		sql=removeLastChar(sql)+"\n";
+		sql+=");";
+		return sql;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassField.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassField.java b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassField.java
new file mode 100644
index 0000000..b0d0090
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassField.java
@@ -0,0 +1,47 @@
+package model;
+/*
+ *
+ * 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.
+ *
+ */
+
+
+public class JPAClassField{
+	public String tableColumnName;
+	public String fieldName;
+	public String fieldNameConstant;
+	public String fieldDataType;
+	public String fieldTitle;
+	public boolean primaryKey;
+	public boolean foriegnKey=false;
+	public String foriegnKeyJPAClass;
+	public String foriegnKeyJPAResourceClass;
+	public JPAClassField(String tableColumnName, String fieldName,
+			String fieldDataType, String fieldTitle, boolean primaryKey,boolean foriegnKey,String foriegnKeyJPAClass,String foriegnKeyJPAResourceClass) {
+		this.tableColumnName = tableColumnName;
+		this.fieldName = fieldName;
+		this.fieldDataType = fieldDataType;
+		this.fieldTitle = fieldTitle;
+		this.primaryKey=primaryKey;
+		this.foriegnKey=foriegnKey;
+		this.foriegnKeyJPAClass=foriegnKeyJPAClass;
+		this.foriegnKeyJPAResourceClass=foriegnKeyJPAResourceClass;
+	}
+	
+	
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassModel.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassModel.java b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassModel.java
new file mode 100644
index 0000000..8ac8ff8
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAClassModel.java
@@ -0,0 +1,34 @@
+package model;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+
+public class JPAClassModel{
+	public String className;
+	public String classNameConstant;
+	public String tableName;
+	public boolean generatePKClass=false;
+	public List<JPAClassField> fields=new ArrayList<JPAClassField>();
+	public JPAPKClassModel pkClassModel=new JPAPKClassModel();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAPKClassModel.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAPKClassModel.java b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAPKClassModel.java
new file mode 100644
index 0000000..f09f426
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAPKClassModel.java
@@ -0,0 +1,30 @@
+package model;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+
+public class JPAPKClassModel{
+	public String className;
+	public List<JPAClassField> pkFields=new ArrayList<JPAClassField>();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAResourceClassModel.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAResourceClassModel.java b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAResourceClassModel.java
new file mode 100644
index 0000000..f0b4c21
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/model/JPAResourceClassModel.java
@@ -0,0 +1,28 @@
+package model;
+/*
+ *
+ * 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.
+ *
+ */
+
+
+public class JPAResourceClassModel{
+	public String className;
+	public JPAClassModel jpaClassModel;
+	public String jpaClassConstantClassName;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/model/SQLData.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/model/SQLData.java b/modules/registry/registry-tools/jpa-gen/src/main/java/model/SQLData.java
new file mode 100644
index 0000000..59f0332
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/model/SQLData.java
@@ -0,0 +1,79 @@
+package model;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+public class SQLData {
+	private String tableName;
+	private Map<String,List<String>> fieldData;
+	private List<String> primaryKeys;
+	private Map<String,ForiegnKeyData> foriegnKeys;
+	
+	public static class ForiegnKeyData{
+		public String tableAndField;
+		public String jpaClassName;
+		public String jpaResourceClassName;
+		public ForiegnKeyData(String tableAndField, String jpaClassName,String jpaResourceClassName) {
+			this.tableAndField = tableAndField;
+			this.jpaClassName = jpaClassName;
+			this.jpaResourceClassName = jpaResourceClassName;
+		}
+	}
+	
+	public String getTableName() {
+		return tableName;
+	}
+	public void setTableName(String tableName) {
+		this.tableName = tableName;
+	}
+	public Map<String, List<String>> getFieldData() {
+		if (fieldData==null){
+			fieldData=new HashMap<String, List<String>>();
+		}
+		return fieldData;
+	}
+	
+	public void setFieldData(Map<String, List<String>> fieldData) {
+		this.fieldData = fieldData;
+	}
+	public List<String> getPrimaryKeys() {
+		if (primaryKeys==null){
+			primaryKeys=new ArrayList<String>();
+		}
+		return primaryKeys;
+	}
+	public void setPrimaryKeys(List<String> primaryKeys) {
+		this.primaryKeys = primaryKeys;
+	}
+	public Map<String,ForiegnKeyData> getForiegnKeys() {
+		if (foriegnKeys==null){
+			foriegnKeys=new HashMap<String, ForiegnKeyData>();
+		}
+		return foriegnKeys;
+	}
+	public void setForiegnKeys(Map<String,ForiegnKeyData> foriegnKeys) {
+		this.foriegnKeys = foriegnKeys;
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/test/Test.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/test/Test.java b/modules/registry/registry-tools/jpa-gen/src/main/java/test/Test.java
new file mode 100644
index 0000000..9d5510d
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/test/Test.java
@@ -0,0 +1,81 @@
+package test;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+public class Test {
+
+
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("COMMUNITY_USER");
+		data.getFieldData().put("GATEWAY_NAME", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
+		data.getFieldData().put("COMMUNITY_USER_NAME", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
+		data.getFieldData().put("TOKEN_ID", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
+		data.getFieldData().put("COMMUNITY_USER_EMAIL", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
+		data.getFieldData().put("CREATION_TIME", Arrays.asList(new String[]{"TIMESTAMP", "DEFAULT", "NOW()"}));
+		data.getFieldData().put("CPU_COUNT", Arrays.asList(new String[]{"INTEGER"}));
+		data.getPrimaryKeys().add("GATEWAY_NAME");
+		data.getPrimaryKeys().add("COMMUNITY_USER_NAME");
+		data.getPrimaryKeys().add("TOKEN_ID");
+		data.getForiegnKeys().put("EXPERIMENT_ID", new SQLData.ForiegnKeyData("EXPERIMENT(EXPERIMENT_ID)","Experiment","ExperimentResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/registry-tool/README
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/registry-tool/README b/modules/registry/registry-tools/registry-tool/README
new file mode 100644
index 0000000..40a8e65
--- /dev/null
+++ b/modules/registry/registry-tools/registry-tool/README
@@ -0,0 +1,9 @@
+0.7 => 0.8
+==============
+
+1. Build registry-tools
+2. Copy registry-tool-0.8-SNAPSHOT.jar and commons-cli-1.1.jar (you will find this in your maven repository) to <AIRAVATA_HOME>/lib
+3. Copy db-migrate.sh file to <AIRAVATA_HOME>/bin
+4. Make sure previous version of airavata database is up and running
+5. Run db-migrate.sh script file
+        ./db-migrate.sh -url jdbc:mysql://localhost:3306/experiment_catalog -user airavata -pwd airavata -v 0.7
\ No newline at end of file


[3/4] airavata git commit: add registry-tools

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java b/modules/registry/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java
deleted file mode 100644
index f3f8978..0000000
--- a/modules/registry/jpa-gen/src/main/java/generators/JPAResourceClassGenerator.java
+++ /dev/null
@@ -1,513 +0,0 @@
-package generators;
-import java.util.ArrayList;
-import java.util.List;
-
-import model.JPAClassField;
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-
-
-/*
- *
- * 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.
- *
- */
-
-public class JPAResourceClassGenerator extends AbstractGenerator {
-	private String exceptionClassName;
-	private String jpaUtilsClassName;
-	private String resourceTypeClassName;
-	private String queryGeneratorClassName;
-	
-	public JPAResourceClassModel createJPAResourceClassModel(JPAClassModel jpaClassModel){
-		JPAResourceClassModel jpaResourceClassModel = new JPAResourceClassModel();
-		jpaResourceClassModel.jpaClassModel=jpaClassModel;
-		jpaResourceClassModel.className=jpaClassModel.className+"Resource";
-		jpaClassModel.classNameConstant=convertToJavaConstantNameCaseStringConvention(jpaClassModel.className);
-		for (JPAClassField jpaField : jpaClassModel.fields) {
-			jpaField.fieldNameConstant=convertToJavaConstantNameCaseStringConvention(jpaField.fieldName);
-		}
-		jpaResourceClassModel.jpaClassConstantClassName=jpaClassModel.className+"Constants";
-		return jpaResourceClassModel;
-	}
-	
-	public String generateJPAResourceClass(JPAResourceClassModel model){
-		String classStr = null;
-		String className = model.className;
-		classStr=addLines(classStr,"public class "+className+" extends AbstractResource {");
-		classStr=addLines(classStr,tabs(1)+"private final static Logger logger = LoggerFactory.getLogger("+className+".class);");
-
-		List<String> columnFields=new ArrayList<String>();
-		List<String> fieldGetters=new ArrayList<String>();
-		List<String> fieldSetters=new ArrayList<String>();
-		for (JPAClassField jpaField : model.jpaClassModel.fields) {
-		    String fieldName = jpaField.fieldName;
-		    String dataType = jpaField.fieldDataType;
-		    String fieldTitleString = jpaField.fieldTitle;
-		    
-			String fieldString=tabs(1)+createFieldVarString(dataType, fieldName);
-		    columnFields.add(fieldString);
-		    
-		    fieldGetters.add(createGetterString(1, fieldName, dataType, fieldTitleString));
-		    fieldSetters.add(createSetterString(1, fieldName, dataType, fieldTitleString));
-		    
-		    if (jpaField.foriegnKey){
-			    fieldName = createVarNameFromClassName(jpaField.foriegnKeyJPAResourceClass);
-			    dataType = jpaField.foriegnKeyJPAResourceClass;
-			    fieldTitleString = jpaField.foriegnKeyJPAResourceClass;
-			    
-				fieldString=tabs(1)+createFieldVarString(dataType ,fieldName);
-				columnFields.add(fieldString);
-				
-			    fieldGetters.add(createGetterString(1, fieldName,dataType, fieldTitleString));
-			    fieldSetters.add(createSetterString(1, fieldName,dataType, fieldTitleString));
-		    }
-		    
-		}
-		classStr=addLines(classStr,columnFields.toArray(new String[]{}));
-		
-		//remove method
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public void remove(Object identifier) throws "+getExceptionClassName()+" {");
-		if (model.jpaClassModel.generatePKClass){
-			classStr=addLines(classStr,tabs(2)+"HashMap<String, String> ids;");
-			classStr=addLines(classStr,tabs(2)+"if (identifier instanceof Map) {");
-			classStr=addLines(classStr,tabs(3)+"ids = (HashMap<String, String>) identifier;");
-			classStr=addLines(classStr,tabs(2)+"} else {");
-			classStr=addLines(classStr,tabs(3)+"logger.error(\"Identifier should be a map with the field name and it's value\");");
-			classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(\"Identifier should be a map with the field name and it's value\");");
-            classStr=addLines(classStr,tabs(2)+"}");	
-		}
-		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
-		classStr=addLines(classStr,tabs(2)+"try {");
-		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
-
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
-		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
-		if (model.jpaClassModel.generatePKClass){
-			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
-				classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", ids.get("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"));");
-			}
-		}else{
-			for(JPAClassField field:model.jpaClassModel.fields){
-				if (field.primaryKey){
-					classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", identifier);");
-				}
-			}
-		}
-		classStr=addLines(classStr,tabs(3)+"Query q = generator.deleteQuery(em);");
-		classStr=addLines(classStr,tabs(3)+"q.executeUpdate();");
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
-		classStr=addLines(classStr,tabs(3)+"em.close();");
-		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
-		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
-		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
-		classStr=addLines(classStr,tabs(2)+"} finally {");
-		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
-		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
-		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(4)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(2)+"}");
-        
-		classStr=addLines(classStr,tabs(1)+"}");
-		
-		//get method for resource class
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public Resource get(Object identifier) throws "+getExceptionClassName()+" {");
-		
-		if (model.jpaClassModel.generatePKClass){
-			classStr=addLines(classStr,tabs(2)+"HashMap<String, String> ids;");
-			classStr=addLines(classStr,tabs(2)+"if (identifier instanceof Map) {");
-			classStr=addLines(classStr,tabs(3)+"ids = (HashMap<String, String>) identifier;");
-			classStr=addLines(classStr,tabs(2)+"} else {");
-			classStr=addLines(classStr,tabs(3)+"logger.error(\"Identifier should be a map with the field name and it's value\");");
-			classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(\"Identifier should be a map with the field name and it's value\");");
-            classStr=addLines(classStr,tabs(2)+"}");	
-		}
-		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
-		classStr=addLines(classStr,tabs(2)+"try {");
-		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
-
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
-		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
-		if (model.jpaClassModel.generatePKClass){
-			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
-				classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", ids.get("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"));");
-			}
-		}else{
-			for(JPAClassField field:model.jpaClassModel.fields){
-				if (field.primaryKey){
-					classStr=addLines(classStr,tabs(3)+"generator.setParameter("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+", identifier);");
-				}
-			}
-		}
-
-		classStr=addLines(classStr,tabs(3)+"Query q = generator.selectQuery(em);");
-		String jpaObjVar=createVarNameFromClassName(model.jpaClassModel.className);
-		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+jpaObjVar+" = ("+model.jpaClassModel.className+") q.getSingleResult();");
-		String jpaObjVarResource=createVarNameFromClassName(model.className);
-		classStr=addLines(classStr,tabs(3)+model.className+" "+jpaObjVarResource+" = ("+model.className+") "+getJpaUtilsClassName()+".getResource("+getResourceTypeClassName()+"."+model.jpaClassModel.classNameConstant+", "+jpaObjVar+");");
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
-		classStr=addLines(classStr,tabs(3)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"return "+jpaObjVarResource+";");
-		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
-		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
-		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
-		classStr=addLines(classStr,tabs(2)+"} finally {");
-		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
-		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
-		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(4)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(2)+"}");
-		classStr=addLines(classStr,tabs(1)+"}");
-
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public List<Resource> get(String fieldName, Object value) throws "+getExceptionClassName()+" {");
-		
-		String resultListVarName=createVarNameFromClassName(model.className)+"s";
-		classStr=addLines(classStr,tabs(2)+"List<Resource> "+resultListVarName+" = new ArrayList<Resource>();");
-		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
-		classStr=addLines(classStr,tabs(2)+"try {");
-		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
-
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
-		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
-
-		classStr=addLines(classStr,tabs(3)+"Query q;");
-		List<String> fieldNameValidations=new ArrayList<String>();
-		for(JPAClassField field:model.jpaClassModel.fields){
-			fieldNameValidations.add("(fieldName.equals("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"))");
-		}
-		String fieldNameValidationLogic = commaSeperatedString(fieldNameValidations, " || ");
-		classStr=addLines(classStr,tabs(3)+"if ("+fieldNameValidationLogic+") {");
-		classStr=addLines(classStr,tabs(4)+"generator.setParameter(fieldName, value);");
-		classStr=addLines(classStr,tabs(4)+"q = generator.selectQuery(em);");
-		classStr=addLines(classStr,tabs(4)+"List<?> results = q.getResultList();");
-		classStr=addLines(classStr,tabs(4)+"for (Object result : results) {");
-		classStr=addLines(classStr,tabs(5)+model.jpaClassModel.className+" "+jpaObjVar+" = ("+model.jpaClassModel.className+") result;");
-		classStr=addLines(classStr,tabs(5)+model.className+" "+jpaObjVarResource+" = ("+model.className+") "+getJpaUtilsClassName()+".getResource("+getResourceTypeClassName()+"."+model.jpaClassModel.classNameConstant+", "+jpaObjVar+");");
-		classStr=addLines(classStr,tabs(5)+resultListVarName+".add("+jpaObjVarResource+");");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(3)+"} else {");
-		classStr=addLines(classStr,tabs(4)+"em.getTransaction().commit();");
-		classStr=addLines(classStr,tabs(5)+"em.close();");
-		classStr=addLines(classStr,tabs(4)+"logger.error(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\", new IllegalArgumentException());");
-		classStr=addLines(classStr,tabs(4)+"throw new IllegalArgumentException(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\");");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
-		classStr=addLines(classStr,tabs(3)+"em.close();");
-		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
-		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
-		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
-		classStr=addLines(classStr,tabs(2)+"} finally {");
-		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
-		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
-		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(4)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(2)+"}");
-		classStr=addLines(classStr,tabs(2)+"return "+resultListVarName+";");
-		classStr=addLines(classStr,tabs(1)+"}");
-
-		//id list method
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public List<String> getIds(String fieldName, Object value) throws "+getExceptionClassName()+" {");
-		
-		resultListVarName=createVarNameFromClassName(model.className)+"IDs";
-		classStr=addLines(classStr,tabs(2)+"List<String> "+resultListVarName+" = new ArrayList<String>();");
-		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
-		classStr=addLines(classStr,tabs(2)+"try {");
-		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
-
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
-		classStr=addLines(classStr,tabs(3)+""+getQueryGeneratorClassName()+" generator = new "+getQueryGeneratorClassName()+"("+model.jpaClassModel.classNameConstant+");");
-
-		classStr=addLines(classStr,tabs(3)+"Query q;");
-		fieldNameValidations=new ArrayList<String>();
-		for(JPAClassField field:model.jpaClassModel.fields){
-			fieldNameValidations.add("(fieldName.equals("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+"))");
-		}
-		fieldNameValidationLogic = commaSeperatedString(fieldNameValidations, " || ");
-		classStr=addLines(classStr,tabs(3)+"if ("+fieldNameValidationLogic+") {");
-		classStr=addLines(classStr,tabs(4)+"generator.setParameter(fieldName, value);");
-		classStr=addLines(classStr,tabs(4)+"q = generator.selectQuery(em);");
-		classStr=addLines(classStr,tabs(4)+"List<?> results = q.getResultList();");
-		classStr=addLines(classStr,tabs(4)+"for (Object result : results) {");
-		classStr=addLines(classStr,tabs(5)+model.jpaClassModel.className+" "+jpaObjVar+" = ("+model.jpaClassModel.className+") result;");
-		classStr=addLines(classStr,tabs(5)+model.className+" "+jpaObjVarResource+" = ("+model.className+") "+getJpaUtilsClassName()+".getResource("+getResourceTypeClassName()+"."+model.jpaClassModel.classNameConstant+", "+jpaObjVar+");");
-		String idFieldToAdd=null;
-		if (model.jpaClassModel.generatePKClass){
-			for (JPAClassField field : model.jpaClassModel.fields) {
-				if (field.foriegnKey){
-					idFieldToAdd=jpaObjVarResource+".get"+field.fieldTitle+"()";
-					break;
-				}
-			}
-		}else{
-			for (JPAClassField field : model.jpaClassModel.fields) {
-				if (field.primaryKey){
-					idFieldToAdd=jpaObjVarResource+".get"+field.fieldTitle+"()";
-				}
-			}
-		}
-		classStr=addLines(classStr,tabs(5)+resultListVarName+".add("+idFieldToAdd+");");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(3)+"} else {");
-		classStr=addLines(classStr,tabs(4)+"em.getTransaction().commit();");
-		classStr=addLines(classStr,tabs(5)+"em.close();");
-		classStr=addLines(classStr,tabs(4)+"logger.error(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\", new IllegalArgumentException());");
-		classStr=addLines(classStr,tabs(4)+"throw new IllegalArgumentException(\"Unsupported field name for "+convertToTitleCaseString(model.className)+".\");");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
-		classStr=addLines(classStr,tabs(3)+"em.close();");
-		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
-		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
-		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
-		classStr=addLines(classStr,tabs(2)+"} finally {");
-		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
-		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
-		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(4)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(2)+"}");
-		classStr=addLines(classStr,tabs(2)+"return "+resultListVarName+";");
-		
-		
-		classStr=addLines(classStr,tabs(1)+"}");
-		
-		//save method
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public void save() throws "+getExceptionClassName()+" {");
-		
-		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
-		classStr=addLines(classStr,tabs(2)+"try {");
-		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
-		String existingJPAObjVar="existing"+model.jpaClassModel.className;
-		
-		String primaryKeySearchString=null;
-		if (model.jpaClassModel.generatePKClass){
-			List<String> fieldStrings=new ArrayList<String>();
-			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
-				fieldStrings.add(field.fieldName);
-			}
-			primaryKeySearchString="new "+model.jpaClassModel.pkClassModel.className+"("+commaSeperatedString(fieldStrings, ", ")+")";
-		}else{
-			for(JPAClassField field:model.jpaClassModel.fields){
-				if (field.primaryKey){
-					primaryKeySearchString=field.fieldName;
-				}
-			}
-		}
-		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+existingJPAObjVar+" = em.find("+model.jpaClassModel.className+".class, "+primaryKeySearchString+");");
-		classStr=addLines(classStr,tabs(3)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+jpaObjVar+";");
-		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().begin();");
-		classStr=addLines(classStr,tabs(3)+"if ("+existingJPAObjVar+" == null) {");
-		classStr=addLines(classStr,tabs(4)+jpaObjVar+" = new "+model.jpaClassModel.className+"();");
-		classStr=addLines(classStr,tabs(3)+"} else {");
-		classStr=addLines(classStr,tabs(4)+jpaObjVar+" = "+existingJPAObjVar+";");
-		classStr=addLines(classStr,tabs(3)+"}");
-		for (JPAClassField field : model.jpaClassModel.fields) {
-			classStr=addLines(classStr,tabs(3)+jpaObjVar+".set"+field.fieldTitle+"(get"+field.fieldTitle+"());");
-			if (field.foriegnKey){
-				String varNameForForiegnKeyObj = createVarNameFromClassName(field.foriegnKeyJPAClass);
-				classStr=addLines(classStr,tabs(3)+field.foriegnKeyJPAClass+" "+varNameForForiegnKeyObj+" = em.find("+field.foriegnKeyJPAClass+".class, get"+field.fieldTitle+"());");
-				classStr=addLines(classStr,tabs(3)+jpaObjVar+".set"+field.foriegnKeyJPAClass+"("+varNameForForiegnKeyObj+");");
-			}
-		}
-		classStr=addLines(classStr,tabs(3)+"if ("+existingJPAObjVar+" == null) {");
-		classStr=addLines(classStr,tabs(4)+"em.persist("+jpaObjVar+");");
-		classStr=addLines(classStr,tabs(3)+"} else {");
-		classStr=addLines(classStr,tabs(4)+"em.merge("+jpaObjVar+");");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(3)+"em.getTransaction().commit();");
-		classStr=addLines(classStr,tabs(3)+"em.close();");
-		classStr=addLines(classStr,tabs(2)+"} catch (Exception e) {");
-		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
-		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
-		classStr=addLines(classStr,tabs(2)+"} finally {");
-		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
-		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
-		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(4)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(2)+"}");
-		classStr=addLines(classStr,tabs(1)+"}");
-		
-		//isexist method
-
-		classStr=addLines(classStr,tabs(1));
-		classStr=addLines(classStr,tabs(1)+"@Override");
-		classStr=addLines(classStr,tabs(1)+"public boolean isExists(Object identifier) throws "+getExceptionClassName()+" {");
-		
-		if (model.jpaClassModel.generatePKClass){
-			classStr=addLines(classStr,tabs(2)+"HashMap<String, String> ids;");
-			classStr=addLines(classStr,tabs(2)+"if (identifier instanceof Map) {");
-			classStr=addLines(classStr,tabs(3)+"ids = (HashMap<String, String>) identifier;");
-			classStr=addLines(classStr,tabs(2)+"} else {");
-			classStr=addLines(classStr,tabs(3)+"logger.error(\"Identifier should be a map with the field name and it's value\");");
-			classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(\"Identifier should be a map with the field name and it's value\");");
-            classStr=addLines(classStr,tabs(2)+"}");	
-		}
-        
-		primaryKeySearchString=null;
-		if (model.jpaClassModel.generatePKClass){
-			List<String> fieldStrings=new ArrayList<String>();
-			for(JPAClassField field:model.jpaClassModel.pkClassModel.pkFields){
-				fieldStrings.add("ids.get("+model.jpaClassConstantClassName+"."+field.fieldNameConstant+")");
-			}
-			primaryKeySearchString="new "+model.jpaClassModel.pkClassModel.className+"("+commaSeperatedString(fieldStrings, ", ")+")";
-		}else{
-			for(JPAClassField field:model.jpaClassModel.fields){
-				if (field.primaryKey){
-					primaryKeySearchString="identifier";
-				}
-			}
-		}
-		classStr=addLines(classStr,tabs(2)+"EntityManager em = null;");
-		classStr=addLines(classStr,tabs(2)+"try {");
-		classStr=addLines(classStr,tabs(3)+"em = "+getJpaUtilsClassName()+".getEntityManager();");
-		classStr=addLines(classStr,tabs(3)+model.jpaClassModel.className+" "+jpaObjVar+" = em.find("+model.jpaClassModel.className+".class, "+primaryKeySearchString+");");
-
-		classStr=addLines(classStr,tabs(3)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"return "+jpaObjVar+" != null;");
-		classStr=addLines(classStr,tabs(2)+"} catch (ApplicationSettingsException e) {");
-		classStr=addLines(classStr,tabs(3)+"logger.error(e.getMessage(), e);");
-		classStr=addLines(classStr,tabs(3)+"throw new "+getExceptionClassName()+"(e);");
-		classStr=addLines(classStr,tabs(2)+"} finally {");
-		classStr=addLines(classStr,tabs(3)+"if (em != null && em.isOpen()) {");
-		classStr=addLines(classStr,tabs(4)+"if (em.getTransaction().isActive()) {");
-		classStr=addLines(classStr,tabs(5)+"em.getTransaction().rollback();");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(4)+"em.close();");
-		classStr=addLines(classStr,tabs(3)+"}");
-		classStr=addLines(classStr,tabs(2)+"}");
-		classStr=addLines(classStr,tabs(1)+"}");
-
-		
-		classStr=addLines(classStr,fieldGetters.toArray(new String[]{}));
-		classStr=addLines(classStr,fieldSetters.toArray(new String[]{}));
-		
-		classStr=addLines(classStr,"}");
-		return classStr;
-	}
-	
-	public String generateAbstractResourceClassUpdates(JPAResourceClassModel model){
-		String classStr = null;
-		classStr=addLines(classStr,"public abstract class AbstractResource implements Resource {");
-		
-		classStr=addLines(classStr,tabs(1)+"public static final String "+model.jpaClassModel.classNameConstant+" = \""+model.jpaClassModel.className+"\";");
-		
-		classStr=addLines(classStr,tabs(1)+"// "+convertToTitleCaseString(model.jpaClassModel.className)+" Table");
-		classStr=addLines(classStr,tabs(1)+"public final class "+model.jpaClassConstantClassName+" {");
-		for (JPAClassField jpaField : model.jpaClassModel.fields) {
-			classStr=addLines(classStr,tabs(2)+"public static final String "+jpaField.fieldNameConstant+" = \""+jpaField.fieldName+"\";");
-		}
-		classStr=addLines(classStr,tabs(1)+"}");
-		classStr=addLines(classStr,"}");
-		return classStr;
-	}
-	
-	public String generateAppCatalogJPAUtilUpdates(JPAResourceClassModel model){
-		String classStr = null;
-		String conversionMethodName="create"+model.jpaClassModel.className;
-		classStr=addLines(classStr,"public class "+getJpaUtilsClassName()+" {");
-		classStr=addLines(classStr,tabs(1)+"public static Resource getResource("+getResourceTypeClassName()+" type, Object o) {");
-		classStr=addLines(classStr,tabs(2)+"switch (type){");
-		classStr=addLines(classStr,tabs(3)+"case "+model.jpaClassModel.classNameConstant+":");
-		classStr=addLines(classStr,tabs(4)+"if (o instanceof "+model.jpaClassModel.className+"){");
-		classStr=addLines(classStr,tabs(5)+"return "+conversionMethodName+"(("+model.jpaClassModel.className+") o);");
-		classStr=addLines(classStr,tabs(4)+"}else{");
-		classStr=addLines(classStr,tabs(5)+"logger.error(\"Object should be a "+convertToTitleCaseString(model.jpaClassModel.className)+".\", new IllegalArgumentException());");
-		classStr=addLines(classStr,tabs(5)+"throw new IllegalArgumentException(\"Object should be a "+convertToTitleCaseString(model.jpaClassModel.className)+".\");");
-		classStr=addLines(classStr,tabs(4)+"}");
-		classStr=addLines(classStr,tabs(2)+"}");
-		classStr=addLines(classStr,tabs(1)+"}");
-		classStr=addLines(classStr,tabs(1));
-		
-		String resourceVariableName = createVarNameFromClassName(model.className);
-		classStr=addLines(classStr,tabs(1)+"private static Resource "+conversionMethodName+"("+model.jpaClassModel.className+" o) {");
-		classStr=addLines(classStr,tabs(2)+model.className+" "+resourceVariableName+" = new "+model.className+"();");
-		for(JPAClassField field:model.jpaClassModel.fields){
-			classStr=addLines(classStr,tabs(2)+resourceVariableName+".set"+field.fieldTitle+"(o.get"+field.fieldTitle+"());");
-			if (field.foriegnKey){
-				classStr=addLines(classStr,tabs(2)+resourceVariableName+".set"+field.foriegnKeyJPAResourceClass+"(("+field.foriegnKeyJPAResourceClass+")create"+field.foriegnKeyJPAClass+"(o.get"+field.foriegnKeyJPAClass+"()));");
-			}
-		}
-		classStr=addLines(classStr,tabs(2)+"return "+resourceVariableName+";");
-		classStr=addLines(classStr,tabs(1)+"}");
-		
-		classStr=addLines(classStr,"}");
-		return classStr;
-	}
-	
-	public String generateAppCatalogResourceTypeUpdates(JPAResourceClassModel model){
-		String classStr = null;
-		classStr=addLines(classStr,"public enum "+getResourceTypeClassName()+" {");
-		classStr=addLines(classStr,tabs(1)+model.jpaClassModel.classNameConstant);
-		classStr=addLines(classStr,"}");
-		return classStr;
-	}
-
-	public String getExceptionClassName() {
-		return exceptionClassName;
-	}
-
-	public void setExceptionClassName(String exceptionClassName) {
-		this.exceptionClassName = exceptionClassName;
-	}
-
-	public String getJpaUtilsClassName() {
-		return jpaUtilsClassName;
-	}
-
-	public void setJpaUtilsClassName(String jpaUtilsClassName) {
-		this.jpaUtilsClassName = jpaUtilsClassName;
-	}
-
-	public String getResourceTypeClassName() {
-		return resourceTypeClassName;
-	}
-
-	public void setResourceTypeClassName(String resourceTypeClassName) {
-		this.resourceTypeClassName = resourceTypeClassName;
-	}
-
-	public String getQueryGeneratorClassName() {
-		return queryGeneratorClassName;
-	}
-
-	public void setQueryGeneratorClassName(String queryGeneratorClassName) {
-		this.queryGeneratorClassName = queryGeneratorClassName;
-	}
-	
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/generators/SQLGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/generators/SQLGenerator.java b/modules/registry/jpa-gen/src/main/java/generators/SQLGenerator.java
deleted file mode 100644
index 3d326ca..0000000
--- a/modules/registry/jpa-gen/src/main/java/generators/SQLGenerator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package generators;
-import java.util.ArrayList;
-import java.util.List;
-
-import model.SQLData;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- *
- * 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.
- *
- */
-
-public class SQLGenerator extends AbstractGenerator {
-    private static final Logger log = LoggerFactory.getLogger(SQLGenerator.class);
-    
-	public static enum DataTypes{
-		VARCHAR,
-		TIMESTAMP,
-		INTEGER,
-		LONGTEXT,
-		SMALLINT,
-		CLOB,
-	}
-	
-	public String generateSQLCreateQuery(SQLData sqlData){
-		String sql = null;
-		sql="CREATE TABLE "+sqlData.getTableName()+"\n";
-		sql+="(";
-		for (String fieldName : sqlData.getFieldData().keySet()) {
-			List<String> fieldData = new ArrayList<String>();
-			fieldData.addAll(sqlData.getFieldData().get(fieldName));
-			String dataTypeStr = fieldData.get(0);
-			fieldData.remove(0);
-			DataTypes.valueOf(dataTypeStr);
-			sql+="\n\t"+fieldName+" "+dataTypeStr;
-			for (String data : fieldData) {
-				sql+=" "+data;
-			}
-			sql+=",";
-		}
-		
-		if (sqlData.getPrimaryKeys().size()>0) {
-			sql+="\n\tPRIMARY KEY (";
-			for (String primaryKey : sqlData.getPrimaryKeys()) {
-				sql+=primaryKey+",";
-			}
-			sql=removeLastChar(sql);
-			sql+="),";
-		}
-		for (String foriegnKey : sqlData.getForiegnKeys().keySet()) {
-			sql+="\n\tFOREIGN KEY ";
-			sql+="("+foriegnKey+") REFERENCES "+sqlData.getForiegnKeys().get(foriegnKey).tableAndField+",";
-		}
-		sql=removeLastChar(sql)+"\n";
-		sql+=");";
-		return sql;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/model/JPAClassField.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/model/JPAClassField.java b/modules/registry/jpa-gen/src/main/java/model/JPAClassField.java
deleted file mode 100644
index b0d0090..0000000
--- a/modules/registry/jpa-gen/src/main/java/model/JPAClassField.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package model;
-/*
- *
- * 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.
- *
- */
-
-
-public class JPAClassField{
-	public String tableColumnName;
-	public String fieldName;
-	public String fieldNameConstant;
-	public String fieldDataType;
-	public String fieldTitle;
-	public boolean primaryKey;
-	public boolean foriegnKey=false;
-	public String foriegnKeyJPAClass;
-	public String foriegnKeyJPAResourceClass;
-	public JPAClassField(String tableColumnName, String fieldName,
-			String fieldDataType, String fieldTitle, boolean primaryKey,boolean foriegnKey,String foriegnKeyJPAClass,String foriegnKeyJPAResourceClass) {
-		this.tableColumnName = tableColumnName;
-		this.fieldName = fieldName;
-		this.fieldDataType = fieldDataType;
-		this.fieldTitle = fieldTitle;
-		this.primaryKey=primaryKey;
-		this.foriegnKey=foriegnKey;
-		this.foriegnKeyJPAClass=foriegnKeyJPAClass;
-		this.foriegnKeyJPAResourceClass=foriegnKeyJPAResourceClass;
-	}
-	
-	
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/model/JPAClassModel.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/model/JPAClassModel.java b/modules/registry/jpa-gen/src/main/java/model/JPAClassModel.java
deleted file mode 100644
index 8ac8ff8..0000000
--- a/modules/registry/jpa-gen/src/main/java/model/JPAClassModel.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package model;
-import java.util.ArrayList;
-import java.util.List;
-
-/*
- *
- * 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.
- *
- */
-
-
-public class JPAClassModel{
-	public String className;
-	public String classNameConstant;
-	public String tableName;
-	public boolean generatePKClass=false;
-	public List<JPAClassField> fields=new ArrayList<JPAClassField>();
-	public JPAPKClassModel pkClassModel=new JPAPKClassModel();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/model/JPAPKClassModel.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/model/JPAPKClassModel.java b/modules/registry/jpa-gen/src/main/java/model/JPAPKClassModel.java
deleted file mode 100644
index f09f426..0000000
--- a/modules/registry/jpa-gen/src/main/java/model/JPAPKClassModel.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package model;
-import java.util.ArrayList;
-import java.util.List;
-
-/*
- *
- * 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.
- *
- */
-
-
-public class JPAPKClassModel{
-	public String className;
-	public List<JPAClassField> pkFields=new ArrayList<JPAClassField>();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/model/JPAResourceClassModel.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/model/JPAResourceClassModel.java b/modules/registry/jpa-gen/src/main/java/model/JPAResourceClassModel.java
deleted file mode 100644
index f0b4c21..0000000
--- a/modules/registry/jpa-gen/src/main/java/model/JPAResourceClassModel.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package model;
-/*
- *
- * 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.
- *
- */
-
-
-public class JPAResourceClassModel{
-	public String className;
-	public JPAClassModel jpaClassModel;
-	public String jpaClassConstantClassName;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/model/SQLData.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/model/SQLData.java b/modules/registry/jpa-gen/src/main/java/model/SQLData.java
deleted file mode 100644
index 59f0332..0000000
--- a/modules/registry/jpa-gen/src/main/java/model/SQLData.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package model;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/*
- *
- * 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.
- *
- */
-
-public class SQLData {
-	private String tableName;
-	private Map<String,List<String>> fieldData;
-	private List<String> primaryKeys;
-	private Map<String,ForiegnKeyData> foriegnKeys;
-	
-	public static class ForiegnKeyData{
-		public String tableAndField;
-		public String jpaClassName;
-		public String jpaResourceClassName;
-		public ForiegnKeyData(String tableAndField, String jpaClassName,String jpaResourceClassName) {
-			this.tableAndField = tableAndField;
-			this.jpaClassName = jpaClassName;
-			this.jpaResourceClassName = jpaResourceClassName;
-		}
-	}
-	
-	public String getTableName() {
-		return tableName;
-	}
-	public void setTableName(String tableName) {
-		this.tableName = tableName;
-	}
-	public Map<String, List<String>> getFieldData() {
-		if (fieldData==null){
-			fieldData=new HashMap<String, List<String>>();
-		}
-		return fieldData;
-	}
-	
-	public void setFieldData(Map<String, List<String>> fieldData) {
-		this.fieldData = fieldData;
-	}
-	public List<String> getPrimaryKeys() {
-		if (primaryKeys==null){
-			primaryKeys=new ArrayList<String>();
-		}
-		return primaryKeys;
-	}
-	public void setPrimaryKeys(List<String> primaryKeys) {
-		this.primaryKeys = primaryKeys;
-	}
-	public Map<String,ForiegnKeyData> getForiegnKeys() {
-		if (foriegnKeys==null){
-			foriegnKeys=new HashMap<String, ForiegnKeyData>();
-		}
-		return foriegnKeys;
-	}
-	public void setForiegnKeys(Map<String,ForiegnKeyData> foriegnKeys) {
-		this.foriegnKeys = foriegnKeys;
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/jpa-gen/src/main/java/test/Test.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/test/Test.java b/modules/registry/jpa-gen/src/main/java/test/Test.java
deleted file mode 100644
index 9d5510d..0000000
--- a/modules/registry/jpa-gen/src/main/java/test/Test.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package test;
-
-import generators.JPAClassGenerator;
-import generators.JPAResourceClassGenerator;
-import generators.SQLGenerator;
-
-import java.util.Arrays;
-
-import model.JPAClassModel;
-import model.JPAResourceClassModel;
-import model.SQLData;
-
-/*
- *
- * 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.
- *
- */
-
-public class Test {
-
-
-	private static SQLData createSQLData() {
-		SQLData data = new SQLData();
-		data.setTableName("COMMUNITY_USER");
-		data.getFieldData().put("GATEWAY_NAME", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
-		data.getFieldData().put("COMMUNITY_USER_NAME", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
-		data.getFieldData().put("TOKEN_ID", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
-		data.getFieldData().put("COMMUNITY_USER_EMAIL", Arrays.asList(new String[]{"VARCHAR", "256", "NOT", "NULL"}));
-		data.getFieldData().put("CREATION_TIME", Arrays.asList(new String[]{"TIMESTAMP", "DEFAULT", "NOW()"}));
-		data.getFieldData().put("CPU_COUNT", Arrays.asList(new String[]{"INTEGER"}));
-		data.getPrimaryKeys().add("GATEWAY_NAME");
-		data.getPrimaryKeys().add("COMMUNITY_USER_NAME");
-		data.getPrimaryKeys().add("TOKEN_ID");
-		data.getForiegnKeys().put("EXPERIMENT_ID", new SQLData.ForiegnKeyData("EXPERIMENT(EXPERIMENT_ID)","Experiment","ExperimentResource"));
-		return data;
-	}
-	public static void testSqlGen() {
-		SQLData data = createSQLData();
-		SQLGenerator sqlGenerator = new SQLGenerator();
-		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
-	}
-	
-	public static void testJPAClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		System.out.println(jpaClassGenerator.generateJPAClass(model));
-		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
-	}
-	
-	public static void testJPAResourceClassGen() {
-		SQLData data = createSQLData();
-		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
-		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
-		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
-		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
-		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
-		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
-		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
-		
-	}
-	public static void main(String[] args) {
-		testJPAResourceClassGen();
-	}
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/pom.xml b/modules/registry/pom.xml
index 0132411..9809db0 100644
--- a/modules/registry/pom.xml
+++ b/modules/registry/pom.xml
@@ -32,7 +32,7 @@
             <modules>
                 <module>registry-cpi</module>
                 <module>registry-core</module>
-                <!--<module>jpa-gen</module>-->
+                <module>registry-tools</module>
             </modules>
         </profile>
     </profiles>

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
index dfc655d..9e6dff0 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
@@ -41,6 +41,7 @@ public class AppCatalogJPAUtils {
     private static final String APPCATALOG_JDBC_PWD = "appcatalog.jdbc.password";
     private static final String APPCATALOG_VALIDATION_QUERY = "appcatalog.validationQuery";
     private static final String JPA_CACHE_SIZE = "jpa.cache.size";
+    private static final String JPA_CACHE_ENABLED = "cache.enable";
     @PersistenceUnit(unitName="appcatalog_data")
     protected static EntityManagerFactory factory;
     @PersistenceContext(unitName="appcatalog_data")
@@ -59,8 +60,8 @@ public class AppCatalogJPAUtils {
             properties.put("openjpa.ConnectionProperties", connectionProperties);
             properties.put("openjpa.DynamicEnhancementAgent", "true");
             properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
-            properties.put("openjpa.DataCache","true(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE))  + ", SoftReferenceSize=0)");
-            properties.put("openjpa.QueryCache","true(CacheSize=" + Integer.valueOf(readServerProperties(JPA_CACHE_SIZE))  + ", SoftReferenceSize=0)");
+            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)");

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/pom.xml b/modules/registry/registry-tools/jpa-gen/pom.xml
new file mode 100644
index 0000000..663f3e2
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--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. -->
+
+<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/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata-registry-tools</artifactId>
+        <version>0.16-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>jpa-gen</artifactId>
+    <packaging>jar</packaging>
+    <name>JPA Class Data Generator</name>
+    <url>http://airavata.apache.org/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java
new file mode 100644
index 0000000..9cc6558
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/BatchQueueGenerator.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class BatchQueueGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("BATCH_QUEUE");
+		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("QUEUE_NAME", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("QUEUE_DESCRIPTION", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
+		data.getFieldData().put("MAX_RUNTIME", Arrays.asList(new String[]{"INTEGER"}));
+		data.getFieldData().put("MAX_NODES", Arrays.asList(new String[]{"INTEGER"}));
+		data.getFieldData().put("MAX_PROCESSORS", Arrays.asList(new String[]{"INTEGER"}));
+		data.getFieldData().put("MAX_JOB_IN_QUEUE", Arrays.asList(new String[]{"INTEGER"}));
+		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
+		data.getPrimaryKeys().add("QUEUE_NAME");
+		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java
new file mode 100644
index 0000000..c61a518
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/ComputeResourceDescriptionGenerator.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class ComputeResourceDescriptionGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("COMPUTE_RESOURCE");
+		data.getFieldData().put("RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("HOST_NAME", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("RESOURCE_DESCRIPTION", Arrays.asList(new String[]{"VARCHAR", "(255)"}));
+		data.getPrimaryKeys().add("RESOURCE_ID");
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java
new file mode 100644
index 0000000..21c1028
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/DataMovementInterfaceGenerator.java
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class DataMovementInterfaceGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("DATA_MOVEMENT_INTERFACE");
+		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("DATA_MOVEMENT_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)","NOT", "NULL"}));
+		data.getFieldData().put("PRIORITY_ORDER", Arrays.asList(new String[]{"INTEGER"}));
+		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
+		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
+		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java
new file mode 100644
index 0000000..34f07e7
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/FileSystemsGenerator.java
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class FileSystemsGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("COMPUTE_RESOURCE_FILE_SYSTEM");
+		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("FILE_SYSTEM", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("PATH", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
+		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
+		data.getPrimaryKeys().add("FILE_SYSTEM");
+		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java
new file mode 100644
index 0000000..418fadc
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPDataMovementGenerator.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class GridFTPDataMovementGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("GRIDFTP_DATA_MOVEMENT");
+		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("SECURITY_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
+		return data;
+	}
+	
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java
new file mode 100644
index 0000000..fc4e6ec
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/GridFTPEndpointsGenerator.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class GridFTPEndpointsGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("GRIDFTP_ENDPOINT");
+		data.getFieldData().put("DATA_MOVEMENT_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("ENDPOINT", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getPrimaryKeys().add("DATA_MOVEMENT_INTERFACE_ID");
+		data.getPrimaryKeys().add("ENDPOINT");
+		data.getForiegnKeys().put("DATA_MOVEMENT_INTERFACE_ID", new SQLData.ForiegnKeyData("GRIDFTP_DATA_MOVEMENT(DATA_MOVEMENT_INTERFACE_ID)","GridftpDataMovement","GridftpDataMovementResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java
new file mode 100644
index 0000000..45cdbb6
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobManagerCommandGenerator.java
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class JobManagerCommandGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("JOB_MANAGER_COMMAND");
+		data.getFieldData().put("RESOURCE_JOB_MANAGER_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("COMMAND_TYPE", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("COMMAND", Arrays.asList(new String[]{"VARCHAR", "(255)",}));
+		data.getPrimaryKeys().add("RESOURCE_JOB_MANAGER_ID");
+		data.getPrimaryKeys().add("COMMAND_TYPE");
+		data.getForiegnKeys().put("RESOURCE_JOB_MANAGER_ID", new SQLData.ForiegnKeyData("RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)","ResourceJobManager","ResourceJobManagerResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c1eebe3/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java
new file mode 100644
index 0000000..16fa903
--- /dev/null
+++ b/modules/registry/registry-tools/jpa-gen/src/main/java/appcatalog/computeresource/JobSubmissionInterfaceGenerator.java
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 appcatalog.computeresource;
+
+import generators.JPAClassGenerator;
+import generators.JPAResourceClassGenerator;
+import generators.SQLGenerator;
+
+import java.util.Arrays;
+
+import model.JPAClassModel;
+import model.JPAResourceClassModel;
+import model.SQLData;
+
+public class JobSubmissionInterfaceGenerator {
+	private static SQLData createSQLData() {
+		SQLData data = new SQLData();
+		data.setTableName("JOB_SUBMISSION_INTERFACE");
+		data.getFieldData().put("COMPUTE_RESOURCE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("JOB_SUBMISSION_INTERFACE_ID", Arrays.asList(new String[]{"VARCHAR", "(255)", "NOT", "NULL"}));
+		data.getFieldData().put("JOB_SUBMISSION_PROTOCOL", Arrays.asList(new String[]{"VARCHAR", "(255)","NOT", "NULL"}));
+		data.getFieldData().put("PRIORITY_ORDER", Arrays.asList(new String[]{"INTEGER"}));
+		data.getPrimaryKeys().add("COMPUTE_RESOURCE_ID");
+		data.getPrimaryKeys().add("JOB_SUBMISSION_INTERFACE_ID");
+		data.getForiegnKeys().put("COMPUTE_RESOURCE_ID", new SQLData.ForiegnKeyData("COMPUTE_RESOURCE(RESOURCE_ID)","ComputeResource","ComputeHostResource"));
+		return data;
+	}
+	public static void testSqlGen() {
+		SQLData data = createSQLData();
+		SQLGenerator sqlGenerator = new SQLGenerator();
+		System.out.println(sqlGenerator.generateSQLCreateQuery(data));
+	}
+	
+	public static void testJPAClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		jpaClassGenerator.setJpaClassPackageName("org.apache.aiaravata.application.catalog.data.model");
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		System.out.println(jpaClassGenerator.generateJPAClass(model));
+		System.out.println(jpaClassGenerator.generateJPAPKClass(model.pkClassModel));
+		System.out.println(jpaClassGenerator.generatePersistenceXmlEntry(model));
+	}
+	
+	public static void testJPAResourceClassGen() {
+		SQLData data = createSQLData();
+		JPAClassGenerator jpaClassGenerator = new JPAClassGenerator();
+		JPAClassModel model = jpaClassGenerator.createJPAClassModel(data);
+		JPAResourceClassGenerator jpaResourceClassGenerator = new JPAResourceClassGenerator();
+		jpaResourceClassGenerator.setExceptionClassName("AppCatalogException");
+		jpaResourceClassGenerator.setJpaUtilsClassName("AppCatalogJPAUtils");
+		jpaResourceClassGenerator.setResourceTypeClassName("AppCatalogResourceType");
+		jpaResourceClassGenerator.setQueryGeneratorClassName("AppCatalogQueryGenerator");
+
+		JPAResourceClassModel model2 = jpaResourceClassGenerator.createJPAResourceClassModel(model);
+		System.out.println(jpaResourceClassGenerator.generateJPAResourceClass(model2));
+		System.out.println(jpaResourceClassGenerator.generateAbstractResourceClassUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogResourceTypeUpdates(model2));
+		System.out.println(jpaResourceClassGenerator.generateAppCatalogJPAUtilUpdates(model2));
+		
+	}
+	public static void main(String[] args) {
+		testSqlGen();
+		testJPAClassGen();
+		testJPAResourceClassGen();
+	}
+}