use of org.expath.pkg.repo.UserInteractionStrategy in project exist by eXist-db.
the class RemoveFunction method eval.
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
Sequence removed = BooleanValue.TRUE;
boolean force = false;
UserInteractionStrategy interact = new BatchUserInteraction();
String pkg = args[0].getStringValue();
try {
Optional<ExistRepository> repo = getContext().getRepository();
if (repo.isPresent()) {
Repository parent_repo = repo.get().getParentRepo();
parent_repo.removePackage(pkg, force, interact);
repo.get().reportAction(ExistRepository.Action.UNINSTALL, pkg);
context.getBroker().getBrokerPool().getXQueryPool().clear();
} else {
throw new XPathException("expath repository not available");
}
} catch (PackageException | XPathException pe) {
return BooleanValue.FALSE;
// /TODO: _repo.removePackage seems to throw PackageException
// throw new XPathException("Problem removing package " + pkg + " in expath repository, check that eXist-db has access permissions to expath repository file directory ", pe);
}
return removed;
}
Aggregations