airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hes...@apache.org
Subject svn commit: r1297224 - /incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java
Date Mon, 05 Mar 2012 20:40:18 GMT
Author: heshan
Date: Mon Mar  5 20:40:18 2012
New Revision: 1297224

URL: http://svn.apache.org/viewvc?rev=1297224&view=rev
Log:
AIRAVATA-309 improving a util method.

Modified:
    incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java

Modified: incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java?rev=1297224&r1=1297223&r2=1297224&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java
(original)
+++ incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java
Mon Mar  5 20:40:18 2012
@@ -214,14 +214,47 @@ public class MigrationUtil {
      */
     public static ApplicationDeploymentDescription createAppDeploymentDescription(String
applicationName, ApplicationBean appBean) {
         ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription();
-        ApplicationDeploymentDescriptionType app = appDesc.getType();
-        ApplicationDeploymentDescriptionType.ApplicationName name =
-                ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
-        name.setStringValue(applicationName);
-
-        app.setApplicationName(name);
-        app.setExecutableLocation(appBean.getExecutable());
-        app.setScratchWorkingDirectory(appBean.getTmpDir());
+
+        if(appBean.getJobType() != null) {
+            appDesc.getType().changeType(GramApplicationDeploymentType.type);
+            GramApplicationDeploymentType gram = (GramApplicationDeploymentType) appDesc.getType();
+            ApplicationDeploymentDescriptionType.ApplicationName name =
+                    ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+            name.setStringValue(applicationName);
+
+            gram.setApplicationName(name);
+            gram.setExecutableLocation(appBean.getExecutable());
+            gram.setScratchWorkingDirectory(appBean.getTmpDir());
+
+            gram.setJobType(getJobTypeEnum(appBean.getJobType()));
+            // TODO : verify the following
+            ProjectAccountType projectAccount;
+            if(gram.getProjectAccount() != null) {
+                projectAccount = gram.getProjectAccount();
+            } else {
+                projectAccount = gram.addNewProjectAccount();
+            }
+            projectAccount.setProjectAccountNumber(appBean.getProjectName());
+            projectAccount.setProjectAccountDescription(appBean.getPcount().toString());
+
+            QueueType queueName;
+            if(gram.getQueue() != null) {
+                queueName = gram.getQueue();
+            } else {
+                queueName = gram.addNewQueue();
+            }
+            queueName.setQueueName(appBean.getQueue());
+
+        } else {
+            ApplicationDeploymentDescriptionType app = appDesc.getType();
+            ApplicationDeploymentDescriptionType.ApplicationName name =
+                    ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+            name.setStringValue(applicationName);
+
+            app.setApplicationName(name);
+            app.setExecutableLocation(appBean.getExecutable());
+            app.setScratchWorkingDirectory(appBean.getTmpDir());
+        }
         return appDesc;
     }
 



Mime
View raw message