airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1484595 - in /airavata/trunk/modules: distribution/airavata-server/src/main/resources/conf/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ registry/airavata-jpa-registry/src/main/java/org/apache/...
Date Mon, 20 May 2013 21:05:13 GMT
Author: lahiru
Date: Mon May 20 21:05:13 2013
New Revision: 1484595

URL: http://svn.apache.org/r1484595
Log:
allowing users to give jpa connectionproperties in airavata-server.properties file.

Modified:
    airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java
    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/resources/Utils.java
    airavata/trunk/modules/rest/webapp/src/main/resources/airavata-server.properties

Modified: airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties?rev=1484595&r1=1484594&r2=1484595&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
(original)
+++ airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
Mon May 20 21:05:13 2013
@@ -60,6 +60,7 @@ default.registry.password=admin
 default.registry.password.hash.method=SHA
 default.registry.gateway=default
 validationQuery=SELECT 1 from Configuration
+jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
 #for rest [RegistryClient]
 #registry.jdbc.url=http://localhost:9080/airavata-services
 

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java?rev=1484595&r1=1484594&r2=1484595&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java
Mon May 20 21:05:13 2013
@@ -28,4 +28,5 @@ public class JPAConstants {
 	public static final String KEY_JDBC_DRIVER = "registry.jdbc.driver";
 	public static final String KEY_DERBY_START_ENABLE = "start.derby.server.mode";
     public static final String VALIDATION_QUERY = "validationQuery";
+    public static final String CONNECTION_JPA_PROPERTY = "jpa.connection.properties";
 }

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=1484595&r1=1484594&r2=1484595&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
Mon May 20 21:05:13 2013
@@ -46,8 +46,8 @@ public class ResourceUtils {
     public static EntityManager getEntityManager(){
         if (factory == null) {
             String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + ","
+ "Url=" + Utils.getJDBCURL() + "," +
-                    "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword()
+ ",MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,validationQuery=" +
-            Utils.getValidationQuery() + ",testWhileIdle=true,testOnBorrow=true";
+                    "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword()
+ ",validationQuery=" +
+            Utils.getValidationQuery() + "," + Utils.getJPAConnectionProperties();
             System.out.println(connectionProperties);
             Map<String, String> properties = new HashMap<String, String>();
             properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");

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=1484595&r1=1484594&r2=1484595&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
Mon May 20 21:05:13 2013
@@ -144,6 +144,25 @@ public class Utils {
             return null;
 		}
     }
+
+     public static String getJPAConnectionProperties(){
+    	try {
+			if (getProvider()!=null){
+                if(getProvider().getValue(JPAConstants.CONNECTION_JPA_PROPERTY) != null){
+				    return getProvider().getValue(JPAConstants.CONNECTION_JPA_PROPERTY).toString();
+                }
+			} else {
+                if(getProvider().getValue(JPAConstants.CONNECTION_JPA_PROPERTY) != null){
+                    return RegistrySettings.getSetting(JPAConstants.CONNECTION_JPA_PROPERTY);
+                }
+            }
+            return "";
+		} catch (RegistrySettingsException e) {
+            logger.error(e.getMessage(), e);
+            return null;
+		}
+    }
+
     public static String getJDBCPassword(){
     	try {
 			if (getProvider()!=null){

Modified: airavata/trunk/modules/rest/webapp/src/main/resources/airavata-server.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/webapp/src/main/resources/airavata-server.properties?rev=1484595&r1=1484594&r2=1484595&view=diff
==============================================================================
--- airavata/trunk/modules/rest/webapp/src/main/resources/airavata-server.properties (original)
+++ airavata/trunk/modules/rest/webapp/src/main/resources/airavata-server.properties Mon May
20 21:05:13 2013
@@ -60,6 +60,7 @@ default.registry.password=admin
 default.registry.password.hash.method=SHA
 default.registry.gateway=default
 validationQuery=SELECT 1 from Configuration
+jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
 #for rest [RegistryClient]
 #registry.jdbc.url=http://localhost:9080/airavata-services
 



Mime
View raw message