use of org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter in project sling by apache.
the class VltUtils method getPaths.
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;
}
use of org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter in project sling by apache.
the class VaultFsLocatorImpl method getFileSystem.
@Override
public VaultFileSystem getFileSystem(RepositoryAddress repositoryAddress, File contentSyncRoot, Session session) throws RepositoryException, IOException, ConfigurationException {
// TODO - should not use File to read from FS, rather input streams
VaultFsConfig config = null;
DefaultWorkspaceFilter filter = null;
File filterFile = findFilterFile(contentSyncRoot);
if (filterFile != null) {
filter = new DefaultWorkspaceFilter();
filter.load(filterFile);
}
File metaInfDir = new File(contentSyncRoot.getParent(), Constants.META_INF);
if (metaInfDir.isDirectory()) {
File vaultDir = new File(metaInfDir, Constants.VAULT_DIR);
if (vaultDir.isDirectory()) {
File configFile = new File(vaultDir, Constants.CONFIG_XML);
if (configFile.exists()) {
config = AbstractVaultFsConfig.load(configFile);
}
}
}
return Mounter.mount(config, filter, repositoryAddress, "/", session);
}
use of org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter in project sling by apache.
the class FileVaultResourceMapper method getWorkspaceFilter.
/**
* @return Workspace filter or null if none found.
*/
private WorkspaceFilter getWorkspaceFilter() {
if (filterXmlFile != null && filterXmlFile.exists()) {
try {
DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();
workspaceFilter.load(filterXmlFile);
return workspaceFilter;
} catch (IOException | ConfigurationException ex) {
log.error("Unable to parse workspace filter: " + filterXmlFile.getPath(), ex);
}
} else {
log.debug("Workspace filter not found: " + filterXmlFile.getPath());
}
return null;
}
use of org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter in project sling by apache.
the class VltUtils method createFilter.
public static WorkspaceFilter createFilter(DistributionRequest distributionRequest, NavigableMap<String, List<String>> nodeFilters, NavigableMap<String, List<String>> propertyFilters) {
DefaultWorkspaceFilter filter = new DefaultWorkspaceFilter();
for (String path : distributionRequest.getPaths()) {
// Set node path filters
List<String> patterns = new ArrayList<String>();
patterns.addAll(Arrays.asList(distributionRequest.getFilters(path)));
boolean deep = distributionRequest.isDeep(path);
PathFilterSet nodeFilterSet = new PathFilterSet(path);
if (!deep) {
nodeFilterSet.addInclude(new DefaultPathFilter(path));
}
initFilterSet(nodeFilterSet, nodeFilters, patterns);
filter.add(nodeFilterSet);
// Set property path filters
PathFilterSet propertyFilterSet = new PathFilterSet("/");
initFilterSet(propertyFilterSet, propertyFilters, new ArrayList<String>());
filter.addPropertyFilterSet(propertyFilterSet);
}
return filter;
}
use of org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter in project sling by apache.
the class FileVaultXmlMounter method getWorkspaceFilter.
private WorkspaceFilter getWorkspaceFilter(final File filterXmlFile) throws MojoExecutionException {
try {
DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();
workspaceFilter.load(filterXmlFile);
return workspaceFilter;
} catch (IOException | ConfigurationException ex) {
throw new MojoExecutionException("Unable to parse workspace filter: " + filterXmlFile.getPath(), ex);
}
}
Aggregations