/** * Checks if an XQuery component is already installed as part of another package. * * @param comp component * @param name component's package * @return result * @throws QueryException query exception */ private boolean isInstalled(final Component comp, final byte[] name) throws QueryException { // get packages in which the module's namespace is found final TokenSet pkgs = repo.nsDict().get(comp.uri); if (pkgs == null) return false; for (final byte[] nextPkg : pkgs) { if (nextPkg != null && !eq(Package.name(nextPkg), name)) { // installed package is a different one, not just a different version // of the current one final String pkgDir = string(repo.pkgDict().get(nextPkg)); final IO pkgDesc = new IOFile(repo.path(pkgDir), DESCRIPTOR); final Package pkg = new PkgParser(repo, input).parse(pkgDesc); for (final Component nextComp : pkg.comps) { if (nextComp.name().equals(comp.name())) return true; } } } return false; }