Compare commits

...

5 Commits

5 changed files with 26 additions and 8 deletions

View File

@ -19,9 +19,9 @@
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="rmp-common-library">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
</wb-module>
</project-modules>

View File

@ -4,6 +4,14 @@
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] - 2023-04-22
- Feature #25384: rmp-common-library ContextManager should read VO IDs as well
## [v2.8.6] - 2022-06-17
- Fixed pom for HL portal removal
## [v2.8.5] - 2022-03-17
- Fix for #21652 Some keys contain the context and some other (the VRE contextes) contains in the context name.

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>rmp-common-library</artifactId>
<version>2.8.5</version>
<version>2.9.0</version>
<name>Resource Management Library</name>
<description>
gCube Resource Management Library is a common library containing shared code for Information System Operations
@ -38,7 +38,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.3</version>
<version>3.7.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -104,7 +104,7 @@
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<scope>provided</scope>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>junit</groupId>

View File

@ -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)) {