svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.spi / src / main / java / org / gvsig / fmap / dal / feature / spi / index / FeatureIndexProviderServices.java @ 40767
History | View | Annotate | Download (4.58 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.fmap.dal.feature.spi.index; |
26 |
|
27 |
import org.gvsig.fmap.dal.exception.InitializeException; |
28 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
29 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
30 |
import org.gvsig.fmap.dal.feature.FeatureStoreNotification; |
31 |
import org.gvsig.fmap.dal.feature.FeatureType; |
32 |
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException; |
33 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
34 |
import org.gvsig.tools.dispose.Disposable; |
35 |
import org.gvsig.tools.observer.Observable; |
36 |
import org.gvsig.tools.observer.Observer; |
37 |
|
38 |
/**
|
39 |
* SPI for all index implementations.
|
40 |
*
|
41 |
* This observable object provides notificationswhen the index has finished
|
42 |
* filling with data and is available to be used. The observer will
|
43 |
* receive then a {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
|
44 |
* notification, with the index object if it has finished
|
45 |
* successfully, or a {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
|
46 |
* notification with the exception object if there has been
|
47 |
* any error in the process.
|
48 |
*
|
49 |
* @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
|
50 |
* @see FeatureStoreNotification#INDEX_FILLING_ERROR
|
51 |
*
|
52 |
* @author gvSIG team
|
53 |
*/
|
54 |
public interface FeatureIndexProviderServices extends FeatureIndex, Observable, |
55 |
Disposable { |
56 |
|
57 |
/** Initializes this provider */
|
58 |
public void initialize() throws InitializeException; |
59 |
|
60 |
/** Column to which belongs this index */
|
61 |
public FeatureAttributeDescriptor getFeatureAttributeDescriptor();
|
62 |
|
63 |
/** FeatureType to which belongs this index */
|
64 |
public FeatureType getFeatureType();
|
65 |
|
66 |
/** FeatureStore to which belongs this index */
|
67 |
public FeatureStoreProviderServices getFeatureStoreProviderServices();
|
68 |
|
69 |
/**
|
70 |
* Returns the absolute path (directory + filename) where this index is or
|
71 |
* will be stored
|
72 |
*/
|
73 |
public String getFileName(); |
74 |
|
75 |
/**
|
76 |
* Returns a temporary absolute path (directory + filename) according to the
|
77 |
* system environment
|
78 |
*/
|
79 |
public String getTemporaryFileName(); |
80 |
|
81 |
/**
|
82 |
* Calculates and returns a new filename for an index, using the given
|
83 |
* prefix and suffix
|
84 |
*/
|
85 |
public String getNewFileName(String prefix, String sufix); |
86 |
|
87 |
/**
|
88 |
* Fills this index with the store's data. This operation will not return
|
89 |
* until the index has filled with all the store's data.
|
90 |
*
|
91 |
* @throws FeatureIndexException
|
92 |
* if there is an error while filling the index
|
93 |
*/
|
94 |
public void fill() throws FeatureIndexException; |
95 |
|
96 |
/**
|
97 |
* Fills this index with the store's data.
|
98 |
*
|
99 |
* @param background
|
100 |
* if the filling must be performed in background
|
101 |
* @param observer
|
102 |
* optional observer to be notified when the
|
103 |
* fill index operation finishes
|
104 |
*
|
105 |
* @throws FeatureIndexException
|
106 |
* if there is an error while filling the index
|
107 |
*
|
108 |
* @see FeatureStoreNotification#INDEX_FILLING_STARTED
|
109 |
* @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
|
110 |
* @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
|
111 |
* @see FeatureStoreNotification#INDEX_FILLING_ERROR
|
112 |
*/
|
113 |
public void fill(boolean background, Observer observer) |
114 |
throws FeatureIndexException;
|
115 |
|
116 |
/**
|
117 |
* Sets the index as valid or invalid, so it may be used or not.
|
118 |
*
|
119 |
* @param valid
|
120 |
* status to set the index to
|
121 |
*/
|
122 |
public void setValid(boolean valid); |
123 |
|
124 |
/**
|
125 |
* If the index is in the process of being filled by a background task,
|
126 |
* synchronize this method or add some mechanism for external callers to
|
127 |
* block on it.
|
128 |
*/
|
129 |
public void waitForIndex(); |
130 |
} |