airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [2/2] git commit: adding jpa class gen project
Date Sat, 05 Jul 2014 00:07:18 GMT
adding jpa class gen project


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

Branch: refs/heads/master
Commit: 2c32d42b9ea7eba07c2e635071401ac391f1a8a1
Parents: c4268c1
Author: Saminda Wijeratne <samindaw@gmail.com>
Authored: Fri Jul 4 20:06:52 2014 -0400
Committer: Saminda Wijeratne <samindaw@gmail.com>
Committed: Fri Jul 4 20:06:52 2014 -0400

----------------------------------------------------------------------
 .../client/tools/DocumentCreatorNew.java        | 838 +++++++++++++++++++
 .../data/resources/AbstractResource.java        |  31 +-
 .../resources/ApplicationInputResource.java     |  42 +-
 .../catalog/data/util/AppCatalogJPAUtils.java   | 128 ++-
 .../data/util/AppCatalogResourceType.java       |   5 +-
 .../src/main/resources/META-INF/persistence.xml |   4 +
 .../src/main/resources/appcatalog-derby.sql     |  30 +
 modules/registry/jpa-gen/pom.xml                |  42 +
 .../java/appcatalog/BatchQueueGenerator.java    |  86 ++
 .../java/appcatalog/FileSystemsGenerator.java   |  82 ++
 .../JobSubmissionInterfaceGenerator.java        |  83 ++
 .../main/java/generators/AbstractGenerator.java | 119 +++
 .../main/java/generators/JPAClassGenerator.java | 193 +++++
 .../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 ++
 .../org/apache/airavata/server/ServerMain.java  |   4 +-
 modules/workflow-model/pom.xml                  |   3 +
 23 files changed, 2542 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
