airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject airavata git commit: Adding DBEventManagerRunner to server start
Date Tue, 11 Jul 2017 17:34:20 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop d03c72402 -> e72ddf0b3


Adding DBEventManagerRunner to server start


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

Branch: refs/heads/develop
Commit: e72ddf0b3b2060356618c10113d4356219708317
Parents: d03c724
Author: Marcus Christie <machristie@apache.org>
Authored: Tue Jul 11 11:34:35 2017 -0500
Committer: Marcus Christie <machristie@apache.org>
Committed: Tue Jul 11 12:28:02 2017 -0500

----------------------------------------------------------------------
 .../templates/airavata-server.properties.j2     |  5 ++
 .../templates/airavata-server.properties.j2     |  5 ++
 .../main/resources/airavata-server.properties   |  7 +-
 modules/db-event-manager/pom.xml                |  2 +-
 .../db/event/manager/DBEventManagerRunner.java  | 67 +++++++++++++++++++-
 modules/distribution/pom.xml                    |  5 ++
 .../org/apache/airavata/server/ServerMain.java  |  4 +-
 pom.xml                                         |  1 +
 8 files changed, 92 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2 b/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2
index 2e87706..ab0ee9f 100644
--- a/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2
+++ b/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2
@@ -328,3 +328,8 @@ iam.server.url={{ iam_server_url }}
 new.gateway.admin.temp.password=Password@123
 iam.server.super.admin.username={{ iam_server_super_admin_username }}
 iam.server.super.admin.password={{ iam_server_super_admin_password }}
+
+###########################################################################
+# DB Event Manager Runner
+###########################################################################
+db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner

http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/dev-tools/ansible/roles/gfac/templates/airavata-server.properties.j2
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/roles/gfac/templates/airavata-server.properties.j2 b/dev-tools/ansible/roles/gfac/templates/airavata-server.properties.j2
index c1d5388..0ed4071 100644
--- a/dev-tools/ansible/roles/gfac/templates/airavata-server.properties.j2
+++ b/dev-tools/ansible/roles/gfac/templates/airavata-server.properties.j2
@@ -295,3 +295,8 @@ trust.store.password=airavata
 authz.cache.enabled=true
 authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager
 in.memory.cache.size=1000
+
+###########################################################################
+# DB Event Manager Runner
+###########################################################################
+db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner

http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index 2be81ef..bf0bc6f 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -349,4 +349,9 @@ profile.service.jdbc.password=airavata
 iam.server.url=https://iam.scigap.org/auth
 new.gateway.admin.temp.password=Password@123
 iam.server.super.admin.username=admin
-iam.server.super.admin.password=password
\ No newline at end of file
+iam.server.super.admin.password=password
+
+###########################################################################
+# DB Event Manager Runner
+###########################################################################
+db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/modules/db-event-manager/pom.xml
----------------------------------------------------------------------
diff --git a/modules/db-event-manager/pom.xml b/modules/db-event-manager/pom.xml
index 3069fb6..ef6b89d 100644
--- a/modules/db-event-manager/pom.xml
+++ b/modules/db-event-manager/pom.xml
@@ -21,7 +21,7 @@
 
     <modelVersion>4.0.0</modelVersion>
     <artifactId>db-event-manager</artifactId>
-    <packaging>pom</packaging>
+    <packaging>jar</packaging>
     <name>Airavata DB Event Manager</name>
     <url>http://airavata.apache.org/</url>
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/DBEventManagerRunner.java
----------------------------------------------------------------------
diff --git a/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/DBEventManagerRunner.java
b/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/DBEventManagerRunner.java
index 88e0455..e45646f 100644
--- a/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/DBEventManagerRunner.java
+++ b/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/DBEventManagerRunner.java
@@ -21,6 +21,7 @@
 package org.apache.airavata.db.event.manager;
 
 import org.apache.airavata.common.exception.AiravataException;
+import org.apache.airavata.common.utils.IServer;
 import org.apache.airavata.db.event.manager.messaging.DBEventManagerMessagingFactory;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
@@ -28,10 +29,15 @@ import org.apache.log4j.Logger;
 /**
  * Created by Ajinkya on 3/29/17.
  */
