This is an automated email from the ASF dual-hosted git repository. yasith pushed a commit to branch feat/single-jvm in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 15293bbb0b6ef6ab6d0eed0a58551c1b71d99144 Author: yasithdev <[email protected]> AuthorDate: Wed Mar 25 23:53:53 2026 -0500 refactor: remove old per-service server classes and startup scripts Delete ServerMain, RegistryAPIServer, SharingRegistryServer, CredentialStoreServer, AiravataAPIServer and the nine per-service shell scripts (orchestrator, controller, participant, sharing-registry, etc.) now that AiravataUnifiedServer consolidates all Thrift services in a single JVM. Add airavata.sh as the single entry-point startup script. Fix SharingServiceDBEventHandler to inline the two string constants that were imported from the deleted SharingRegistryServer class. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --- .../airavata/api/server/AiravataAPIServer.java | 200 ---------- .../store/server/CredentialStoreServer.java | 148 ------- .../registry/api/service/RegistryAPIServer.java | 192 ---------- .../org/apache/airavata/server/ServerMain.java | 425 --------------------- .../messaging/SharingServiceDBEventHandler.java | 5 +- .../sharing/registry/server/ServerMain.java | 106 ----- .../registry/server/SharingRegistryServer.java | 183 --------- .../main/resources/distribution/bin/airavata.sh | 5 + .../main/resources/distribution/bin/controller.sh | 26 -- .../resources/distribution/bin/email-monitor.sh | 26 -- .../resources/distribution/bin/orchestrator.sh | 54 --- .../main/resources/distribution/bin/parser-wm.sh | 26 -- .../main/resources/distribution/bin/participant.sh | 26 -- .../src/main/resources/distribution/bin/post-wm.sh | 26 -- .../src/main/resources/distribution/bin/pre-wm.sh | 26 -- .../resources/distribution/bin/realtime-monitor.sh | 26 -- .../resources/distribution/bin/sharing-registry.sh | 26 -- 17 files changed, 7 insertions(+), 1519 deletions(-) diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java deleted file mode 100644 index 928d722d69..0000000000 --- a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java +++ /dev/null @@ -1,200 +0,0 @@ -/** -* -* 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.api.server; - -import com.google.inject.Guice; -import com.google.inject.Injector; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import org.apache.airavata.api.Airavata; -import org.apache.airavata.api.server.handler.AiravataServerHandler; -import org.apache.airavata.api.server.util.Constants; -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.IServer; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.model.error.AiravataErrorType; -import org.apache.airavata.model.error.AiravataSystemException; -import org.apache.airavata.service.security.interceptor.SecurityModule; -import org.apache.thrift.server.TServer; -import org.apache.thrift.server.TThreadPoolServer; -import org.apache.thrift.transport.TSSLTransportFactory; -import org.apache.thrift.transport.TServerSocket; -import org.apache.thrift.transport.TServerTransport; -import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AiravataAPIServer implements IServer { - - private static final Logger logger = LoggerFactory.getLogger(AiravataAPIServer.class); - private static final String SERVER_NAME = "Airavata API Server"; - private static final String SERVER_VERSION = "1.0"; - - private ServerStatus status; - - private TServer server, TLSServer; - - public AiravataAPIServer() { - setStatus(ServerStatus.STOPPED); - } - - public void startAiravataServer(Airavata.Processor<Airavata.Iface> airavataAPIServer) - throws AiravataSystemException { - try { - final String serverHost = ServerSettings.getSetting(Constants.API_SERVER_HOST, null); - final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_PORT, "8930")); - - if (!ServerSettings.isTLSEnabled()) { - TServerTransport serverTransport; - if (serverHost == null) { - serverTransport = new TServerSocket(serverPort); - } else { - InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); - serverTransport = new TServerSocket(inetSocketAddress); - } - TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport); - options.minWorkerThreads = - Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_MIN_THREADS, "50")); - server = new TThreadPoolServer(options.processor(airavataAPIServer)); - new Thread(() -> { - server.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Airavata API Server Stopped."); - }) - .start(); - new Thread(() -> { - while (!server.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; - } - } - if (server.isServing()) { - setStatus(ServerStatus.STARTED); - logger.info("Starting Airavata API Server on Port " + serverPort); - logger.info("Listening to Airavata Clients ...."); - } - }) - .start(); - logger.info("Started API Server ...."); - } else { - var TLSParams = new TSSLTransportFactory.TSSLTransportParameters(); - TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); - var TLSServerTransport = TSSLTransportFactory.getServerSocket( - serverPort, ServerSettings.getTLSClientTimeout(), InetAddress.getByName(serverHost), TLSParams); - TThreadPoolServer.Args settings = new TThreadPoolServer.Args(TLSServerTransport); - settings.minWorkerThreads = - Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_MIN_THREADS, "50")); - TLSServer = new TThreadPoolServer(settings.processor(airavataAPIServer)); - new Thread(() -> { - TLSServer.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Airavata API Server over TLS Stopped."); - }) - .start(); - new Thread(() -> { - while (!TLSServer.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; - } - } - if (TLSServer.isServing()) { - setStatus(ServerStatus.STARTED); - } - }) - .start(); - logger.info("API server started over TLS on Port: " + serverPort + " ..."); - } - - } catch (TTransportException | ApplicationSettingsException | UnknownHostException e) { - logger.error("Failed to start API server ...", e); - setStatus(ServerStatus.FAILED); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } - } - - public static void main(String[] args) { - try { - AiravataAPIServer server = new AiravataAPIServer(); - server.start(); - } catch (Exception e) { - logger.error("Error while initializing Airavata API server", e); - } - } - - @Override - public void start() throws Exception { - setStatus(ServerStatus.STARTING); - // Obtain a AiravataServerHandl - // er object from Guice which is wrapped with interception logic. - Injector injector = Guice.createInjector(new SecurityModule()); - Airavata.Processor<Airavata.Iface> airavataAPIServer = - new Airavata.Processor<Airavata.Iface>(injector.getInstance(AiravataServerHandler.class)); - startAiravataServer(airavataAPIServer); - } - - @Override - public void stop() throws Exception { - if ((!ServerSettings.isTLSEnabled()) && server.isServing()) { - setStatus(ServerStatus.STOPING); - server.stop(); - } - // stop the Airavata API server hosted over TLS. - if ((ServerSettings.isTLSEnabled()) && TLSServer.isServing()) { - TLSServer.stop(); - } - } - - @Override - public void restart() throws Exception { - stop(); - start(); - } - - @Override - public void configure() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public ServerStatus getStatus() throws Exception { - return status; - } - - private void setStatus(ServerStatus stat) { - status = stat; - status.updateTime(); - } - - @Override - public String getName() { - return SERVER_NAME; - } - - @Override - public String getVersion() { - return SERVER_VERSION; - } -} diff --git a/airavata-api/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java b/airavata-api/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java deleted file mode 100644 index 24994de8b5..0000000000 --- a/airavata-api/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java +++ /dev/null @@ -1,148 +0,0 @@ -/** -* -* 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.credential.store.server; - -import java.net.InetSocketAddress; -import org.apache.airavata.common.utils.IServer; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.credential.store.cpi.CredentialStoreService; -import org.apache.thrift.server.TServer; -import org.apache.thrift.server.TThreadPoolServer; -import org.apache.thrift.transport.TServerSocket; -import org.apache.thrift.transport.TServerTransport; -import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CredentialStoreServer implements IServer { - private static final Logger logger = LoggerFactory.getLogger(CredentialStoreServer.class); - private static final String SERVER_NAME = "Credential Store Server"; - private static final String SERVER_VERSION = "1.0"; - - private IServer.ServerStatus status; - private TServer server; - - public CredentialStoreServer() { - setStatus(IServer.ServerStatus.STOPPED); - } - - @Override - public String getName() { - return SERVER_NAME; - } - - @Override - public String getVersion() { - return SERVER_VERSION; - } - - @Override - public void start() throws Exception { - try { - setStatus(ServerStatus.STARTING); - final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort()); - final String serverHost = ServerSettings.getCredentialStoreServerHost(); - CredentialStoreService.Processor processor = - new CredentialStoreService.Processor(new CredentialStoreServerHandler()); - - TServerTransport serverTransport; - - if (serverHost == null) { - serverTransport = new TServerSocket(serverPort); - } else { - InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); - serverTransport = new TServerSocket(inetSocketAddress); - } - TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport); - options.minWorkerThreads = 30; - server = new TThreadPoolServer(options.processor(processor)); - - new Thread() { - public void run() { - server.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Credential store Server Stopped."); - } - }.start(); - new Thread() { - public void run() { - while (!server.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; - } - } - if (server.isServing()) { - setStatus(ServerStatus.STARTED); - logger.info("Starting Credential store Server on Port " + serverPort); - logger.info("Listening to Credential store clients ...."); - } - } - }.start(); - } catch (TTransportException e) { - setStatus(ServerStatus.FAILED); - throw new Exception("Error while starting the credential store service", e); - } - } - - public static void main(String[] args) { - try { - new CredentialStoreServer().start(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - @Override - public void stop() throws Exception { - if (server != null && server.isServing()) { - setStatus(ServerStatus.STOPING); - server.stop(); - } - } - - @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(IServer.ServerStatus stat) { - status = stat; - status.updateTime(); - } - - public TServer getServer() { - return server; - } - - public void setServer(TServer server) { - this.server = server; - } -} diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java b/airavata-api/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java deleted file mode 100644 index b68e353290..0000000000 --- a/airavata-api/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java +++ /dev/null @@ -1,192 +0,0 @@ -/** -* -* 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.registry.api.service; - -import java.net.InetSocketAddress; -import java.util.Arrays; -import java.util.List; -import org.apache.airavata.common.utils.DBInitConfig; -import org.apache.airavata.common.utils.DBInitializer; -import org.apache.airavata.common.utils.IServer; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.registry.api.RegistryService; -import org.apache.airavata.registry.api.service.handler.RegistryServerHandler; -import org.apache.airavata.registry.api.service.messaging.RegistryServiceDBEventMessagingFactory; -import org.apache.airavata.registry.api.service.util.Constants; -import org.apache.airavata.registry.core.utils.AppCatalogDBInitConfig; -import org.apache.airavata.registry.core.utils.ExpCatalogDBInitConfig; -import org.apache.airavata.registry.core.utils.ReplicaCatalogDBInitConfig; -import org.apache.thrift.server.TServer; -import org.apache.thrift.server.TThreadPoolServer; -import org.apache.thrift.transport.TServerSocket; -import org.apache.thrift.transport.TServerTransport; -import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RegistryAPIServer implements IServer { - private static final Logger logger = LoggerFactory.getLogger(RegistryAPIServer.class); - - private static final String SERVER_NAME = "Registry API Server"; - private static final String SERVER_VERSION = "1.0"; - - private ServerStatus status; - - private TServer server; - - private List<DBInitConfig> dbInitConfigs = - Arrays.asList(new ExpCatalogDBInitConfig(), new AppCatalogDBInitConfig(), new ReplicaCatalogDBInitConfig()); - - public RegistryAPIServer() { - setStatus(ServerStatus.STOPPED); - } - - public void StartRegistryServer(RegistryService.Processor<RegistryServerHandler> orchestratorServerHandlerProcessor) - throws Exception { - - logger.info("Initializing databases..."); - for (DBInitConfig dbInitConfig : dbInitConfigs) { - DBInitializer.initializeDB(dbInitConfig); - } - logger.info("Databases initialized successfully"); - - final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.REGISTRY_SERVER_PORT, "8960")); - try { - final String serverHost = ServerSettings.getSetting(Constants.REGISTRY_SERVER_HOST, null); - TServerTransport serverTransport; - if (serverHost == null) { - serverTransport = new TServerSocket(serverPort); - } else { - InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); - serverTransport = new TServerSocket(inetSocketAddress); - } - - // thrift server start - TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport); - options.minWorkerThreads = - Integer.parseInt(ServerSettings.getSetting(Constants.REGISTRY_SERVER_MIN_THREADS, "30")); - server = new TThreadPoolServer(options.processor(orchestratorServerHandlerProcessor)); - new Thread() { - public void run() { - server.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Registry Server Stopped."); - } - }.start(); - new Thread() { - public void run() { - while (!server.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; - } - } - if (server.isServing()) { - setStatus(ServerStatus.STARTED); - logger.info("Started Registry Server on Port " + serverPort + " ..."); - - // start db event handlers - if (!startDatabaseEventHandlers()) { - logger.error("Stopping Registry Server as DB event handlers failed to start!"); - server.stop(); - } - } - } - }.start(); - } catch (TTransportException e) { - logger.error(e.getMessage()); - setStatus(ServerStatus.FAILED); - logger.error("Failed to start Registry server on port " + serverPort + " ..."); - } - } - - private boolean startDatabaseEventHandlers() { - try { - // db-event handlers - logger.info("Registring registry service with publishers for db-events."); - RegistryServiceDBEventMessagingFactory.registerRegistryServiceWithPublishers( - Constants.DB_EVENT_SUBSCRIBERS); - - logger.info("Starting registry service db-event-handler subscriber."); - RegistryServiceDBEventMessagingFactory.getDBEventSubscriber(); - } catch (Exception ex) { - logger.error("Failed to start database event handlers, reason: " + ex.getMessage(), ex); - return false; - } - return true; - } - - public static void main(String[] args) { - try { - new RegistryAPIServer().start(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - @Override - public void start() throws Exception { - setStatus(ServerStatus.STARTING); - RegistryService.Processor<RegistryServerHandler> orchestratorService = - new RegistryService.Processor<RegistryServerHandler>(new RegistryServerHandler()); - StartRegistryServer(orchestratorService); - } - - @Override - public void stop() throws Exception { - if (server != null && server.isServing()) { - setStatus(ServerStatus.STOPING); - server.stop(); - } - } - - @Override - public void restart() throws Exception { - stop(); - start(); - } - - @Override - public void configure() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public ServerStatus getStatus() throws Exception { - return status; - } - - private void setStatus(ServerStatus stat) { - status = stat; - status.updateTime(); - } - - @Override - public String getName() { - return SERVER_NAME; - } - - @Override - public String getVersion() { - return SERVER_VERSION; - } -} diff --git a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java b/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java deleted file mode 100644 index 701d5e4dd6..0000000000 --- a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java +++ /dev/null @@ -1,425 +0,0 @@ -/** -* -* 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.server; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.*; -import org.apache.airavata.common.utils.ApplicationSettings.ShutdownStrategy; -import org.apache.airavata.common.utils.IServer.ServerStatus; -import org.apache.airavata.common.utils.StringUtil.CommandLineParameters; -import org.apache.airavata.patform.monitoring.MonitoringServer; -import org.apache.commons.cli.ParseException; -import org.apache.zookeeper.server.ServerCnxnFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ServerMain { - private static List<IServer> servers; - private static final String SERVERS_KEY = "servers"; - private static final Logger logger = LoggerFactory.getLogger(ServerMain.class); - private static boolean serversLoaded = false; - private static final String stopFileNamePrefix = "server_stop"; - private static long serverPID = -1; - private static final String serverStartedFileNamePrefix = "server_start"; - private static boolean systemShutDown = false; - private static String STOP_COMMAND_STR = "stop"; - - private static final String ALL_IN_ONE = "all"; - private static final String API_ORCH = "api-orch"; - private static final String EXECUTION = "execution"; - // server names - private static final String API_SERVER = "apiserver.class"; - private static final String CREDENTIAL_STORE = "credential.store.class"; - private static final String REGISTRY_SERVER = "regserver"; - 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 PROFILE_SERVICE = "profile_service.class"; - private static final String DB_EVENT_MANAGER = "db_event_manager.class"; - - private static ServerCnxnFactory cnxnFactory; - // private static boolean shutdownHookCalledBefore=false; - static { - servers = new ArrayList<IServer>(); - } - - private static void loadServers(String serverNames) { - try { - if (serverNames != null) { - List<String> serversList = handleServerDependencies(serverNames); - for (String serverString : serversList) { - serverString = serverString.trim(); - String serverClassName = ServerSettings.getSetting(serverString); - Class<?> classInstance; - try { - classInstance = ServerMain.class.getClassLoader().loadClass(serverClassName); - servers.add((IServer) classInstance.newInstance()); - } catch (ClassNotFoundException e) { - logger.error("Error while locating server implementation \"" + serverString + "\"!!!", e); - } catch (InstantiationException e) { - logger.error("Error while initiating server instance \"" + serverString + "\"!!!", e); - } catch (IllegalAccessException e) { - logger.error("Error while initiating server instance \"" + serverString + "\"!!!", e); - } catch (ClassCastException e) { - logger.error("Invalid server \"" + serverString + "\"!!!", e); - } - } - } else { - logger.warn("No server name specify to start, use -h command line option to view help menu ..."); - } - } catch (ApplicationSettingsException e) { - logger.error("Error while retrieving server list!!!", e); - } - serversLoaded = true; - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - setSystemShutDown(); - stopAllServers(); - } - }); - } - - private static List<String> handleServerDependencies(String serverNames) { - List<String> serverList = new ArrayList<>(Arrays.asList(serverNames.split(","))); - if (serverList.indexOf(ALL_IN_ONE) > -1) { - serverList.clear(); - serverList.add(DB_EVENT_MANAGER); // DB Event Manager should start before everything - serverList.add(REGISTRY_SERVER); // registry server should start before everything else - serverList.add(CREDENTIAL_STORE); // credential store should start before api server - serverList.add(SHARING_SERVER); - serverList.add(API_SERVER); - serverList.add(ORCHESTRATOR); - serverList.add(GFAC_SERVER); - serverList.add(PROFILE_SERVICE); - } else if (serverList.indexOf(API_ORCH) > -1) { - serverList.clear(); - serverList.add(DB_EVENT_MANAGER); // DB Event Manager should start before everything - serverList.add(REGISTRY_SERVER); // registry server should start before everything else - serverList.add(CREDENTIAL_STORE); // credential store should start before api server - serverList.add(SHARING_SERVER); - serverList.add(API_SERVER); - serverList.add(ORCHESTRATOR); - serverList.add(PROFILE_SERVICE); - } else if (serverList.indexOf(EXECUTION) > -1) { - serverList.clear(); - serverList.add(GFAC_SERVER); - } else { - // registry server should start before everything - int regPos = serverList.indexOf(REGISTRY_SERVER); - if (regPos > 0) { - String temp = serverList.get(0); - serverList.set(0, serverList.get(regPos)); - serverList.set(regPos, temp); - } - - // credential store should start before api server - int credPos = serverList.indexOf(CREDENTIAL_STORE); - int apiPos = serverList.indexOf(API_SERVER); - if (credPos >= 0 && apiPos >= 0 && (credPos > apiPos)) { - String temp = serverList.get(apiPos); - serverList.set(apiPos, serverList.get(credPos)); - serverList.set(credPos, temp); - } - } - return serverList; - } - - // private static void addSecondaryShutdownHook(){ - // Runtime.getRuntime().addShutdownHook(new Thread(){ - // @Override - // public void run() { - // System.out.print("Graceful shutdown attempt is still active. Do you want to exit instead? (y/n)"); - // String command=System.console().readLine().trim().toLowerCase(); - // if (command.equals("yes") || command.equals("y")){ - // System.exit(1); - // } - - // } - // }); - // } - - public static void main(String[] args) throws IOException, AiravataException, ParseException { - ServerSettings.mergeSettingsCommandLineArgs(args); - if (ServerSettings.getBooleanSetting("api.server.monitoring.enabled")) { - MonitoringServer monitoringServer = new MonitoringServer( - ServerSettings.getSetting("api.server.monitoring.host"), - ServerSettings.getIntSetting("api.server.monitoring.port")); - monitoringServer.start(); - - Runtime.getRuntime().addShutdownHook(new Thread(monitoringServer::stop)); - } - - CommandLineParameters commandLineParameters = StringUtil.getCommandLineParser(args); - if (commandLineParameters.getArguments().contains(STOP_COMMAND_STR)) { - performServerStopRequest(commandLineParameters); - } else { - performServerStart(args); - } - } - - private static void performServerStart(String[] args) { - setServerStarted(); - logger.info("Airavata server instance starting..."); - String serverNames = "all"; - for (String string : args) { - logger.info("Server Arguments: " + string); - if (string.startsWith("--servers=")) { - serverNames = string.substring("--servers=".length()); - } - } - serverNames = ApplicationSettings.getSetting(SERVERS_KEY, serverNames); - startAllServers(serverNames); - while (!hasStopRequested()) { - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - stopAllServers(); - } - } - if (hasStopRequested()) { - ServerSettings.setStopAllThreads(true); - stopAllServers(); - ShutdownStrategy shutdownStrategy; - try { - shutdownStrategy = ServerSettings.getShutdownStrategy(); - } catch (Exception e) { - String strategies = ""; - for (ShutdownStrategy s : ShutdownStrategy.values()) { - strategies += "/" + s.toString(); - } - logger.warn(e.getMessage()); - logger.warn("Valid shutdown options are : " + strategies.substring(1)); - shutdownStrategy = ShutdownStrategy.SELF_TERMINATE; - } - if (shutdownStrategy == ShutdownStrategy.SELF_TERMINATE) { - System.exit(0); - } - } - } - - private static void performServerStopRequest(CommandLineParameters commandLineParameters) throws IOException { - // deleteOldStartRecords(); - String serverIndexOption = "serverIndex"; - if (commandLineParameters.getParameters().containsKey(serverIndexOption)) { - serverPID = Integer.parseInt(commandLineParameters.getParameters().get(serverIndexOption)); - } - if (isServerRunning()) { - logger.info("Requesting airavata server" + (serverPID == -1 ? "(s)" : " instance " + serverPID) - + " to stop..."); - requestStop(); - while (isServerRunning()) { - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } - } - logger.info("Server" + (serverPID == -1 ? "(s)" : " instance " + serverPID) + " stopped!!!"); - } else { - logger.error("Server" + (serverPID == -1 ? "" : " instance " + serverPID) + " is not running!!!"); - } - if (ServerSettings.isEmbeddedZK()) { - cnxnFactory.shutdown(); - } - } - - @SuppressWarnings("resource") - private static void requestStop() throws IOException { - File file = new File(getServerStopFileName()); - file.createNewFile(); - new RandomAccessFile(file, "rw").getChannel().lock(); - file.deleteOnExit(); - } - - private static boolean hasStopRequested() { - return isSystemShutDown() - || new File(getServerStopFileName()).exists() - || new File(stopFileNamePrefix).exists(); - } - - private static String getServerStopFileName() { - return stopFileNamePrefix; - } - - private static void deleteOldStopRequests() { - File[] files = new File(".").listFiles(); - for (File file : files) { - if (file.getName().contains(stopFileNamePrefix)) { - file.delete(); - } - } - } - - // private static void deleteOldStartRecords(){ - // File[] files = new File(".").listFiles(); - // for (File file : files) { - // if (file.getName().contains(serverStartedFileNamePrefix)){ - // try { - // new FileOutputStream(file); - // file.delete(); - // } catch (Exception e) { - // //file is locked which means there's an active process using it - // } - // } - // } - // } - - private static boolean isServerRunning() { - if (serverPID == -1) { - String[] files = new File(".").list(); - for (String file : files) { - if (file.contains(serverStartedFileNamePrefix)) { - return true; - } - } - return false; - } else { - return new File(getServerStartedFileName()).exists(); - } - } - - @SuppressWarnings({"resource"}) - private static void setServerStarted() { - try { - serverPID = getPID(); - deleteOldStopRequests(); - File serverStartedFile = null; - serverStartedFile = new File(getServerStartedFileName()); - serverStartedFile.createNewFile(); - serverStartedFile.deleteOnExit(); - new RandomAccessFile(serverStartedFile, "rw").getChannel().lock(); - } catch (FileNotFoundException e) { - logger.error(e.getMessage(), e); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - - private static String getServerStartedFileName() { - return new File( - new File(System.getenv("AIRAVATA_HOME"), "bin"), - serverStartedFileNamePrefix + "_" + Long.toString(serverPID)) - .toString(); - } - - public static void stopAllServers() { - // stopping should be done in reverse order of starting the servers - for (int i = servers.size() - 1; i >= 0; i--) { - try { - servers.get(i).stop(); - waitForServerToStop(servers.get(i), null); - } catch (Exception e) { - logger.error("Server Stop Error:", e); - } - } - } - - public static void startAllServers(String serversNames) { - if (!serversLoaded) { - loadServers(serversNames); - } - for (IServer server : servers) { - try { - server.configure(); - server.start(); - waitForServerToStart(server, null); - } catch (Exception e) { - logger.error("Server Start Error:", e); - } - } - } - - private static final int SERVER_STATUS_CHANGE_WAIT_INTERVAL = 500; - - private static void waitForServerToStart(IServer server, Integer maxWait) throws Exception { - int count = 0; - // if (server.getStatus()==ServerStatus.STARTING) { - // logger.info("Waiting for " + server.getName() + " to start..."); - // } - while (server.getStatus() == ServerStatus.STARTING && (maxWait == null || count < maxWait)) { - Thread.sleep(SERVER_STATUS_CHANGE_WAIT_INTERVAL); - count += SERVER_STATUS_CHANGE_WAIT_INTERVAL; - } - if (server.getStatus() != ServerStatus.STARTED) { - logger.error("The " + server.getName() + " did not start!!!"); - } - } - - private static void waitForServerToStop(IServer server, Integer maxWait) throws Exception { - int count = 0; - if (server.getStatus() == ServerStatus.STOPING) { - logger.info("Waiting for " + server.getName() + " to stop..."); - } - // we are doing hasStopRequested() check because while we are stuck in the loop to stop there could be a - // forceStop request - while (server.getStatus() == ServerStatus.STOPING && (maxWait == null || count < maxWait)) { - Thread.sleep(SERVER_STATUS_CHANGE_WAIT_INTERVAL); - count += SERVER_STATUS_CHANGE_WAIT_INTERVAL; - } - if (server.getStatus() != ServerStatus.STOPPED) { - logger.error("Error stopping the " + server.getName() + "!!!"); - } - } - - private static boolean isSystemShutDown() { - return systemShutDown; - } - - private static void setSystemShutDown() { - ServerMain.systemShutDown = true; - } - - // private static int getPID(){ - // try { - // java.lang.management.RuntimeMXBean runtime = java.lang.management.ManagementFactory - // .getRuntimeMXBean(); - // java.lang.reflect.Field jvm = runtime.getClass() - // .getDeclaredField("jvm"); - // jvm.setAccessible(true); - // sun.management.VMManagement mgmt = (sun.management.VMManagement) jvm - // .get(runtime); - // java.lang.reflect.Method pid_method = mgmt.getClass() - // .getDeclaredMethod("getProcessId"); - // pid_method.setAccessible(true); - // - // int pid = (Integer) pid_method.invoke(mgmt); - // return pid; - // } catch (Exception e) { - // return -1; - // } - // } - - // getPID from ProcessHandle JDK 9 and onwards - private static long getPID() { - try { - return ProcessHandle.current().pid(); - } catch (Exception e) { - return -1; - } - } -} diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java index 173e809fe3..34b534fbe8 100644 --- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java +++ b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java @@ -38,7 +38,6 @@ import org.apache.airavata.sharing.registry.models.Entity; import org.apache.airavata.sharing.registry.models.PermissionType; import org.apache.airavata.sharing.registry.models.SharingRegistryException; import org.apache.airavata.sharing.registry.models.User; -import org.apache.airavata.sharing.registry.server.SharingRegistryServer; import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService; import org.apache.airavata.sharing.registry.utils.ThriftDataModelConversion; import org.apache.thrift.TException; @@ -57,8 +56,8 @@ public class SharingServiceDBEventHandler implements MessageHandler { SharingServiceDBEventHandler() throws ApplicationSettingsException, SharingRegistryException { log.info("Starting sharing registry client....."); sharingRegistryClient = SharingRegistryServiceClientFactory.createSharingRegistryClient( - ServerSettings.getSetting(SharingRegistryServer.SHARING_REG_SERVER_HOST), - Integer.parseInt(ServerSettings.getSetting(SharingRegistryServer.SHARING_REG_SERVER_PORT))); + ServerSettings.getSetting("sharing.registry.server.host"), + Integer.parseInt(ServerSettings.getSetting("sharing.registry.server.port"))); } @Override diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/ServerMain.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/ServerMain.java deleted file mode 100644 index 85fc301f19..0000000000 --- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/ServerMain.java +++ /dev/null @@ -1,106 +0,0 @@ -/** -* -* 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.sharing.registry.server; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ServerMain { - private static final Logger logger = LoggerFactory.getLogger(ServerMain.class); - - private static long serverPID = -1; - private static final String stopFileNamePrefix = "server_stop"; - private static final String serverStartedFileNamePrefix = "server_start"; - - public static void main(String[] args) { - try { - setServerStarted(); - new SharingRegistryServer().start(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - @SuppressWarnings({"resource"}) - private static void setServerStarted() { - try { - serverPID = getPID(); - deleteOldStopRequests(); - File serverStartedFile = null; - serverStartedFile = new File(getServerStartedFileName()); - serverStartedFile.createNewFile(); - serverStartedFile.deleteOnExit(); - new RandomAccessFile(serverStartedFile, "rw").getChannel().lock(); - } catch (FileNotFoundException e) { - logger.warn(e.getMessage(), e); - } catch (IOException e) { - logger.warn(e.getMessage(), e); - } - } - - private static String getServerStartedFileName() { - String SHARING_REGISTRY_HOME = System.getenv("" + "SHARING_REGISTRY_HOME"); - if (SHARING_REGISTRY_HOME == null) SHARING_REGISTRY_HOME = "/tmp"; - else SHARING_REGISTRY_HOME = SHARING_REGISTRY_HOME + "/bin"; - return new File(SHARING_REGISTRY_HOME, serverStartedFileNamePrefix + "_" + Long.toString(serverPID)).toString(); - } - - // private static int getPID() { - // try { - // java.lang.management.RuntimeMXBean runtime = java.lang.management.ManagementFactory - // .getRuntimeMXBean(); - // java.lang.reflect.Field jvm = runtime.getClass() - // .getDeclaredField("jvm"); - // jvm.setAccessible(true); - // sun.management.VMManagement mgmt = (sun.management.VMManagement) jvm - // .get(runtime); - // java.lang.reflect.Method pid_method = mgmt.getClass() - // .getDeclaredMethod("getProcessId"); - // pid_method.setAccessible(true); - // - // int pid = (Integer) pid_method.invoke(mgmt); - // return pid; - // } catch (Exception e) { - // return -1; - // } - // } - - // getPID from ProcessHandle JDK 9 and onwards - private static long getPID() { - try { - return ProcessHandle.current().pid(); - } catch (Exception e) { - return -1; - } - } - - private static void deleteOldStopRequests() { - File[] files = new File(".").listFiles(); - for (File file : files) { - if (file.getName().contains(stopFileNamePrefix)) { - file.delete(); - } - } - } -} diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java deleted file mode 100644 index f84b3c974f..0000000000 --- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java +++ /dev/null @@ -1,183 +0,0 @@ -/** -* -* 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.sharing.registry.server; - -import java.net.InetAddress; -import java.net.InetSocketAddress; -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.common.utils.IServer; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.sharing.registry.db.utils.SharingRegistryDBInitConfig; -import org.apache.airavata.sharing.registry.messaging.SharingServiceDBEventMessagingFactory; -import org.apache.airavata.sharing.registry.models.SharingRegistryException; -import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService; -import org.apache.airavata.sharing.registry.utils.Constants; -import org.apache.thrift.server.TServer; -import org.apache.thrift.server.TThreadPoolServer; -import org.apache.thrift.transport.TSSLTransportFactory; -import org.apache.thrift.transport.TServerSocket; -import org.apache.thrift.transport.TServerTransport; -import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SharingRegistryServer implements IServer { - private static final Logger logger = LoggerFactory.getLogger(SharingRegistryServer.class); - - public static final String SHARING_REG_SERVER_HOST = "sharing.registry.server.host"; - public static final String SHARING_REG_SERVER_PORT = "sharing.registry.server.port"; - - private static final String SERVER_NAME = "Sharing Registry Server"; - private static final String SERVER_VERSION = "1.0"; - - private IServer.ServerStatus status; - private TServer server; - private boolean testMode = false; - - public SharingRegistryServer() { - setStatus(IServer.ServerStatus.STOPPED); - } - - @Override - public String getName() { - return SERVER_NAME; - } - - @Override - public String getVersion() { - return SERVER_VERSION; - } - - @Override - public void start() throws Exception { - try { - setStatus(IServer.ServerStatus.STARTING); - - final int serverPort = Integer.parseInt(ServerSettings.getSetting(SHARING_REG_SERVER_PORT)); - final String serverHost = ServerSettings.getSetting(SHARING_REG_SERVER_HOST); - SharingRegistryService.Processor processor = new SharingRegistryService.Processor( - new SharingRegistryServerHandler(createSharingRegistryDBInitConfig())); - - TServerTransport serverTransport; - TThreadPoolServer.Args options; - - if (!ServerSettings.isTLSEnabled()) { - InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); - serverTransport = new TServerSocket(inetSocketAddress); - options = new TThreadPoolServer.Args(serverTransport); - } else { - TSSLTransportFactory.TSSLTransportParameters TLSParams = - new TSSLTransportFactory.TSSLTransportParameters(); - TLSParams.requireClientAuth(true); - TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); - TServerSocket TLSServerTransport = TSSLTransportFactory.getServerSocket( - serverPort, ServerSettings.getTLSClientTimeout(), InetAddress.getByName(serverHost), TLSParams); - options = new TThreadPoolServer.Args(TLSServerTransport); - } - options.minWorkerThreads = 30; - server = new TThreadPoolServer(options.processor(processor)); - - new Thread(() -> { - server.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Sharing Registry Server Stopped."); - }) - .start(); - new Thread(() -> { - while (!server.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; - } - } - if (server.isServing()) { - - try { - logger.info("Register sharing service with DB Event publishers"); - SharingServiceDBEventMessagingFactory.registerSharingServiceWithPublishers( - Constants.PUBLISHERS); - - logger.info("Start sharing service DB Event subscriber"); - SharingServiceDBEventMessagingFactory.getDBEventSubscriber(); - } catch (AiravataException | SharingRegistryException e) { - logger.error("Error starting sharing service. Error setting up DB event services."); - server.stop(); - } - setStatus(ServerStatus.STARTED); - logger.info("Starting Sharing Registry Server on Port " + serverPort); - logger.info("Listening to Sharing Registry server clients ...."); - } - }) - .start(); - - } catch (TTransportException e) { - setStatus(IServer.ServerStatus.FAILED); - throw new Exception("Error while starting the Sharing Registry service", e); - } - } - - @Override - public void stop() throws Exception { - if (server != null && server.isServing()) { - setStatus(IServer.ServerStatus.STOPING); - server.stop(); - } - } - - @Override - public void restart() throws Exception { - stop(); - start(); - } - - @Override - public void configure() throws Exception {} - - @Override - public IServer.ServerStatus getStatus() throws Exception { - return status; - } - - private void setStatus(IServer.ServerStatus stat) { - status = stat; - status.updateTime(); - } - - public TServer getServer() { - return server; - } - - public void setServer(TServer server) { - this.server = server; - } - - public void setTestMode(boolean testMode) { - this.testMode = testMode; - } - - private SharingRegistryDBInitConfig createSharingRegistryDBInitConfig() { - SharingRegistryDBInitConfig sharingRegistryDBInitConfig = new SharingRegistryDBInitConfig(); - if (this.testMode) { - sharingRegistryDBInitConfig.setDBInitScriptPrefix("sharing-registry"); - } - return sharingRegistryDBInitConfig; - } -} diff --git a/airavata-api/src/main/resources/distribution/bin/airavata.sh b/airavata-api/src/main/resources/distribution/bin/airavata.sh new file mode 100644 index 0000000000..9121bf92cd --- /dev/null +++ b/airavata-api/src/main/resources/distribution/bin/airavata.sh @@ -0,0 +1,5 @@ +#!/bin/bash +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +run_service "airavata" "org.apache.airavata.api.server.AiravataUnifiedServer" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/controller.sh b/airavata-api/src/main/resources/distribution/bin/controller.sh deleted file mode 100755 index 4e145cd5ee..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/controller.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="controller" -MAIN_CLASS="org.apache.airavata.helix.impl.controller.HelixController" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/email-monitor.sh b/airavata-api/src/main/resources/distribution/bin/email-monitor.sh deleted file mode 100755 index beb11ebbad..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/email-monitor.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="email-monitor" -MAIN_CLASS="org.apache.airavata.monitor.email.EmailBasedMonitor" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/orchestrator.sh b/airavata-api/src/main/resources/distribution/bin/orchestrator.sh deleted file mode 100755 index 5e457ac5bc..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/orchestrator.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="orchestrator" -MAIN_CLASS="org.apache.airavata.server.ServerMain" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -SERVERS="" -ARGS=() -while [[ $# -gt 0 ]]; do - case $1 in - apiserver | gfac | orchestrator | credentialstore | regserver) - if [ -z "$SERVERS" ]; then SERVERS="$1"; else SERVERS="$SERVERS,$1"; fi - shift - ;; - all | api-orch | execution) - SERVERS="$1" - shift - ;; - *) - ARGS+=("$1") - shift - ;; - esac -done -CONSTRUCTED_ARGS=() -if [[ " ${ARGS[*]} " =~ " start " ]]; then - if [ -n "$SERVERS" ]; then - CONSTRUCTED_ARGS+=("--servers=${SERVERS}") - else - echo "You should provide at least one server component to start the airavata server. Please use -h option to get more details." - exit 1 - fi -fi - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "${ARGS[@]}" "${CONSTRUCTED_ARGS[@]}" diff --git a/airavata-api/src/main/resources/distribution/bin/parser-wm.sh b/airavata-api/src/main/resources/distribution/bin/parser-wm.sh deleted file mode 100755 index f451c6dabb..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/parser-wm.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="parser-wm" -MAIN_CLASS="org.apache.airavata.helix.impl.workflow.ParserWorkflowManager" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/participant.sh b/airavata-api/src/main/resources/distribution/bin/participant.sh deleted file mode 100755 index 2f8730c743..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/participant.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="participant" -MAIN_CLASS="org.apache.airavata.helix.impl.participant.GlobalParticipant" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/post-wm.sh b/airavata-api/src/main/resources/distribution/bin/post-wm.sh deleted file mode 100755 index 6d867cdcba..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/post-wm.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="post-wm" -MAIN_CLASS="org.apache.airavata.helix.impl.workflow.PostWorkflowManager" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/pre-wm.sh b/airavata-api/src/main/resources/distribution/bin/pre-wm.sh deleted file mode 100755 index c8f1dc3bab..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/pre-wm.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="pre-wm" -MAIN_CLASS="org.apache.airavata.helix.impl.workflow.PreWorkflowManager" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh b/airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh deleted file mode 100755 index 347fd24a21..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="realtime-monitor" -MAIN_CLASS="org.apache.airavata.monitor.realtime.RealtimeMonitor" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/airavata-api/src/main/resources/distribution/bin/sharing-registry.sh b/airavata-api/src/main/resources/distribution/bin/sharing-registry.sh deleted file mode 100755 index 9ce01762ae..0000000000 --- a/airavata-api/src/main/resources/distribution/bin/sharing-registry.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -. $(dirname $0)/setenv.sh - -SERVICE_NAME="sharing-registry" -MAIN_CLASS="org.apache.airavata.sharing.registry.server.ServerMain" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml" - -run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
