Aggrefier: support for aggrefying child sources of container sources (zip, gzip, arc...)

Issue #78 resolved
Laurent Bihanic
created an issue

The aggrefier module should recognized and aggrefy composite sources present in the child sources of container sources (zip, gzip, arc...).

A possible implementation would be:

  • Add {{{hasChildSources()}}} method to Source (for efficiency instead of using {{{getNumChildSources()}}})

{{{
Source.java:
/*
* Returns whether this source has child sources.
* @return <code>true</code> if this source has child sources;
* <code>false</code> otherwise.
/
public boolean hasChildSources();

AbstractSource.java:
/* {@Joe} /
@Override
public boolean hasChildSources() {
return (! this.children.isEmpty());
}
}}}

  • Modify {{{AggrefierCommand}}} to check for child sources

{{{
public void execute(JHOVE2 jhove2, Source source, Input input)
throws JHOVE2Exception
{
if ((source instanceof AggregateSource) || (source.hasChildSources())) {
...
}}}

  • Have {{{GlobPathRecognizer}}} use the source name rather than the file name (which may now be a temporary file name) to match sources

{{{
protected Collection <GlobPathMatchInfoGroup> groupSources(Source source)
throws JHOVE2Exception{
...
for (Source childSource:source.getChildSources()){
String filePath = null;
if (childSource instanceof NamedSource) {
filePath = ((NamedSource)childSource).getSourceName();
}
if (filePath != null) {
...
}}}