org.apache.jackrabbit.vault.fs.api.WorkspaceFilter类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.jackrabbit.vault.fs.api.WorkspaceFilter类的一些代码示例,展示了WorkspaceFilter类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkspaceFilter类的具体详情如下:
包路径:org.apache.jackrabbit.vault.fs.api.WorkspaceFilter
类名称:WorkspaceFilter

WorkspaceFilter介绍

[英]WorkspaceFilter defined a filter for items (node or property).
[中]WorkspaceFilter为项(节点或属性)定义了一个筛选器。

代码示例

代码示例来源:origin: net.adamcin.granite/granite-client-packman

public static WspFilter adaptWorkspaceFilter(WorkspaceFilter filter) {
  List<Root> roots = new ArrayList<Root>();
  for (PathFilterSet filterSet : filter.getFilterSets()) {
    roots.add(adaptFilterSet(filterSet));
  }
  return new WspFilter(roots);
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

Predicate<? super Map.Entry<PackageId, WorkspaceFilter>> overlaps(final String path) {
  return entry -> entry.getValue().contains(path);
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

/**
 * Tests if the given workspace filter includes the given property. If the filter does not cover the property,
 * it returns {@code true}.
 *
 * @param filter the workspace filter
 * @param propertyPath the path to the property
 * @return {@code true} if the property is included in the aggregate
 */
private boolean includesProperty(WorkspaceFilter filter, String propertyPath) {
  if (!filter.covers(propertyPath)) {
    // include all properties that are not covered by any filter. this is to ensure that the ancestor paths
    // have at least jcr:primary type.
    return true;
  }
  for (PathFilterSet filterSet: filter.getPropertyFilterSets()) {
    if (filterSet.contains(propertyPath)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

private TxInfo postFilter(TxInfo root) {
  TxInfo modifierRoot = root;
  if (filter.contains(modifierRoot.path)){
    return modifierRoot;
  }
  if (filter.isAncestor(modifierRoot.path)) {
    for (String k : modifierRoot.children().keySet()) {
      TxInfo child = modifierRoot.children().get(k);
      modifierRoot.children().put(k, postFilter(child));
    }
  }
  else {
    modifierRoot.discard();
  }
  return modifierRoot;
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

filter = filter.translate(new SimplePathMapping(mountPath, rootPath));
PackageId id = new PackageId(group, name, version);
Set<String> rts = new HashSet<String>();
for (PathFilterSet p: filter.getFilterSets()) {
  rts.add(p.getRoot());
writeFile(new ByteArrayInputStream(tmpOut.toByteArray()), Constants.META_DIR + "/" + Constants.PROPERTIES_XML);
writeFile(mgr.getConfig().getSource(), Constants.META_DIR + "/" + Constants.CONFIG_XML);
writeFile(filter.getSource(), Constants.META_DIR + "/" + Constants.FILTER_XML);

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

Node n = nIter.nextNode();
String path = n.getPath();
PathFilterSet coverSet = filter.getCoveringFilterSet(path);
boolean isAncestor = filter.isAncestor(path);
boolean isIncluded = filter.contains(path);
if (coverSet == null && !isAncestor) {
  continue;

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

filter = filter.translate(pathMapping);
  this.archive = archive = new MappedArchive(archive, pathMapping);
  this.archive.open(true);
for (PathFilterSet set: filter.getFilterSets()) {
  filterTree.put(set.getRoot(), set);
if (filter!=null && filter.getFilterSets() != null && filter.getFilterSets().size() > 0 ) {
  root = postFilter(root);

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

Node child = iter.nextNode();
String path = child.getPath();
if (wspFilter.contains(path)) {
  if (wspFilter.getImportMode(path) == ImportMode.REPLACE) {
    if (!hints.contains(path)) {

代码示例来源:origin: net.adamcin.granite/granite-client-packman

protected static ValidationResult checkDeniedPathInclusion(ValidationOptions options, VaultPackage pack) {
  List<String> pathsDeniedForInclusion = options.getPathsDeniedForInclusion();
  if (pathsDeniedForInclusion != null) {
    for (String path : pathsDeniedForInclusion) {
      if (pack.getMetaInf().getFilter().contains(path)) {
        WspFilter.Root invalidRoot = null;
        PathFilterSet filter = pack.getMetaInf().getFilter().getCoveringFilterSet(path);
        if (filter != null) {
          invalidRoot = WspFilter.adaptFilterSet(filter);
        }
        return ValidationResult.deniedPathInclusion(path, invalidRoot);
      }
    }
  }
  return ValidationResult.success();
}

代码示例来源:origin: net.adamcin.granite/granite-client-packman

protected static ValidationResult checkFilter(ValidationOptions options, WspFilter archiveFilter) {
  WspFilter wspFilter = options.getValidationFilter();
  // skip filter check if validation filter is not specified
  if (wspFilter != null)  {
    WorkspaceFilter filter = convertToWorkspaceFilter(wspFilter);
    for (Root archiveRoot : archiveFilter.getRoots()) {
      String root = archiveRoot.getPath();
      if (filter.covers(root)) {
        PathFilterSet covering = filter.getCoveringFilterSet(root);
        Root coveringRoot =
            WspFilter.adaptFilterSet(covering);
        if (!hasRequiredRules(coveringRoot, archiveRoot)) {
          return ValidationResult.rootMissingRules(archiveRoot, coveringRoot);
        }
      } else if (!options.isAllowNonCoveredRoots()) {
        return ValidationResult.rootNotAllowed(archiveRoot);
      }
    }
  }
  return ValidationResult.success();
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

protected void saveFilter(@Nonnull File metaDir)
    throws IOException {
  if (filter != null) {
    File file = new File(metaDir, Constants.FILTER_XML);
    IOUtils.copy(
        filter.getSource(),
        FileUtils.openOutputStream(file)
    );
  }
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

public void dumpConfig(PrintWriter out) throws IOException {
  DumpContext ctx = new DumpContext(out);
  ctx.println(false, "workspace filter");
  ctx.indent(false);
  workspaceFilter.dump(ctx, true);
  ctx.outdent();
  aggregatorProvider.dump(ctx, false);
  ctx.println(true, "handlers");
  ctx.indent(true);
  for (Iterator<ArtifactHandler> iter = artifactHandlers.iterator(); iter.hasNext();) {
    ArtifactHandler h = iter.next();
    h.dump(ctx, !iter.hasNext());
  }
  ctx.outdent();
  ctx.flush();
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

String id = userManagement.getAuthorizableId(ni);
String newPath = node.getPath() + "/" + ni.name;
boolean isIncluded = wspFilter.contains(newPath);
String oldPath = userManagement.getAuthorizablePath(this.session, id);
if (oldPath == null) {
ImportMode mode = wspFilter.getImportMode(newPath);

代码示例来源:origin: org.apache.jackrabbit.vault/vault-cli

} else {
  IOUtils.copy(
    fs.getWorkspaceFilter().getSource(),
    FileUtils.openOutputStream(file)
  );

代码示例来源:origin: org.apache.jackrabbit.vault/vault-vlt

DumpContext dc = new DumpContext(new PrintWriter(ctx.getStdout()));
dc.println("Filter");
ctx.getMetaInf().getFilter().dump(dc, true);
dc.outdent();
dc.flush();

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

/**
 * Detects the package type based on the workspace filter.
 * @param filter the workspace filter
 * @return the package type
 */
private static PackageType detectPackageType(WorkspaceFilter filter)  {
  boolean hasApps = false;
  boolean hasOther = false;
  for (PathFilterSet p: filter.getFilterSets()) {
    if ("cleanup".equals(p.getType())) {
      continue;
    }
    String root = p.getRoot();
    if ("/apps".equals(root) || root.startsWith("/apps/") || "/libs".equals(root) || root.startsWith("/libs/")) {
      hasApps = true;
    } else {
      hasOther = true;
    }
  }
  if (hasApps && !hasOther) {
    return PackageType.APPLICATION;
  } else if (hasOther && !hasApps) {
    return PackageType.CONTENT;
  }
  return PackageType.MIXED;
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
public void importedPath(final PackageId packageId, final String path, final Node node)
    throws RepositoryException {
  // don't worry about nodes outside of our own scope.
  if (filters.get(packageId).contains(path)) {
    findOverlaps(packageId, path, Violation.Severity.MINOR);
  }
}

代码示例来源:origin: nateyolles/publick-sling-blog

public static String[] getPaths(MetaInf metaInf) {
  if (metaInf == null) {
    return null;
  }
  WorkspaceFilter filter = metaInf.getFilter();
  if (filter == null) {
    filter = new DefaultWorkspaceFilter();
  }
  List<PathFilterSet> filterSets = filter.getFilterSets();
  String[] paths = new String[filterSets.size()];
  for (int i = 0; i < paths.length; i++) {
    paths[i] = filterSets.get(i).getRoot();
  }
  return paths;
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

private void assertInFilter(String repoPath) {
  if (!fs.getWorkspaceFilter().contains(repoPath)) {
    log.warn("{} is excluded by the workspace filter. continuing with unknown results.", repoPath);
  }
}

代码示例来源:origin: org.apache.sling/org.apache.sling.distribution.core

public static String[] getPaths(MetaInf metaInf) {
  if (metaInf == null) {
    return null;
  }
  WorkspaceFilter filter = metaInf.getFilter();
  if (filter == null) {
    filter = new DefaultWorkspaceFilter();
  }
  List<PathFilterSet> filterSets = filter.getFilterSets();
  String[] paths = new String[filterSets.size()];
  for (int i = 0; i < paths.length; i++) {
    paths[i] = filterSets.get(i).getRoot();
  }
  return paths;
}

相关文章