root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / impl / DALDefaultImplLibrary.java @ 32880
History | View | Annotate | Download (4.37 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 |
* 2009 IVER T.I {{Task}}
|
26 |
*/
|
27 |
|
28 |
/**
|
29 |
*
|
30 |
*/
|
31 |
package org.gvsig.fmap.dal.impl; |
32 |
|
33 |
import java.io.IOException; |
34 |
import java.util.Map; |
35 |
|
36 |
import org.gvsig.fmap.dal.DALLibrary; |
37 |
import org.gvsig.fmap.dal.DALLocator; |
38 |
import org.gvsig.fmap.dal.DataTypes; |
39 |
import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform; |
40 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureQuery; |
41 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReference; |
42 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection; |
43 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection; |
44 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore; |
45 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStoreTransforms; |
46 |
import org.gvsig.fmap.dal.impl.coerce.CoerceToCRS; |
47 |
import org.gvsig.fmap.dal.impl.coerce.CoerceToGeometry; |
48 |
import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager; |
49 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
50 |
import org.gvsig.metadata.exceptions.MetadataException; |
51 |
import org.gvsig.tools.ToolsLocator; |
52 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
53 |
import org.gvsig.tools.dynobject.DynClass; |
54 |
import org.gvsig.tools.dynobject.DynObjectManager; |
55 |
import org.gvsig.tools.library.AbstractLibrary; |
56 |
import org.gvsig.tools.library.LibraryException; |
57 |
import org.xmlpull.v1.XmlPullParserException; |
58 |
|
59 |
public class DALDefaultImplLibrary extends AbstractLibrary { |
60 |
|
61 |
protected void doInitialize() throws LibraryException { |
62 |
DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager(); |
63 |
|
64 |
dataTypesManager.setCoercion(DataTypes.GEOMETRY, new CoerceToGeometry());
|
65 |
dataTypesManager.setCoercion(DataTypes.CRS, new CoerceToCRS());
|
66 |
|
67 |
DALLocator.registerDefaultDataManager(DefaultDataManager.class); |
68 |
DALLocator.registerResourceManager(DefaultResourceManager.class); |
69 |
|
70 |
try {
|
71 |
registerBaseNewProvidersParametersDefinition(); |
72 |
} catch (XmlPullParserException e) {
|
73 |
throw new LibraryException(this.getClass(), e); |
74 |
} catch (IOException e) { |
75 |
throw new LibraryException(this.getClass(), e); |
76 |
} |
77 |
} |
78 |
|
79 |
protected void doPostInitialize() throws LibraryException { |
80 |
LibraryException ex=null;
|
81 |
|
82 |
new DALLibrary().postInitialize();
|
83 |
|
84 |
DefaultFeatureQuery.registerPersistent(); |
85 |
DefaultFeatureReference.registerPersistent(); |
86 |
DefaultFeatureStoreTransforms.registerPersistent(); |
87 |
AbstractFeatureStoreTransform.registerPersistent(); |
88 |
DefaultFeatureReferenceSelection.registerPersistent(); |
89 |
DefaultFeatureSelection.registerPersistent(); |
90 |
// DefaultCoverageStore.registerPersistent();
|
91 |
|
92 |
DefaultFeatureStore.registerPersistenceDefinition(); |
93 |
try {
|
94 |
DefaultFeatureStore.registerMetadataDefinition(); |
95 |
} catch (MetadataException e) {
|
96 |
ex = new LibraryException(this.getClass(),e); |
97 |
} |
98 |
|
99 |
//DefaultFeatureAttributeDescriptor.registerPersistent();
|
100 |
|
101 |
if( ex!=null ) { |
102 |
throw ex;
|
103 |
} |
104 |
} |
105 |
|
106 |
private void registerBaseNewProvidersParametersDefinition() throws XmlPullParserException, IOException { |
107 |
DynObjectManager manager = ToolsLocator.getDynObjectManager(); |
108 |
if( manager.get("DAL", DataStoreProviderServices.BASE_NEWPARAMETERS_PROVIDER_DEFINITION_NAME)==null ) { |
109 |
Map definitions = manager.importDynClassDefinitions(
|
110 |
DataStoreProviderServices.class.getResourceAsStream("ProviderParametersDefinition.xml"),
|
111 |
DataStoreProviderServices.class.getClassLoader() |
112 |
); |
113 |
manager.add((DynClass) definitions.get(DataStoreProviderServices.BASE_NEWPARAMETERS_PROVIDER_DEFINITION_FULLNAME)); |
114 |
manager.add((DynClass) definitions.get(DataStoreProviderServices.BASE_PARAMETERS_PROVIDER_DEFINITION_FULLNAME)); |
115 |
} |
116 |
} |
117 |
|
118 |
|
119 |
} |