Statistics
| Revision:

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 @ 40435

History | View | Annotate | Download (4.6 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 {{Company}}   {{Task}}
26
 */
27

    
28
package org.gvsig.fmap.dal.feature.spi.index;
29

    
30
import org.gvsig.fmap.dal.exception.InitializeException;
31
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
32
import org.gvsig.fmap.dal.feature.FeatureIndex;
33
import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
34
import org.gvsig.fmap.dal.feature.FeatureType;
35
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
36
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
37
import org.gvsig.tools.dispose.Disposable;
38
import org.gvsig.tools.observer.Observable;
39
import org.gvsig.tools.observer.Observer;
40

    
41
/**
42
 * SPI for all index implementations.
43
 * 
44
 * This observable object provides notificationswhen the index has finished
45
 * filling with data and is available to be used. The observer will
46
 * receive then a {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
47
 * notification, with the index object if it has finished
48
 * successfully, or a {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
49
 * notification with the exception object if there has been
50
 * any error in the process.
51
 * 
52
 * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
53
 * @see FeatureStoreNotification#INDEX_FILLING_ERROR
54
 * 
55
 * @author gvSIG team
56
 */
57
public interface FeatureIndexProviderServices extends FeatureIndex, Observable,
58
    Disposable {
59

    
60
    /** Initializes this provider */
61
    public void initialize() throws InitializeException;
62

    
63
    /** Column to which belongs this index */
64
    public FeatureAttributeDescriptor getFeatureAttributeDescriptor();
65

    
66
    /** FeatureType to which belongs this index */
67
    public FeatureType getFeatureType();
68

    
69
    /** FeatureStore to which belongs this index */
70
    public FeatureStoreProviderServices getFeatureStoreProviderServices();
71

    
72
    /**
73
     * Returns the absolute path (directory + filename) where this index is or
74
     * will be stored
75
     */
76
    public String getFileName();
77

    
78
    /**
79
     * Returns a temporary absolute path (directory + filename) according to the
80
     * system environment
81
     */
82
    public String getTemporaryFileName();
83

    
84
    /**
85
     * Calculates and returns a new filename for an index, using the given
86
     * prefix and suffix
87
     */
88
    public String getNewFileName(String prefix, String sufix);
89

    
90
    /**
91
     * Fills this index with the store's data. This operation will not return
92
     * until the index has filled with all the store's data.
93
     * 
94
     * @throws FeatureIndexException
95
     *             if there is an error while filling the index
96
     */
97
    public void fill() throws FeatureIndexException;
98

    
99
    /**
100
     * Fills this index with the store's data.
101
     * 
102
     * @param background
103
     *            if the filling must be performed in background
104
     * @param observer
105
     *            optional observer to be notified when the
106
     *            fill index operation finishes
107
     * 
108
     * @throws FeatureIndexException
109
     *             if there is an error while filling the index
110
     * 
111
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
112
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
113
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
114
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
115
     */
116
    public void fill(boolean background, Observer observer)
117
        throws FeatureIndexException;
118

    
119
    /**
120
     * Sets the index as valid or invalid, so it may be used or not.
121
     * 
122
     * @param valid
123
     *            status to set the index to
124
     */
125
    public void setValid(boolean valid);
126

    
127
    /**
128
     * If the index is in the process of being filled by a background task,
129
     * synchronize this method or add some mechanism for external callers to
130
     * block on it.
131
     */
132
    public void waitForIndex();
133
}