*/
protected void extract(InstallContextImpl ctx,
List<String> subPackages)
throws RepositoryException, PackageException {
log.info("Extracting {}", getId());
InstallHookProcessor hooks = ctx.getHooks();
Importer importer = ctx.getImporter();
try {
if (!hooks.execute(ctx)) {
throw new PackageException("Import aborted during prepare phase.");
}
try {
importer.run(archive, ctx.getImportRoot());
} catch (Exception e) {
log.error("Error during install.", e);
ctx.setPhase(InstallContext.Phase.INSTALL_FAILED);
hooks.execute(ctx);
throw new PackageException(e);
}
ctx.setPhase(InstallContext.Phase.INSTALLED);
hooks.execute(ctx);
if (importer.hasErrors() && ctx.getOptions().isStrict()) {
ctx.setPhase(InstallContext.Phase.INSTALL_FAILED);
hooks.execute(ctx);
throw new PackageException("Errors during import.");
}
} finally {
ctx.setPhase(InstallContext.Phase.END);
hooks.execute(ctx);
}
if (subPackages != null) {
subPackages.addAll(importer.getSubPackages());
}
log.info("Extracting {} completed.", getId());