Revision 37780 branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/ExporttoGenericProvider.java
ExporttoGenericProvider.java | ||
---|---|---|
59 | 59 |
* @version $Id$ |
60 | 60 |
*/ |
61 | 61 |
public class ExporttoGenericProvider extends AbstractProvider implements |
62 |
ExporttoSwingProvider { |
|
62 |
ExporttoSwingProvider {
|
|
63 | 63 |
|
64 |
private static final Logger LOG = |
|
65 |
LoggerFactory.getLogger(ExporttoGenericProvider.class);
|
|
64 |
private static final Logger LOG = LoggerFactory
|
|
65 |
.getLogger(ExporttoGenericProvider.class); |
|
66 | 66 |
|
67 | 67 |
private static final DataManager DATA_MANAGER = DALLocator.getDataManager(); |
68 |
private static final DynObjectSwingManager DYN_OBJECT_SWING_MANAGER =
|
|
68 |
private static final DynObjectSwingManager DYN_OBJECT_SWING_MANAGER =
|
|
69 | 69 |
ToolsSwingLocator.getDynObjectSwingManager(); |
70 |
private static final ExporttoManager EXPORTTO_MANAGER = |
|
71 |
ExporttoLocator.getManager();
|
|
70 |
private static final ExporttoManager EXPORTTO_MANAGER = ExporttoLocator
|
|
71 |
.getManager(); |
|
72 | 72 |
|
73 | 73 |
private DataServerExplorerPanel dataServerExplorerPanel = null; |
74 | 74 |
private DataServerExplorerParamsPanel dataServerExplorerParamsPanel = null; |
75 | 75 |
private DataStorePanel dataStorePanel = null; |
76 | 76 |
private DataStoreParamsPanel dataStoreParamsPanel = null; |
77 | 77 |
|
78 |
|
|
79 | 78 |
private FeatureStore featureStore; |
80 | 79 |
private IProjection projection; |
81 | 80 |
private DataServerExplorer dataServerExplorer = null; |
... | ... | |
88 | 87 |
* @param file |
89 | 88 |
* to get the Exporto from |
90 | 89 |
*/ |
91 |
public ExporttoGenericProvider(ProviderServices providerServices, FeatureStore featureStore, IProjection projection) { |
|
90 |
public ExporttoGenericProvider(ProviderServices providerServices, |
|
91 |
FeatureStore featureStore, IProjection projection) { |
|
92 | 92 |
super(providerServices); |
93 | 93 |
this.featureStore = featureStore; |
94 | 94 |
this.projection = projection; |
... | ... | |
99 | 99 |
dataStoreParamsPanel = new DataStoreParamsPanel(this); |
100 | 100 |
} |
101 | 101 |
|
102 |
public int getPanelCount() {
|
|
102 |
public int getPanelCount() { |
|
103 | 103 |
return 4; |
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
public ExporttoSwingProviderPanel getPanelAt(int index) { |
107 |
switch(index){
|
|
107 |
switch (index) {
|
|
108 | 108 |
case 0: |
109 | 109 |
return dataServerExplorerPanel; |
110 | 110 |
case 1: |
... | ... | |
113 | 113 |
return dataStorePanel; |
114 | 114 |
case 3: |
115 | 115 |
return dataStoreParamsPanel; |
116 |
}
|
|
116 |
} |
|
117 | 117 |
return null; |
118 | 118 |
} |
119 | 119 |
|
120 |
public void setDataServerExplorerSelected(String explorerName) throws ExporttoPanelValidationException { |
|
120 |
public void setDataServerExplorerSelected(String explorerName) |
|
121 |
throws ExporttoPanelValidationException { |
|
121 | 122 |
DataServerExplorerParameters dataServerExplorerParameters; |
122 | 123 |
try { |
123 |
dataServerExplorerParameters = DATA_MANAGER.createServerExplorerParameters(explorerName); |
|
124 |
JDynObjectComponent dynObjectComponent = DYN_OBJECT_SWING_MANAGER.createJDynObjectComponent(dataServerExplorerParameters, true); |
|
125 |
this.dataServerExplorerParamsPanel.setDynObjectComponent(dynObjectComponent); |
|
126 |
} catch (InitializeException e1) { |
|
127 |
throw new ExporttoPanelValidationException("Error creating the explorer params panel", e1); |
|
128 |
} catch (ProviderNotRegisteredException e1) { |
|
129 |
throw new ExporttoPanelValidationException("Error creating the explorer params panel", e1); |
|
130 |
} catch (ServiceException e1) { |
|
131 |
throw new ExporttoPanelValidationException("Error creating the explorer params panel", e1); |
|
132 |
} |
|
133 |
} |
|
124 |
dataServerExplorerParameters = |
|
125 |
DATA_MANAGER.createServerExplorerParameters(explorerName); |
|
126 |
JDynObjectComponent dynObjectComponent = |
|
127 |
DYN_OBJECT_SWING_MANAGER.createJDynObjectComponent( |
|
128 |
dataServerExplorerParameters, true); |
|
129 |
this.dataServerExplorerParamsPanel |
|
130 |
.setDynObjectComponent(dynObjectComponent); |
|
131 |
} catch (InitializeException e1) { |
|
132 |
throw new ExporttoPanelValidationException( |
|
133 |
"Error creating the explorer params panel", e1); |
|
134 |
} catch (ProviderNotRegisteredException e1) { |
|
135 |
throw new ExporttoPanelValidationException( |
|
136 |
"Error creating the explorer params panel", e1); |
|
137 |
} catch (ServiceException e1) { |
|
138 |
throw new ExporttoPanelValidationException( |
|
139 |
"Error creating the explorer params panel", e1); |
|
140 |
} |
|
141 |
} |
|
134 | 142 |
|
135 |
public void setDataServerExplorerParameters(DataServerExplorerParameters dataServerExplorerParameters) throws ExporttoPanelValidationException { |
|
136 |
String explorerName = this.dataServerExplorerPanel.getSelectedProvider(); |
|
137 |
if (explorerName != null){ |
|
138 |
if (dataServerExplorerParameters != null){ |
|
143 |
public void setDataServerExplorerParameters( |
|
144 |
DataServerExplorerParameters dataServerExplorerParameters) |
|
145 |
throws ExporttoPanelValidationException { |
|
146 |
String explorerName = |
|
147 |
this.dataServerExplorerPanel.getSelectedProvider(); |
|
148 |
if (explorerName != null) { |
|
149 |
if (dataServerExplorerParameters != null) { |
|
139 | 150 |
try { |
140 |
dataServerExplorer = DATA_MANAGER.openServerExplorer(explorerName, dataServerExplorerParameters); |
|
141 |
this.dataStorePanel.setDataServerExplorer(dataServerExplorer); |
|
142 |
} catch (ValidateDataParametersException e) { |
|
143 |
throw new ExporttoPanelValidationException("error creating the explorer", e); |
|
144 |
} catch (InitializeException e) { |
|
145 |
throw new ExporttoPanelValidationException("error creating the explorer", e); |
|
146 |
} catch (ProviderNotRegisteredException e) { |
|
147 |
throw new ExporttoPanelValidationException("error creating the explorer", e); |
|
148 |
} |
|
149 |
} |
|
151 |
dataServerExplorer = |
|
152 |
DATA_MANAGER.openServerExplorer(explorerName, |
|
153 |
dataServerExplorerParameters); |
|
154 |
this.dataStorePanel |
|
155 |
.setDataServerExplorer(dataServerExplorer); |
|
156 |
} catch (ValidateDataParametersException e) { |
|
157 |
throw new ExporttoPanelValidationException( |
|
158 |
"error creating the explorer", e); |
|
159 |
} catch (InitializeException e) { |
|
160 |
throw new ExporttoPanelValidationException( |
|
161 |
"error creating the explorer", e); |
|
162 |
} catch (ProviderNotRegisteredException e) { |
|
163 |
throw new ExporttoPanelValidationException( |
|
164 |
"error creating the explorer", e); |
|
165 |
} |
|
166 |
} |
|
150 | 167 |
} |
151 |
}
|
|
168 |
} |
|
152 | 169 |
|
153 |
public DataServerExplorer getDataServerExplorer() {
|
|
170 |
public DataServerExplorer getDataServerExplorer() { |
|
154 | 171 |
return dataServerExplorer; |
155 |
}
|
|
172 |
} |
|
156 | 173 |
|
157 |
public void setDataStoreSelected(String storeName) throws ExporttoPanelValidationException { |
|
158 |
try{ |
|
159 |
NewDataStoreParameters newDataStoreParameters = dataServerExplorer.getAddParameters(storeName); |
|
174 |
public void setDataStoreSelected(String storeName) |
|
175 |
throws ExporttoPanelValidationException { |
|
176 |
try { |
|
177 |
NewDataStoreParameters newDataStoreParameters = |
|
178 |
dataServerExplorer.getAddParameters(storeName); |
|
160 | 179 |
|
161 |
try{ |
|
180 |
try {
|
|
162 | 181 |
newDataStoreParameters.setDynValue("CRS", projection); |
182 |
} catch (DynFieldNotFoundException e) { |
|
183 |
LOG.info("The provider {} doesn't support the CRS parameter", |
|
184 |
storeName); |
|
163 | 185 |
} |
164 |
catch(DynFieldNotFoundException e) |
|
165 |
{ |
|
166 |
LOG.info("The provider {} doesn't support the CRS parameter", storeName); |
|
186 |
try { |
|
187 |
newDataStoreParameters.setDynValue("featureType", featureStore |
|
188 |
.getDefaultFeatureType().getEditable()); |
|
189 |
} catch (DynFieldNotFoundException e) { |
|
190 |
LOG.info( |
|
191 |
"The provider {} doesn't support the featureType parameter", |
|
192 |
storeName); |
|
167 | 193 |
} |
168 |
try{ |
|
169 |
newDataStoreParameters.setDynValue("featureType", featureStore.getDefaultFeatureType().getEditable()); |
|
170 |
} |
|
171 |
catch(DynFieldNotFoundException e) |
|
172 |
{ |
|
173 |
LOG.info("The provider {} doesn't support the featureType parameter", storeName); |
|
174 |
} |
|
175 | 194 |
|
176 |
JDynObjectComponent dynObjectComponent = DYN_OBJECT_SWING_MANAGER.createJDynObjectComponent(newDataStoreParameters, true); |
|
195 |
JDynObjectComponent dynObjectComponent = |
|
196 |
DYN_OBJECT_SWING_MANAGER.createJDynObjectComponent( |
|
197 |
newDataStoreParameters, true); |
|
177 | 198 |
this.dataStoreParamsPanel.setDynObjectComponent(dynObjectComponent); |
178 |
} catch (Exception e1) { |
|
179 |
throw new ExporttoPanelValidationException("Error creating the store params panel", e1); |
|
199 |
} catch (Exception e1) { |
|
200 |
throw new ExporttoPanelValidationException( |
|
201 |
"Error creating the store params panel", e1); |
|
180 | 202 |
} |
181 | 203 |
} |
182 | 204 |
|
183 |
|
|
184 |
private NewDataStoreParameters getNewDataStoreParameters() |
|
185 |
{ |
|
205 |
private NewDataStoreParameters getNewDataStoreParameters() { |
|
186 | 206 |
return dataStoreParamsPanel.getNewDataStoreParameters(); |
187 | 207 |
} |
188 | 208 |
|
189 |
public ExporttoService createExporttoService() { |
|
190 |
return EXPORTTO_MANAGER.getExporttoService(dataServerExplorer, getNewDataStoreParameters()); |
|
191 |
|
|
209 |
public ExporttoService createExporttoService() { |
|
210 |
return EXPORTTO_MANAGER.getExporttoService(dataServerExplorer, |
|
211 |
getNewDataStoreParameters()); |
|
212 |
|
|
192 | 213 |
} |
193 |
} |
|
214 |
} |
Also available in: Unified diff