Added method for getting portal instance name
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portal/portal-manager@117072 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
992e17f4d8
commit
23c1b5d032
|
@ -26,8 +26,9 @@ public class PortalContext {
|
||||||
private static final String INFRASTRUCTURE_NAME = "infrastructure";
|
private static final String INFRASTRUCTURE_NAME = "infrastructure";
|
||||||
private static final String SCOPES = "scopes";
|
private static final String SCOPES = "scopes";
|
||||||
|
|
||||||
private static final String SENDER_EMAIL_PROPNAME = "notificationSenderEmail";;
|
private static final String SENDER_EMAIL = "notificationSenderEmail";
|
||||||
|
private static final String GATEWAY_NAME = "portalinstancename";
|
||||||
|
|
||||||
private static PortalContext singleton = new PortalContext();
|
private static PortalContext singleton = new PortalContext();
|
||||||
|
|
||||||
private String infra;
|
private String infra;
|
||||||
|
@ -89,9 +90,32 @@ public class PortalContext {
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read the sender email for notifications name from a property file and returns it
|
* read the portal instance name from a property file and returns it
|
||||||
|
*/
|
||||||
|
public static String getPortalInstanceName() {
|
||||||
|
//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(GATEWAY_NAME);
|
||||||
|
}
|
||||||
|
//catch exception in case properties file does not exist
|
||||||
|
catch(IOException e) {
|
||||||
|
toReturn = "D4science Gateway";
|
||||||
|
_log.error("gcube-data.properties file not found under $CATALINA_HOME/conf dir, returning default Portal Name " + toReturn);
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
_log.debug("Returning Gateway Name: " + toReturn );
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* read the sender (from) email address for notifications name from a property file and returns it
|
||||||
*/
|
*/
|
||||||
public String getSenderEmail() {
|
public String getSenderEmail() {
|
||||||
//get the portles to look for from the property file
|
//get the portles to look for from the property file
|
||||||
|
@ -103,7 +127,7 @@ public class PortalContext {
|
||||||
File propsFile = new File(propertyfile);
|
File propsFile = new File(propertyfile);
|
||||||
FileInputStream fis = new FileInputStream(propsFile);
|
FileInputStream fis = new FileInputStream(propsFile);
|
||||||
props.load( fis);
|
props.load( fis);
|
||||||
toReturn = props.getProperty(SENDER_EMAIL_PROPNAME);
|
toReturn = props.getProperty(SENDER_EMAIL);
|
||||||
}
|
}
|
||||||
//catch exception in case properties file does not exist
|
//catch exception in case properties file does not exist
|
||||||
catch(IOException e) {
|
catch(IOException e) {
|
||||||
|
|
Loading…
Reference in New Issue