X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.repo%2Fsrc%2Forg%2Fargeo%2Fslc%2Frepo%2FNodeIndexer.java;fp=org.argeo.slc.repo%2Fsrc%2Forg%2Fargeo%2Fslc%2Frepo%2FNodeIndexer.java;h=374ad8505d5308959bf7bc21f2a5d40cc7e68190;hb=825d60c5348dbe3f5be25b0bccf7bdebfe694219;hp=0000000000000000000000000000000000000000;hpb=5e991fff5cba01858dcc5747a27e637325bc5c8e;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.slc.repo/src/org/argeo/slc/repo/NodeIndexer.java b/org.argeo.slc.repo/src/org/argeo/slc/repo/NodeIndexer.java new file mode 100644 index 0000000..374ad85 --- /dev/null +++ b/org.argeo.slc.repo/src/org/argeo/slc/repo/NodeIndexer.java @@ -0,0 +1,29 @@ +package org.argeo.slc.repo; + +import javax.jcr.Node; +import javax.jcr.observation.EventListener; + +/** + * Adds metadata to an existing node, ideally via observation after it has been + * added. There is a similar concept in ModeShape with which this abstraction + * may be merged in the future. + */ +public interface NodeIndexer { + /** + * Whether the node at this path will be supported. This is typically use in + * an {@link EventListener} before the node is loaded, and would apply on + * information contained in the path / file name: file extension, base path, + * etc. If the node needs to be loaded, the recommended approach is to + * return true here and wait for index to be called, possibly + * returning without processing if the node should not be indexed. While + * not strictly a requirement, this avoids to open sessions in the indexer, + * centralizing such tasks in the caller. + */ + public Boolean support(String path); + + /** + * Adds the metadata. This is the responsibility of the caller to save the + * underlying session. + */ + public void index(Node node); +}