Removed PublisherFactory class and activity publisher properties from airavata server properties
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/65c2a967 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/65c2a967 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/65c2a967 Branch: refs/heads/lahiru/AIRAVATA-2057 Commit: 65c2a9672e8d539fcc62b6d0156007d41decc0a0 Parents: e4cc54d Author: Shameera Rathnayaka <[email protected]> Authored: Wed Aug 10 15:41:39 2016 -0400 Committer: Shameera Rathnayaka <[email protected]> Committed: Wed Aug 10 15:41:39 2016 -0400 ---------------------------------------------------------------------- .../airavata/common/utils/ServerSettings.java | 10 -- .../main/resources/airavata-server.properties | 1 - .../messaging/core/PublisherFactory.java | 138 +++++++++---------- .../core/impl/GFACPassiveJobSubmitter.java | 9 +- .../server/OrchestratorServerHandler.java | 3 +- 5 files changed, 76 insertions(+), 85 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/65c2a967/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java ---------------------------------------------------------------------- diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java index 2459658..8d52a3d 100644 --- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java +++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java @@ -79,8 +79,6 @@ public class ServerSettings extends ApplicationSettings { private static final String MY_PROXY_USER = "myproxy.user"; private static final String MY_PROXY_PASSWORD = "myproxy.password"; private static final String MY_PROXY_LIFETIME = "myproxy.life"; - private static final String STATUS_PUBLISHER = "status.publisher"; - private static final String TASK_LAUNCH_PUBLISHER = "task.launch.publisher"; public static final String JOB_NOTIFICATION_ENABLE = "job.notification.enable"; public static final String JOB_NOTIFICATION_EMAILIDS = "job.notification.emailids"; public static final String JOB_NOTIFICATION_FLAGS = "job.notification.flags"; @@ -234,14 +232,6 @@ public class ServerSettings extends ApplicationSettings { return Integer.parseInt(getSetting(MY_PROXY_LIFETIME)); } - public static String getStatusPublisher() throws ApplicationSettingsException { - return getSetting(STATUS_PUBLISHER); - } - - public static String getTaskLaunchPublisher() throws ApplicationSettingsException { - return getSetting(TASK_LAUNCH_PUBLISHER); - } - public static boolean isEmbeddedZK() { return Boolean.parseBoolean(getSetting(EMBEDDED_ZK, "true")); } http://git-wip-us.apache.org/repos/asf/airavata/blob/65c2a967/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 29b256f..0dad713 100644 --- a/modules/configuration/server/src/main/resources/airavata-server.properties +++ b/modules/configuration/server/src/main/resources/airavata-server.properties @@ -253,7 +253,6 @@ durable.queue=false prefetch.count=200 process.launch.queue.name=process.launch.queue experiment.launch.queue.name=experiment.launch.queue -activity.publisher=org.apache.airavata.messaging.core.impl.RabbitMQStatusPublisher ########################################################################### # Zookeeper Server Configuration http://git-wip-us.apache.org/repos/asf/airavata/blob/65c2a967/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/PublisherFactory.java ---------------------------------------------------------------------- diff --git a/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/PublisherFactory.java b/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/PublisherFactory.java index 2e560a3..9cab483 100644 --- a/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/PublisherFactory.java +++ b/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/PublisherFactory.java @@ -1,69 +1,69 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.messaging.core; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.common.utils.ServerSettings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PublisherFactory { - private static Logger log = LoggerFactory.getLogger(PublisherFactory.class); - - public static Publisher createActivityPublisher() throws AiravataException { - String activityPublisher = ServerSettings.getStatusPublisher(); - - if (activityPublisher == null) { - String s = "Activity publisher is not specified"; - log.error(s); - throw new AiravataException(s); - } - - try { - Class<? extends Publisher> aPublisher = Class.forName(activityPublisher).asSubclass(Publisher.class); - return aPublisher.newInstance(); - } catch (Exception e) { - String msg = "Failed to load the publisher from the publisher class property: " + activityPublisher; - log.error(msg, e); - throw new AiravataException(msg, e); - } - } - - public static Publisher createTaskLaunchPublisher() throws AiravataException { - String taskLaunchPublisher = ServerSettings.getTaskLaunchPublisher(); - - if (taskLaunchPublisher == null) { - String s = "Task launch publisher is not specified"; - log.error(s); - throw new AiravataException(s); - } - - try { - Class<? extends Publisher> aPublisher = Class.forName(taskLaunchPublisher).asSubclass(Publisher.class); - return aPublisher.newInstance(); - } catch (Exception e) { - String msg = "Failed to load the publisher from the publisher class property: " + taskLaunchPublisher; - log.error(msg, e); - throw new AiravataException(msg, e); - } - } -} +///* +// * +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// * +// */ +// +//package org.apache.airavata.messaging.core; +// +//import org.apache.airavata.common.exception.AiravataException; +//import org.apache.airavata.common.utils.ServerSettings; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +// +//public class PublisherFactory { +// private static Logger log = LoggerFactory.getLogger(PublisherFactory.class); +// +// public static Publisher createActivityPublisher() throws AiravataException { +// String activityPublisher = ServerSettings.getStatusPublisher(); +// +// if (activityPublisher == null) { +// String s = "Activity publisher is not specified"; +// log.error(s); +// throw new AiravataException(s); +// } +// +// try { +// Class<? extends Publisher> aPublisher = Class.forName(activityPublisher).asSubclass(Publisher.class); +// return aPublisher.newInstance(); +// } catch (Exception e) { +// String msg = "Failed to load the publisher from the publisher class property: " + activityPublisher; +// log.error(msg, e); +// throw new AiravataException(msg, e); +// } +// } +// +// public static Publisher createTaskLaunchPublisher() throws AiravataException { +// String taskLaunchPublisher = ServerSettings.getTaskLaunchPublisher(); +// +// if (taskLaunchPublisher == null) { +// String s = "Task launch publisher is not specified"; +// log.error(s); +// throw new AiravataException(s); +// } +// +// try { +// Class<? extends Publisher> aPublisher = Class.forName(taskLaunchPublisher).asSubclass(Publisher.class); +// return aPublisher.newInstance(); +// } catch (Exception e) { +// String msg = "Failed to load the publisher from the publisher class property: " + taskLaunchPublisher; +// log.error(msg, e); +// throw new AiravataException(msg, e); +// } +// } +//} http://git-wip-us.apache.org/repos/asf/airavata/blob/65c2a967/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACPassiveJobSubmitter.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACPassiveJobSubmitter.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACPassiveJobSubmitter.java index 02ecfe1..856f9f3 100644 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACPassiveJobSubmitter.java +++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/GFACPassiveJobSubmitter.java @@ -27,9 +27,12 @@ import org.apache.airavata.credential.store.store.CredentialReader; import org.apache.airavata.gfac.client.GFACInstance; import org.apache.airavata.gfac.core.GFacUtils; import org.apache.airavata.messaging.core.MessageContext; +import org.apache.airavata.messaging.core.MessagingFactory; import org.apache.airavata.messaging.core.Publisher; -import org.apache.airavata.messaging.core.PublisherFactory; -import org.apache.airavata.model.messaging.event.*; +import org.apache.airavata.messaging.core.Type; +import org.apache.airavata.model.messaging.event.MessageType; +import org.apache.airavata.model.messaging.event.ProcessSubmitEvent; +import org.apache.airavata.model.messaging.event.ProcessTerminateEvent; import org.apache.airavata.orchestrator.core.context.OrchestratorContext; import org.apache.airavata.orchestrator.core.exception.OrchestratorException; import org.apache.airavata.orchestrator.core.job.JobSubmitter; @@ -53,7 +56,7 @@ public class GFACPassiveJobSubmitter implements JobSubmitter,Watcher { this.publisher = orchestratorContext.getPublisher(); }else { try { - this.publisher = PublisherFactory.createTaskLaunchPublisher(); + this.publisher = MessagingFactory.getPublisher(Type.PROCESS_LAUNCH); } catch (AiravataException e) { logger.error(e.getMessage(), e); throw new OrchestratorException("Cannot initialize " + GFACPassiveJobSubmitter.class + " need to start Rabbitmq server to use " + GFACPassiveJobSubmitter.class); http://git-wip-us.apache.org/repos/asf/airavata/blob/65c2a967/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java index 5d02100..03f6f8a 100644 --- a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java +++ b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java @@ -33,7 +33,6 @@ import org.apache.airavata.messaging.core.MessageContext; import org.apache.airavata.messaging.core.MessageHandler; import org.apache.airavata.messaging.core.MessagingFactory; import org.apache.airavata.messaging.core.Publisher; -import org.apache.airavata.messaging.core.PublisherFactory; import org.apache.airavata.messaging.core.Subscriber; import org.apache.airavata.messaging.core.Type; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; @@ -112,7 +111,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface { public OrchestratorServerHandler() throws OrchestratorException{ try { - publisher = PublisherFactory.createActivityPublisher(); + publisher = MessagingFactory.getPublisher(Type.STATUS); setAiravataUserName(ServerSettings.getDefaultUser()); } catch (AiravataException e) { log.error(e.getMessage(), e);
