@Override public boolean apply(String path) { return name.equals(getName(path)); } });
@Override public boolean apply(String path) { return name.equals(getName(path)); } });
@Override public boolean apply(String path) { return name.equals(getName(path)); } });
static String getSafePropName(String relativePropName) { String propName = PathUtils.getName(relativePropName); int indexOfColon = propName.indexOf(':'); if (indexOfColon > 0){ propName = propName.substring(indexOfColon + 1); } //Just keep ascii chars propName = propName.replaceAll("\\W", ""); return propName; } }
static String getSafePropName(String relativePropName) { String propName = PathUtils.getName(relativePropName); int indexOfColon = propName.indexOf(':'); if (indexOfColon > 0){ propName = propName.substring(indexOfColon + 1); } //Just keep ascii chars propName = propName.replaceAll("\\W", ""); return propName; } }
public PropertyInclude(PropertyDefinition pd) { super(getParentPath(pd.name)); this.propertyDefinition = pd; this.propertyName = PathUtils.getName(pd.name); this.parentPath = getParentPath(pd.name); if (pd.isRegexp) { pattern = Pattern.compile(propertyName); } else { pattern = null; } }
@Override public PropertyValue currentProperty() { String path = selector.currentPath(); if (path == null) { return null; } String name = PathUtils.getName(path); // TODO reverse namespace remapping? return PropertyValues.newName(name); }
@Override public PropertyValue currentProperty() { String path = selector.currentPath(); if (path == null) { return null; } String name = PathUtils.getName(path); String localName = getLocalName(name); // TODO reverse namespace remapping? return PropertyValues.newString(localName); }
private boolean isVersionable(ReadWriteVersionManager versionManager) { Tree tree = new ImmutableTree(ImmutableTree.ParentProvider.UNSUPPORTED, PathUtils.getName(path), builder.getNodeState()); return versionManager.isVersionable(tree); } }
static LuceneIndexNodeManager open(String indexPath, NodeState root, NodeState defnNodeState, LuceneIndexReaderFactory readerFactory, @Nullable NRTIndexFactory nrtFactory) throws IOException { LuceneIndexDefinition definition = new LuceneIndexDefinition(root, defnNodeState, indexPath); List<LuceneIndexReader> readers = readerFactory.createReaders(definition, defnNodeState, indexPath); NRTIndex nrtIndex = nrtFactory != null ? nrtFactory.createIndex(definition) : null; if (!readers.isEmpty() || (nrtIndex != null && !hasAsyncIndexerRun(root, indexPath, defnNodeState))){ return new LuceneIndexNodeManager(PathUtils.getName(indexPath), definition, readers, nrtIndex); } return null; }
@Override public PropertyValue currentProperty() { String path = selector.currentPath(); if (path == null) { return null; } String name = PathUtils.getName(path); String localName = getLocalName(name); // TODO reverse namespace remapping? return PropertyValues.newString(localName); }
static LuceneIndexNodeManager open(String indexPath, NodeState root, NodeState defnNodeState, LuceneIndexReaderFactory readerFactory, @Nullable NRTIndexFactory nrtFactory) throws IOException { LuceneIndexDefinition definition = new LuceneIndexDefinition(root, defnNodeState, indexPath); List<LuceneIndexReader> readers = readerFactory.createReaders(definition, defnNodeState, indexPath); NRTIndex nrtIndex = nrtFactory != null ? nrtFactory.createIndex(definition) : null; if (!readers.isEmpty() || (nrtIndex != null && !hasAsyncIndexerRun(root, indexPath, defnNodeState))){ return new LuceneIndexNodeManager(PathUtils.getName(indexPath), definition, readers, nrtIndex); } return null; }
private void createIndexFolder(File indexFolder, String indexPath) throws IOException { String dirName = PathUtils.getName(indexPath); File indexDir = new File(indexFolder, dirName); File indexMeta = new File(indexDir, IndexerInfo.INDEX_METADATA_FILE_NAME); Properties p = new Properties(); p.setProperty(IndexerInfo.PROP_INDEX_PATH, indexPath); indexDir.mkdir(); PropUtils.writeTo(p, indexMeta, "index info"); }
private static PropertyState getValue(NodeState node, String propertyRelativePath) { int depth = PathUtils.getDepth(propertyRelativePath); NodeState propNode = node; String propName = propertyRelativePath; if (depth > 1) { propName = PathUtils.getName(propertyRelativePath); String parentPath = PathUtils.getParentPath(propertyRelativePath); propNode = NodeStateUtils.getNode(node, parentPath); } return propNode.getProperty(propName); } }
@Override void apply(Root root) { String parentPath = PathUtils.getParentPath(path); String name = PathUtils.getName(path); root.getTree(parentPath).getChild(name).remove(); }
private Operation createSetProperty() { String path = choosePropertyPath(); if (path == null) { return null; } String value = createValue(); return new SetProperty(PathUtils.getParentPath(path), PathUtils.getName(path), value); }
private static NodeBuilder move(NodeBuilder builder, String source, String dest) { NodeBuilder sourceBuilder = getBuilder(builder, source); NodeBuilder destParentBuilder = getBuilder(builder, PathUtils.getParentPath(dest)); assertTrue(sourceBuilder.moveTo(destParentBuilder, PathUtils.getName(dest))); return builder; }
private void updateBefore(IndexDefinitionBuilder defnb) { NodeBuilder builder = before.builder(); NodeBuilder cb = TestUtil.child(builder, PathUtils.getParentPath(indexPath)); cb.setChildNode(PathUtils.getName(indexPath), defnb.build()); before = builder.getNodeState(); }
private void createTestNode(String path, NodeState state) throws CommitFailedException { String parentPath = PathUtils.getParentPath(path); NodeBuilder builder = store.getRoot().builder(); NodeBuilder parent = childBuilder(builder, parentPath); parent.setChildNode(PathUtils.getName(path), state); merge(builder); }
private static void checkNotPath(NodeBuilder node, String key, String path) { path = PathUtils.concat(key, path); String parentPath = PathUtils.getParentPath(path); String name = PathUtils.getName(path); NodeBuilder check = node; for (String p : PathUtils.elements(parentPath)) { Assert.assertTrue("Missing child node " + p + " on path " + path, check.hasChildNode(p)); check = check.child(p); } Assert.assertFalse(check.hasChildNode(name)); }