diff --git a/pom.xml b/pom.xml
index 2112210..528b21e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
org.gcube.common.portal
portal-manager
- 1.1.0-SNAPSHOT
+ 1.2.0-SNAPSHOT
jar
gCube Portal Manager
diff --git a/src/main/java/org/gcube/common/portal/PortalContext.java b/src/main/java/org/gcube/common/portal/PortalContext.java
index 634eef8..a23d4d4 100644
--- a/src/main/java/org/gcube/common/portal/PortalContext.java
+++ b/src/main/java/org/gcube/common/portal/PortalContext.java
@@ -28,6 +28,7 @@ public class PortalContext {
private static final String SENDER_EMAIL = "notificationSenderEmail";
private static final String GATEWAY_NAME = "portalinstancename";
+ private static final String ADMIN_USERNAME = "administratorUsername";
private static PortalContext singleton = new PortalContext();
@@ -91,9 +92,18 @@ public class PortalContext {
return toReturn;
}
/**
- * read the portal instance name from a property file and returns it
+ *
+ * @deprecated use getConfiguration().getGatewayName() method
+ * read the portal instance name from a property file and returns it
*/
+ @Deprecated
public static String getPortalInstanceName() {
+ return getConfiguration().getGatewayName();
+ }
+ /**
+ * read the infrastructure gateway name from a property file and returns it
+ */
+ public String getGatewayName() {
//get the portles to look for from the property file
Properties props = new Properties();
String toReturn = "";
@@ -138,6 +148,30 @@ public class PortalContext {
_log.debug("Returning SENDER_EMAIL: " + toReturn );
return toReturn;
}
+ /**
+ * read the sender (from) email address for notifications name from a property file and returns it
+ */
+ public String getAdministratorUsername() {
+ //get the portles to look for from the property file
+ Properties props = new Properties();
+ String toReturn = "";
+
+ try {
+ String propertyfile = getCatalinaHome() + File.separator + "conf" + File.separator + "gcube-data.properties";
+ File propsFile = new File(propertyfile);
+ FileInputStream fis = new FileInputStream(propsFile);
+ props.load( fis);
+ toReturn = props.getProperty(ADMIN_USERNAME);
+ }
+ //catch exception in case properties file does not exist
+ catch(IOException e) {
+ toReturn = "massimiliano.assante";
+ _log.error("gcube-data.properties file not found under $CATALINA_HOME/conf dir, returning default administrator" + toReturn);
+ return toReturn;
+ }
+ _log.debug("Returning Administrator username: " + toReturn );
+ return toReturn;
+ }
/**
*
* @return $CATALINA_HOME