airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1432179 - in /airavata/trunk/modules: registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ registry/aira...
Date Fri, 11 Jan 2013 17:35:26 GMT
Author: chathuri
Date: Fri Jan 11 17:35:26 2013
New Revision: 1432179

URL: http://svn.apache.org/viewvc?rev=1432179&view=rev
Log:
adding category_id field to configuration table

Modified:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
    airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
Fri Jan 11 17:35:26 2013
@@ -286,8 +286,10 @@ public class ResourceUtils {
 
     public static boolean isConfigurationExists(String configKey, String configVal){
         try{
+            //Currently categoryID is hardcoded value
+            String categoryID = "SYSTEM";
             EntityManager em = ResourceUtils.getEntityManager();
-            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey,
configVal));
+            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey,
configVal, categoryID));
             em.close();
             return existing!= null;
         } catch (Exception e){

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
Fri Jan 11 17:35:26 2013
@@ -31,6 +31,8 @@ public class Configuration implements Se
     private String config_key;
     @Id
     private String config_val;
+    @Id
+    private String category_id;
     private Timestamp expire_date;
 
     public String getConfig_key() {
@@ -56,4 +58,12 @@ public class Configuration implements Se
     public void setExpire_date(Timestamp expire_date) {
         this.expire_date = expire_date;
     }
+
+    public String getCategory_id() {
+        return category_id;
+    }
+
+    public void setCategory_id(String category_id) {
+        this.category_id = category_id;
+    }
 }

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java
Fri Jan 11 17:35:26 2013
@@ -24,10 +24,12 @@ package org.apache.airavata.persistance.
 public class Configuration_PK {
     private String config_key;
     private String config_val;
+    private String category_id;
 
-    public Configuration_PK(String config_key, String config_val) {
+    public Configuration_PK(String config_key, String config_val, String category_id) {
         this.config_key = config_key;
         this.config_val = config_val;
+        this.category_id = category_id;
     }
 
     public Configuration_PK() {
@@ -59,4 +61,12 @@ public class Configuration_PK {
     public String getConfig_val() {
         return config_val;
     }
+
+    public String getCategory_id() {
+        return category_id;
+    }
+
+    public void setCategory_id(String category_id) {
+        this.category_id = category_id;
+    }
 }

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
Fri Jan 11 17:35:26 2013
@@ -42,6 +42,7 @@ public class ConfigurationResource exten
     private String configKey;
     private String configVal;
     private Timestamp expireDate;
+    private String categoryID = "SYSTEM";
 
     public ConfigurationResource() {
     }
@@ -156,7 +157,7 @@ public class ConfigurationResource exten
         try {
             EntityManager em = ResourceUtils.getEntityManager();
             //whether existing
-            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey,
configVal));
+            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey,
configVal, categoryID));
             em.close();
 
             em = ResourceUtils.getEntityManager();
@@ -165,8 +166,10 @@ public class ConfigurationResource exten
             configuration.setConfig_key(configKey);
             configuration.setConfig_val(configVal);
             configuration.setExpire_date(expireDate);
+            configuration.setCategory_id(categoryID);
             if (existing != null) {
                 existing.setExpire_date(expireDate);
+                existing.setCategory_id(categoryID);
                 configuration = em.merge(existing);
             } else {
                 em.merge(configuration);
@@ -217,4 +220,12 @@ public class ConfigurationResource exten
     public void setConfigVal(String configVal) {
         this.configVal = configVal;
     }
+
+    public String getCategoryID() {
+        return categoryID;
+    }
+
+    public void setCategoryID(String categoryID) {
+        this.categoryID = categoryID;
+    }
 }

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
Fri Jan 11 17:35:26 2013
@@ -338,6 +338,7 @@ public class Utils {
         configurationResource.setConfigKey(o.getConfig_key());
         configurationResource.setConfigVal(o.getConfig_val());
         configurationResource.setExpireDate(o.getExpire_date());
+        configurationResource.setCategoryID(o.getCategory_id());
         return configurationResource;
     }
 

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
Fri Jan 11 17:35:26 2013
@@ -31,7 +31,8 @@ create table Configuration
         config_key varchar(255),
         config_val varchar(255),
         expire_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-        PRIMARY KEY(config_key, config_val)
+        category_id varchar (255),
+        PRIMARY KEY(config_key, config_val, category_id)
 );
 
 create table Users

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
Fri Jan 11 17:35:26 2013
@@ -30,7 +30,8 @@ create table Configuration
         config_key varchar(255),
         config_val varchar(255),
         expire_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-        PRIMARY KEY(config_key, config_val)
