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