protected void persistBucketRemovalChanges( NodeKey parentKey, Map<BucketId, Set<NodeKey>> removalsPerBucket ) { EditableDocument parentDoc = documentStore.edit(parentKey.toString(), false); // for each bucket, get the corresponding document (locking it) and make the children changes for (Map.Entry<BucketId, Set<NodeKey>> entry : removalsPerBucket.entrySet()) { BucketId bucketId = entry.getKey(); Set<NodeKey> removalsFromBucket = entry.getValue(); String bucketIdString = bucketId.toString(); String bucketKey = bucketKey(parentKey.toString(), bucketIdString); // we don't worry about locking the bucket keys because the parent key should've already been locked, acting therefore // as a monitor for all the buckets EditableDocument bucketDoc = documentStore.edit(bucketKey, false); assert bucketDoc != null; for (NodeKey toRemove : removalsFromBucket) { // keys are stored directly in the bucket bucketDoc.remove(toRemove.toString()); } if (bucketDoc.isEmpty()) { documentStore.remove(bucketKey); parentDoc.getArray(BUCKETS).remove((Object)bucketIdString); } } }
protected void persistBucketRemovalChanges( NodeKey parentKey, Map<BucketId, Set<NodeKey>> removalsPerBucket ) { EditableDocument parentDoc = documentStore.edit(parentKey.toString(), false); // for each bucket, get the corresponding document (locking it) and make the children changes for (Map.Entry<BucketId, Set<NodeKey>> entry : removalsPerBucket.entrySet()) { BucketId bucketId = entry.getKey(); Set<NodeKey> removalsFromBucket = entry.getValue(); String bucketIdString = bucketId.toString(); String bucketKey = bucketKey(parentKey.toString(), bucketIdString); // we don't worry about locking the bucket keys because the parent key should've already been locked, acting therefore // as a monitor for all the buckets EditableDocument bucketDoc = documentStore.edit(bucketKey, false); assert bucketDoc != null; for (NodeKey toRemove : removalsFromBucket) { // keys are stored directly in the bucket bucketDoc.remove(toRemove.toString()); } if (bucketDoc.isEmpty()) { documentStore.remove(bucketKey); parentDoc.getArray(BUCKETS).remove((Object)bucketIdString); } } }
public Property removeProperty( EditableDocument document, Name propertyName, Set<BinaryKey> unusedBinaryKeys, Set<BinaryKey> usedBinaryKeys) { // Get the properties container if it exists ... EditableDocument properties = document.getDocument(PROPERTIES); if (properties == null) { // Doesn't contain the property ... return null; } // Get the namespace container for the property name's namespace ... String namespaceUri = propertyName.getNamespaceUri(); EditableDocument urlProps = properties.getDocument(namespaceUri); if (urlProps == null) { // Doesn't contain the property ... return null; } // Now remove the property ... String localName = propertyName.getLocalName(); Object fieldValue = urlProps.remove(localName); // We're removing a reference to a binary value, and we need to decrement the reference count ... decrementBinaryReferenceCount(fieldValue, unusedBinaryKeys, usedBinaryKeys); // Now remove the namespace if empty ... if (urlProps.isEmpty()) { properties.remove(namespaceUri); } return fieldValue == null ? null : propertyFor(propertyName, fieldValue); }
if (urlProps.isEmpty()) { properties.remove(namespaceUri);
if (urlProps.isEmpty()) { properties.remove(namespaceUri);
public Property removeProperty( EditableDocument document, Name propertyName, Set<BinaryKey> unusedBinaryKeys, Set<BinaryKey> usedBinaryKeys) { // Get the properties container if it exists ... EditableDocument properties = document.getDocument(PROPERTIES); if (properties == null) { // Doesn't contain the property ... return null; } // Get the namespace container for the property name's namespace ... String namespaceUri = propertyName.getNamespaceUri(); EditableDocument urlProps = properties.getDocument(namespaceUri); if (urlProps == null) { // Doesn't contain the property ... return null; } // Now remove the property ... String localName = propertyName.getLocalName(); Object fieldValue = urlProps.remove(localName); // We're removing a reference to a binary value, and we need to decrement the reference count ... decrementBinaryReferenceCount(fieldValue, unusedBinaryKeys, usedBinaryKeys); // Now remove the namespace if empty ... if (urlProps.isEmpty()) { properties.remove(namespaceUri); } return fieldValue == null ? null : propertyFor(propertyName, fieldValue); }
@Override public void start( StartContext arg0 ) throws StartException { if (config.isEmpty()) { return;