ContextManager should read VO IDs as well

Feature/25384
Massimiliano Assante 10 months ago
parent eb617ee395
commit c48c8bd783

@ -4,6 +4,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.9.0-SNAPSHOT] - 2023-07-14
- Feature #25384: rmp-common-library ContextManager should read VO IDs as well
## [v2.8.6] - 2022-06-17
- Fixed pom for HL portal removal

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>rmp-common-library</artifactId>
<version>2.8.6</version>
<version>2.9.0-SNAPSHOT</version>
<name>Resource Management Library</name>
<description>
gCube Resource Management Library is a common library containing shared code for Information System Operations

@ -58,7 +58,7 @@ import org.xml.sax.SAXException;
public class ContextManager {
private static final Map<String, ScopeBean> CONTEXTS = new LinkedHashMap<String, ScopeBean>();
private static String confFile = null;
private static final String LOG_PREFIX = "[SCOPE-MGR]";
private static final String LOG_PREFIX = "[CONTEXT-MGR]";
private static final String GEN_RESOURCE_TYPE = "INFRASTRUCTURE";
private static final String GEN_RESOURCE_NAME = "VirtualOrganisation";
@ -104,7 +104,7 @@ public class ContextManager {
public static LinkedHashMap<String, ScopeBean> readContexts() throws Exception {
LinkedHashMap<String, ScopeBean> toReturn = new LinkedHashMap<String, ScopeBean>();
String scopeXML = readInfraVoFromIS();
System.out.println("**** readContexts()");
ServerConsole.info(LOG_PREFIX, "**** readContexts()");
Document scopeDocument = getDocumentGivenXML(scopeXML);
NodeList voElements = scopeDocument.getElementsByTagName("vo");
ServerConsole.debug("voElements="+ voElements.getLength());
@ -136,15 +136,21 @@ public class ContextManager {
public static LinkedHashMap<String, D4SEnvironment> readContextsWithUUIDs() throws Exception {
LinkedHashMap<String, D4SEnvironment> toReturn = new LinkedHashMap<String, D4SEnvironment>();
String scopeXML = readInfraVoFromIS();
System.out.println("**** readContexts()");
ServerConsole.info(LOG_PREFIX, "**** readContexts()");
Document scopeDocument = getDocumentGivenXML(scopeXML);
NodeList voElements = scopeDocument.getElementsByTagName("vo");
ServerConsole.debug("voElements="+ voElements.getLength());
for (int i = 0; i < voElements.getLength(); i++) {
NodeList voDetails = voElements.item(i).getChildNodes();
String voString = voDetails.item(2).getFirstChild().getNodeValue();
String voID = "non-existing-vo-id";
try {
voID = voDetails.item(3).getFirstChild().getNodeValue();
} catch (Exception e) {
ServerConsole.error("Exception raised while trying reading VO ID from GenericResource having name: " + GEN_RESOURCE_NAME, e);
}
ScopeBean vo = new ScopeBean(voString);
D4SEnvironment voWrapper = new D4SEnvironment(vo, "uuid-not-exisiting-for-vos");
D4SEnvironment voWrapper = new D4SEnvironment(vo, voID);
toReturn.put(vo.toString(), voWrapper);
try {
for (GenericResource resVRE : getVREResourcesFromVO(vo)) {

Loading…
Cancel
Save