From 2361b8384c277e8f928289bfe5395202078a85d5 Mon Sep 17 00:00:00 2001 From: mtorrisi Date: Tue, 26 Jul 2016 15:37:39 +0200 Subject: [PATCH] Changed visibility to the ActiveInteractions class to support Futuregateway with MyJobs portlet. Some minor bug fixed sending email. --- .../GridEngine/Config/GridEngineConfig.java | 129 +++++++++--------- .../ct/GridEngine/Job/JSagaJobSubmission.java | 5 +- .../Job/MultiInfrastructureJobSubmission.java | 5 +- .../UsersTracking/ActiveInteractions.java | 4 +- 4 files changed, 72 insertions(+), 71 deletions(-) diff --git a/it/infn/ct/GridEngine/Config/GridEngineConfig.java b/it/infn/ct/GridEngine/Config/GridEngineConfig.java index 2eb9fb8..d4c1731 100644 --- a/it/infn/ct/GridEngine/Config/GridEngineConfig.java +++ b/it/infn/ct/GridEngine/Config/GridEngineConfig.java @@ -8,70 +8,70 @@ public class GridEngineConfig { - private static GridEngineConfig instance = null; + private static GridEngineConfig instance = null; private static final Logger _log = Logger.getLogger(GridEngineConfig.class.getName()); - private final String gePropertiesFile = "GridEngine.properties"; - - private String userstrackingDatasource = "jdbc/UserTrackingPool"; //default value - private String hibernateDatasource = "jdbc/gehibernatepool"; //default value - - public static synchronized GridEngineConfig getInstance(){ - if (instance == null) - instance = new GridEngineConfig(); - return instance; - } - + private final String gePropertiesFile = "GridEngine.properties"; + + private String userstrackingDatasource = "jdbc/UserTrackingPool"; + private String hibernateDatasource = "jdbc/gehibernatepool"; + + public static synchronized GridEngineConfig getInstance() { + if (instance == null) + instance = new GridEngineConfig(); + return instance; + } + /** - * Load the given configuration file which overrides static settings - * @param configFile - */ - private GridEngineConfig() { - /* - Load a configuration file containing GridEngineDaemon settings - wich override the static settings defined in the class - */ - loadProperties(); - _log.info("GridEngine config:" + this.toString()); - } + * Load the given configuration file which overrides static settings + * + * @param configFile + */ + private GridEngineConfig() { + /* + * Load a configuration file containing GridEngineDaemon settings wich + * override the static settings defined in the class + */ + loadProperties(); + _log.info("GridEngine config:" + this.toString()); + } private void loadProperties() { - // - InputStream inputStream=null; - Properties prop = new Properties(); - try { - inputStream = this.getClass().getClassLoader(). - getResourceAsStream(gePropertiesFile); - - prop.load(inputStream); - - /* - Retrieving configuration values - */ - - // APIServer DB settings - String prop_usertrackingDatasource = prop.getProperty("usertracking_datasource"); - String prop_hibernateDatasource = prop.getProperty("hibernate_datasource"); - - if(prop_usertrackingDatasource!=null) { - this.userstrackingDatasource = prop_usertrackingDatasource; - } - if(prop_hibernateDatasource!=null) { - this.hibernateDatasource = prop_hibernateDatasource; - } - } catch(NullPointerException e) { - _log.warn("Unable to load property file; using default settings"); - } catch(IOException e) { - _log.warn("Error reading file: "+ e); - } catch(NumberFormatException e) { - _log.warn("Error while reading property file: "+ e); - } - finally { - try { - if(null != inputStream) inputStream.close(); - } catch (IOException e) { - _log.error("Error closing configuration file input stream"); - } - } + // + InputStream inputStream = null; + Properties prop = new Properties(); + try { + inputStream = this.getClass().getClassLoader().getResourceAsStream(gePropertiesFile); + + prop.load(inputStream); + + /* + * Retrieving configuration values + */ + + // APIServer DB settings + String prop_usertrackingDatasource = prop.getProperty("usertracking_datasource"); + String prop_hibernateDatasource = prop.getProperty("hibernate_datasource"); + + if (prop_usertrackingDatasource != null) { + this.userstrackingDatasource = prop_usertrackingDatasource; + } + if (prop_hibernateDatasource != null) { + this.hibernateDatasource = prop_hibernateDatasource; + } + } catch (NullPointerException e) { + _log.warn("Unable to load property file; using default settings"); + } catch (IOException e) { + _log.warn("Error reading file: " + e); + } catch (NumberFormatException e) { + _log.warn("Error while reading property file: " + e); + } finally { + try { + if (null != inputStream) + inputStream.close(); + } catch (IOException e) { + _log.error("Error closing configuration file input stream"); + } + } } public String getUserstrackingDatasource() { @@ -81,12 +81,11 @@ public String getUserstrackingDatasource() { public String getHibernateDatasource() { return hibernateDatasource; } - + @Override public String toString() { - return "GridEngineConfig [gePropetiesFile=" + gePropertiesFile - + ", userstrackingDatasource=" + userstrackingDatasource - + ", hibernateDatasource=" + hibernateDatasource + "]"; + return "GridEngineConfig [gePropetiesFile=" + gePropertiesFile + ", userstrackingDatasource=" + + userstrackingDatasource + ", hibernateDatasource=" + hibernateDatasource + "]"; } - + } diff --git a/it/infn/ct/GridEngine/Job/JSagaJobSubmission.java b/it/infn/ct/GridEngine/Job/JSagaJobSubmission.java index afcc80d..823d260 100644 --- a/it/infn/ct/GridEngine/Job/JSagaJobSubmission.java +++ b/it/infn/ct/GridEngine/Job/JSagaJobSubmission.java @@ -590,7 +590,8 @@ public String getUserEmail() { */ public void setUserEmail(String userEmail) { if(!this.userEmail.equals("")){ - this.userEmail.concat("|"+userEmail); + String tmp = this.userEmail; + this.userEmail = tmp + "|" +userEmail; } else { this.userEmail = userEmail; } @@ -604,7 +605,7 @@ public void setUserEmail(String userEmail) { public void setSenderEmail(String senderEmail) { if(!this.userEmail.equals("")){ String tmp = this.userEmail; - this.userEmail = senderEmail+"|"+tmp; + this.userEmail = senderEmail + "|" + tmp; } else { this.userEmail = senderEmail; } diff --git a/it/infn/ct/GridEngine/Job/MultiInfrastructureJobSubmission.java b/it/infn/ct/GridEngine/Job/MultiInfrastructureJobSubmission.java index 9f15b31..ecf2cff 100644 --- a/it/infn/ct/GridEngine/Job/MultiInfrastructureJobSubmission.java +++ b/it/infn/ct/GridEngine/Job/MultiInfrastructureJobSubmission.java @@ -472,7 +472,8 @@ public String getUserEmail() { */ public void setUserEmail(String userEmail) { if(!this.userEmail.equals("")){ - this.userEmail.concat("|"+userEmail); + String tmp = this.userEmail; + this.userEmail = tmp + "|" +userEmail; } else { this.userEmail = userEmail; } @@ -486,7 +487,7 @@ public void setUserEmail(String userEmail) { public void setSenderEmail(String senderEmail) { if(!this.userEmail.equals("")){ String tmp = this.userEmail; - this.userEmail = senderEmail+"|"+tmp; + this.userEmail = senderEmail + "|" + tmp; } else { this.userEmail = senderEmail; } diff --git a/it/infn/ct/GridEngine/UsersTracking/ActiveInteractions.java b/it/infn/ct/GridEngine/UsersTracking/ActiveInteractions.java index a1c9ced..6fcd1be 100644 --- a/it/infn/ct/GridEngine/UsersTracking/ActiveInteractions.java +++ b/it/infn/ct/GridEngine/UsersTracking/ActiveInteractions.java @@ -14,11 +14,11 @@ public class ActiveInteractions { private String[] interactionInfos; private Vector subJobs; - protected ActiveInteractions() { + public ActiveInteractions() { super(); } - protected ActiveInteractions(String[] interactionInfos, + public ActiveInteractions(String[] interactionInfos, Vector subJobs) { super(); this.interactionInfos = interactionInfos;