1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db.layer0.adapter;
\r
14 import java.util.List;
\r
15 import java.util.Map;
\r
17 import org.simantics.db.RequestProcessor;
\r
18 import org.simantics.db.Resource;
\r
20 public interface GenericRelationIndex {
\r
23 * Returns indexed results based on this relation with given constants that
\r
24 * fulfill the specified search string.
\r
26 List<Map<String, Object>> query(RequestProcessor session, String search, String bindingPattern, Object[] constants, int maxResultCount);
\r
27 List<Resource> queryResources(RequestProcessor session, String search, String bindingPattern, Object[] constants, int maxResultCount);
\r
30 * Returns indexed results based on this relation with given constants.
\r
32 * TODO: index listing is not useful like this for large indices. It needs
\r
33 * support for listing the contents in a piecewise fashion, iterating
\r
34 * through the complete index in slices.
\r
36 List<Map<String, Object>> list(RequestProcessor session, String bindingPattern, Object[] constants, int maxResultCount);
\r
39 * Starts to track changes in this relation. Updates an index using the
\r
40 * IndexedRelations service.
\r
42 void trackAndIndex(RequestProcessor processor, Resource input);
\r
43 void untrack(RequestProcessor processor, Resource input);
\r
46 * Rebuilds this index
\r
48 void reset(RequestProcessor processor, Resource input);
\r
51 * The observer is fired whenever changes to the relation are observed. This
\r
52 * is applicable only after trackAndIndex has been called.
\r
54 void addListener(RequestProcessor processor, Resource model, Runnable observer);
\r
55 void removeListener(RequestProcessor processor, Resource model, Runnable observer);
\r