fixed bug in parsing method

This commit is contained in:
Marco Procaccini 2024-05-07 14:17:20 +02:00
parent 50168d5d4e
commit ee057642df
27 changed files with 39 additions and 18 deletions

0
.classpath Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
.project Normal file → Executable file
View File

0
.settings/org.eclipse.jdt.apt.core.prefs Normal file → Executable file
View File

0
.settings/org.eclipse.jdt.core.prefs Normal file → Executable file
View File

0
.settings/org.eclipse.m2e.core.prefs Normal file → Executable file
View File

0
CHANGELOG.md Normal file → Executable file
View File

0
FUNDING.md Normal file → Executable file
View File

0
LICENSE.md Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
descriptor.xml Normal file → Executable file
View File

4
pom.xml Normal file → Executable file
View File

@ -3,12 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- <parent>
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.1.0</version>
</parent>
-->
<groupId>org.gcube.vremanagement</groupId>
<artifactId>vre-removed-publisher</artifactId>
<version>1.0.0-SNAPSHOT</version>

0
profile.xml Normal file → Executable file
View File

2
src/main/java/org/gcube/vremanagement/App.java Normal file → Executable file
View File

@ -49,7 +49,7 @@ public class App {
//xmlManager.getGatewaysInfo();
xmlManager.getVosInfo("D4Science.org Detached Gateway");
//xmlManager.findVo("D4Science.org Detached Gateway", "gCubeApps");
//xmlManager.findVre("D4Science.org Detached Gateway", "D4OS", "CNROutreach");
xmlManager.findVre("D4Science.org Detached Gateway", "D4OS", "CNROutreach");
}
}

0
src/main/java/org/gcube/vremanagement/CsvManager.java Normal file → Executable file
View File

0
src/main/java/org/gcube/vremanagement/Gateway.java Normal file → Executable file
View File

0
src/main/java/org/gcube/vremanagement/Vos.java Normal file → Executable file
View File

View File

0
src/main/java/org/gcube/vremanagement/Vres.java Normal file → Executable file
View File

49
src/main/java/org/gcube/vremanagement/XmlManager.java Normal file → Executable file
View File

@ -34,7 +34,9 @@ public class XmlManager implements VreRemPubInterface {
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(xmlFile);
doc.getDocumentElement().normalize();
NodeList gatewayList = doc.getElementsByTagName("entry");
NodeList gatewayNodes = doc.getElementsByTagName("gateways");
NodeList gatewayList = gatewayNodes.item(0).getChildNodes();
for (int i = 0; i < gatewayList.getLength(); i++) {
Node gatewayNode = gatewayList.item(i);
@ -44,6 +46,8 @@ public class XmlManager implements VreRemPubInterface {
String gatewayDescription = gatewayElement.getElementsByTagName("description").item(0)
.getTextContent().trim();
//System.out.println("gateway name:"+gatewayName);
//System.out.println("Gateway descr:"+gatewayDescription);
Gateway gateway = new Gateway(gatewayName, gatewayDescription);
// Find the <vos> element within the gateway entry
@ -53,21 +57,36 @@ public class XmlManager implements VreRemPubInterface {
if (vosNode.getNodeType() == Node.ELEMENT_NODE) {
Element vosElement = (Element) vosNode;
// Iterate through <entry> elements representing VOs within <vos>
NodeList voList = vosElement.getElementsByTagName("entry");
for (int k = 0; k < voList.getLength(); k++) {
Node voNode = voList.item(k);
if (voNode.getNodeType() == Node.ELEMENT_NODE) {
Element voElement = (Element) voNode;
String voName = voElement.getElementsByTagName("name").item(0).getTextContent().trim();
String voScope = voElement.getElementsByTagName("scope").item(0).getTextContent().trim();
String voKey = voElement.getElementsByTagName("key").item(0).getTextContent().trim();
// Create a new Vos object and add it to the gateway's vosList
String voKey = vosElement.getElementsByTagName("key").item(0).getTextContent().trim();
String voName = vosElement.getElementsByTagName("name").item(0).getTextContent().trim();
String voScope = vosElement.getElementsByTagName("scope").item(0).getTextContent().trim();
//getting vo
Vos vos = new Vos(voKey,voScope, voName);
//vos.printInfo();
// Iterate on the vres..
//NodeList vreList = vosElement.getElementsByTagName("vres");
//
//for (int k = 0; k < vreList.getLength(); k++) {
// Node voNode = voList.item(k);
// if (voNode.getNodeType() == Node.ELEMENT_NODE) {
// Element voElement = (Element) voNode;
// String voName = voElement.getElementsByTagName("name").item(0).getTextContent().trim();
// String voScope = voElement.getElementsByTagName("scope").item(0).getTextContent().trim();
// String voKey = voElement.getElementsByTagName("key").item(0).getTextContent().trim();
// Create a new Vos object and add it to the gateway's vosList
// Vos vos = new Vos(voKey, voScope, voName);
// Find the <vres> element within the VO entry
NodeList vresList = voElement.getElementsByTagName("vres");
NodeList vresList = vosElement.getElementsByTagName("vres");
for (int l = 0; l < vresList.getLength(); l++) {
Node vresNode = vresList.item(l);
if (vresNode.getNodeType() == Node.ELEMENT_NODE) {
@ -96,6 +115,8 @@ public class XmlManager implements VreRemPubInterface {
Vres vres = new Vres(vreKey, vreName, vreDescription, vreManager,
vreStartDate, vreEndDate);
vos.addVres(vres);
//vres.printInfo();
}
}
}
@ -103,8 +124,8 @@ public class XmlManager implements VreRemPubInterface {
// Add the Vos object to the gateway's vosList
gateway.addVos(vos);
}
}
//}
//}
}
}

0
src/main/resources/META-INF/maven/archetype.xml Normal file → Executable file
View File

0
src/main/resources/archetype-resources/pom.xml Normal file → Executable file
View File

View File

View File

0
src/main/resources/doc.xml Normal file → Executable file
View File

0
src/main/resources/logback-test.xml Normal file → Executable file
View File

0
src/main/resources/updated_VREDecommisioned-240326.csv Normal file → Executable file
View File

Can't render this file because it has a wrong number of fields in line 2.