本文整理汇总了Java中org.apache.jackrabbit.vault.fs.api.PathFilterSet类的典型用法代码示例。如果您正苦于以下问题:Java PathFilterSet类的具体用法?Java PathFilterSet怎么用?Java PathFilterSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathFilterSet类属于org.apache.jackrabbit.vault.fs.api包,在下文中一共展示了PathFilterSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkForbiddenFilterRootPrefix
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
protected static ValidationResult checkForbiddenFilterRootPrefix(ValidationOptions options, VaultPackage pack) {
List<String> forbiddenFilterRootPrefixes = options.getForbiddenFilterRootPrefixes();
if (forbiddenFilterRootPrefixes != null) {
for (String rootPrefix : forbiddenFilterRootPrefixes) {
String trimmed = rootPrefix.trim();
if (trimmed.isEmpty()) {
continue;
}
final String noTrailingSlash = trimmed.replaceAll("/*$", "").replaceAll("^/*", "/");
final String withTrailingSlash = noTrailingSlash.replaceAll("/*$", "/");
for (PathFilterSet filterSet : pack.getMetaInf().getFilter().getFilterSets()) {
if (filterSet.getRoot().equals(noTrailingSlash)
|| filterSet.getRoot().startsWith(withTrailingSlash)) {
WspFilter.Root invalidRoot = WspFilter.adaptFilterSet(filterSet);
return ValidationResult.forbiddenRootPrefix(rootPrefix, invalidRoot);
}
}
}
}
return ValidationResult.success();
}
示例2: checkDeniedPathInclusion
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
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();
}
示例3: checkFilter
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
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();
}
示例4: convertToWorkspaceFilter
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
public static WorkspaceFilter convertToWorkspaceFilter(WspFilter wspFilter) {
DefaultWorkspaceFilter filter = new DefaultWorkspaceFilter();
for (WspFilter.Root root : wspFilter.getRoots()) {
PathFilterSet filterSet = new PathFilterSet(root.getPath());
filter.add(filterSet);
for (WspFilter.Rule rule : root.getRules()) {
if (rule.isInclude()) {
filterSet.addInclude(new DefaultPathFilter(rule.getPattern()));
} else {
filterSet.addExclude(new DefaultPathFilter(rule.getPattern()));
}
}
}
return filter;
}
示例5: findPaths
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
private List<PathFilterSet> findPaths(final ResourceResolver resourceResolver,
final String[] authorizableIds) throws RepositoryException {
final UserManager userManager = resourceResolver.adaptTo(UserManager.class);
final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>();
for (final String authorizableId : authorizableIds) {
try {
final Authorizable authorizable = userManager.getAuthorizable(authorizableId);
if (authorizable != null) {
final String path = authorizable.getPath();
final PathFilterSet principal = new PathFilterSet(path);
// Exclude tokens as they are not vlt installable in AEM6/Oak
principal.addExclude(new DefaultPathFilter(path + "/\\.tokens"));
pathFilterSets.add(principal);
}
} catch (RepositoryException e) {
log.warn("Unable to find path for authorizable " + authorizableId, e);
}
}
return pathFilterSets;
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:25,代码来源:AuthorizablePackagerServletImpl.java
示例6: createPackage
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public JcrPackage createPackage(final Collection<Resource> resources, final Session session,
final String groupName, final String name, String version,
final ConflictResolution conflictResolution,
final Map<String, String> packageDefinitionProperties)
throws IOException, RepositoryException {
final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>();
for (final Resource resource : resources) {
pathFilterSets.add(new PathFilterSet(resource.getPath()));
}
return this.createPackageFromPathFilterSets(pathFilterSets, session, groupName, name, version,
conflictResolution, packageDefinitionProperties);
}
示例7: createPackageForPaths
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public JcrPackage createPackageForPaths(final Collection<String> paths, final Session session,
final String groupName, String name, final String version,
final ConflictResolution conflictResolution,
Map<String, String> packageDefinitionProperties)
throws IOException, RepositoryException {
final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>();
for (final String path : paths) {
pathFilterSets.add(new PathFilterSet(path));
}
return this.createPackageFromPathFilterSets(pathFilterSets, session, groupName, name, version,
conflictResolution, packageDefinitionProperties);
}
示例8: getSuccessJSON
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public String getSuccessJSON(final JcrPackage jcrPackage) throws JSONException, RepositoryException {
final JSONObject json = new JSONObject();
json.put(KEY_STATUS, "success");
json.put(KEY_PATH, jcrPackage.getNode().getPath());
json.put(KEY_FILTER_SETS, new JSONArray());
final List<PathFilterSet> filterSets = jcrPackage.getDefinition().getMetaInf().getFilter().getFilterSets();
for (final PathFilterSet filterSet : filterSets) {
final JSONObject jsonFilterSet = new JSONObject();
jsonFilterSet.put(KEY_IMPORT_MODE, filterSet.getImportMode().name());
jsonFilterSet.put(KEY_ROOT_PATH, filterSet.getRoot());
json.accumulate(KEY_FILTER_SETS, jsonFilterSet);
}
return json.toString();
}
示例9: getPathFilterSetPreviewJSON
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public String getPathFilterSetPreviewJSON(final Collection<PathFilterSet> pathFilterSets) throws JSONException {
final JSONObject json = new JSONObject();
json.put(KEY_STATUS, "preview");
json.put(KEY_PATH, "Not applicable (Preview)");
json.put(KEY_FILTER_SETS, new JSONArray());
for (final PathFilterSet pathFilterSet : pathFilterSets) {
final JSONObject tmp = new JSONObject();
tmp.put(KEY_IMPORT_MODE, "Not applicable (Preview)");
tmp.put(KEY_ROOT_PATH, pathFilterSet.getRoot());
json.accumulate("filterSets", tmp);
}
return json.toString();
}
示例10: getPrincipalResources
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
/**
* Gets the resources for the param principals.
*
* @param resourceResolver the ResourceResolver obj to get the principal resources;
* Must have read access to the principal resources.
* @param principalNames the principals to get
* @return a list of PathFilterSets covering the selectes principal names (if they exist)
* @throws RepositoryException
*/
private List<PathFilterSet> getPrincipalResources(final ResourceResolver resourceResolver,
final String[] principalNames) throws RepositoryException {
final UserManager userManager = resourceResolver.adaptTo(UserManager.class);
final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>();
for (final String principalName : principalNames) {
final Authorizable authorizable = userManager.getAuthorizable(principalName);
if (authorizable != null) {
final Resource resource = resourceResolver.getResource(authorizable.getPath());
if (resource != null) {
final PathFilterSet principal = new PathFilterSet(resource.getPath());
// Exclude tokens as they are not vlt installable in AEM6/Oak
principal.addExclude(new DefaultPathFilter(resource.getPath() + "/\\.tokens"));
pathFilterSets.add(principal);
}
}
}
return pathFilterSets;
}
示例11: testCreatePackageFromPathFilterSets
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
@Test
public void testCreatePackageFromPathFilterSets() throws Exception {
Map<String, String> properties = new HashMap<String, String>();
final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>();
pathFilterSets.add(new PathFilterSet("/a/b/c"));
pathFilterSets.add(new PathFilterSet("/d/e/f"));
pathFilterSets.add(new PathFilterSet("/g/h/i"));
when(jcrPackageManager.create(packageGroup, packageName, packageOneVersion)).thenReturn(packageOne);
packageHelper.createPackageFromPathFilterSets(pathFilterSets, session, packageGroup, packageName, packageOneVersion,
PackageHelper.ConflictResolution.None, properties);
// Verify the session was saved, creating the package
verify(session, times(1)).save();
}
示例12: createFilter
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
public static WorkspaceFilter createFilter(final String[] paths, final boolean deep) {
DefaultWorkspaceFilter filter = new DefaultWorkspaceFilter();
for (String path : paths) {
PathFilterSet filterSet = createFilterSet(path, deep);
filter.add(filterSet);
}
return filter;
}
示例13: createFilterSet
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
private static PathFilterSet createFilterSet(String path, boolean deep) {
PathFilterSet filterSet = new PathFilterSet(path);
if (!deep) {
filterSet.addInclude(new DefaultPathFilter(path));
}
return filterSet;
}
示例14: adaptWorkspaceFilter
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
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);
}
示例15: adaptFilterSet
import org.apache.jackrabbit.vault.fs.api.PathFilterSet; //导入依赖的package包/类
public static Root adaptFilterSet(PathFilterSet filterSet) {
final String path = filterSet.getRoot();
List<Rule> rules = new ArrayList<Rule>();
for (FilterSet.Entry<PathFilter> filterEntry : filterSet.getEntries()) {
if (filterEntry.getFilter() instanceof DefaultPathFilter) {
rules.add(new Rule(filterEntry.isInclude(),
((DefaultPathFilter) filterEntry.getFilter()).getPattern()));
} else {
throw new IllegalArgumentException(String
.format("Only DefaultPathFilter entries are allowed. [error in filter root=%s]", path));
}
}
return new Root(path, rules);
}