-public class DBEventManagerRunner {
+public class DBEventManagerRunner implements IServer {
 
     private static final Logger log = LogManager.getLogger(DBEventManagerRunner.class);
 
+    private static final String SERVER_NAME = "DB Event Manager";
+    private static final String SERVER_VERSION = "1.0";
+
+    private ServerStatus status;
+
     /**
      * Start required messaging utilities
      */
@@ -75,4 +81,63 @@ public class DBEventManagerRunner {
         }
     }
 
+    @Override
+    public String getName() {
+        return SERVER_NAME;
+    }
+
+    @Override
+    public String getVersion() {
+        return SERVER_VERSION;
+    }
+
+    @Override
+    public void start() throws Exception {
+
+        try {
+            Runnable runner = new Runnable() {
+                @Override
+                public void run() {
+                    DBEventManagerRunner dBEventManagerRunner = new DBEventManagerRunner();
+                    dBEventManagerRunner.startDBEventManagerRunner();
+                }
+            };
+
+            // start the worker thread
+            log.info("Starting the DB Event Manager runner.");
+            new Thread(runner).start();
+            setStatus(ServerStatus.STARTED);
+        } catch (Exception ex) {
+            log.error("Something went wrong with the DB Event Manager runner. Error: " +
ex, ex);
+            setStatus(ServerStatus.FAILED);
+        }
+    }
+
+    @Override
+    public void stop() throws Exception {
+
+        // TODO: implement stopping the DBEventManager
+    }
+
+    @Override
+    public void restart() throws Exception {
+
+        stop();
+        start();
+    }
+
+    @Override
+    public void configure() throws Exception {
+
+    }
+
+    @Override
+    public ServerStatus getStatus() throws Exception {
+        return status;
+    }
+
+    private void setStatus(ServerStatus stat){
+        status=stat;
+        status.updateTime();
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/modules/distribution/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/pom.xml b/modules/distribution/pom.xml
index 336820c..de9cc8d 100644
--- a/modules/distribution/pom.xml
+++ b/modules/distribution/pom.xml
@@ -481,6 +481,11 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>db-event-manager</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
     <url>http://airavata.apache.org/</url>

http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
index c041622..36d317b 100644
--- a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -62,8 +62,8 @@ public class ServerMain {
 	private static final String SHARING_SERVER = "sharing_server";
 	private static final String GFAC_SERVER = "gfac";
 	private static final String ORCHESTRATOR = "orchestrator";
-	private static final String USER_PROFILE = "user_profile";
 	private static final String PROFILE_SERVICE = "profile_service";
+	private static final String DB_EVENT_MANAGER = "db_event_manager";
 
     private static ServerCnxnFactory cnxnFactory;
 //	private static boolean shutdownHookCalledBefore=false;
@@ -120,6 +120,7 @@ public class ServerMain {
 			serverList.add(ORCHESTRATOR);
 			serverList.add(GFAC_SERVER);
 			serverList.add(PROFILE_SERVICE);
+			serverList.add(DB_EVENT_MANAGER);
 		} else if (serverList.indexOf(API_ORCH) > -1) {
 			serverList.clear();
             serverList.add(REGISTRY_SERVER);  // registry server should start before everything
@@ -128,6 +129,7 @@ public class ServerMain {
 			serverList.add(API_SERVER);
 			serverList.add(ORCHESTRATOR);
 			serverList.add(PROFILE_SERVICE);
+			serverList.add(DB_EVENT_MANAGER);
 		} else if (serverList.indexOf(EXECUTION) > -1) {
 			serverList.clear();
 			serverList.add(GFAC_SERVER);

http://git-wip-us.apache.org/repos/asf/airavata/blob/e72ddf0b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3079a5d..9c78519 100644
--- a/pom.xml
+++ b/pom.xml
@@ -687,6 +687,7 @@
                 <module>modules/cluster-monitoring</module>
                 <module>modules/user-profile-migration</module>
                 <module>airavata-services</module>
+                <module>modules/db-event-manager</module>
                 <!-- Deprecated Modules-->
                 <!--<module>modules/integration-tests</module>-->
                 <!--<module>modules/workflow-model</module>-->


Mime
View raw message