You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ad...@apache.org on 2017/04/13 18:47:50 UTC
[2/6] airavata git commit: Adding common utils methods to worker core
Adding common utils methods to worker core
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e1ff08b6
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e1ff08b6
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e1ff08b6
Branch: refs/heads/feature-workload-mgmt
Commit: e1ff08b6787a964e6c92002e562e555755367b82
Parents: 4248419
Author: Ajinkya Dhamnaskar <ad...@apache.org>
Authored: Thu Apr 13 14:35:28 2017 -0400
Committer: Ajinkya Dhamnaskar <ad...@apache.org>
Committed: Thu Apr 13 14:35:28 2017 -0400
----------------------------------------------------------------------
.../airavata/worker/core/utils/WorkerUtils.java | 21 ++++++++++++++++++++
1 file changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/e1ff08b6/modules/worker/worker-core/src/main/java/org/apache/airavata/worker/core/utils/WorkerUtils.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-core/src/main/java/org/apache/airavata/worker/core/utils/WorkerUtils.java b/modules/worker/worker-core/src/main/java/org/apache/airavata/worker/core/utils/WorkerUtils.java
index ef11c20..a53d736 100644
--- a/modules/worker/worker-core/src/main/java/org/apache/airavata/worker/core/utils/WorkerUtils.java
+++ b/modules/worker/worker-core/src/main/java/org/apache/airavata/worker/core/utils/WorkerUtils.java
@@ -1,6 +1,11 @@
package org.apache.airavata.worker.core.utils;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
import org.apache.airavata.messaging.core.MessageContext;
import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType;
import org.apache.airavata.model.commons.ErrorModel;
@@ -211,4 +216,20 @@ public class WorkerUtils {
return null;
}
}
+
+ public static CredentialReader getCredentialReader()
+ throws ApplicationSettingsException, IllegalAccessException,
+ InstantiationException {
+ try {
+ String jdbcUrl = ServerSettings.getCredentialStoreDBURL();
+ String jdbcUsr = ServerSettings.getCredentialStoreDBUser();
+ String jdbcPass = ServerSettings.getCredentialStoreDBPassword();
+ String driver = ServerSettings.getCredentialStoreDBDriver();
+ return new CredentialReaderImpl(new DBUtil(jdbcUrl, jdbcUsr, jdbcPass,
+ driver));
+ } catch (ClassNotFoundException e) {
+ logger.error("Not able to find driver: " + e.getLocalizedMessage());
+ return null;
+ }
+ }
}