]> git.argeo.org Git - gpl/argeo-slc.git/blob - NodeIndexer.java
374ad8505d5308959bf7bc21f2a5d40cc7e68190
[gpl/argeo-slc.git] / NodeIndexer.java
1 package org.argeo.slc.repo;
2
3 import javax.jcr.Node;
4 import javax.jcr.observation.EventListener;
5
6 /**
7 * Adds metadata to an existing node, ideally via observation after it has been
8 * added. There is a similar concept in ModeShape with which this abstraction
9 * may be merged in the future.
10 */
11 public interface NodeIndexer {
12 /**
13 * Whether the node at this path will be supported. This is typically use in
14 * an {@link EventListener} before the node is loaded, and would apply on
15 * information contained in the path / file name: file extension, base path,
16 * etc. If the node needs to be loaded, the recommended approach is to
17 * return <code>true</code> here and wait for index to be called, possibly
18 * returning without processing if the node should not be indexed. While
19 * not strictly a requirement, this avoids to open sessions in the indexer,
20 * centralizing such tasks in the caller.
21 */
22 public Boolean support(String path);
23
24 /**
25 * Adds the metadata. This is the responsibility of the caller to save the
26 * underlying session.
27 */
28 public void index(Node node);
29 }