A new property containing the ICProxy EndPoint named "ic-proxy-endpoint" has beenadded in $CATALINA_HOME/conf/gcube-data.properties

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portal/portal-manager@141972 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-01-31 17:51:49 +00:00
parent 0dd89ef9aa
commit 51ed4a70ea
2 changed files with 57 additions and 0 deletions

View File

@ -15,6 +15,8 @@ public class GCubePortalConstants {
public static final String INFRASTRUCTURE_NAME = "infrastructure";
public static final String SCOPES = "scopes";
public static final String PORTAL_APPLICATION_TOKEN = "portalAuthToken";
public static final String ICPROXY_ENDPOINT_URL = "ic-proxy-endpointURL";
public static final String SENDER_EMAIL = "notificationSenderEmail";
public static final String GATEWAY_NAME = "portalinstancename";
public static final String ADMIN_USERNAME = "administratorUsername";

View File

@ -691,6 +691,59 @@ public class PortalContext {
return toReturn;
}
/**
* <p>
* read the portal application token valid in the root Virtual Organisation into a property file
* </p>
* @return the portal application token valid in the root Virtual Organisation or <code>null</code> if the token could not be found
*/
public static String getPortalApplicationToken() {
//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(GCubePortalConstants.PORTAL_APPLICATION_TOKEN);
}
//catch exception in case properties file does not exist
catch(IOException e) {
toReturn = null;
_log.error("gcube-data.properties file or portal app token not found under $CATALINA_HOME/conf dir, please add the property and or a valid token: " + GCubePortalConstants.PORTAL_APPLICATION_TOKEN);
return toReturn;
}
return toReturn;
}
/**
* <p>
* read the IC Proxy endpoint from a property file, IC Proxy is needed to query the Information System via REST
* e.g. http://dev.d4science.org:8080/icproxy/gcube/service
* </p>
* @return the IC Proxy endpoint or <code>null</code> if the IC Proxy could not be found
*/
public static String getICProxyEndPoint() {
//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(GCubePortalConstants.ICPROXY_ENDPOINT_URL);
}
//catch exception in case properties file does not exist
catch(IOException e) {
toReturn = null;
_log.error("gcube-data.properties file or portal app token not found under $CATALINA_HOME/conf dir, please add the property and or a valid token: " + GCubePortalConstants.PORTAL_APPLICATION_TOKEN);
return toReturn;
}
return toReturn;
}
/**
* read the sender (from) email address for notifications name from a property file and returns it
@ -867,6 +920,8 @@ public class PortalContext {
}
/**
*
* @return $CATALINA_HOME