----------------------------------------------------------------------
diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
new file mode 100644
index 0000000..2cf971b
--- /dev/null
+++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
@@ -0,0 +1,838 @@
+/*
+ *
+ * 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.client.tools;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.airavata.appcatalog.cpi.AppCatalog;
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.airavata.appcatalog.cpi.ApplicationDeployment;
+import org.airavata.appcatalog.cpi.ApplicationInterface;
+import org.airavata.appcatalog.cpi.ComputeResource;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.computehost.ComputeResourceDescription;
+import org.apache.airavata.model.computehost.JobSubmissionProtocol;
+import org.apache.airavata.model.computehost.ResourceJobManager;
+import org.apache.airavata.model.computehost.SSHJobSubmission;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.JobTypeType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.ParameterType;
+import org.apache.airavata.schemas.gfac.ProjectAccountType;
+import org.apache.airavata.schemas.gfac.QueueType;
+
+public class DocumentCreatorNew {
+
+    private AppCatalog appcatalog = null;
+    private String trestleshpcHostAddress = "trestles.sdsc.edu";
+    private String lonestarHostAddress = "lonestar.tacc.utexas.edu";
+    private String stampedeHostAddress  = "stampede.tacc.xsede.org";
+    private String gridftpAddress = "gsiftp://trestles-dm1.sdsc.edu:2811";
+    private String gramAddress = "trestles-login1.sdsc.edu:2119/jobmanager-pbstest2";
+
+
+    public DocumentCreatorNew(AppCatalog appcatalog) {
+        this.appcatalog = appcatalog;
+    }
+
+    public void createLocalHostDocs() {
+        HostDescription descriptor = new HostDescription();
+        descriptor.getType().setHostName("localhost");
+        descriptor.getType().setHostAddress("127.0.0.1");
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(descriptor);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        String serviceName = "SimpleEcho0";
+        ServiceDescription serviceDescription = new ServiceDescription();
+        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+        serviceDescription.getType().setName(serviceName);
+        serviceDescription.getType().setDescription("Echo service");
+        // Creating input parameters
+        InputParameterType parameter = InputParameterType.Factory.newInstance();
+        parameter.setParameterName("echo_input");
+        parameter.setParameterDescription("echo input");
+        ParameterType parameterType = parameter.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+        inputParameters.add(parameter);
+
+        // Creating output parameters
+        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
+        outputParameter.setParameterName("echo_output");
+        outputParameter.setParameterDescription("Echo output");
+        ParameterType outputParaType = outputParameter.addNewParameterType();
+        outputParaType.setType(DataType.STRING);
+        outputParaType.setName("String");
+        outputParameters.add(outputParameter);
+
+        // Setting input and output parameters to serviceDescriptor
+        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
+        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));
+
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serviceDescription);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        ApplicationDescription applicationDeploymentDescription = new ApplicationDescription();
+        ApplicationDeploymentDescriptionType applicationDeploymentDescriptionType = applicationDeploymentDescription
+                .getType();
+        applicationDeploymentDescriptionType.addNewApplicationName().setStringValue("EchoApplication");
+        applicationDeploymentDescriptionType.setExecutableLocation("/bin/echo");
+        applicationDeploymentDescriptionType.setScratchWorkingDirectory("/tmp");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, "localhost", applicationDeploymentDescription);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+    
+
+    public InputDataObjectType createAppInput (String inputName, String value, org.apache.airavata.model.appcatalog.appinterface.DataType type ){
+        InputDataObjectType input = new InputDataObjectType();
+        input.setName(inputName);
+        input.setValue(value);
+        input.setType(type);
+        input.setApplicationArgument("test arg");
+        return input;
+    }
+
+    public OutputDataObjectType createAppOutput (String inputName, String value, org.apache.airavata.model.appcatalog.appinterface.DataType type ){
+        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
+        outputDataObjectType.setName(inputName);
+        outputDataObjectType.setValue(value);
+        outputDataObjectType.setType(type);
+        return outputDataObjectType;
+    }
+    
+    public String createSSHHostDocs() throws AppCatalogException {
+    	ComputeResource computeResource = appcatalog.getComputeResource();
+        ApplicationInterface appInt = appcatalog.getApplicationInterface();
+        ApplicationDeployment appDep = appcatalog.getApplicationDeployment();
+        
+        ComputeResourceDescription description = new ComputeResourceDescription();
+        description.setHostName("gw111.iu.xsede.org");
+        description.setResourceDescription("gw111 ssh access");
+        Set<String> ipdaresses = new HashSet<String>();
+        ipdaresses.add("gw111.iu.xsede.org");
+        description.setIpAddresses(ipdaresses);
+        description.setHostAliases(new HashSet<String>());
+        SSHJobSubmission jobSubmission = new SSHJobSubmission();
+        jobSubmission.setSshPort(22);
+        jobSubmission.setResourceJobManager(ResourceJobManager.PBS);
+        String sshsubmissionId = appcatalog.getComputeResource().addSSHJobSubmission(jobSubmission);
+        description.setPreferredJobSubmissionProtocol(sshsubmissionId);
+        Map<String, JobSubmissionProtocol> jobProtools = new HashMap<String, JobSubmissionProtocol>();
+        jobProtools.put(sshsubmissionId, JobSubmissionProtocol.SSH);
+        description.setJobSubmissionProtocols(jobProtools);
+        String resourceId = computeResource.addComputeResource(description);
+    	
+
+        ApplicationModule module = new ApplicationModule();
+        module.setAppModuleName("echo");
+        module.setAppModuleVersion("1.0.0");
+        String echoModuleId = appInt.addApplicationModule(module);
+
+        
+        ApplicationDeploymentDescription deployment = new ApplicationDeploymentDescription();
+        deployment.setAppModuleId(echoModuleId);
+        deployment.setComputeHostId(resourceId);
+        deployment.setExecutablePath("/bin/echo");
+        deployment.setAppDeploymentDescription("SSHEchoApplication");
+        appDep.addApplicationDeployment(deployment);
+        
+        
+        ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
+        List<String> modules = new ArrayList<String>();
+        modules.add(echoModuleId);
+        application.setApplicationModules(modules);
+        List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
+        List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
+        InputDataObjectType appInput1 = createAppInput("echo_input", null, org.apache.airavata.model.appcatalog.appinterface.DataType.STRING);
+        OutputDataObjectType output1 = createAppOutput("echo_output", null, org.apache.airavata.model.appcatalog.appinterface.DataType.STRING);
+        inputs.add(appInput1);
+        outputs.add(output1);
+        application.setApplicationName("SSHEcho1");
+        application.setApplicationInputs(inputs);
+        application.setApplicationOutputs(outputs);
+        return appInt.addApplicationInterface(application);
+    }
+
+    public void createGramDocs() {
+//        /*
+//           creating host descriptor for gram
+//        */
+//        HostDescription host = new HostDescription(GlobusHostType.type);
+//        host.getType().setHostAddress(trestleshpcHostAddress);
+//        host.getType().setHostName(trestleshpcHostAddress);
+//        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{gramAddress});
+//        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
+//        try {
+//            airavataAPI.getApplicationManager().saveHostDescription(host);
+//        } catch (AiravataAPIInvocationException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        }
+//
+//
+//        /*
+//        * Service Description creation and saving
+//        */
+//        String serviceName = "SimpleEcho1";
+//        ServiceDescription serv = new ServiceDescription();
+//        serv.getType().setName(serviceName);
+//
+//        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+//        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+//
+//        InputParameterType input = InputParameterType.Factory.newInstance();
+//        input.setParameterName("echo_input");
+//        ParameterType parameterType = input.addNewParameterType();
+//        parameterType.setType(DataType.STRING);
+//        parameterType.setName("String");
+//
+//        OutputParameterType output = OutputParameterType.Factory.newInstance();
+//        output.setParameterName("echo_output");
+//        ParameterType parameterType1 = output.addNewParameterType();
+//        parameterType1.setType(DataType.STRING);
+//        parameterType1.setName("String");
+//
+//        inputList.add(input);
+//        outputList.add(output);
+//
+//        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+//        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+//
+//        serv.getType().setInputParametersArray(inputParamList);
+//        serv.getType().setOutputParametersArray(outputParamList);
+//        try {
+//            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+//        } catch (AiravataAPIInvocationException e) {
+//            e.printStackTrace();
+//        }
+//
+//        /*
+//            Application descriptor creation and saving
+//         */
+//        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+//        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+//        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+//        name.setStringValue("EchoLocal");
+//        app.setApplicationName(name);
+//        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+//        projectAccountType.setProjectAccountNumber("sds128");
+//
+//        QueueType queueType = app.addNewQueue();
+//        queueType.setQueueName("normal");
+//
+//        app.setCpuCount(1);
+//        app.setJobType(JobTypeType.SERIAL);
+//        app.setNodeCount(1);
+//        app.setProcessorsPerNode(1);
+//
+//        /*
+//           * Use bat file if it is compiled on Windows
+//           */
+//        app.setExecutableLocation("/bin/echo");
+//
+//        /*
+//           * Default tmp location
+//           */
+//        String tempDir = "/home/ogce/scratch";
+//        app.setScratchWorkingDirectory(tempDir);
+//        app.setMaxMemory(10);
+//
+//
+//        try {
+//            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, trestleshpcHostAddress, appDesc);
+//        } catch (AiravataAPIInvocationException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        }
+    }
+
+    public void createPBSDocsForOGCE() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress(trestleshpcHostAddress);
+        host.getType().setHostName(trestleshpcHostAddress);
+        ((GsisshHostType) host.getType()).setPort(22);
+        ((GsisshHostType) host.getType()).setInstalledPath("/opt/torque/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "SimpleEcho2";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("echo_input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("echo_output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.STRING);
+        parameterType1.setName("String");
+
+        inputList.add(input);
+        outputList.add(output);
+
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+            Application descriptor creation and saving
+         */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue("EchoLocal");
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("sds128");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.SERIAL);
+        app.setNodeCount(1);
+        app.setProcessorsPerNode(1);
+        app.setMaxWallTime(10);
+        /*
+           * Use bat file if it is compiled on Windows
+           */
+        app.setExecutableLocation("/bin/echo");
+
+        /*
+           * Default tmp location
+           */
+        String tempDir = "/oasis/scratch/trestles/ogce/temp_project/";
+
+     
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/opt/torque/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, trestleshpcHostAddress, appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+         /*
+        * Service Description creation and saving
+        */
+        String wrfserviceName = "WRF";
+        ServiceDescription wrfServ = new ServiceDescription();
+        wrfServ.getType().setName(wrfserviceName);
+
+        List<InputParameterType> wrfinputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> wrfoutputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType wrfinput1 = InputParameterType.Factory.newInstance();
+        wrfinput1.setParameterName("WRF_Namelist");
+        ParameterType wrfparameterType1 = wrfinput1.addNewParameterType();
+        wrfparameterType1.setType(DataType.URI);
+        wrfparameterType1.setName("URI");
+
+        InputParameterType wrfinput2 = InputParameterType.Factory.newInstance();
+        wrfinput2.setParameterName("WRF_Input_File");
+        ParameterType wrfparameterType2 = wrfinput2.addNewParameterType();
+        wrfparameterType2.setType(DataType.URI);
+        wrfparameterType2.setName("URI");
+
+        InputParameterType wrfinput3 = InputParameterType.Factory.newInstance();
+        wrfinput3.setParameterName("WRF_Boundary_File");
+        ParameterType wrfparameterType3 = wrfinput3.addNewParameterType();
+        wrfparameterType3.setType(DataType.URI);
+        wrfparameterType3.setName("URI");
+
+        OutputParameterType wrfOutput1 = OutputParameterType.Factory.newInstance();
+        wrfOutput1.setParameterName("WRF_Output");
+        ParameterType wrfoutparameterType1 = wrfOutput1.addNewParameterType();
+        wrfoutparameterType1.setType(DataType.URI);
+        wrfoutparameterType1.setName("URI");
+
+        OutputParameterType wrfOutput2 = OutputParameterType.Factory.newInstance();
+        wrfOutput2.setParameterName("WRF_Execution_Log");
+        ParameterType wrfoutparameterType2 = wrfOutput2.addNewParameterType();
+        wrfoutparameterType2.setType(DataType.URI);
+        wrfoutparameterType2.setName("URI");
+
+        wrfinputList.add(wrfinput1);
+        wrfinputList.add(wrfinput2);
+        wrfinputList.add(wrfinput3);
+        wrfoutputList.add(wrfOutput1);
+        wrfoutputList.add(wrfOutput2);
+
+        InputParameterType[] wrfinputParamList = wrfinputList.toArray(new InputParameterType[wrfinputList.size()]);
+        OutputParameterType[] wrfoutputParamList = wrfoutputList.toArray(new OutputParameterType[wrfoutputList.size()]);
+
+        wrfServ.getType().setInputParametersArray(wrfinputParamList);
+        wrfServ.getType().setOutputParametersArray(wrfoutputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(wrfServ);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+            Application descriptor creation and saving
+         */
+        ApplicationDescription wrfAppDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType wrfApp = (HpcApplicationDeploymentType) wrfAppDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName wrfName = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        wrfName.setStringValue("WRF");
+        wrfApp.setApplicationName(wrfName);
+        ProjectAccountType wrfprojectAccountType = wrfApp.addNewProjectAccount();
+        wrfprojectAccountType.setProjectAccountNumber("sds128");
+
+        QueueType wrfQueueType = wrfApp.addNewQueue();
+        wrfQueueType.setQueueName("normal");
+
+        wrfApp.setCpuCount(32);
+        wrfApp.setJobType(JobTypeType.MPI);
+        wrfApp.setNodeCount(2);
+        wrfApp.setProcessorsPerNode(1);
+        wrfApp.setMaxWallTime(30);
+        /*
+           * Use bat file if it is compiled on Windows
+           */
+        wrfApp.setExecutableLocation("/home/ogce/apps/wrf_wrapper.sh");
+
+        /*
+           * Default tmp location
+           */
+        String wrfTempDir = "/oasis/scratch/trestles/ogce/temp_project/";
+
+        wrfApp.setScratchWorkingDirectory(wrfTempDir);
+        wrfApp.setInstalledParentPath("/opt/torque/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(wrfserviceName, trestleshpcHostAddress, wrfAppDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+   
+    public void createSlurmDocs() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress(stampedeHostAddress);
+        host.getType().setHostName(stampedeHostAddress);
+        ((GsisshHostType) host.getType()).setJobManager("slurm");
+        ((GsisshHostType) host.getType()).setInstalledPath("/usr/bin/");
+        ((GsisshHostType) host.getType()).setPort(2222);
+        ((GsisshHostType) host.getType()).setMonitorMode("push");
+    
+
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "SimpleEcho3";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("echo_input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("echo_output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.STRING);
+        parameterType1.setName("String");
+
+        inputList.add(input);
+        outputList.add(output);
+
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+           Application descriptor creation and saving
+        */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue("EchoLocal");
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("TG-STA110014S");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.SERIAL);
+        app.setNodeCount(1);
+        app.setProcessorsPerNode(1);
+        app.setMaxWallTime(10);
+        /*
+        * Use bat file if it is compiled on Windows
+        */
+        app.setExecutableLocation("/bin/echo");
+
+        /*
+        * Default tmp location
+        */
+        String tempDir = "/home1/01437/ogce";
+
+
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/usr/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, stampedeHostAddress, appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+    public void createSGEDocs() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress(lonestarHostAddress);
+        host.getType().setHostName(lonestarHostAddress);
+        ((GsisshHostType) host.getType()).setJobManager("sge");
+        ((GsisshHostType) host.getType()).setInstalledPath("/opt/sge6.2/bin/lx24-amd64/");
+        ((GsisshHostType) host.getType()).setPort(22);
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "SimpleEcho4";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("echo_input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("echo_output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.STRING);
+        parameterType1.setName("String");
+
+        inputList.add(input);
+        outputList.add(output);
+
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+           Application descriptor creation and saving
+        */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue("EchoLocal");
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("TG-STA110014S");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.SERIAL);
+        app.setNodeCount(1);
+        app.setProcessorsPerNode(1);
+        app.setMaxWallTime(10);
+        /*
+        * Use bat file if it is compiled on Windows
+        */
+        app.setExecutableLocation("/bin/echo");
+
+        /*
+        * Default tmp location
+        */
+        String tempDir = "/home1/01437/ogce";
+
+
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/opt/sge6.2/bin/lx24-amd64/");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, lonestarHostAddress, appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+	public void createEchoHostDocs() {
+		String serviceName = "Echo";
+		ServiceDescription serviceDescription = new ServiceDescription();
+		List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+		List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+		serviceDescription.getType().setName(serviceName);
+		serviceDescription.getType().setDescription("Echo service");
+		// Creating input parameters
+		InputParameterType parameter = InputParameterType.Factory.newInstance();
+		parameter.setParameterName("echo_input");
+		parameter.setParameterDescription("echo input");
+		ParameterType parameterType = parameter.addNewParameterType();
+		parameterType.setType(DataType.STRING);
+		parameterType.setName("String");
+		inputParameters.add(parameter);
+
+		// Creating output parameters
+		OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
+		outputParameter.setParameterName("echo_output");
+		outputParameter.setParameterDescription("Echo output");
+		ParameterType outputParaType = outputParameter.addNewParameterType();
+		outputParaType.setType(DataType.STRING);
+		outputParaType.setName("String");
+		outputParameters.add(outputParameter);
+
+		// Setting input and output parameters to serviceDescriptor
+		serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[] {}));
+		serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[] {}));
+
+		try {
+			airavataAPI.getApplicationManager().saveServiceDescription(serviceDescription);
+		} catch (AiravataAPIInvocationException e) {
+			e.printStackTrace(); // To change body of catch statement use File |
+									// Settings | File Templates.
+		}
+		// Localhost
+		ApplicationDescription applicationDeploymentDescription = new ApplicationDescription();
+		ApplicationDeploymentDescriptionType applicationDeploymentDescriptionType = applicationDeploymentDescription.getType();
+		applicationDeploymentDescriptionType.addNewApplicationName().setStringValue(serviceName);
+		applicationDeploymentDescriptionType.setExecutableLocation("/bin/echo");
+		applicationDeploymentDescriptionType.setScratchWorkingDirectory("/tmp");
+
+		try {
+			airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, "localhost", applicationDeploymentDescription);
+		} catch (AiravataAPIInvocationException e) {
+			e.printStackTrace(); // To change body of catch statement use File |
+									// Settings | File Templates.
+		}
+		// Stampede
+		/*
+		 * Application descriptor creation and saving
+		 */
+		ApplicationDescription appDesc1 = new ApplicationDescription(HpcApplicationDeploymentType.type);
+		HpcApplicationDeploymentType app1 = (HpcApplicationDeploymentType) appDesc1.getType();
+		ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+		name.setStringValue(serviceName);
+		app1.setApplicationName(name);
+		ProjectAccountType projectAccountType = app1.addNewProjectAccount();
+		projectAccountType.setProjectAccountNumber("TG-STA110014S");
+
+		QueueType queueType = app1.addNewQueue();
+		queueType.setQueueName("normal");
+
+		app1.setCpuCount(1);
+		app1.setJobType(JobTypeType.SERIAL);
+		app1.setNodeCount(1);
+		app1.setProcessorsPerNode(1);
+		app1.setMaxWallTime(10);
+		/*
+		 * Use bat file if it is compiled on Windows
+		 */
+		app1.setExecutableLocation("/bin/echo");
+
+		/*
+		 * Default tmp location
+		 */
+		String tempDir = "/home1/01437/ogce";
+
+		app1.setScratchWorkingDirectory(tempDir);
+		app1.setInstalledParentPath("/usr/bin/");
+
+		try {
+			airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, stampedeHostAddress, appDesc1);
+		} catch (AiravataAPIInvocationException e) {
+			e.printStackTrace(); // To change body of catch statement use File |
+									// Settings | File Templates.
+		}
+		// Trestles
+		/*
+		 * Application descriptor creation and saving
+		 */
+		ApplicationDescription appDesc2 = new ApplicationDescription(HpcApplicationDeploymentType.type);
+		HpcApplicationDeploymentType app2 = (HpcApplicationDeploymentType) appDesc2.getType();
+		ApplicationDeploymentDescriptionType.ApplicationName name2 = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+		name2.setStringValue(serviceName);
+		app2.setApplicationName(name);
+		ProjectAccountType projectAccountType2 = app2.addNewProjectAccount();
+		projectAccountType2.setProjectAccountNumber("sds128");
+
+		QueueType queueType2 = app2.addNewQueue();
+		queueType2.setQueueName("normal");
+
+		app2.setCpuCount(1);
+		app2.setJobType(JobTypeType.SERIAL);
+		app2.setNodeCount(1);
+		app2.setProcessorsPerNode(1);
+		app2.setMaxWallTime(10);
+		/*
+		 * Use bat file if it is compiled on Windows
+		 */
+		app2.setExecutableLocation("/bin/echo");
+
+		/*
+		 * Default tmp location
+		 */
+		String tempDir2 = "/home/ogce/scratch";
+
+		app2.setScratchWorkingDirectory(tempDir2);
+		app2.setInstalledParentPath("/opt/torque/bin/");
+
+		try {
+			airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, trestleshpcHostAddress, appDesc2);
+		} catch (AiravataAPIInvocationException e) {
+			e.printStackTrace(); // To change body of catch statement use File |
+									// Settings | File Templates.
+		}
+		// Lonestar
+		/*
+		 * Application descriptor creation and saving
+		 */
+		ApplicationDescription appDesc3 = new ApplicationDescription(HpcApplicationDeploymentType.type);
+		HpcApplicationDeploymentType app3 = (HpcApplicationDeploymentType) appDesc3.getType();
+		ApplicationDeploymentDescriptionType.ApplicationName name3 = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+		name3.setStringValue(serviceName);
+		app3.setApplicationName(name);
+		ProjectAccountType projectAccountType3 = app3.addNewProjectAccount();
+		projectAccountType3.setProjectAccountNumber("TG-STA110014S");
+
+		QueueType queueType3 = app3.addNewQueue();
+		queueType3.setQueueName("normal");
+
+		app3.setCpuCount(1);
+		app3.setJobType(JobTypeType.SERIAL);
+		app3.setNodeCount(1);
+		app3.setProcessorsPerNode(1);
+		app3.setMaxWallTime(10);
+		/*
+		 * Use bat file if it is compiled on Windows
+		 */
+		app3.setExecutableLocation("/bin/echo");
+
+		/*
+		 * Default tmp location
+		 */
+		String tempDir3 = "/home1/01437/ogce";
+
+		app3.setScratchWorkingDirectory(tempDir3);
+		app3.setInstalledParentPath("/opt/sge6.2/bin/lx24-amd64/");
+
+		try {
+			airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, lonestarHostAddress, appDesc3);
+		} catch (AiravataAPIInvocationException e) {
+			e.printStackTrace(); // To change body of catch statement use File |
+									// Settings | File Templates.
+		}
+
+	}
+    public AiravataAPI getAiravataAPI() {
+        return airavataAPI;
+    }
+
+    public void setAiravataAPI(AiravataAPI airavataAPI) {
+        this.airavataAPI = airavataAPI;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
index 78edf60..4166e1e 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
@@ -49,7 +49,10 @@ public abstract class AbstractResource implements Resource {
     public static final String APPLICATION_OUTPUT = "ApplicationOutput";
     public static final String GATEWAY_PROFILE = "GatewayProfile";
     public static final String COMPUTE_RESOURCE_PREFERENCE = "ComputeResourcePreference";
-
+	public static final String BATCH_QUEUE = "BatchQueue";
+	public static final String COMPUTE_RESOURCE_FILE_SYSTEM = "ComputeResourceFileSystem";
+	public static final String JOB_SUBMISSION_INTERFACE = "JobSubmissionInterface";
+	
     // Compute Resource Table
     public final class ComputeResourceConstants {
         public static final String RESOURCE_ID = "resourceID";
@@ -226,5 +229,29 @@ public abstract class AbstractResource implements Resource {
         public static final String ALLOCATION_PROJECT_NUMBER = "projectNumber";
     }
 
-
+    // Batch Queue Table
+ 	public final class BatchQueueConstants {
+ 		public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+ 		public static final String MAX_RUNTIME = "maxRuntime";
+ 		public static final String MAX_JOB_IN_QUEUE = "maxJobInQueue";
+ 		public static final String QUEUE_DESCRIPTION = "queueDescription";
+ 		public static final String QUEUE_NAME = "queueName";
+ 		public static final String MAX_PROCESSORS = "maxProcessors";
+ 		public static final String MAX_NODES = "maxNodes";
+ 	}
+ 	
+	// Compute Resource File System Table
+	public final class ComputeResourceFileSystemConstants {
+		public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+		public static final String PATH = "path";
+		public static final String FILE_SYSTEM = "fileSystem";
+	}
+	
+	// Job Submission Interface Table
+	public final class JobSubmissionInterfaceConstants {
+		public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
+		public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
+		public static final String JOB_SUBMISSION_PROTOCOL = "jobSubmissionProtocol";
+		public static final String PRIORITY_ORDER = "priorityOrder";
+	}
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java
index 84f6889..356c743 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/ApplicationInputResource.java
@@ -240,34 +240,28 @@ public class ApplicationInputResource extends AbstractResource {
             em = AppCatalogJPAUtils.getEntityManager();
             ApplicationInput existingApplicationInput = em.find(ApplicationInput.class, new AppInput_PK(interfaceID, inputKey));
             em.close();
-
+            ApplicationInput applicationInput;
             em = AppCatalogJPAUtils.getEntityManager();
             em.getTransaction().begin();
-            if (existingApplicationInput != null) {
-                existingApplicationInput.setInterfaceID(interfaceID);
-                ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
-                existingApplicationInput.setApplicationInterface(applicationInterface);
-                existingApplicationInput.setDataType(dataType);
-                existingApplicationInput.setInputKey(inputKey);
-                existingApplicationInput.setInputVal(inputVal);
-                existingApplicationInput.setMetadata(metadata);
-                existingApplicationInput.setAppArgument(appArgument);
-                existingApplicationInput.setUserFriendlyDesc(userFriendlyDesc);
-                existingApplicationInput.setStandardInput(standareInput);
-                em.merge(existingApplicationInput);
+            if (existingApplicationInput == null) {
+                applicationInput = new ApplicationInput();
             } else {
-                ApplicationInput applicationInput = new ApplicationInput();
-                applicationInput.setInterfaceID(interfaceID);
-                ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
-                applicationInput.setApplicationInterface(applicationInterface);
-                applicationInput.setDataType(dataType);
-                applicationInput.setInputKey(inputKey);
-                applicationInput.setInputVal(inputVal);
-                applicationInput.setMetadata(metadata);
-                applicationInput.setAppArgument(appArgument);
-                applicationInput.setUserFriendlyDesc(userFriendlyDesc);
-                applicationInput.setStandardInput(standareInput);
+            	applicationInput=existingApplicationInput;
+            }
+            applicationInput.setInterfaceID(interfaceID);
+            ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
+            applicationInput.setApplicationInterface(applicationInterface);
+            applicationInput.setDataType(dataType);
+            applicationInput.setInputKey(inputKey);
+            applicationInput.setInputVal(inputVal);
+            applicationInput.setMetadata(metadata);
+            applicationInput.setAppArgument(appArgument);
+            applicationInput.setUserFriendlyDesc(userFriendlyDesc);
+            applicationInput.setStandardInput(standareInput);
+            if (existingApplicationInput == null) {
                 em.persist(applicationInput);
+            } else {
+                em.merge(applicationInput);
             }
             em.getTransaction().commit();
             em.close();

http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
index 160083a..4d6fe9b 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
@@ -21,18 +21,76 @@
 
 package org.apache.aiaravata.application.catalog.data.util;
 
-import org.apache.aiaravata.application.catalog.data.model.*;
-import org.apache.aiaravata.application.catalog.data.resources.*;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.Persistence;
-import java.util.HashMap;
-import java.util.Map;
+
+import org.apache.aiaravata.application.catalog.data.model.AppEnvironment;
+import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationInput;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
+import org.apache.aiaravata.application.catalog.data.model.ApplicationOutput;
+import org.apache.aiaravata.application.catalog.data.model.BatchQueue;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem;
+import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference;
+import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocol;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHExport;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHPostJobCommand;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHPreJobCommand;
+import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
+import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
+import org.apache.aiaravata.application.catalog.data.model.GlobusGKEndpoint;
+import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
+import org.apache.aiaravata.application.catalog.data.model.GridFTPDMEndpoint;
+import org.apache.aiaravata.application.catalog.data.model.GridFTPDataMovement;
+import org.apache.aiaravata.application.catalog.data.model.HostAlias;
+import org.apache.aiaravata.application.catalog.data.model.HostIPAddress;
+import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface;
+import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocol;
+import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath;
+import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath;
+import org.apache.aiaravata.application.catalog.data.model.SCPDataMovement;
+import org.apache.aiaravata.application.catalog.data.model.SSHSubmission;
+import org.apache.aiaravata.application.catalog.data.resources.AppDeploymentResource;
+import org.apache.aiaravata.application.catalog.data.resources.AppEnvironmentResource;
+import org.apache.aiaravata.application.catalog.data.resources.AppInterfaceResource;
+import org.apache.aiaravata.application.catalog.data.resources.AppModuleMappingResource;
+import org.apache.aiaravata.application.catalog.data.resources.AppModuleResource;
+import org.apache.aiaravata.application.catalog.data.resources.ApplicationInputResource;
+import org.apache.aiaravata.application.catalog.data.resources.ApplicationOutputResource;
+import org.apache.aiaravata.application.catalog.data.resources.BatchQueueResource;
+import org.apache.aiaravata.application.catalog.data.resources.ComputeHostPreferenceResource;
+import org.apache.aiaravata.application.catalog.data.resources.ComputeHostResource;
+import org.apache.aiaravata.application.catalog.data.resources.ComputeResourceFileSystemResource;
+import org.apache.aiaravata.application.catalog.data.resources.DataMovementProtocolResource;
+import org.apache.aiaravata.application.catalog.data.resources.GSISSHExportResource;
+import org.apache.aiaravata.application.catalog.data.resources.GSISSHPostJobCommandResource;
+import org.apache.aiaravata.application.catalog.data.resources.GSISSHPreJobCommandResource;
+import org.apache.aiaravata.application.catalog.data.resources.GSISSHSubmissionResource;
+import org.apache.aiaravata.application.catalog.data.resources.GatewayProfileResource;
+import org.apache.aiaravata.application.catalog.data.resources.GlobusGKEndpointResource;
+import org.apache.aiaravata.application.catalog.data.resources.GlobusJobSubmissionResource;
+import org.apache.aiaravata.application.catalog.data.resources.GridFTPDMEndpointResource;
+import org.apache.aiaravata.application.catalog.data.resources.GridFTPDataMovementResource;
+import org.apache.aiaravata.application.catalog.data.resources.HostAliasResource;
+import org.apache.aiaravata.application.catalog.data.resources.HostIPAddressResource;
+import org.apache.aiaravata.application.catalog.data.resources.JobSubmissionInterfaceResource;
+import org.apache.aiaravata.application.catalog.data.resources.JobSubmissionProtocolResource;
+import org.apache.aiaravata.application.catalog.data.resources.LibraryApendPathResource;
+import org.apache.aiaravata.application.catalog.data.resources.LibraryPrepandPathResource;
+import org.apache.aiaravata.application.catalog.data.resources.Resource;
+import org.apache.aiaravata.application.catalog.data.resources.SCPDataMovementResource;
+import org.apache.aiaravata.application.catalog.data.resources.SSHSubmissionResource;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AppCatalogJPAUtils {
     private final static Logger logger = LoggerFactory.getLogger(AppCatalogJPAUtils.class);
@@ -267,12 +325,64 @@ public class AppCatalogJPAUtils {
                     logger.error("Object should be a ApplicationInput.", new IllegalArgumentException());
                     throw new IllegalArgumentException("Object should be a ApplicationInput.");
                 }
+            case BATCH_QUEUE:
+				if (o instanceof BatchQueue){
+					return createBatchQueue((BatchQueue) o);
+				}else{
+					logger.error("Object should be a Batch Queue.", new IllegalArgumentException());
+					throw new IllegalArgumentException("Object should be a Batch Queue.");
+				}
+            case COMPUTE_RESOURCE_FILE_SYSTEM:
+				if (o instanceof ComputeResourceFileSystem){
+					return createComputeResourceFileSystem((ComputeResourceFileSystem) o);
+				}else{
+					logger.error("Object should be a Compute Resource File System.", new IllegalArgumentException());
+					throw new IllegalArgumentException("Object should be a Compute Resource File System.");
+				}
+            case JOB_SUBMISSION_INTERFACE:
+				if (o instanceof JobSubmissionInterface){
+					return createJobSubmissionInterface((JobSubmissionInterface) o);
+				}else{
+					logger.error("Object should be a Job Submission Interface.", new IllegalArgumentException());
+					throw new IllegalArgumentException("Object should be a Job Submission Interface.");
+				}
             default:
                 logger.error("Illegal data type..", new IllegalArgumentException());
                 throw new IllegalArgumentException("Illegal data type..");
         }
     }
-
+    
+    private static Resource createJobSubmissionInterface(JobSubmissionInterface o) {
+		JobSubmissionInterfaceResource jobSubmissionInterfaceResource = new JobSubmissionInterfaceResource();
+		jobSubmissionInterfaceResource.setJobSubmissionInterfaceId(o.getJobSubmissionInterfaceId());
+		jobSubmissionInterfaceResource.setComputeResourceId(o.getComputeResourceId());
+		jobSubmissionInterfaceResource.setComputeHostResource((ComputeHostResource)createComputeResource(o.getComputeResource()));
+		jobSubmissionInterfaceResource.setJobSubmissionProtocol(o.getJobSubmissionProtocol());
+		jobSubmissionInterfaceResource.setPriorityOrder(o.getPriorityOrder());
+		return jobSubmissionInterfaceResource;
+	}
+    
+    private static Resource createComputeResourceFileSystem(ComputeResourceFileSystem o) {
+		ComputeResourceFileSystemResource computeResourceFileSystemResource = new ComputeResourceFileSystemResource();
+		computeResourceFileSystemResource.setComputeResourceId(o.getComputeResourceId());
+		computeResourceFileSystemResource.setComputeHostResource((ComputeHostResource)createComputeResource(o.getComputeResource()));
+		computeResourceFileSystemResource.setPath(o.getPath());
+		computeResourceFileSystemResource.setFileSystem(o.getFileSystem());
+		return computeResourceFileSystemResource;
+	}
+    
+    private static Resource createBatchQueue(BatchQueue o) {
+		BatchQueueResource batchQueueResource = new BatchQueueResource();
+		batchQueueResource.setComputeResourceId(o.getComputeResourceId());
+		batchQueueResource.setComputeHostResource((ComputeHostResource)createComputeResource(o.getComputeResource()));
+		batchQueueResource.setMaxRuntime(o.getMaxRuntime());
+		batchQueueResource.setMaxJobInQueue(o.getMaxJobInQueue());
+		batchQueueResource.setQueueDescription(o.getQueueDescription());
+		batchQueueResource.setQueueName(o.getQueueName());
+		batchQueueResource.setMaxProcessors(o.getMaxProcessors());
+		batchQueueResource.setMaxNodes(o.getMaxNodes());
+		return batchQueueResource;
+	}
     private static Resource createComputeResource(ComputeResource o) {
         ComputeHostResource hostResource = new ComputeHostResource();
         hostResource.setResoureId(o.getResourceID());

http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
index 174dfa5..e8ee430 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogResourceType.java
@@ -47,5 +47,8 @@ public enum AppCatalogResourceType {
     APPLICATION_INPUT,
     APPLICATION_OUTPUT,
     GATEWAY_PROFILE,
-    COMPUTE_RESOURCE_PREFERENCE
+    COMPUTE_RESOURCE_PREFERENCE,
+	BATCH_QUEUE,
+	COMPUTE_RESOURCE_FILE_SYSTEM,
+	JOB_SUBMISSION_INTERFACE
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml b/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
index c7ca38d..da522a9 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/META-INF/persistence.xml
@@ -49,6 +49,10 @@
         <class>org.apache.aiaravata.application.catalog.data.model.ApplicationOutput</class>
         <class>org.apache.aiaravata.application.catalog.data.model.GatewayProfile</class>
         <class>org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference</class>
+        <class>org.apache.aiaravata.application.catalog.data.model.BatchQueue</class>
+        <class>org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem</class>
+        <class>org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface</class>
+        <class>org.apache.aiaravata.application.catalog.data.model.BatchQueue</class>
         <exclude-unlisted-classes>true</exclude-unlisted-classes>
     </persistence-unit>
 </persistence>

http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
index 765c50b..c111759 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
@@ -255,7 +255,37 @@ CREATE TABLE COMPUTE_RESOURCE_PREFERENCE
         FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE
 );
 
+CREATE TABLE BATCH_QUEUE
+(
+	COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL,
+	MAX_RUNTIME INTEGER,
+	MAX_JOB_IN_QUEUE INTEGER,
+	QUEUE_DESCRIPTION VARCHAR(255),
+	QUEUE_NAME VARCHAR(255) NOT NULL,
+	MAX_PROCESSORS INTEGER,
+	MAX_NODES INTEGER,
+	PRIMARY KEY (COMPUTE_RESOURCE_ID,QUEUE_NAME),
+	FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
 
+CREATE TABLE COMPUTE_RESOURCE_FILE_SYSTEM
+(
+	COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+	PATH VARCHAR (255),
+	FILE_SYSTEM VARCHAR (255) NOT NULL,
+	PRIMARY KEY (COMPUTE_RESOURCE_ID,FILE_SYSTEM),
+	FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_SUBMISSION_INTERFACE
+(
+	JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
+	COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+	JOB_SUBMISSION_PROTOCOL VARCHAR (255) NOT NULL,
+	PRIORITY_ORDER INTEGER,
+	PRIMARY KEY (COMPUTE_RESOURCE_ID,JOB_SUBMISSION_INTERFACE_ID),
+	FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
 
 
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2c32d42b/modules/registry/jpa-gen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/pom.xml b/modules/registry/jpa-gen/pom.xml
new file mode 100644
index 0000000..ee9e0ea
--- /dev/null
+++ b/modules/registry/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>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/2c32d42b/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java
new file mode 100644
index 0000000..7e760e1
--- /dev/null
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/BatchQueueGenerator.java
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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;
+
+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();
+		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();
+		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/2c32d42b/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.java
new file mode 100644
index 0000000..b3194e4
--- /dev/null
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/FileSystemsGenerator.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;
+
+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();
+		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();
+		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/2c32d42b/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java b/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.java
new file mode 100644
index 0000000..f556e51
--- /dev/null
+++ b/modules/registry/jpa-gen/src/main/java/appcatalog/JobSubmissionInterfaceGenerator.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;
+
+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();
+		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();
+		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/2c32d42b/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
new file mode 100644
index 0000000..b4fb643
--- /dev/null
+++ b/modules/registry/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);
+	}
+}


Mime
View raw message