*
* @param luid
* the Library UID of the story
+ * @param pg
+ * the optional {@link Progress}
*
* @return the corresponding {@link Story}
*/
- public abstract File getFile(String luid);
+ public abstract File getFile(String luid, Progress pg);
/**
* Return the cover image associated to this story.
* @return the corresponding {@link Story} or NULL if not found
*/
public synchronized Story getStory(String luid, Progress pg) {
- // TODO: pg
if (pg == null) {
pg = new Progress();
}
+ Progress pgGet = new Progress();
+ Progress pgProcess = new Progress();
+
+ pg.setMinMax(0, 2);
+ pg.addProgress(pgGet, 1);
+ pg.addProgress(pgProcess, 1);
+
Story story = null;
for (MetaData meta : getMetas(null)) {
if (meta.getLuid().equals(luid)) {
- File file = getFile(luid);
+ File file = getFile(luid, pgGet);
+ pgGet.done();
try {
SupportType type = SupportType.valueOfAllOkUC(meta
.getType());
URL url = file.toURI().toURL();
if (type != null) {
- story = BasicSupport.getSupport(type).process(url, pg);
+ story = BasicSupport.getSupport(type).process(url,
+ pgProcess);
+ story.setMeta(meta);
} else {
throw new IOException("Unknown type: " + meta.getType());
}
} catch (IOException e) {
// We should not have not-supported files in the
// library
- Instance.syserr(new IOException(
+ Instance.getTraceHandler().error(new IOException(
"Cannot load file from library: " + file, e));
} finally {
+ pgProcess.done();
pg.done();
}