*/
private void extract(ImportOptions options, boolean createSnapshot, boolean replaceSnapshot)
throws RepositoryException, PackageException, IOException {
getPackage();
// get a copy of the import options (bug 35164)
ImportOptions opts = options.copy();
// check for disable intermediate saves (GRANITE-1047)
if (this.getDefinition().getBoolean(JcrPackageDefinition.PN_DISABLE_INTERMEDIATE_SAVE) ) {
// MAX_VALUE disables saving completely, therefore we have to use a lower value!
opts.setAutoSaveThreshold(Integer.MAX_VALUE - 1);
}
InstallContextImpl ctx = pack.prepareExtract(node.getSession(), opts);
JcrPackage snap = null;
if (!opts.isDryRun() && createSnapshot) {
ExportOptions eOpts = new ExportOptions();
eOpts.setListener(opts.getListener());
snap = snapshot(eOpts, replaceSnapshot, opts.getAccessControlHandling());
}
List<String> subPackages = new ArrayList<String>();
pack.extract(ctx, subPackages);
getDefinition();
if (def != null && !opts.isDryRun()) {
def.touchLastUnpacked(null, true);
}
// process sub packages
Session s = node.getSession();
List<JcrPackageImpl> subPacks = new LinkedList<JcrPackageImpl>();
for (String path: subPackages) {
if (s.nodeExists(path)) {
JcrPackageImpl p = new JcrPackageImpl(s.getNode(path));
if (!p.isValid()) {
// check if package was included as pure .zip or .jar
try {
p.tryUnwrap();
} catch (Exception e) {
log.info("Sub package {} not valid: " + e, path);
}
}
if (p.isValid()) {
subPacks.add(p);
}
}
}
// don't extract sub packages if not recursive
if (!opts.isNonRecursive() && !subPacks.isEmpty()) {
try {
DependencyUtil.sortPackages(subPacks);
} catch (CyclicDependencyException e) {
if (opts.isStrict()) {
throw e;
}
}
List<String> subIds = new LinkedList<String>();
SubPackageHandling sb = pack.getSubPackageHandling();