return ARCHIVE_TYPE.ZIP.mimeTypes[0];
}
private Metadata makeManifest(HashMap<String, Object> manifestElements, String archivePrefix) {
SimpleManifestComposer smc = new Metadata.SimpleManifestComposer();
for (Map.Entry<String, Object> me : manifestElements.entrySet()) {
String name = me.getKey();
Object o = me.getValue();
if(o instanceof HashMap) {
@SuppressWarnings("unchecked")
HashMap<String,Object> hm = (HashMap<String, Object>) o;
HashMap<String,Object> subMap = new HashMap<String,Object>();
//System.out.println("Decompose: "+name+" (SubDir)");
smc.addItem(name, makeManifest(hm, archivePrefix+name+ '/'));
if(logDEBUG)
Logger.debug(this, "Sub map for "+name+" : "+subMap.size()+" elements from "+hm.size());
} else if (o instanceof Metadata) {
//already Metadata, take it as is
//System.out.println("Decompose: "+name+" (Metadata)");
smc.addItem(name, (Metadata)o);
} else {
ManifestElement element = (ManifestElement) o;
String mimeType = element.mimeOverride;
ClientMetadata cm;
if(mimeType == null || mimeType.equals(DefaultMIMETypes.DEFAULT_MIME_TYPE))
cm = null;
else
cm = new ClientMetadata(mimeType);
Metadata m;
if(element.targetURI != null) {
//System.out.println("Decompose: "+name+" (ManifestElement, Redirect)");
m = new Metadata(DocumentType.SIMPLE_REDIRECT, null, null, element.targetURI, cm);
} else {
//System.out.println("Decompose: "+name+" (ManifestElement, Data)");
containerItems.add(new ContainerElement(element.getData(), archivePrefix+name));
m = new Metadata(DocumentType.ARCHIVE_INTERNAL_REDIRECT, null, null, archivePrefix+element.fullName, cm);
}
smc.addItem(name, m);
}
}
return smc.getMetadata();
}