Skip to content

Commit

Permalink
updated info endpoint fixes Edirom/MEIGarage#76
Browse files Browse the repository at this point in the history
  • Loading branch information
anneferger committed Jun 21, 2024
1 parent b7907ac commit b894dee
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/main/java/pl/psnc/dl/ege/webapp/servlethelpers/Info.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,32 @@ public void doGetHelper(HttpServletRequest request, HttpServletResponse response
//get info from each converter
//add info which sources are used /usr/share/xml/tei/odd/VERSION
//TEIROOT default is /usr/share/xml/tei/
String versionodd = Files.readString(Paths.get(EGEConstants.TEIROOT + "odd/VERSION"), StandardCharsets.UTF_8);
String versionstylesheets = Files.readString(Paths.get(EGEConstants.TEIROOT + "stylesheet/VERSION"), StandardCharsets.UTF_8);
json_info.put("tei-odd-version", versionodd);
json_info.put("tei-stylesheet-version", versionstylesheets);
//add info which MEI sources are used
//To do: /usr/share/xml/mei/music-encoding/mei401...
if(new File(EGEConstants.TEIROOT + "odd/VERSION").isFile()){
String versionodd = Files.readString(Paths.get(EGEConstants.TEIROOT + "odd/VERSION"), StandardCharsets.UTF_8);
if (!(versionodd == null)) {
json_info.put("tei-odd-version", versionodd.replaceAll("\\n", ""));
}
}
if(new File(EGEConstants.TEIROOT + "stylesheet/VERSION").isFile()){
String versionstylesheets = Files.readString(Paths.get(EGEConstants.TEIROOT + "stylesheet/VERSION"), StandardCharsets.UTF_8);
if (!(versionstylesheets == null)) {
json_info.put("tei-stylesheet-version", versionstylesheets.replaceAll("\\n", ""));
}
}
//add info which MEI de version is used
//music-encoding/meidev/GITHASH
if(new File(EGEConstants.MEIROOT + "music-encoding/meidev/GITHASH").isFile()){
String versionmeidev = Files.readString(Paths.get(EGEConstants.MEIROOT + "music-encoding/meidev/GITHASH"), StandardCharsets.UTF_8);
if (!(versionmeidev == null)){
json_info.put("mei-dev-githash", versionmeidev.replaceAll("\\n", ""));
}
}
if(new File(EGEConstants.MEIROOT + "music-stylesheets/encoding-tools/GITHASH").isFile()){
String versionmeitools = Files.readString(Paths.get(EGEConstants.MEIROOT + "music-stylesheets/encoding-tools/GITHASH"), StandardCharsets.UTF_8);
if (!(versionmeitools == null)){
json_info.put("mei-encoding-tools-githash", versionmeitools.replaceAll("\\n", ""));
}
}
//resolve request and catch any errors
RequestResolver rr = new InfoRequestResolver(request,
Method.GET);
Expand All @@ -73,6 +93,9 @@ public void doGetHelper(HttpServletRequest request, HttpServletResponse response
} catch (JSONException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}

}

Expand Down

0 comments on commit b894dee

Please sign in to comment.