Revision 29326 branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/store/mysql/MySQLStoreProvider.java
MySQLStoreProvider.java | ||
---|---|---|
44 | 44 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
45 | 45 |
import org.gvsig.fmap.dal.feature.FeatureType; |
46 | 46 |
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider; |
47 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
47 | 48 |
import org.gvsig.fmap.dal.store.jdbc.JDBCHelper; |
48 | 49 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreProviderWriter; |
49 | 50 |
import org.gvsig.fmap.geom.Geometry; |
50 | 51 |
import org.gvsig.tools.ToolsLocator; |
51 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
52 | 52 |
import org.gvsig.tools.dynobject.DynClass; |
53 | 53 |
import org.gvsig.tools.dynobject.DynObjectManager; |
54 | 54 |
import org.slf4j.Logger; |
... | ... | |
65 | 65 |
private static DynClass DYNCLASS = null; |
66 | 66 |
|
67 | 67 |
|
68 |
protected MySQLStoreParameters myParams; |
|
69 |
|
|
70 |
|
|
71 | 68 |
protected static void registerDynClass() { |
72 | 69 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
73 | 70 |
DynClass dynClass; |
... | ... | |
79 | 76 |
} |
80 | 77 |
} |
81 | 78 |
|
82 |
public MySQLStoreProvider() { |
|
83 |
super(); |
|
84 |
} |
|
85 | 79 |
|
86 |
public MySQLStoreProvider(MySQLStoreParameters params) |
|
80 |
public MySQLStoreProvider(MySQLStoreParameters params, |
|
81 |
DataStoreProviderServices storeServices) |
|
87 | 82 |
throws InitializeException { |
88 |
super(); |
|
89 |
this.init(params); |
|
83 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
84 |
.createDynObject(DYNCLASS)); |
|
85 |
|
|
90 | 86 |
} |
91 | 87 |
|
92 |
protected void init(MySQLStoreParameters params) |
|
93 |
throws InitializeException { |
|
94 |
this.myParams = params; |
|
95 |
super.init(params); |
|
96 |
|
|
97 |
this.metadata = (DelegatedDynObject) ToolsLocator |
|
98 |
.getDynObjectManager().createDynObject(DYNCLASS); |
|
99 |
|
|
100 |
this.metadata.setDynValue("DefaultSRS", null); |
|
101 |
this.metadata.setDynValue("Envelope", null); |
|
88 |
private MySQLStoreParameters getMySQLParamters() { |
|
89 |
return (MySQLStoreParameters) this.getParameters(); |
|
102 | 90 |
} |
103 | 91 |
|
104 | 92 |
protected JDBCHelper createHelper() throws InitializeException { |
105 |
return new MySQLHelper(this, myParams);
|
|
93 |
return new MySQLHelper(this, getMySQLParamters());
|
|
106 | 94 |
} |
107 | 95 |
|
108 | 96 |
protected String fixFilter(String filter) { |
... | ... | |
151 | 139 |
public DataServerExplorer getExplorer() throws ReadException { |
152 | 140 |
DataManager manager = DALLocator.getDataManager(); |
153 | 141 |
MySQLServerExplorerParameters exParams; |
142 |
MySQLStoreParameters params = getMySQLParamters(); |
|
154 | 143 |
try { |
155 | 144 |
exParams = (MySQLServerExplorerParameters) manager |
156 | 145 |
.createServerExplorerParameters(MySQLServerExplorer.NAME); |
... | ... | |
163 | 152 |
exParams.setCatalog(params.getCatalog()); |
164 | 153 |
exParams.setSchema(params.getSchema()); |
165 | 154 |
exParams.setJDBCDriverClassName(params.getJDBCDriverClassName()); |
166 |
exParams.setUseSSL(myParams.getUseSSL());
|
|
155 |
exParams.setUseSSL(params.getUseSSL());
|
|
167 | 156 |
|
168 | 157 |
return manager.createServerExplorer(exParams); |
169 | 158 |
} catch (DataException e) { |
... | ... | |
202 | 191 |
|
203 | 192 |
public boolean canWriteGeometry(int geometryType, int geometrySubtype) |
204 | 193 |
throws DataException { |
205 |
FeatureAttributeDescriptor geomAttr = this.store |
|
206 |
.getDefaultFeatureType().getAttributeDescriptor( |
|
207 |
this.store.getDefaultFeatureType() |
|
208 |
.getDefaultGeometryAttributeName()); |
|
194 |
FeatureType fType = this.getFeatureStore().getDefaultFeatureType(); |
|
195 |
FeatureAttributeDescriptor geomAttr = fType |
|
196 |
.getAttributeDescriptor(fType.getDefaultGeometryAttributeName()); |
|
209 | 197 |
if (geomAttr == null) { |
210 | 198 |
return false; |
211 | 199 |
} |
Also available in: Unified diff