1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.layer0.genericrelation;
14 import java.util.Collection;
15 import java.util.List;
18 import org.eclipse.core.runtime.IProgressMonitor;
19 import org.simantics.db.RequestProcessor;
20 import org.simantics.db.Resource;
21 import org.simantics.db.Session;
22 import org.simantics.db.layer0.adapter.GenericRelation;
27 * TODO: make a statement about synchronization requirements imposed by the interface
29 * TODO: what exceptions are the methods supposed to throw? any checked exceptions?
31 * @author Antti Villberg
33 public interface IndexedRelations {
41 * @param maxResultCount
43 * @throws IndexException
45 public List<Map<String, Object>> query(IProgressMonitor monitor, String search, RequestProcessor session,
46 Resource relation, Resource input, int maxResultCount) throws IndexException;
48 public List<Resource> queryResources(IProgressMonitor monitor, String search, RequestProcessor session,
49 Resource relation, Resource input, int maxResultCount) throws IndexException;
58 * @throws IndexException
60 public void insert(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
61 Resource resource, Resource input, Collection<Object[]> documents)
62 throws IndexException;
72 * @throws IndexException
74 public void remove(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
75 Resource resource, Resource input, String key, Collection<Object> keyValues)
76 throws IndexException;
78 public void removeAll(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
79 Resource resource, Resource input)
80 throws IndexException;
91 * @throws IndexException
93 public boolean replace(IProgressMonitor monitor, RequestProcessor processor, GenericRelation relation,
94 Resource resource, Resource input, String key, Collection<Object> keyValues, Collection<Object[]> documents)
95 throws IndexException;
97 public void reset(IProgressMonitor monitor, RequestProcessor processor, Resource resource, Resource input)
98 throws IndexException;
100 public void fullRebuild(IProgressMonitor monitor, RequestProcessor processor) throws IndexException;
103 * Flush any memory-based index caches to disk and close down any resources
104 * related to each separate index.
106 * Must be invoked outside of any database transactions.
110 * @throws IndexException
112 public void flush(IProgressMonitor monitor, Session session) throws IndexException;