1 /* 2 * Copyright (C) 2007-2012 Argeo GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.argeo.slc.repo; 17 18 import javax.jcr.Node; 19 import javax.jcr.observation.EventListener; 20 21 /** 22 * Adds metadata to an existing node, ideally via observation after it has been 23 * added. There is a similar concept in ModeShape with which this abstraction 24 * may be merged in the future. 25 */ 26 public interface NodeIndexer { 27 /** 28 * Whether the node at this path will be supported. This is typically use in 29 * an {@link EventListener} before the node is loaded, and would apply on 30 * information contained in the path / file name: file extension, base path, 31 * etc. If the node needs to be loaded, the recommended approach is to 32 * return <code>true</code> here and wait for index to be called, possibly 33 * returning without processing if the node should not be indexed. While 34 * not strictly a requirement, this avoids to open sessions in the indexer, 35 * centralizing such tasks in the caller. 36 */ 37 public Boolean support(String path); 38 39 /** 40 * Adds the metadata. This is the responsibility of the caller to save the 41 * underlying session. 42 */ 43 public void index(Node node); 44 }