Skip to content

Commit

Permalink
Use hostname in serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
ACz-UniBi authored and jdvorak001 committed Dec 9, 2023
1 parent 8c32485 commit a83f4ce
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ public void error( final SAXParseException exception ) throws SAXException {
fail( "While validating element " + elString + ": " + e );
}
}

}

/**
Expand All @@ -801,6 +800,7 @@ public FileLoggingConnectionStreamFactory( final String logDir ) {
@Override
public InputStream makeInputStream( final URLConnection conn ) throws IOException {
InputStream inputStream = conn.getInputStream();
String baseURLhostname = conn.getURL().getHost();
if ( logDir != null ) {
final Path logDirPath = Paths.get( logDir );
Files.createDirectories( logDirPath );
Expand All @@ -816,10 +816,9 @@ public InputStream makeInputStream( final URLConnection conn ) throws IOExceptio
sb.append( m2.group( 1 ) );
}
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern( "yyyyMMdd'T'HHmmss.SSS" );
final String logFilename = "oai-pmh--" + dtf.format( LocalDateTime.now() ) + "--" + sb.toString() + ".xml";
final String logFilename = baseURLhostname + "_oai-pmh--" + dtf.format( LocalDateTime.now() ) + "--" + sb.toString() + ".xml";
inputStream = new FileSavingInputStream( inputStream, logDirPath.resolve( logFilename ) );
}
return inputStream;
}

}

1 comment on commit a83f4ce

@ACz-UniBi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jdvorak001 . Having the endpoint hostname on the data serialization at the filesystem level is very useful.

Please sign in to comment.