Revision 24079
branches/v2_0_0_prep/libraries/libFMap_data/src-test/org/gvsig/fmap/data/feature/FeatureSetTestParent.java | ||
---|---|---|
117 | 117 |
protected FeatureStore createFeatureStore() throws Exception { |
118 | 118 |
DataManager manager = DALLocator.getDataManager(); |
119 | 119 |
return (FeatureStore) manager |
120 |
.createDataStore(createStoreParameters(manager));
|
|
120 |
.createStore(createStoreParameters(manager)); |
|
121 | 121 |
} |
122 | 122 |
|
123 | 123 |
protected abstract void register(); |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/DataManager.java | ||
---|---|---|
6 | 6 |
import org.gvsig.fmap.data.exceptions.ProviderNotRegisteredException; |
7 | 7 |
import org.gvsig.tools.evaluator.Evaluator; |
8 | 8 |
|
9 |
import com.iver.utiles.XMLEntity; |
|
10 |
|
|
11 | 9 |
public interface DataManager { |
12 | 10 |
|
11 |
/** |
|
12 |
* Returns the default DAL's temporary directory |
|
13 |
* |
|
14 |
* @return Temporary directory name |
|
15 |
*/ |
|
16 |
public String getTemporaryDirectory(); |
|
13 | 17 |
|
14 |
public List getDataStoreProviders(); |
|
15 |
|
|
16 |
public List getDataExplorerProviders(); |
|
17 |
|
|
18 |
/** |
|
19 |
* Returns an array of index provider names that are compatible with the |
|
20 |
* given data type. |
|
18 |
/* |
|
19 |
* ==================================================================== |
|
21 | 20 |
* |
22 |
* @param dataType |
|
23 |
* @return list of strings with the names of compatible index providers |
|
21 |
* Store related services |
|
24 | 22 |
*/ |
25 |
public List getDataIndexProviders(int dataType); |
|
26 | 23 |
|
27 |
|
|
28 |
|
|
29 |
|
|
30 | 24 |
/** |
31 | 25 |
* Start a instance of the solicited parameters inicialize the instance name |
32 | 26 |
* and returns it. |
... | ... | |
37 | 31 |
* TODO |
38 | 32 |
* @throws ProviderNotRegisteredException |
39 | 33 |
**/ |
40 |
public DataStoreParameters createDataStoreParameters(String name)
|
|
34 |
public DataStoreParameters createStoreParameters(String name) |
|
41 | 35 |
throws InitializeException, ProviderNotRegisteredException; |
42 | 36 |
|
43 |
public DataStoreParameters createDataStoreParameters( |
|
44 |
XMLEntity xmlEntity) |
|
45 |
throws InitializeException, ProviderNotRegisteredException; |
|
46 |
|
|
47 | 37 |
/** |
48 | 38 |
* Start a instance of data store, start a instance of provider that data |
49 | 39 |
* store needs at ends initialize the data store. |
... | ... | |
52 | 42 |
* @throws InitializeException |
53 | 43 |
* @throws ProviderNotRegisteredException |
54 | 44 |
**/ |
55 |
public DataStore createDataStore(DataStoreParameters parameters)
|
|
45 |
public DataStore createStore(DataStoreParameters parameters) |
|
56 | 46 |
throws InitializeException, ProviderNotRegisteredException; |
57 | 47 |
|
58 |
public DataStore createDataStore(XMLEntity xmlEntity) |
|
59 |
throws InitializeException, ProviderNotRegisteredException; |
|
60 | 48 |
|
49 |
public List getStoreProviders(); |
|
50 |
|
|
51 |
/* |
|
52 |
* ==================================================================== |
|
53 |
* |
|
54 |
* Explorer related services |
|
55 |
*/ |
|
61 | 56 |
/** |
62 | 57 |
* Start a instance with solicited parameters starts name in the instance |
63 | 58 |
* and returns it. |
... | ... | |
68 | 63 |
* @throws ProviderNotRegisteredException |
69 | 64 |
**/ |
70 | 65 |
|
71 |
public DataExplorerParameters createDataExplorerParameters(
|
|
66 |
public DataExplorerParameters createExplorerParameters( |
|
72 | 67 |
String name) |
73 | 68 |
throws InitializeException, ProviderNotRegisteredException; |
74 | 69 |
|
75 |
public DataExplorerParameters createDataExplorerParameters(
|
|
76 |
XMLEntity xmlEntity) throws InitializeException,
|
|
77 |
ProviderNotRegisteredException; |
|
70 |
public DataExplorer createExplorer(
|
|
71 |
DataExplorerParameters parameters)
|
|
72 |
throws InitializeException, ProviderNotRegisteredException;
|
|
78 | 73 |
|
79 | 74 |
|
75 |
public List getExplorerProviders(); |
|
80 | 76 |
|
81 |
public DataExplorer createDataExplorer( |
|
82 |
DataExplorerParameters parameters) |
|
83 |
throws InitializeException, ProviderNotRegisteredException; |
|
77 |
/* |
|
78 |
* ==================================================================== |
|
79 |
* |
|
80 |
* Expresion evaluation related services |
|
81 |
*/ |
|
84 | 82 |
|
85 |
public DataExplorer createDataExplorer(XMLEntity xmlEntity) |
|
86 |
throws InitializeException, ProviderNotRegisteredException; |
|
83 |
public void registerDefaultEvaluator(Class evaluator); |
|
87 | 84 |
|
85 |
public Evaluator createExpresion(String expresion) |
|
86 |
throws InitializeException; |
|
88 | 87 |
|
88 |
/* |
|
89 |
* ==================================================================== |
|
90 |
* |
|
91 |
* Index related services |
|
92 |
*/ |
|
93 |
|
|
94 |
|
|
89 | 95 |
/** |
96 |
* Returns an array of index provider names that are compatible with the |
|
97 |
* given data type. |
|
98 |
* |
|
99 |
* @param dataType |
|
100 |
* @return list of strings with the names of compatible index providers |
|
101 |
*/ |
|
102 |
public List getDataIndexProviders(int dataType); |
|
103 |
|
|
104 |
/** |
|
90 | 105 |
* Sets the default DataIndexProvider for the given data type. |
91 | 106 |
* @param dataType one of the data types defined in the api package |
92 | 107 |
* @param name Provider's name |
... | ... | |
100 | 115 |
*/ |
101 | 116 |
public String getDefaultDataIndexProviderName(int dataType); |
102 | 117 |
|
103 |
/** |
|
104 |
* Returns the default DAL's temporary directory |
|
105 |
* @return Temporary directory name |
|
106 |
*/ |
|
107 |
public String getTemporaryDirectory(); |
|
108 | 118 |
|
109 |
|
|
110 |
public void registerDefaultEvaluator(Class evaluator); |
|
111 |
|
|
112 |
public Evaluator createExpresion(String expresion); |
|
113 |
|
|
114 |
|
|
115 | 119 |
} |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/DataStoreParameters.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.fmap.data; |
29 | 29 |
|
30 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
|
31 | 30 |
import org.gvsig.fmap.data.spi.AbstractDataParameters; |
32 | 31 |
|
33 |
import com.iver.utiles.XMLEntity; |
|
34 |
|
|
35 | 32 |
public abstract class DataStoreParameters extends |
36 | 33 |
AbstractDataParameters { |
37 | 34 |
|
... | ... | |
42 | 39 |
public abstract String getDescription(); |
43 | 40 |
|
44 | 41 |
|
45 |
public abstract void loadFromXMLEntity(XMLEntity xmlEntity) |
|
46 |
throws InitializeException; |
|
47 |
|
|
48 |
public XMLEntity getXMLEntity() { |
|
49 |
XMLEntity xmlEntity = new XMLEntity(); |
|
50 |
xmlEntity.putProperty("dataStoreName", this.getDataStoreName()); |
|
51 |
return xmlEntity; |
|
52 |
} |
|
53 |
|
|
54 | 42 |
} |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/joinstore/Register.java | ||
---|---|---|
7 | 7 |
public static void selfRegister() { |
8 | 8 |
DataManager dsm = DefaultDataManager.getManager(); |
9 | 9 |
|
10 |
dsm.registerDataStoreProvider(JoinFeatureStore.DATASTORE_NAME,
|
|
10 |
dsm.registerStoreProvider(JoinFeatureStore.DATASTORE_NAME, |
|
11 | 11 |
JoinFeatureStore.class, |
12 | 12 |
JoinFeatureStoreParameters.class |
13 | 13 |
); |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/joinstore/JoinFeatureStore.java | ||
---|---|---|
295 | 295 |
} |
296 | 296 |
JoinFeatureStoreParameters jParams = this.getJoinParameters(); |
297 | 297 |
DataManager dataManager = DefaultDataManager.getManager(); |
298 |
this.storePrimary = (FeatureStore) dataManager.createDataStore(jParams
|
|
298 |
this.storePrimary = (FeatureStore) dataManager.createStore(jParams |
|
299 | 299 |
.getStorePrimary()); |
300 | 300 |
this.storeSecondary = (FeatureStore) dataManager |
301 |
.createDataStore(jParams.getStoreSecondary());
|
|
301 |
.createStore(jParams.getStoreSecondary()); |
|
302 | 302 |
|
303 | 303 |
this.observeStore(this.storePrimary); |
304 | 304 |
this.observeStore(this.storeSecondary); |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/joinstore/JoinFeatureStoreParameters.java | ||
---|---|---|
230 | 230 |
|
231 | 231 |
} |
232 | 232 |
try { |
233 |
this.setStorePrimary(manager.createDataStoreParameters(params));
|
|
233 |
this.setStorePrimary(manager.createStoreParameters(params)); |
|
234 | 234 |
} catch (InitializeException e) { |
235 | 235 |
new InitializeException("store params(primary) error", this |
236 | 236 |
.getDataStoreName(), e); |
... | ... | |
244 | 244 |
|
245 | 245 |
} |
246 | 246 |
try { |
247 |
this.setStoreSecondary(manager.createDataStoreParameters(params));
|
|
247 |
this.setStoreSecondary(manager.createStoreParameters(params)); |
|
248 | 248 |
} catch (InitializeException e) { |
249 | 249 |
new InitializeException("store params(secondary) error", this |
250 | 250 |
.getDataStoreName(), e); |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/exceptions/XMLInitializeException.java | ||
---|---|---|
1 |
package org.gvsig.fmap.data.feature.exceptions; |
|
2 |
|
|
3 |
import java.util.Map; |
|
4 |
|
|
5 |
import com.iver.utiles.XMLException; |
|
6 |
|
|
7 |
public class XMLInitializeException extends XMLException { |
|
8 |
|
|
9 |
/** |
|
10 |
* |
|
11 |
*/ |
|
12 |
private static final long serialVersionUID = 8769648026876440810L; |
|
13 |
|
|
14 |
public XMLInitializeException(String name,Throwable exception) { |
|
15 |
init(); |
|
16 |
} |
|
17 |
|
|
18 |
public XMLInitializeException(String description,String name,Throwable exception) { |
|
19 |
init(); |
|
20 |
} |
|
21 |
|
|
22 |
public XMLInitializeException(String description,String name) { |
|
23 |
init(); |
|
24 |
} |
|
25 |
/** |
|
26 |
* |
|
27 |
*/ |
|
28 |
protected void init() { |
|
29 |
messageKey = "error_initialize"; |
|
30 |
formatString = "Can?t initialize %(name): %(description) "; |
|
31 |
} |
|
32 |
|
|
33 |
protected Map values() { |
|
34 |
// TODO Auto-generated method stub |
|
35 |
return null; |
|
36 |
} |
|
37 |
} |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/spi/FeatureStoreProvider.java | ||
---|---|---|
9 | 9 |
import org.gvsig.fmap.data.feature.FeatureReference; |
10 | 10 |
import org.gvsig.fmap.data.feature.FeatureSelection; |
11 | 11 |
import org.gvsig.fmap.data.feature.FeatureType; |
12 |
import org.gvsig.fmap.data.feature.impl.expansionadapter.ExpansionAdapter; |
|
13 | 12 |
import org.gvsig.fmap.data.spi.DataStoreProvider; |
14 | 13 |
import org.gvsig.fmap.geom.primitive.Envelope; |
15 | 14 |
import org.gvsig.metadata.Metadatable; |
15 |
import org.gvsig.tools.persistence.Persistent; |
|
16 | 16 |
|
17 |
import com.iver.utiles.IPersistence; |
|
17 |
public interface FeatureStoreProvider extends Persistent, Metadatable, |
|
18 |
DataStoreProvider { |
|
18 | 19 |
|
19 |
public interface FeatureStoreProvider extends IPersistence, Metadatable, DataStoreProvider { |
|
20 |
|
|
21 | 20 |
public String getName(); |
22 | 21 |
|
23 | 22 |
public FeatureData createFeatureData(FeatureType type) throws DataException; |
24 | 23 |
|
24 |
public FeatureReference createFeatureReference(Object frefid); |
|
25 |
|
|
25 | 26 |
public FeatureData getFeatureData(Object refId) throws DataException; |
26 | 27 |
|
27 |
public ExpansionAdapter createTemporaryContainer(); |
|
28 |
|
|
29 | 28 |
public FeatureSelection createFeatureSelection() throws DataException; |
30 | 29 |
|
31 | 30 |
public FeatureLocks createFeatureLocks() throws DataException; |
... | ... | |
58 | 57 |
|
59 | 58 |
public int getFeatureReferenceIdType(); |
60 | 59 |
|
61 |
|
|
62 | 60 |
} |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/spi/AbstractFeatureStoreProvider.java | ||
---|---|---|
23 | 23 |
import org.slf4j.Logger; |
24 | 24 |
import org.slf4j.LoggerFactory; |
25 | 25 |
|
26 |
import com.iver.utiles.XMLEntity; |
|
27 |
import com.iver.utiles.XMLException; |
|
28 | 26 |
|
29 |
|
|
30 | 27 |
public abstract class AbstractFeatureStoreProvider implements |
31 | 28 |
FeatureStoreProvider { |
32 | 29 |
|
... | ... | |
118 | 115 |
return null; |
119 | 116 |
} |
120 | 117 |
|
121 |
public XMLEntity getXMLEntity() throws XMLException { |
|
122 |
return null; |
|
123 |
} |
|
124 |
|
|
125 |
public void setXMLEntity(XMLEntity arg0) throws XMLException { |
|
126 |
|
|
127 |
} |
|
128 |
|
|
129 | 118 |
public abstract DataExplorer getExplorer() throws ReadException; |
130 | 119 |
|
131 | 120 |
public abstract FeatureData getFeatureDataByReference(FeatureReference reference, FeatureType featureType) |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/FeatureReferenceSelection.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Gobernment (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 | 22 |
|
23 | 23 |
/* |
... | ... | |
31 | 31 |
import org.gvsig.fmap.data.DataSelection; |
32 | 32 |
import org.gvsig.tools.observer.Observable; |
33 | 33 |
import org.gvsig.tools.observer.Observer; |
34 |
import org.gvsig.tools.persistence.Persistent; |
|
34 | 35 |
|
35 |
import com.iver.utiles.IPersistence; |
|
36 |
|
|
37 | 36 |
/** |
38 | 37 |
* Interface to manage selection of objects from an undetermined set. Allows to |
39 | 38 |
* add and remove values from the selection, as well as reversing the selection. |
40 |
*
|
|
39 |
* |
|
41 | 40 |
* @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a> |
42 | 41 |
*/ |
43 | 42 |
public interface FeatureReferenceSelection extends DataSelection, Observer, |
44 |
Observable, IPersistence {
|
|
43 |
Observable, Persistent {
|
|
45 | 44 |
|
46 | 45 |
/** |
47 | 46 |
* Adds a feature to the selection. |
48 |
*
|
|
47 |
* |
|
49 | 48 |
* @param reference |
50 | 49 |
* the selected feature reference |
51 | 50 |
* @return true if the feature was not selected before selecting it |
... | ... | |
54 | 53 |
|
55 | 54 |
/** |
56 | 55 |
* Removes a feature from the selection. |
57 |
*
|
|
56 |
* |
|
58 | 57 |
* @param reference |
59 | 58 |
* the deselected feature reference |
60 | 59 |
* @return true if the feature was selected before deselecting it |
... | ... | |
73 | 72 |
|
74 | 73 |
/** |
75 | 74 |
* Returns if a feature is selected. |
76 |
*
|
|
75 |
* |
|
77 | 76 |
* @param reference |
78 | 77 |
* to check |
79 | 78 |
* @return if it is selected |
... | ... | |
88 | 87 |
|
89 | 88 |
/** |
90 | 89 |
* Returns the number of selected values. |
91 |
*
|
|
90 |
* |
|
92 | 91 |
* @return the number of selected values |
93 | 92 |
*/ |
94 | 93 |
long getSelectedCount(); |
95 | 94 |
|
96 | 95 |
/** |
97 | 96 |
* Returns an unmodifiable Iterator of selected feature references. |
98 |
*
|
|
97 |
* |
|
99 | 98 |
* @return the iterator of selected feature references |
100 | 99 |
*/ |
101 | 100 |
Iterator referenceIterator(); |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/DataExplorerParameters.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.fmap.data; |
29 | 29 |
|
30 |
import com.iver.utiles.IPersistence; |
|
31 | 30 |
|
32 | 31 |
|
33 |
public interface DataExplorerParameters extends DataParameters, IPersistence {
|
|
32 |
public interface DataExplorerParameters extends DataParameters { |
|
34 | 33 |
|
35 | 34 |
public DataExplorerType getType(); |
36 | 35 |
|
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/explorer/filesystem/FilesystemExplorer.java | ||
---|---|---|
15 | 15 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
16 | 16 |
import org.gvsig.fmap.data.exceptions.ReadException; |
17 | 17 |
import org.gvsig.fmap.data.spi.DataExplorerProvider; |
18 |
import org.gvsig.tools.exception.NotYetImplemented; |
|
19 | 18 |
import org.gvsig.tools.extensionPoint.ExtensionPoint; |
20 | 19 |
import org.gvsig.tools.extensionPoint.ExtensionPoints; |
21 | 20 |
import org.gvsig.tools.extensionPoint.ExtensionPointsSingleton; |
22 | 21 |
|
23 |
import com.iver.utiles.XMLEntity; |
|
24 | 22 |
|
25 |
|
|
26 | 23 |
public class FilesystemExplorer implements DataExplorerProvider { |
27 | 24 |
// FIXME: , IPersistence{ |
28 | 25 |
|
... | ... | |
101 | 98 |
this.path = new File(this.parameters.getPath()); |
102 | 99 |
} |
103 | 100 |
|
104 |
public void init(XMLEntity xmlEntity) throws InitializeException { |
|
105 |
// TODO Auto-generated method stub |
|
106 |
throw new NotYetImplemented(); |
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
|
|
111 | 101 |
public DataExplorerType getType() { |
112 | 102 |
return parameters.getType(); |
113 | 103 |
} |
... | ... | |
186 | 176 |
return null; |
187 | 177 |
} |
188 | 178 |
|
179 |
public DataStoreParameters getCreationParameters(String storeName) { |
|
180 |
// TODO Auto-generated method stub |
|
181 |
return null; |
|
182 |
} |
|
183 |
|
|
189 | 184 |
// ========================================== |
190 | 185 |
|
191 | 186 |
|
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/impl/DefaultDataManager0.java | ||
---|---|---|
1 |
package org.gvsig.fmap.data.impl; |
|
2 |
|
|
3 |
import java.lang.reflect.InvocationTargetException; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.gvsig.fmap.data.DALLocator; |
|
7 |
import org.gvsig.fmap.data.DataExplorer; |
|
8 |
import org.gvsig.fmap.data.DataExplorerParameters; |
|
9 |
import org.gvsig.fmap.data.DataManager; |
|
10 |
import org.gvsig.fmap.data.DataStore; |
|
11 |
import org.gvsig.fmap.data.DataStoreParameters; |
|
12 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
|
13 |
import org.gvsig.fmap.data.exceptions.ProviderNotRegisteredException; |
|
14 |
import org.gvsig.fmap.data.feature.FeatureAttributeDescriptor; |
|
15 |
import org.gvsig.fmap.data.feature.FeatureStore; |
|
16 |
import org.gvsig.fmap.data.feature.FeatureType; |
|
17 |
import org.gvsig.fmap.data.feature.spi.index.FeatureIndexProviderServices; |
|
18 |
import org.gvsig.fmap.data.resource.ResourceManager; |
|
19 |
import org.gvsig.fmap.data.spi.DataManagerProvider; |
|
20 |
import org.gvsig.tools.ToolsLocator; |
|
21 |
import org.gvsig.tools.evaluator.Evaluator; |
|
22 |
|
|
23 |
public class DefaultDataManager0 implements DataManager, DataManagerProvider { |
|
24 |
|
|
25 |
final static private String DATA_MANAGER_STORE = "Data.manager.stores"; |
|
26 |
final static private String DATA_MANAGER_STORE_DESCRIPTION = "DAL stores providers"; |
|
27 |
|
|
28 |
final static private String DATA_MANAGER_STORE_PARAMS = "Data.manager.stores.params"; |
|
29 |
final static private String DATA_MANAGER_STORE_PARAMS_DESCRIPTION = "DAL stores providers parameters"; |
|
30 |
|
|
31 |
final static private String DATA_MANAGER_EXPLORER = "Data.manager.explorers"; |
|
32 |
final static private String DATA_MANAGER_EXPLORER_DESCRIPTION = "DAL explorers providers"; |
|
33 |
|
|
34 |
final static private String DATA_MANAGER_EXPLORER_PARAMS = "Data.manager.explorers.params"; |
|
35 |
final static private String DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION = "DAL explorer providers parameters"; |
|
36 |
|
|
37 |
final static private String DATA_MANAGER_INDEX = "Data.manager.indexes"; |
|
38 |
final static private String DATA_MANAGER_INDEX_DESCRIPTION = "DAL index providers"; |
|
39 |
|
|
40 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR = "Data.manager.expresion.evaluator"; |
|
41 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT = "default"; |
|
42 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION = "DAL expresion evaluators."; |
|
43 |
|
|
44 |
|
|
45 |
public DefaultDataManager0() { |
|
46 |
/* |
|
47 |
* Create te extensions point in te registry. |
|
48 |
*/ |
|
49 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE, |
|
50 |
DATA_MANAGER_STORE_DESCRIPTION); |
|
51 |
|
|
52 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE_PARAMS, |
|
53 |
DATA_MANAGER_STORE_PARAMS_DESCRIPTION); |
|
54 |
|
|
55 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_EXPLORER, |
|
56 |
DATA_MANAGER_EXPLORER_DESCRIPTION); |
|
57 |
|
|
58 |
ToolsLocator.getExtensionPointManager().add( |
|
59 |
DATA_MANAGER_EXPLORER_PARAMS, |
|
60 |
DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION); |
|
61 |
|
|
62 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_INDEX, |
|
63 |
DATA_MANAGER_INDEX_DESCRIPTION); |
|
64 |
|
|
65 |
ToolsLocator.getExtensionPointManager().add( |
|
66 |
DATA_MANAGER_EXPRESION_EVALUATOR, |
|
67 |
DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* |
|
72 |
* @return ResourceManager |
|
73 |
*/ |
|
74 |
|
|
75 |
public ResourceManager getResourceManager() { |
|
76 |
return DALLocator.getResourceManager(); |
|
77 |
} |
|
78 |
|
|
79 |
public String getTemporaryDirectory() { |
|
80 |
// FIXME Define a better tempdir solution |
|
81 |
String tmp = System.getenv("TMP"); |
|
82 |
if (tmp == null) { |
|
83 |
tmp = System.getenv("TEMP"); |
|
84 |
} |
|
85 |
if (tmp == null) { |
|
86 |
tmp = System.getenv("HOME"); |
|
87 |
} |
|
88 |
return tmp; |
|
89 |
} |
|
90 |
|
|
91 |
/* |
|
92 |
* ==================================================================== |
|
93 |
* |
|
94 |
* Store related services |
|
95 |
*/ |
|
96 |
public void registerStoreProvider(String name, |
|
97 |
Class storeProviderClass, |
|
98 |
Class parametersClass) { |
|
99 |
|
|
100 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE, |
|
101 |
DATA_MANAGER_STORE_DESCRIPTION, name, null, |
|
102 |
storeProviderClass); |
|
103 |
|
|
104 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE_PARAMS, |
|
105 |
DATA_MANAGER_STORE_PARAMS_DESCRIPTION, name, null, |
|
106 |
storeProviderClass); |
|
107 |
} |
|
108 |
|
|
109 |
public DataStoreParameters createStoreParameters(String name) |
|
110 |
throws InitializeException, ProviderNotRegisteredException { |
|
111 |
try { |
|
112 |
DataStoreParameters params = (DataStoreParameters) ToolsLocator |
|
113 |
.getExtensionPointManager().get(DATA_MANAGER_STORE_PARAMS) |
|
114 |
.create(name); |
|
115 |
if (params == null) { |
|
116 |
throw new ProviderNotRegisteredException(name); |
|
117 |
} |
|
118 |
return params; |
|
119 |
} catch (InstantiationException e) { |
|
120 |
throw new InitializeException(e); |
|
121 |
} catch (IllegalAccessException e) { |
|
122 |
throw new InitializeException(e); |
|
123 |
} catch (SecurityException e) { |
|
124 |
throw new InitializeException(e); |
|
125 |
} catch (IllegalArgumentException e) { |
|
126 |
throw new InitializeException(e); |
|
127 |
} |
|
128 |
} |
|
129 |
|
|
130 |
public DataStore createStore(DataStoreParameters parameters) |
|
131 |
throws InitializeException, ProviderNotRegisteredException { |
|
132 |
String name = parameters.getDataStoreName(); |
|
133 |
|
|
134 |
try { |
|
135 |
DataStore store = (DataStore) ToolsLocator |
|
136 |
.getExtensionPointManager().get(DATA_MANAGER_STORE).create( |
|
137 |
name, new Object[] { parameters }); |
|
138 |
if (store == null) { |
|
139 |
throw new ProviderNotRegisteredException(name); |
|
140 |
} |
|
141 |
return store; |
|
142 |
} catch (InstantiationException e) { |
|
143 |
throw new InitializeException(e); |
|
144 |
} catch (IllegalAccessException e) { |
|
145 |
throw new InitializeException(e); |
|
146 |
} catch (SecurityException e) { |
|
147 |
throw new InitializeException(e); |
|
148 |
} catch (IllegalArgumentException e) { |
|
149 |
throw new InitializeException(e); |
|
150 |
} catch (NoSuchMethodException e) { |
|
151 |
throw new InitializeException(e); |
|
152 |
} catch (InvocationTargetException e) { |
|
153 |
throw new InitializeException(e); |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
public List getStoreProviders() { |
|
158 |
return ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_STORE) |
|
159 |
.getNames(); |
|
160 |
} |
|
161 |
|
|
162 |
/* |
|
163 |
* ==================================================================== |
|
164 |
* |
|
165 |
* Explorer related services |
|
166 |
*/ |
|
167 |
public void registerExplorerProvider(String name, Class explorerClass, |
|
168 |
Class parametersClass) { |
|
169 |
|
|
170 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_EXPLORER, |
|
171 |
DATA_MANAGER_EXPLORER_DESCRIPTION, name, null, explorerClass); |
|
172 |
|
|
173 |
ToolsLocator.getExtensionPointManager().add( |
|
174 |
DATA_MANAGER_EXPLORER_PARAMS, |
|
175 |
DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION, name, null, |
|
176 |
parametersClass); |
|
177 |
} |
|
178 |
|
|
179 |
public DataExplorerParameters createExplorerParameters(String name) |
|
180 |
throws InitializeException, ProviderNotRegisteredException { |
|
181 |
try { |
|
182 |
DataExplorerParameters params = (DataExplorerParameters) ToolsLocator |
|
183 |
.getExtensionPointManager() |
|
184 |
.get( |
|
185 |
DATA_MANAGER_EXPLORER_PARAMS) |
|
186 |
.create(name); |
|
187 |
if (params == null) { |
|
188 |
throw new ProviderNotRegisteredException(name); |
|
189 |
} |
|
190 |
return params; |
|
191 |
} catch (InstantiationException e) { |
|
192 |
throw new InitializeException(e); |
|
193 |
} catch (IllegalAccessException e) { |
|
194 |
throw new InitializeException(e); |
|
195 |
} catch (SecurityException e) { |
|
196 |
throw new InitializeException(e); |
|
197 |
} catch (IllegalArgumentException e) { |
|
198 |
throw new InitializeException(e); |
|
199 |
} |
|
200 |
} |
|
201 |
|
|
202 |
public DataExplorer createExplorer(DataExplorerParameters parameters) |
|
203 |
throws InitializeException, ProviderNotRegisteredException { |
|
204 |
|
|
205 |
String name = parameters.getType().getName(); |
|
206 |
|
|
207 |
try { |
|
208 |
DataExplorer explorer = (DataExplorer) ToolsLocator |
|
209 |
.getExtensionPointManager().get(DATA_MANAGER_STORE).create( |
|
210 |
name, new Object[] { parameters }); |
|
211 |
if (explorer == null) { |
|
212 |
throw new ProviderNotRegisteredException(name); |
|
213 |
} |
|
214 |
return explorer; |
|
215 |
} catch (InstantiationException e) { |
|
216 |
throw new InitializeException(e); |
|
217 |
} catch (IllegalAccessException e) { |
|
218 |
throw new InitializeException(e); |
|
219 |
} catch (SecurityException e) { |
|
220 |
throw new InitializeException(e); |
|
221 |
} catch (IllegalArgumentException e) { |
|
222 |
throw new InitializeException(e); |
|
223 |
} catch (NoSuchMethodException e) { |
|
224 |
throw new InitializeException(e); |
|
225 |
} catch (InvocationTargetException e) { |
|
226 |
throw new InitializeException(e); |
|
227 |
} |
|
228 |
} |
|
229 |
|
|
230 |
public List getExplorerProviders() { |
|
231 |
return ToolsLocator.getExtensionPointManager().get( |
|
232 |
DATA_MANAGER_EXPLORER).getNames(); |
|
233 |
} |
|
234 |
|
|
235 |
|
|
236 |
/* |
|
237 |
* ==================================================================== |
|
238 |
* |
|
239 |
* Expresion evaluation related services |
|
240 |
*/ |
|
241 |
public Evaluator createExpresion(String expresion) |
|
242 |
throws InitializeException { |
|
243 |
try { |
|
244 |
return (Evaluator) ToolsLocator.getExtensionPointManager().get( |
|
245 |
DATA_MANAGER_EXPRESION_EVALUATOR).create( |
|
246 |
DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT, |
|
247 |
new Object[] { expresion }); |
|
248 |
} catch (SecurityException e) { |
|
249 |
throw new InitializeException(e); |
|
250 |
} catch (IllegalArgumentException e) { |
|
251 |
throw new InitializeException(e); |
|
252 |
} catch (NoSuchMethodException e) { |
|
253 |
throw new InitializeException(e); |
|
254 |
} catch (InstantiationException e) { |
|
255 |
throw new InitializeException(e); |
|
256 |
} catch (IllegalAccessException e) { |
|
257 |
throw new InitializeException(e); |
|
258 |
} catch (InvocationTargetException e) { |
|
259 |
throw new InitializeException(e); |
|
260 |
} |
|
261 |
} |
|
262 |
|
|
263 |
public void registerDefaultEvaluator(Class evaluatorClass) { |
|
264 |
if (!evaluatorClass.isInstance(Evaluator.class)) { |
|
265 |
throw new ClassCastException(); |
|
266 |
} |
|
267 |
ToolsLocator.getExtensionPointManager().add( |
|
268 |
DATA_MANAGER_EXPRESION_EVALUATOR, |
|
269 |
DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION, |
|
270 |
DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT, |
|
271 |
"Default expresion evaluator for use in DAL", evaluatorClass); |
|
272 |
} |
|
273 |
|
|
274 |
/* |
|
275 |
* ==================================================================== |
|
276 |
* |
|
277 |
* Index related services |
|
278 |
*/ |
|
279 |
|
|
280 |
|
|
281 |
public List getDataIndexProviders(int dataType) { |
|
282 |
// TODO Auto-generated method stub |
|
283 |
return null; |
|
284 |
} |
|
285 |
|
|
286 |
public String getDefaultDataIndexProviderName(int dataType) { |
|
287 |
// TODO Auto-generated method stub |
|
288 |
return null; |
|
289 |
} |
|
290 |
|
|
291 |
public void setDefaultDataIndexProviderName(int dataType, String name) { |
|
292 |
// TODO Auto-generated method stub |
|
293 |
|
|
294 |
} |
|
295 |
|
|
296 |
public FeatureIndexProviderServices createFeatureIndexProvider( |
|
297 |
FeatureStore store, FeatureType type, |
|
298 |
FeatureAttributeDescriptor attr, String[] providerNames) |
|
299 |
throws InitializeException, ProviderNotRegisteredException { |
|
300 |
// TODO Auto-generated method stub |
|
301 |
return null; |
|
302 |
} |
|
303 |
|
|
304 |
public FeatureIndexProviderServices createFeatureIndexProvider( |
|
305 |
FeatureStore store, FeatureType type, |
|
306 |
FeatureAttributeDescriptor attr) throws InitializeException, |
|
307 |
ProviderNotRegisteredException { |
|
308 |
// TODO Auto-generated method stub |
|
309 |
return null; |
|
310 |
} |
|
311 |
|
|
312 |
public void registerFeatureIndexProvider(String name, String description, |
|
313 |
Class clazz) { |
|
314 |
// TODO Auto-generated method stub |
|
315 |
|
|
316 |
} |
|
317 |
|
|
318 |
|
|
319 |
} |
|
0 | 320 |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/DataStore.java | ||
---|---|---|
7 | 7 |
import org.gvsig.metadata.Metadatable; |
8 | 8 |
import org.gvsig.tools.observer.Observable; |
9 | 9 |
import org.gvsig.tools.observer.Observer; |
10 |
import org.gvsig.tools.operations.ExtendedOperations; |
|
10 |
import org.gvsig.tools.operations.Operations; |
|
11 |
import org.gvsig.tools.persistence.Persistent; |
|
11 | 12 |
|
12 |
import com.iver.utiles.IPersistence; |
|
13 |
|
|
14 | 13 |
/** |
15 | 14 |
* <p>This is the basic interface of data sources. DataStore |
16 | 15 |
* offers generic services like: |
... | ... | |
32 | 31 |
* @author |
33 | 32 |
* |
34 | 33 |
*/ |
35 |
public interface DataStore extends Observable, Metadatable, IPersistence,
|
|
36 |
ExtendedOperations {
|
|
34 |
public interface DataStore extends Observable, Metadatable, Persistent,
|
|
35 |
Operations { |
|
37 | 36 |
|
38 | 37 |
public String getName(); |
39 | 38 |
|
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/DataParameters.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.fmap.data; |
29 | 29 |
|
30 |
import org.gvsig.tools.persistence.Persistent; |
|
30 | 31 |
|
31 |
public interface DataParameters { |
|
32 | 32 |
|
33 |
public interface DataParameters extends Persistent { |
|
34 |
|
|
33 | 35 |
public Object get(String name); |
34 | 36 |
|
35 | 37 |
public DataParameters set(String name, Object value); |
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/DataQuery.java | ||
---|---|---|
29 | 29 |
import java.util.HashMap; |
30 | 30 |
import java.util.Map; |
31 | 31 |
|
32 |
import org.gvsig.tools.persistence.AbstractPersistenceManager; |
|
33 |
import org.gvsig.tools.persistence.PersistenceException; |
|
34 |
import org.gvsig.tools.persistence.Persistent; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
32 | 37 |
/** |
33 | 38 |
* Defines the properties of a collection of data, as a result of a query |
34 | 39 |
* through a DataStore. |
... | ... | |
39 | 44 |
* the data, or maybe to return Data with less detail, like a point or a line |
40 | 45 |
* instead of a polygon. |
41 | 46 |
* </p> |
42 |
*
|
|
47 |
* |
|
43 | 48 |
* @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a> |
44 | 49 |
*/ |
45 |
public class DataQuery { |
|
50 |
public class DataQuery implements Persistent {
|
|
46 | 51 |
|
47 | 52 |
private double scale; |
48 |
|
|
53 |
|
|
49 | 54 |
private Map attributes = new HashMap(); |
50 | 55 |
|
51 | 56 |
/** |
... | ... | |
57 | 62 |
|
58 | 63 |
/** |
59 | 64 |
* Constructor with an scale. |
60 |
*
|
|
65 |
* |
|
61 | 66 |
* @param scale |
62 | 67 |
* the scale for the data |
63 | 68 |
*/ |
... | ... | |
68 | 73 |
|
69 | 74 |
/** |
70 | 75 |
* Returns the scale. |
71 |
*
|
|
76 |
* |
|
72 | 77 |
* @return the scale |
73 | 78 |
*/ |
74 | 79 |
public double getScale() { |
... | ... | |
77 | 82 |
|
78 | 83 |
/** |
79 | 84 |
* Sets the scale. |
80 |
*
|
|
85 |
* |
|
81 | 86 |
* @param scale |
82 | 87 |
* the scale to set |
83 | 88 |
*/ |
... | ... | |
87 | 92 |
|
88 | 93 |
/** |
89 | 94 |
* Returns the value of an attribute. |
90 |
*
|
|
95 |
* |
|
91 | 96 |
* @param name |
92 | 97 |
* of the attribute |
93 | 98 |
* @return the attribute value |
... | ... | |
98 | 103 |
|
99 | 104 |
/** |
100 | 105 |
* Sets the value of an attribute. |
101 |
*
|
|
106 |
* |
|
102 | 107 |
* @param name |
103 | 108 |
* of the attribute |
104 | 109 |
* @param value |
... | ... | |
108 | 113 |
attributes.put(name, value); |
109 | 114 |
} |
110 | 115 |
|
116 |
public PersistentState getState() throws PersistenceException { |
|
117 |
return AbstractPersistenceManager.getState(this); |
|
118 |
} |
|
119 |
|
|
120 |
public void loadState(PersistentState state) throws PersistenceException { |
|
121 |
// FIXME: falta por terminar de implementar |
|
122 |
state.set("scale", scale); |
|
123 |
} |
|
124 |
|
|
125 |
public void setState(PersistentState state) throws PersistenceException { |
|
126 |
// FIXME: falta por terminar de implementar |
|
127 |
this.scale = state.getDouble("scale"); |
|
128 |
} |
|
129 |
|
|
111 | 130 |
} |
Also available in: Unified diff