+        category_id varchar (255),
+        PRIMARY KEY(config_key, config_val, category_id)
 );
 
 create table Users

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
Fri Jan 11 17:35:26 2013
@@ -44,6 +44,7 @@ public class ConfigurationResourceTest e
         java.util.Date d = calender.getTime();
         Timestamp currentTime = new Timestamp(d.getTime());
         configuration.setExpireDate(currentTime);
+        configuration.setCategoryID("SYSTEM");
         configuration.save();
 
         assertTrue("Configuration Save succuessful", ResourceUtils.isConfigurationExist("testConfigKey"));

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
Fri Jan 11 17:35:26 2013
@@ -31,7 +31,8 @@ create table Configuration
         config_key varchar(255),
         config_val varchar(255),
         expire_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-        PRIMARY KEY(config_key, config_val)
+        category_id varchar (255),
+        PRIMARY KEY(config_key, config_val, category_id)
 );
 
 create table Users

Modified: airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
(original)
+++ airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
Fri Jan 11 17:35:26 2013
@@ -31,7 +31,8 @@ create table Configuration
         config_key varchar(255),
         config_val varchar(255),
         expire_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-        PRIMARY KEY(config_key, config_val)
+        category_id varchar (255),
+        PRIMARY KEY(config_key, config_val, category_id)
 );
 
 create table Users

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java Fri
Jan 11 17:35:26 2013
@@ -202,6 +202,9 @@ public class XBaya {
                     String registryURL = args[index];
                     try {
                         this.config.setRegistryURL(parseURL(registryURL));
+                        // we need to give preference when a user set registry url from the
+                        // command line
+                        this.config.setRegURLSetByCMD(true);
                     } catch (URISyntaxException e) {
                         String message = "The message box URL is in wrong format: " + registryURL;
                         logger.warn(message, e);

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
Fri Jan 11 17:35:26 2013
@@ -143,6 +143,8 @@ public class XBayaConfiguration extends 
     private XBayaExecutionMode xbayaExecutionMode=XBayaExecutionMode.IDE;
     
     private List<XBayaExecutionModeListener> xbayaExecutionModeChangeListners=new ArrayList<XBayaExecutionModeListener>();
+
+    private boolean regURLSetByCMD = false;
     
     public enum XBayaExecutionMode{
     	IDE,
@@ -915,6 +917,14 @@ public class XBayaConfiguration extends 
 		this.jcrComponentRegistry = jcrComponentRegistry;
 	}
 
+    public boolean isRegURLSetByCMD() {
+        return regURLSetByCMD;
+    }
+
+    public void setRegURLSetByCMD(boolean regURLSetByCMD) {
+        this.regURLSetByCMD = regURLSetByCMD;
+    }
+
     //    public AiravataAPI setAiravataAPI() {
 //        try{
 //            URI baseUri = new URI(ResourcePathConstants.BASE_URL);

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java?rev=1432179&r1=1432178&r2=1432179&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
Fri Jan 11 17:35:26 2013
@@ -168,7 +168,9 @@ public class RegistryWindow {
         this.usernameTextField = new XBayaTextField();
         this.passwordTextField = new JPasswordField();
         try {
-            if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_REGISTRY_URL)){
+            if (engine.getConfiguration().isRegURLSetByCMD()){
+                this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
+            } else if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_REGISTRY_URL)){
                 this.urlTextField.setText(ClientSettings.getSetting(XBayaConstants.XBAYA_REGISTRY_URL));
             }  else {
                 this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());



Mime
View raw message