Revision 24035

View differences:

branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/spi/index/FeatureIndexProvider.java
30 30

  
31 31
import java.util.List;
32 32

  
33
import org.gvsig.fmap.data.exceptions.InitializeException;
33 34
import org.gvsig.fmap.data.feature.FeatureReference;
34 35
import org.gvsig.fmap.data.feature.exceptions.DataIndexException;
35 36

  
36 37

  
37 38
public interface FeatureIndexProvider {
38 39
	
40
	/** Sets the IndexProviderServices that will provide application services to this index provider */
41
	public void setFeatureIndexProviderServices(FeatureIndexProviderServices services);
42
	
39 43
	/** Initializes this provider */
40
	public void initialize();
44
	public void initialize() throws InitializeException;
41 45

  
42
	/** Inserts an object into the index */
43
	public void insert(Object object, FeatureReference fref);
46
	/** Inserts a value into the index */
47
	public void insert(Object value, FeatureReference fref);
44 48

  
45
	/** Deletes an object from the index, given its reference */
46
	public void delete(Object o, FeatureReference fref);
49
	/** Deletes a value from the index, given its reference */
50
	public void delete(Object value, FeatureReference fref);
47 51
	
48
	/** Performs a search in the index and returns a list with all the elements that match the given value */
52
	/** Performs a search in the index and returns a list with all the values that match the given value */
49 53
	public List match(Object value);
50 54
	
51
	/** Performs a search in the index and returns a list with the elements that intersect with the given interval */
55
	/** Performs a search in the index and returns a list with the values that intersect with the given interval */
52 56
	public List match(Object min, Object max);
53 57
	
54
	/** Performs a search in the index and returns the list of up to n elements which are nearest to the given value. */
58
	/** Performs a search in the index and returns the list of up to n values which are nearest to the given value. */
55 59
	public List nearest(int n, Object value) throws DataIndexException;	
56 60

  
57 61
}
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/spi/index/FeatureIndexProviderServices.java
28 28

  
29 29
package org.gvsig.fmap.data.feature.spi.index;
30 30

  
31
import org.gvsig.fmap.data.exceptions.InitializeException;
31 32
import org.gvsig.fmap.data.feature.FeatureAttributeDescriptor;
32 33
import org.gvsig.fmap.data.feature.FeatureIndex;
33 34
import org.gvsig.fmap.data.feature.FeatureType;
......
42 43
 */
43 44
public interface FeatureIndexProviderServices extends FeatureIndex {
44 45
	
46
	/** Initializes this provider */
47
	public void initialize() throws InitializeException;
48
	
45 49
	/** Column to which belongs this index */
46 50
	public FeatureAttributeDescriptor getFeatureAttributeDescriptor();
47 51
	
......
51 55
	/** FeatureStore to which belongs this index */
52 56
	public FeatureStoreProviderServices getFeatureStore();
53 57
	
58
	/** Returns the absolute path (directory + filename) where this index is or will be stored */
59
	public String getFileName();
60
	
61
	/** Returns a temporary absolute path (directory + filename) according to the system environment */
62
	public String getTemporaryFileName();
63
	
64
	/** Calculates and returns a new filename for an index, using the given prefix and suffix */
65
	public String getNewFileName(String prefix, String sufix);
66
	
54 67
	/** Fills this index with the store's data */
55 68
	public void fill() throws DataIndexException;	
56 69
}
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/impl/DefaultDataManager.java
20 20
import org.gvsig.fmap.data.feature.FeatureAttributeDescriptor;
21 21
import org.gvsig.fmap.data.feature.FeatureStore;
22 22
import org.gvsig.fmap.data.feature.FeatureType;
23
import org.gvsig.fmap.data.feature.impl.DefaultFeatureIndexProviderServices;
23 24
import org.gvsig.fmap.data.feature.impl.DefaultFeatureStore;
24 25
import org.gvsig.fmap.data.feature.spi.FeatureStoreProvider;
26
import org.gvsig.fmap.data.feature.spi.index.FeatureIndexProvider;
25 27
import org.gvsig.fmap.data.feature.spi.index.FeatureIndexProviderServices;
26 28
import org.gvsig.fmap.data.resource.ResourceManager;
27 29
import org.gvsig.fmap.data.spi.DataExplorerProvider;
......
688 690

  
689 691
		// instantiate, initialize and return it
690 692
		try {
691
			FeatureIndexProviderServices dataIndexProvider = (FeatureIndexProviderServices) dataIndexProviderEP.create(name);
692
			dataIndexProvider.initialize();
693
			return dataIndexProvider;
693
			// Instantiate specific implementation
694
			FeatureIndexProvider featureIndexProvider = (FeatureIndexProvider) dataIndexProviderEP.create(name);
695
			// Create default services and pass the specific implementation to use, as delegate
696
			FeatureIndexProviderServices featureIndexProviderServices = new DefaultFeatureIndexProviderServices(store, type, featureIndexProvider, attr, indexName);			
697
			featureIndexProviderServices.initialize();
698
			return featureIndexProviderServices;
694 699
		} catch (IllegalAccessException e) {
695 700
			throw new ProviderNotRegisteredException(name);
696 701
		} catch (InstantiationException e) {

Also available in: Unified diff