Revision 35745
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.main/pom.xml | ||
---|---|---|
51 | 51 |
<version>1.0.0-SNAPSHOT</version> |
52 | 52 |
<scope>runtime</scope> |
53 | 53 |
</dependency> |
54 |
<dependency> |
|
55 |
<groupId>org.gvsig</groupId> |
|
56 |
<artifactId>org.gvsig.exportto.swing.prov.dbf</artifactId> |
|
57 |
<version>1.0.0-SNAPSHOT</version> |
|
58 |
<scope>runtime</scope> |
|
59 |
</dependency> |
|
54 | 60 |
<dependency> |
55 | 61 |
<groupId>org.gvsig</groupId> |
56 | 62 |
<artifactId>org.gvsig.exportto.swing.prov.postgresql</artifactId> |
... | ... | |
96 | 102 |
<classifier>store.postgresql</classifier> |
97 | 103 |
<scope>runtime</scope> |
98 | 104 |
</dependency> |
105 |
<dependency> |
|
106 |
<groupId>org.gvsig</groupId> |
|
107 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
108 |
<scope>runtime</scope> |
|
109 |
</dependency> |
|
99 | 110 |
<dependency> |
100 | 111 |
<groupId>org.gvsig</groupId> |
101 | 112 |
<artifactId>org.gvsig.fmap.dal.db</artifactId> |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/DefaultJExporttoServicePanel.java | ||
---|---|---|
82 | 82 |
|
83 | 83 |
//Used to get the new feature store parameters |
84 | 84 |
private ExporttoSwingProvider exporttoSwingProvider; |
85 |
|
|
86 |
//Provider types that will be displayed |
|
87 |
private int[] providerTypes; |
|
85 | 88 |
|
86 | 89 |
//Wizards used to create the main wizard |
87 | 90 |
private ExporterSelectionWizard exporterSelectionWizard = null; |
... | ... | |
95 | 98 |
|
96 | 99 |
//Action to execute at the end of the export process |
97 | 100 |
ExporttoServiceFinishAction exporttoServiceFinishAction; |
98 |
|
|
101 |
|
|
99 | 102 |
public DefaultJExporttoServicePanel(DefaultExporttoSwingManager uimanager, FeatureStore featureStore, IProjection projection, |
100 |
ExporttoServiceFinishAction exporttoServiceFinishAction) { |
|
103 |
ExporttoServiceFinishAction exporttoServiceFinishAction, int[] providerTypes) {
|
|
101 | 104 |
this.featureStore = featureStore; |
102 | 105 |
this.projection = projection; |
103 | 106 |
this.uimanager = uimanager; |
104 | 107 |
this.exporttoServiceFinishAction = exporttoServiceFinishAction; |
108 |
this.providerTypes = providerTypes; |
|
105 | 109 |
|
106 | 110 |
URL iconURL = getClass().getClassLoader().getResource("org/gvsig/exportto/swing/impl/images/exporttoicon.png"); |
107 | 111 |
ImageIcon icon = new ImageIcon(iconURL); |
108 | 112 |
wizardPanelWithLogo = new WizardPanelWithLogo(icon); |
109 | 113 |
|
110 | 114 |
//Initialize the wizards |
111 |
exporterSelectionWizard = new ExporterSelectionWizard(this); |
|
115 |
exporterSelectionWizard = new ExporterSelectionWizard(this, providerTypes);
|
|
112 | 116 |
exportFilterWizard = new ExportFilterWizard(this); |
113 | 117 |
exporttoProgressWizard = new ExporttoProgressWizard(this); |
114 | 118 |
|
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/DefaultExporttoSwingProviderManager.java | ||
---|---|---|
30 | 30 |
import org.slf4j.LoggerFactory; |
31 | 31 |
|
32 | 32 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProvider; |
33 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderFactory; |
|
33 | 34 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderManager; |
34 | 35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
35 | 36 |
import org.gvsig.tools.ToolsLocator; |
36 | 37 |
import org.gvsig.tools.dynobject.DynObject; |
38 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
|
37 | 39 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
38 | 40 |
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
39 | 41 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
... | ... | |
70 | 72 |
|
71 | 73 |
@SuppressWarnings({ "rawtypes", "unchecked" }) |
72 | 74 |
public List getProviderNames() { |
75 |
return getProviderNames(new int[0]); |
|
76 |
} |
|
77 |
|
|
78 |
@SuppressWarnings({ "rawtypes", "unchecked" }) |
|
79 |
public List getProviderNames(int[] providerTypes) { |
|
73 | 80 |
ExtensionPointManager extensionPointManager = ToolsLocator.getExtensionPointManager(); |
74 | 81 |
ExtensionPoint extensionPoint = extensionPointManager.get(this.getRegistryKey()); |
75 | 82 |
List providers = new ArrayList(); |
... | ... | |
78 | 85 |
while (it.hasNext()){ |
79 | 86 |
Extension extension = (Extension)it.next(); |
80 | 87 |
try { |
81 |
ProviderFactory providerFactory = (ProviderFactory)extension.create(); |
|
82 |
providers.add(providerFactory.getName()); |
|
88 |
ExporttoSwingProviderFactory exporttoSwingProviderFactory = (ExporttoSwingProviderFactory)extension.create(); |
|
89 |
if (providerTypes.length == 0){ |
|
90 |
providers.add(exporttoSwingProviderFactory.getName()); |
|
91 |
}else{ |
|
92 |
boolean areSupported = true; |
|
93 |
for (int i=0 ; i<providerTypes.length ; i++){ |
|
94 |
if (!exporttoSwingProviderFactory.support(providerTypes[i])){ |
|
95 |
areSupported = false; |
|
96 |
break; |
|
97 |
} |
|
98 |
} |
|
99 |
if (areSupported){ |
|
100 |
providers.add(exporttoSwingProviderFactory.getName()); |
|
101 |
} |
|
102 |
} |
|
83 | 103 |
} catch (InstantiationException e) { |
84 | 104 |
LOG.error("Not possible to create the exportto provider factory", e); |
85 | 105 |
} catch (IllegalAccessException e) { |
86 | 106 |
LOG.error("Not possible to create the exportto provider factory", e); |
107 |
} catch (ServiceException e) { |
|
108 |
LOG.error("Not possible to check if the provider support a format", e); |
|
87 | 109 |
} |
88 | 110 |
} |
89 | 111 |
} |
... | ... | |
102 | 124 |
String providerName, FeatureStore featureStore, IProjection projection) |
103 | 125 |
throws ServiceException { |
104 | 126 |
DynObject serviceParameters = createServiceParameters(providerName); |
105 |
serviceParameters.setDynValue(PARAMETER_FEATURESTORE, featureStore); |
|
106 |
serviceParameters.setDynValue(PARAMETER_PROJECTION, projection); |
|
127 |
serviceParameters.setDynValue(PARAMETER_FEATURESTORE, featureStore); |
|
128 |
try{ |
|
129 |
serviceParameters.setDynValue(PARAMETER_PROJECTION, projection); |
|
130 |
}catch(DynFieldNotFoundException e){ |
|
131 |
LOG.info("This provider doesn't accept projection", e); |
|
132 |
} |
|
107 | 133 |
Provider provider = createProvider(serviceParameters, |
108 | 134 |
new DefaultExporttoSwingProviderServices()); |
109 | 135 |
if (!(provider instanceof ExporttoSwingProvider)) { |
... | ... | |
111 | 137 |
} |
112 | 138 |
return (ExporttoSwingProvider) provider; |
113 | 139 |
} |
140 |
|
|
141 |
public boolean support(String providerName, int providerType) throws ServiceException { |
|
142 |
ExtensionPointManager epm = ToolsLocator.getExtensionPointManager(); |
|
143 |
ExtensionPoint ep = epm.get(this.getRegistryKey()); |
|
144 |
ExporttoSwingProviderFactory exporttoSwingProviderFactory = null; |
|
145 |
|
|
146 |
if (ep != null) { |
|
147 |
try { |
|
148 |
exporttoSwingProviderFactory = ((ExporttoSwingProviderFactory) ep.create(providerName)); |
|
149 |
return exporttoSwingProviderFactory.support(providerType); |
|
150 |
} catch (InstantiationException e) { |
|
151 |
LOG.error("Not possible to create the exportto provider factory", e); |
|
152 |
} catch (IllegalAccessException e) { |
|
153 |
LOG.error("Not possible to create the exportto provider factory", e); |
|
154 |
} |
|
155 |
} |
|
156 |
return false; |
|
157 |
} |
|
158 |
|
|
159 |
public void addProviderFactory(ProviderFactory providerFactory){ |
|
160 |
if (providerFactory == null) { |
|
161 |
throw new IllegalArgumentException("ProviderFactory cannot be null."); |
|
162 |
} |
|
163 |
|
|
164 |
if (!(providerFactory instanceof ExporttoSwingProviderFactory)) { |
|
165 |
throw new IllegalArgumentException(providerFactory.getName() |
|
166 |
+ " must implement the ExporttoSwingProviderFactory interface"); |
|
167 |
} |
|
168 |
super.addProviderFactory(providerFactory); |
|
169 |
} |
|
114 | 170 |
} |
115 | 171 |
|
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/DefaultExporttoSwingManager.java | ||
---|---|---|
51 | 51 |
|
52 | 52 |
public JExporttoServicePanel createExportto(FeatureStore featureStore, IProjection projection){ |
53 | 53 |
JExporttoServicePanel panel = |
54 |
new DefaultJExporttoServicePanel(this, featureStore, projection, null); |
|
54 |
new DefaultJExporttoServicePanel(this, featureStore, projection, null, new int[0]);
|
|
55 | 55 |
return panel; |
56 | 56 |
} |
57 | 57 |
|
58 | 58 |
public JExporttoServicePanel createExportto(FeatureStore featureStore, IProjection projection, |
59 | 59 |
ExporttoServiceFinishAction exporttoServiceFinishAction){ |
60 | 60 |
JExporttoServicePanel panel = |
61 |
new DefaultJExporttoServicePanel(this, featureStore, projection, exporttoServiceFinishAction); |
|
61 |
new DefaultJExporttoServicePanel(this, featureStore, projection, exporttoServiceFinishAction, new int[0]);
|
|
62 | 62 |
return panel; |
63 | 63 |
} |
64 |
|
|
65 |
public JExporttoServicePanel createExportto(FeatureStore featureStore, |
|
66 |
IProjection projection, |
|
67 |
ExporttoServiceFinishAction exporttoServiceFinishAction, |
|
68 |
int[] providerTypes) { |
|
69 |
return new DefaultJExporttoServicePanel(this, featureStore, projection, exporttoServiceFinishAction, providerTypes); |
|
70 |
} |
|
64 | 71 |
|
65 | 72 |
public ExporttoManager getManager() { |
66 | 73 |
return this.manager; |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/panel/ExporterSelectionListModel.java | ||
---|---|---|
41 | 41 |
@SuppressWarnings("rawtypes") |
42 | 42 |
private List exporters = null; |
43 | 43 |
|
44 |
public ExporterSelectionListModel() { |
|
44 |
public ExporterSelectionListModel(int[] providerTypes) {
|
|
45 | 45 |
super(); |
46 | 46 |
ExporttoSwingProviderManager exporttoProviderManager = ExporttoSwingProviderLocator.getManager(); |
47 |
exporters = exporttoProviderManager.getProviderNames(); |
|
47 |
exporters = exporttoProviderManager.getProviderNames(providerTypes);
|
|
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
public int getSize() { |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/panel/ProviderSelectionPanel.java | ||
---|---|---|
38 | 38 |
private static final long serialVersionUID = -5887438468358948411L; |
39 | 39 |
protected JList exporttoProviderList = null; |
40 | 40 |
private JScrollPane scrollPane = null; |
41 |
private int[] providerTypes; |
|
41 | 42 |
|
42 |
public ProviderSelectionPanel(DefaultJExporttoServicePanel exporttoServicePanel) { |
|
43 |
public ProviderSelectionPanel(DefaultJExporttoServicePanel exporttoServicePanel, int[] providerTypes) {
|
|
43 | 44 |
super(exporttoServicePanel); |
45 |
this.providerTypes = providerTypes; |
|
44 | 46 |
initializeComponents(); |
45 | 47 |
} |
46 | 48 |
|
... | ... | |
49 | 51 |
|
50 | 52 |
//Create the list |
51 | 53 |
exporttoProviderList = new JList(); |
52 |
exporttoProviderList.setModel(new ExporterSelectionListModel()); |
|
54 |
exporttoProviderList.setModel(new ExporterSelectionListModel(providerTypes));
|
|
53 | 55 |
|
54 | 56 |
scrollPane = new JScrollPane(); |
55 | 57 |
scrollPane.setViewportView(exporttoProviderList); |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/wizard/ExporterSelectionWizard.java | ||
---|---|---|
49 | 49 |
private static final Logger LOG = |
50 | 50 |
LoggerFactory.getLogger(ExporterSelectionWizard.class); |
51 | 51 |
|
52 |
public ExporterSelectionWizard(DefaultJExporttoServicePanel exporttoServicePanel) { |
|
53 |
super(exporttoServicePanel); |
|
52 |
public ExporterSelectionWizard(DefaultJExporttoServicePanel exporttoServicePanel, int[] providerTypes) {
|
|
53 |
super(exporttoServicePanel, providerTypes);
|
|
54 | 54 |
this.exporttoProviderList.addListSelectionListener(this); |
55 | 55 |
} |
56 | 56 |
|
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/pom.xml | ||
---|---|---|
20 | 20 |
<module>org.gvsig.exportto.swing.prov.dxf</module> |
21 | 21 |
<module>org.gvsig.exportto.swing.prov.jdbc</module> |
22 | 22 |
<module>org.gvsig.exportto.swing.prov.postgresql</module> |
23 |
<module>org.gvsig.exportto.swing.prov.mysql</module> |
|
23 |
<module>org.gvsig.exportto.swing.prov.mysql</module> |
|
24 |
<module>org.gvsig.exportto.swing.prov.dbf</module> |
|
24 | 25 |
</modules> |
25 | 26 |
<properties> |
26 | 27 |
<build-dir>${basedir}/../../../build</build-dir> |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.exportto.swing.prov.dbf</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.exportto.swing.prov.dbf</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.exportto.swing.prov</artifactId> |
|
11 |
<version>1.0.0-SNAPSHOT</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.exportto.swing.api</artifactId> |
|
17 |
<version>1.0.0-SNAPSHOT</version> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.exportto.swing.spi</artifactId> |
|
22 |
<version>1.0.0-SNAPSHOT</version> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.exportto.swing.prov.file</artifactId> |
|
27 |
<version>1.0.0-SNAPSHOT</version> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
32 |
<classifier>spi</classifier> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
43 |
<scope>runtime</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
53 |
<scope>compile</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.projection</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.ui</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.i18n</artifactId> |
|
83 |
<scope>compile</scope> |
|
84 |
</dependency> |
|
85 |
</dependencies> |
|
86 |
<properties> |
|
87 |
<build-dir>${basedir}/../../../../build</build-dir> |
|
88 |
</properties> |
|
89 |
|
|
90 |
</project> |
|
0 | 91 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.exportto.swing.prov.dbf.ExporttoDBFProviderLibrary |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFProvider.java | ||
---|---|---|
1 |
package org.gvsig.exportto.swing.prov.dbf; |
|
2 |
|
|
3 |
import org.gvsig.exportto.ExporttoService; |
|
4 |
import org.gvsig.exportto.swing.prov.dbf.panel.ExporttoDBFPanel; |
|
5 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProvider; |
|
6 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProvider; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
8 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
9 |
|
|
10 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
11 |
* |
|
12 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
13 |
* of the Valencian Government (CIT) |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
28 |
* MA 02110-1301, USA. |
|
29 |
* |
|
30 |
*/ |
|
31 |
|
|
32 |
/** |
|
33 |
* Exporto provider which gets Exporto from a file. |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class ExporttoDBFProvider extends AbstractExporttoFileProvider implements |
|
40 |
ExporttoSwingProvider { |
|
41 |
private String encoding; |
|
42 |
|
|
43 |
public ExporttoDBFProvider(ProviderServices providerServices, FeatureStore featureStore) { |
|
44 |
super(providerServices, featureStore, null, new ExporttoDBFPanel()); |
|
45 |
} |
|
46 |
|
|
47 |
public ExporttoService createExporttoService() { |
|
48 |
return new ExporttoDBFService(selectFileOptionPanel.getSelectedFile(), featureStore, |
|
49 |
((ExporttoDBFPanel)selectFileOptionPanel).getEncoding()); |
|
50 |
} |
|
51 |
} |
|
0 | 52 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.exporto package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Exportto provider that export to dbf.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
|
0 | 14 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/panel/ExporttoDBFPanel.java | ||
---|---|---|
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 |
package org.gvsig.exportto.swing.prov.dbf.panel; |
|
23 |
|
|
24 |
import javax.swing.JComboBox; |
|
25 |
import javax.swing.JLabel; |
|
26 |
|
|
27 |
import org.slf4j.Logger; |
|
28 |
import org.slf4j.LoggerFactory; |
|
29 |
|
|
30 |
import org.gvsig.exportto.swing.prov.file.panel.SelectFileOptionPanel; |
|
31 |
|
|
32 |
|
|
33 |
/** |
|
34 |
* @author gvSIG Team |
|
35 |
* @version $Id$ |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class ExporttoDBFPanel extends SelectFileOptionPanel { |
|
39 |
private static final long serialVersionUID = -2657306673271108746L; |
|
40 |
|
|
41 |
private static final Logger LOG = |
|
42 |
LoggerFactory.getLogger(ExporttoDBFPanel.class); |
|
43 |
|
|
44 |
private JLabel encodingLabel; |
|
45 |
private JComboBox encodingCombo; |
|
46 |
|
|
47 |
public ExporttoDBFPanel() { |
|
48 |
super(new EncodingPanel()); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* @return |
|
53 |
*/ |
|
54 |
public String getEncoding() { |
|
55 |
return ((EncodingPanel)this.getOptionsPanel()).getEncoding(); |
|
56 |
} |
|
57 |
} |
|
0 | 58 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/panel/EncodingPanel.java | ||
---|---|---|
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 |
package org.gvsig.exportto.swing.prov.dbf.panel; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.GridBagConstraints; |
|
26 |
import java.awt.GridBagLayout; |
|
27 |
|
|
28 |
import javax.swing.JComboBox; |
|
29 |
import javax.swing.JLabel; |
|
30 |
import javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.gvsig.i18n.Messages; |
|
33 |
import org.gvsig.metadata.MetadataLocator; |
|
34 |
import org.gvsig.metadata.MetadataManager; |
|
35 |
import org.gvsig.tools.dynobject.DynField; |
|
36 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
|
37 |
import org.gvsig.tools.dynobject.DynStruct; |
|
38 |
|
|
39 |
|
|
40 |
/** |
|
41 |
* @author gvSIG Team |
|
42 |
* @version $Id$ |
|
43 |
* |
|
44 |
*/ |
|
45 |
public class EncodingPanel extends JPanel { |
|
46 |
private JLabel encodingLabel; |
|
47 |
private JComboBox encodingCombo; |
|
48 |
|
|
49 |
public EncodingPanel() { |
|
50 |
super(); |
|
51 |
initComponents(); |
|
52 |
initEncodingCombo(); |
|
53 |
} |
|
54 |
|
|
55 |
private void initComponents() { |
|
56 |
this.setLayout(new BorderLayout()); |
|
57 |
|
|
58 |
java.awt.GridBagConstraints gridBagConstraints; |
|
59 |
|
|
60 |
JPanel northPanel = new JPanel(); |
|
61 |
encodingLabel = new JLabel(); |
|
62 |
encodingCombo = new JComboBox(); |
|
63 |
|
|
64 |
northPanel.setLayout(new GridBagLayout()); |
|
65 |
|
|
66 |
encodingLabel.setText(Messages.getText("encoding ") + ": "); |
|
67 |
gridBagConstraints = new GridBagConstraints(); |
|
68 |
gridBagConstraints.gridx = 0; |
|
69 |
gridBagConstraints.gridy = 0; |
|
70 |
northPanel.add(encodingLabel, gridBagConstraints); |
|
71 |
|
|
72 |
gridBagConstraints = new GridBagConstraints(); |
|
73 |
gridBagConstraints.gridx = 1; |
|
74 |
gridBagConstraints.gridy = 0; |
|
75 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
76 |
gridBagConstraints.weightx = 1.0; |
|
77 |
northPanel.add(encodingCombo, gridBagConstraints); |
|
78 |
|
|
79 |
add(northPanel, BorderLayout.NORTH); |
|
80 |
} |
|
81 |
|
|
82 |
private void initEncodingCombo() { |
|
83 |
MetadataManager metadataManager = MetadataLocator.getMetadataManager(); |
|
84 |
DynStruct dynStruct = metadataManager.getDefinition("DBF"); |
|
85 |
DynField dynField = dynStruct.getDynField("Encoding"); |
|
86 |
DynObjectValueItem[] dynObjectValueItem = dynField.getAvailableValues(); |
|
87 |
for (int i=0 ; i<dynObjectValueItem.length ; i++){ |
|
88 |
encodingCombo.addItem(dynObjectValueItem[i].getValue()); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* @return |
|
94 |
*/ |
|
95 |
public String getEncoding() { |
|
96 |
String encoding = (String)encodingCombo.getSelectedItem(); |
|
97 |
if ("".equals(encoding)){ |
|
98 |
return null; |
|
99 |
} |
|
100 |
return encoding; |
|
101 |
} |
|
102 |
} |
|
0 | 103 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFProviderLibrary.java | ||
---|---|---|
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 |
package org.gvsig.exportto.swing.prov.dbf; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.ExporttoSwingLibrary; |
|
25 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderLocator; |
|
26 |
import org.gvsig.tools.library.AbstractLibrary; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
import org.gvsig.tools.service.spi.ProviderManager; |
|
29 |
|
|
30 |
|
|
31 |
/** |
|
32 |
* Library to initialize and register the file Exporto provider |
|
33 |
* implementation. |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class ExporttoDBFProviderLibrary extends AbstractLibrary { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void doRegistration() { |
|
43 |
registerAsServiceOf(ExporttoSwingLibrary.class); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doInitialize() throws LibraryException { |
|
48 |
// Nothing to do |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
protected void doPostInitialize() throws LibraryException { |
|
53 |
ProviderManager providerManager = ExporttoSwingProviderLocator.getManager(); |
|
54 |
providerManager.addProviderFactory(new ExporttoDBFProviderFactory()); |
|
55 |
} |
|
56 |
} |
|
0 | 57 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFService.java | ||
---|---|---|
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 |
package org.gvsig.exportto.swing.prov.dbf; |
|
23 |
|
|
24 |
import java.io.File; |
|
25 |
|
|
26 |
import org.gvsig.exportto.ExporttoService; |
|
27 |
import org.gvsig.exportto.ExporttoServiceException; |
|
28 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileService; |
|
29 |
import org.gvsig.fmap.dal.exception.DataException; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
31 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
32 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* @author gvSIG Team |
|
37 |
* @version $Id$ |
|
38 |
* |
|
39 |
*/ |
|
40 |
public class ExporttoDBFService extends AbstractExporttoFileService implements ExporttoService { |
|
41 |
private String encoding; |
|
42 |
|
|
43 |
protected ExporttoDBFService(File dbfFile, FeatureStore featureStore, String encoding) { |
|
44 |
super(dbfFile, featureStore); |
|
45 |
this.encoding = encoding; |
|
46 |
try { |
|
47 |
this.open(); |
|
48 |
} catch (ExporttoServiceException e) { |
|
49 |
((SimpleTaskStatus)getTaskStatus()).message(e.getMessage()); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
public void addParameters( |
|
54 |
NewFeatureStoreParameters newFeatureStoreParameters) throws DataException { |
|
55 |
newFeatureStoreParameters.setDynValue("Encoding", encoding); |
|
56 |
newFeatureStoreParameters.setDefaultFeatureType(featureStore.getDefaultFeatureType().getEditable()); |
|
57 |
} |
|
58 |
|
|
59 |
public String getFileExtension() { |
|
60 |
return "dbf"; |
|
61 |
} |
|
62 |
} |
|
0 | 63 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFProviderFactory.java | ||
---|---|---|
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 |
package org.gvsig.exportto.swing.prov.dbf; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
25 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProviderFactory; |
|
26 |
import org.gvsig.fmap.dal.DataTypes; |
|
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 |
import org.gvsig.tools.ToolsLocator; |
|
29 |
import org.gvsig.tools.dynobject.DynObject; |
|
30 |
import org.gvsig.tools.service.ServiceException; |
|
31 |
import org.gvsig.tools.service.spi.Provider; |
|
32 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* Factory of file {@link ExportoProvider} objects. |
|
37 |
* |
|
38 |
* @author gvSIG Team |
|
39 |
* @version $Id$ |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class ExporttoDBFProviderFactory extends AbstractExporttoFileProviderFactory { |
|
43 |
private static final String PROVIDER_NAME = "DBF"; |
|
44 |
private static final String PROVIDER_DESCRIPTION = "Provider to Export a file to DBF"; |
|
45 |
|
|
46 |
public ExporttoDBFProviderFactory() { |
|
47 |
super(new int[]{ExporttoSwingManager.VECTORIAL_TABLE_WITHOUT_GEOMETRY}); |
|
48 |
} |
|
49 |
|
|
50 |
public Provider create(DynObject parameters, ProviderServices services) |
|
51 |
throws ServiceException { |
|
52 |
return new ExporttoDBFProvider(services, (FeatureStore)parameters.getDynValue(PARAMETER_FEATURESTORE)); |
|
53 |
} |
|
54 |
|
|
55 |
public String getName() { |
|
56 |
return PROVIDER_NAME; |
|
57 |
} |
|
58 |
|
|
59 |
public String getDescription() { |
|
60 |
return PROVIDER_DESCRIPTION; |
|
61 |
} |
|
62 |
|
|
63 |
public void initialize() { |
|
64 |
parametersDefinition = ToolsLocator.getDynObjectManager() |
|
65 |
.createDynClass(getName(), getDescription()); |
|
66 |
parametersDefinition.addDynField(PARAMETER_FEATURESTORE) |
|
67 |
.setType(DataTypes.OBJECT).setMandatory(true).setClassOfValue(FeatureStore.class); |
|
68 |
} |
|
69 |
} |
|
0 | 70 |
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/ExporttoGenericProviderFactory.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.cresques.cts.IProjection; |
25 | 25 |
|
26 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderFactory; |
|
26 | 27 |
import org.gvsig.fmap.dal.DataTypes; |
27 | 28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 29 |
import org.gvsig.tools.ToolsLocator; |
... | ... | |
30 | 31 |
import org.gvsig.tools.dynobject.DynObject; |
31 | 32 |
import org.gvsig.tools.service.ServiceException; |
32 | 33 |
import org.gvsig.tools.service.spi.Provider; |
33 |
import org.gvsig.tools.service.spi.ProviderFactory; |
|
34 | 34 |
import org.gvsig.tools.service.spi.ProviderServices; |
35 | 35 |
|
36 | 36 |
/** |
... | ... | |
39 | 39 |
* @author gvSIG Team |
40 | 40 |
* @version $Id$ |
41 | 41 |
*/ |
42 |
public class ExporttoGenericProviderFactory implements ProviderFactory { |
|
42 |
public class ExporttoGenericProviderFactory implements ExporttoSwingProviderFactory {
|
|
43 | 43 |
|
44 | 44 |
private static final String PROVIDER_NAME = "Generic"; |
45 | 45 |
private static final String PROVIDER_DESCRIPTION = "Provider to Export a file using the generic form"; |
... | ... | |
66 | 66 |
|
67 | 67 |
public void initialize() { |
68 | 68 |
parametersDefinition = ToolsLocator.getDynObjectManager() |
69 |
.createDynClass(PROVIDER_NAME, PROVIDER_DESCRIPTION);
|
|
69 |
.createDynClass(PROVIDER_NAME, PROVIDER_DESCRIPTION); |
|
70 | 70 |
parametersDefinition.addDynField(PARAMETER_FEATURESTORE) |
71 |
.setType(DataTypes.OBJECT).setMandatory(true).setClassOfValue(FeatureStore.class);
|
|
71 |
.setType(DataTypes.OBJECT).setMandatory(true).setClassOfValue(FeatureStore.class); |
|
72 | 72 |
parametersDefinition.addDynField(PARAMETER_PROJECTION) |
73 |
.setType(DataTypes.CRS).setMandatory(false);
|
|
73 |
.setType(DataTypes.CRS).setMandatory(false); |
|
74 | 74 |
} |
75 |
|
|
76 |
public boolean support(int providerType) throws ServiceException { |
|
77 |
return true; |
|
78 |
} |
|
75 | 79 |
} |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.file/src/main/java/org/gvsig/exportto/swing/prov/file/AbstractExporttoFileProvider.java | ||
---|---|---|
53 | 53 |
* to get the Exporto from |
54 | 54 |
*/ |
55 | 55 |
public AbstractExporttoFileProvider(ProviderServices providerServices, FeatureStore featureStore, IProjection projection) { |
56 |
this(providerServices, featureStore, projection, new SelectFileOptionPanel()); |
|
57 |
} |
|
58 |
|
|
59 |
public AbstractExporttoFileProvider(ProviderServices providerServices, FeatureStore featureStore, IProjection projection, SelectFileOptionPanel selectFileOptionPanel) { |
|
56 | 60 |
super(providerServices); |
57 | 61 |
this.featureStore = featureStore; |
58 | 62 |
this.projection = projection; |
59 | 63 |
|
60 |
selectFileOptionPanel = new SelectFileOptionPanel();
|
|
64 |
this.selectFileOptionPanel = selectFileOptionPanel;
|
|
61 | 65 |
} |
62 | 66 |
|
63 | 67 |
public int getPanelCount() { |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.file/src/main/java/org/gvsig/exportto/swing/prov/file/AbstractExporttoFileService.java | ||
---|---|---|
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 |
package org.gvsig.exportto.swing.prov.file; |
|
23 |
|
|
24 |
import java.io.File; |
|
25 |
|
|
26 |
import org.gvsig.exportto.ExporttoLocator; |
|
27 |
import org.gvsig.exportto.ExporttoManager; |
|
28 |
import org.gvsig.exportto.ExporttoService; |
|
29 |
import org.gvsig.exportto.ExporttoServiceException; |
|
30 |
import org.gvsig.exportto.ExporttoServiceFinishAction; |
|
31 |
import org.gvsig.fmap.dal.DALLocator; |
|
32 |
import org.gvsig.fmap.dal.DataManager; |
|
33 |
import org.gvsig.fmap.dal.exception.DataException; |
|
34 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
35 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
36 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
39 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
40 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
41 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
42 |
import org.gvsig.tools.task.TaskStatus; |
|
43 |
|
|
44 |
|
|
45 |
/** |
|
46 |
* @author gvSIG Team |
|
47 |
* @version $Id$ |
|
48 |
* |
|
49 |
*/ |
|
50 |
public abstract class AbstractExporttoFileService implements ExporttoService { |
|
51 |
protected static final ExporttoManager EXPORTTO_MANAGER = ExporttoLocator.getManager(); |
|
52 |
protected File file; |
|
53 |
protected FeatureStore featureStore; |
|
54 |
protected ExporttoService exporttoService; |
|
55 |
|
|
56 |
private NewFeatureStoreParameters newFeatureStoreParameters; |
|
57 |
private ExporttoServiceFinishAction exporttoServiceFinishAction; |
|
58 |
|
|
59 |
public AbstractExporttoFileService(File file, FeatureStore featureStore) { |
|
60 |
super(); |
|
61 |
this.featureStore = featureStore; |
|
62 |
this.file = file; |
|
63 |
} |
|
64 |
|
|
65 |
public void open() throws ExporttoServiceException{ |
|
66 |
String path = file.getAbsolutePath(); |
|
67 |
|
|
68 |
String extension = "." + getFileExtension(); |
|
69 |
|
|
70 |
if (!(path.toLowerCase().endsWith(extension))){ |
|
71 |
path = path + extension; |
|
72 |
} |
|
73 |
|
|
74 |
File newFile = new File(path); |
|
75 |
DataManager dataManager = DALLocator.getDataManager(); |
|
76 |
|
|
77 |
FilesystemServerExplorerParameters explorerParams; |
|
78 |
try { |
|
79 |
explorerParams = (FilesystemServerExplorerParameters) dataManager.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
|
80 |
} catch (InitializeException e) { |
|
81 |
throw new ExporttoServiceException(e); |
|
82 |
} catch (ProviderNotRegisteredException e) { |
|
83 |
throw new ExporttoServiceException(e); |
|
84 |
} |
|
85 |
explorerParams.setRoot(newFile.getParent()); |
|
86 |
|
|
87 |
FilesystemServerExplorer explorer; |
|
88 |
try { |
|
89 |
explorer = (FilesystemServerExplorer) dataManager.openServerExplorer("FilesystemExplorer", explorerParams); |
|
90 |
} catch (ValidateDataParametersException e) { |
|
91 |
throw new ExporttoServiceException(e); |
|
92 |
} catch (InitializeException e) { |
|
93 |
throw new ExporttoServiceException(e); |
|
94 |
} catch (ProviderNotRegisteredException e) { |
|
95 |
throw new ExporttoServiceException(e); |
|
96 |
} |
|
97 |
|
|
98 |
try { |
|
99 |
newFeatureStoreParameters = (NewFeatureStoreParameters) explorer.getAddParameters(newFile); |
|
100 |
addParameters(newFeatureStoreParameters); |
|
101 |
|
|
102 |
exporttoService = EXPORTTO_MANAGER.getExporttoService(explorer, newFeatureStoreParameters); |
|
103 |
} catch (DataException e) { |
|
104 |
throw new ExporttoServiceException(e); |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
public abstract void addParameters(NewFeatureStoreParameters newFeatureStoreParameters) throws DataException; |
|
109 |
|
|
110 |
public abstract String getFileExtension(); |
|
111 |
|
|
112 |
public void export(FeatureSet featureSet) throws ExporttoServiceException { |
|
113 |
exporttoService.export(featureSet); |
|
114 |
if (exporttoServiceFinishAction != null){ |
|
115 |
exporttoServiceFinishAction.finished(file.getName(), newFeatureStoreParameters); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
public void setFinishAction( |
|
120 |
ExporttoServiceFinishAction exporttoServiceFinishAction) { |
|
121 |
this.exporttoServiceFinishAction = exporttoServiceFinishAction; |
|
122 |
} |
|
123 |
|
|
124 |
public TaskStatus getTaskStatus() { |
|
125 |
return exporttoService.getTaskStatus(); |
|
126 |
} |
|
127 |
|
|
128 |
public boolean isCancellationRequested() { |
|
129 |
return exporttoService.isCancellationRequested(); |
|
130 |
} |
|
131 |
|
|
132 |
public void cancelRequest() { |
|
133 |
exporttoService.cancelRequest(); |
|
134 |
} |
|
135 |
} |
|
0 | 136 |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.file/src/main/java/org/gvsig/exportto/swing/prov/file/AbstractExporttoFileProviderFactory.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.exportto.swing.prov.file; |
23 | 23 |
|
24 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderFactory; |
|
24 | 25 |
import org.gvsig.fmap.dal.DataTypes; |
25 | 26 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
26 | 27 |
import org.gvsig.tools.ToolsLocator; |
27 | 28 |
import org.gvsig.tools.dynobject.DynClass; |
28 | 29 |
import org.gvsig.tools.dynobject.DynObject; |
29 |
import org.gvsig.tools.service.spi.ProviderFactory;
|
|
30 |
import org.gvsig.tools.service.ServiceException;
|
|
30 | 31 |
|
31 | 32 |
/** |
32 | 33 |
* Factory of file {@link ExportoProvider} objects. |
... | ... | |
34 | 35 |
* @author gvSIG Team |
35 | 36 |
* @version $Id$ |
36 | 37 |
*/ |
37 |
public abstract class AbstractExporttoFileProviderFactory implements ProviderFactory { |
|
38 |
public abstract class AbstractExporttoFileProviderFactory implements ExporttoSwingProviderFactory {
|
|
38 | 39 |
protected static final String PARAMETER_FEATURESTORE = "FeatureStore"; |
39 | 40 |
protected static final String PARAMETER_PROJECTION = "Projection"; |
40 | 41 |
|
41 | 42 |
protected DynClass parametersDefinition; |
42 |
|
|
43 |
|
|
44 |
private int[] providerTypes = null; |
|
45 |
|
|
46 |
public AbstractExporttoFileProviderFactory(int[] providerTypes) { |
|
47 |
super(); |
|
48 |
this.providerTypes = providerTypes; |
|
49 |
} |
|
50 |
|
|
43 | 51 |
public DynObject createParameters() { |
44 | 52 |
return ToolsLocator.getDynObjectManager().createDynObject( |
45 | 53 |
parametersDefinition); |
... | ... | |
55 | 63 |
parametersDefinition.addDynField(PARAMETER_PROJECTION) |
56 | 64 |
.setType(DataTypes.CRS).setMandatory(false); |
57 | 65 |
} |
66 |
|
|
67 |
public boolean support(int providerType) throws ServiceException { |
|
68 |
for (int i=0 ; i<providerTypes.length ; i++){ |
|
69 |
if (providerTypes[i] == providerType){ |
|
70 |
return true; |
|
71 |
} |
|
72 |
} |
|
73 |
return false; |
|
74 |
} |
|
58 | 75 |
} |
59 | 76 |
|
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.file/src/main/java/org/gvsig/exportto/swing/prov/file/panel/SelectFileOptionPanel.java | ||
---|---|---|
26 | 26 |
import java.io.File; |
27 | 27 |
|
28 | 28 |
import javax.swing.JOptionPane; |
29 |
import javax.swing.JPanel; |
|
29 | 30 |
|
30 | 31 |
import org.gvsig.exportto.swing.ExporttoSwingLocator; |
31 | 32 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
32 | 33 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
33 | 34 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
35 |
import org.gvsig.i18n.Messages; |
|
34 | 36 |
|
35 | 37 |
/** |
36 | 38 |
* @author gvSIG Team |
... | ... | |
39 | 41 |
*/ |
40 | 42 |
public class SelectFileOptionPanel extends ExporttoSwingProviderPanel{ |
41 | 43 |
private static final long serialVersionUID = -7417782279157857962L; |
42 |
|
|
44 |
private JPanel optionsPanel; |
|
45 |
|
|
43 | 46 |
private static final ExporttoSwingManager EXPORTTO_SWING_MANAGER = |
44 | 47 |
ExporttoSwingLocator.getSwingManager(); |
45 | 48 |
|
... | ... | |
49 | 52 |
* @param fileText |
50 | 53 |
*/ |
51 | 54 |
public SelectFileOptionPanel() { |
55 |
this(null); |
|
56 |
} |
|
57 |
|
|
58 |
public SelectFileOptionPanel(JPanel optionsPanel) { |
|
52 | 59 |
super(); |
53 | 60 |
this.setLayout(new BorderLayout()); |
54 | 61 |
selectFileOptionPanel = new org.gvsig.gui.beans.wizard.panel.SelectFileOptionPanel(null); |
55 | 62 |
add(selectFileOptionPanel, BorderLayout.NORTH); |
63 |
if (optionsPanel != null){ |
|
64 |
optionsPanel.setBorder( |
|
65 |
javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createTitledBorder(Messages.getText("options")), |
|
66 |
javax.swing.BorderFactory.createEmptyBorder(10, 5, 5, 5))); |
|
67 |
add(optionsPanel, BorderLayout.CENTER); |
|
68 |
this.optionsPanel = optionsPanel; |
|
69 |
} |
|
56 | 70 |
} |
57 | 71 |
|
58 | 72 |
@Override |
... | ... | |
79 | 93 |
} |
80 | 94 |
} |
81 | 95 |
return true; |
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* @return the optionsPanel |
|
100 |
*/ |
|
101 |
public JPanel getOptionsPanel() { |
|
102 |
return optionsPanel; |
|
82 | 103 |
} |
83 | 104 |
} |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.file/pom.xml | ||
---|---|---|
72 | 72 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
73 | 73 |
<scope>compile</scope> |
74 | 74 |
</dependency> |
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.i18n</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
75 | 80 |
</dependencies> |
76 | 81 |
<properties> |
77 | 82 |
<build-dir>${basedir}/../../../../build</build-dir> |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.shape/src/main/java/org/gvsig/exportto/swing/prov/shape/ExporttoShapeProviderFactory.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.cresques.cts.IProjection; |
25 | 25 |
|
26 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
26 | 27 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProviderFactory; |
27 | 28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 29 |
import org.gvsig.tools.dynobject.DynObject; |
... | ... | |
39 | 40 |
public class ExporttoShapeProviderFactory extends AbstractExporttoFileProviderFactory { |
40 | 41 |
private static final String PROVIDER_NAME = "Shape"; |
41 | 42 |
private static final String PROVIDER_DESCRIPTION = "Provider to Export a file to Shape"; |
42 |
|
|
43 |
|
|
44 |
public ExporttoShapeProviderFactory() { |
|
45 |
super(new int[]{ExporttoSwingManager.VECTORIAL_TABLE_WITH_GEOMETRY}); |
|
46 |
} |
|
47 |
|
|
43 | 48 |
public Provider create(DynObject parameters, ProviderServices services) |
44 | 49 |
throws ServiceException { |
45 | 50 |
return new ExporttoShapeProvider(services, (FeatureStore)parameters.getDynValue(PARAMETER_FEATURESTORE), |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dxf/src/main/java/org/gvsig/exportto/swing/prov/dxf/ExporttoDXFService.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import org.cresques.cts.IProjection; |
27 | 27 |
|
28 |
import org.gvsig.exportto.ExporttoLocator; |
|
29 |
import org.gvsig.exportto.ExporttoManager; |
|
30 | 28 |
import org.gvsig.exportto.ExporttoService; |
31 | 29 |
import org.gvsig.exportto.ExporttoServiceException; |
32 |
import org.gvsig.exportto.ExporttoServiceFinishAction; |
|
33 |
import org.gvsig.fmap.dal.DALLocator; |
|
34 |
import org.gvsig.fmap.dal.DataManager; |
|
35 |
import org.gvsig.fmap.dal.exception.DataException; |
|
36 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
37 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
38 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
30 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileService; |
|
40 | 31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
41 | 32 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
42 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
43 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
44 | 33 |
import org.gvsig.tools.task.SimpleTaskStatus; |
45 |
import org.gvsig.tools.task.TaskStatus; |
|
46 | 34 |
|
47 | 35 |
|
48 | 36 |
/** |
... | ... | |
50 | 38 |
* @version $Id$ |
51 | 39 |
* |
52 | 40 |
*/ |
53 |
public class ExporttoDXFService implements ExporttoService { |
|
54 |
private static final ExporttoManager EXPORTTO_MANAGER = ExporttoLocator.getManager(); |
|
55 |
private File dxfFile; |
|
41 |
public class ExporttoDXFService extends AbstractExporttoFileService implements ExporttoService { |
|
56 | 42 |
private IProjection projection; |
57 |
private FeatureStore featureStore; |
|
58 |
private ExporttoService exporttoService; |
|
59 |
|
|
60 |
private NewFeatureStoreParameters newFeatureStoreParameters; |
|
61 |
private ExporttoServiceFinishAction exporttoServiceFinishAction; |
|
43 |
|
|
44 |
private NewFeatureStoreParameters newFeatureStoreParameters; |
|
62 | 45 |
|
63 | 46 |
public ExporttoDXFService(File dxfFile, FeatureStore featureStore, IProjection projection) { |
64 |
super(); |
|
65 |
this.projection = projection; |
|
66 |
this.featureStore = featureStore; |
|
67 |
this.dxfFile = dxfFile; |
|
47 |
super(dxfFile, featureStore); |
|
48 |
this.projection = projection; |
|
68 | 49 |
try { |
69 |
this.initializeParams();
|
|
50 |
this.open();
|
|
70 | 51 |
} catch (ExporttoServiceException e) { |
71 | 52 |
((SimpleTaskStatus)getTaskStatus()).message(e.getMessage()); |
72 | 53 |
} |
73 | 54 |
} |
74 | 55 |
|
75 |
public void export(FeatureSet featureSet) throws ExporttoServiceException { |
|
76 |
exporttoService.export(featureSet); |
|
77 |
if (exporttoServiceFinishAction != null){ |
|
78 |
exporttoServiceFinishAction.finished(dxfFile.getName(), newFeatureStoreParameters); |
|
79 |
} |
|
56 |
public NewFeatureStoreParameters getNewFeatureStoreParameters() { |
|
57 |
return newFeatureStoreParameters; |
|
80 | 58 |
} |
81 | 59 |
|
82 |
private void initializeParams() throws ExporttoServiceException { |
|
83 |
String path = dxfFile.getAbsolutePath(); |
|
84 |
|
|
85 |
if (!(path.toLowerCase().endsWith(".dxf"))){ |
|
86 |
path = path + ".dxf"; |
|
87 |
} |
|
88 |
|
|
89 |
File newFile = new File(path); |
|
90 |
DataManager dataManager = DALLocator.getDataManager(); |
|
91 |
|
|
92 |
FilesystemServerExplorerParameters explorerParams; |
|
93 |
try { |
|
94 |
explorerParams = (FilesystemServerExplorerParameters) dataManager.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
|
95 |
} catch (InitializeException e) { |
|
96 |
throw new ExporttoServiceException(e); |
|
97 |
} catch (ProviderNotRegisteredException e) { |
|
98 |
throw new ExporttoServiceException(e); |
|
99 |
} |
|
100 |
explorerParams.setRoot(newFile.getParent()); |
|
101 |
|
|
102 |
FilesystemServerExplorer explorer; |
|
103 |
try { |
|
104 |
explorer = (FilesystemServerExplorer) dataManager.openServerExplorer("FilesystemExplorer", explorerParams); |
|
105 |
} catch (ValidateDataParametersException e) { |
|
106 |
throw new ExporttoServiceException(e); |
|
107 |
} catch (InitializeException e) { |
|
108 |
throw new ExporttoServiceException(e); |
|
109 |
} catch (ProviderNotRegisteredException e) { |
|
110 |
throw new ExporttoServiceException(e); |
|
111 |
} |
|
112 |
|
|
113 |
try { |
|
114 |
newFeatureStoreParameters = (NewFeatureStoreParameters) explorer.getAddParameters(newFile); |
|
115 |
newFeatureStoreParameters.setDynValue("CRS", projection); |
|
116 |
|
|
117 |
exporttoService = EXPORTTO_MANAGER.getExporttoService(explorer, newFeatureStoreParameters); |
|
118 |
} catch (DataException e) { |
|
119 |
throw new ExporttoServiceException(e); |
|
120 |
} |
|
60 |
public void addParameters( |
|
61 |
NewFeatureStoreParameters newFeatureStoreParameters) { |
|
62 |
newFeatureStoreParameters.setDynValue("CRS", projection); |
|
121 | 63 |
} |
122 | 64 |
|
123 |
public void setFinishAction( |
|
124 |
ExporttoServiceFinishAction exporttoServiceFinishAction) { |
|
125 |
this.exporttoServiceFinishAction = exporttoServiceFinishAction; |
|
126 |
} |
|
127 |
|
|
128 |
|
|
129 |
public TaskStatus getTaskStatus() { |
|
130 |
return exporttoService.getTaskStatus(); |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
public boolean isCancellationRequested() { |
|
135 |
return exporttoService.isCancellationRequested(); |
|
136 |
} |
|
137 |
|
|
138 |
|
|
139 |
public void cancelRequest() { |
|
140 |
exporttoService.cancelRequest(); |
|
141 |
} |
|
65 |
public String getFileExtension() { |
|
66 |
return "dxf"; |
|
67 |
} |
|
142 | 68 |
} |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dxf/src/main/java/org/gvsig/exportto/swing/prov/dxf/ExporttoDXFProviderFactory.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.cresques.cts.IProjection; |
25 | 25 |
|
26 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
26 | 27 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProviderFactory; |
27 | 28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 29 |
import org.gvsig.tools.dynobject.DynObject; |
... | ... | |
39 | 40 |
public class ExporttoDXFProviderFactory extends AbstractExporttoFileProviderFactory { |
40 | 41 |
private static final String PROVIDER_NAME = "DXF"; |
41 | 42 |
private static final String PROVIDER_DESCRIPTION = "Provider to Export a file to DXF"; |
43 |
|
|
44 |
public ExporttoDXFProviderFactory() { |
|
45 |
super(new int[]{ExporttoSwingManager.VECTORIAL_TABLE_WITH_GEOMETRY}); |
|
46 |
} |
|
42 | 47 |
|
43 | 48 |
public Provider create(DynObject parameters, ProviderServices services) |
44 | 49 |
throws ServiceException { |
... | ... | |
52 | 57 |
|
53 | 58 |
public String getDescription() { |
54 | 59 |
return PROVIDER_DESCRIPTION; |
55 |
} |
|
60 |
} |
|
61 |
|
|
56 | 62 |
} |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.postgresql/src/main/java/org/gvsig/exportto/swing/prov/postgresql/ExporttoPostgreSQLProviderFactory.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.cresques.cts.IProjection; |
25 | 25 |
|
26 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
26 | 27 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProviderFactory; |
27 | 28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 29 |
import org.gvsig.tools.dynobject.DynObject; |
... | ... | |
40 | 41 |
private static final String PROVIDER_NAME = "PostgreSQL"; |
41 | 42 |
private static final String PROVIDER_DESCRIPTION = "Provider to Export to PostgreSQL"; |
42 | 43 |
|
44 |
public ExporttoPostgreSQLProviderFactory() { |
|
45 |
super(new int[]{ExporttoSwingManager.VECTORIAL_TABLE_WITHOUT_GEOMETRY, |
|
46 |
ExporttoSwingManager.VECTORIAL_TABLE_WITH_GEOMETRY}); |
|
47 |
} |
|
48 |
|
|
43 | 49 |
public Provider create(DynObject parameters, ProviderServices services) |
44 | 50 |
throws ServiceException { |
45 | 51 |
return new ExporttoPostgreSQLProvider(services, (FeatureStore)parameters.getDynValue(PARAMETER_FEATURESTORE), |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.mysql/src/main/java/org/gvsig/exportto/swing/prov/mysql/ExporttoMySQLProviderFactory.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import org.cresques.cts.IProjection; |
25 | 25 |
|
26 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
26 | 27 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProviderFactory; |
27 | 28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
28 | 29 |
import org.gvsig.tools.dynobject.DynObject; |
... | ... | |
39 | 40 |
public class ExporttoMySQLProviderFactory extends AbstractExporttoFileProviderFactory { |
40 | 41 |
private static final String PROVIDER_NAME = "MySQL"; |
41 | 42 |
private static final String PROVIDER_DESCRIPTION = "Provider to Export to MySQL"; |
42 |
|
|
43 |
|
|
44 |
public ExporttoMySQLProviderFactory() { |
|
45 |
super(new int[]{ExporttoSwingManager.VECTORIAL_TABLE_WITHOUT_GEOMETRY, |
|
46 |
ExporttoSwingManager.VECTORIAL_TABLE_WITH_GEOMETRY}); |
|
47 |
} |
|
48 |
|
|
43 | 49 |
public Provider create(DynObject parameters, ProviderServices services) |
44 | 50 |
throws ServiceException { |
45 | 51 |
return new ExporttoMySQLProvider(services, (FeatureStore)parameters.getDynValue(PARAMETER_FEATURESTORE), |
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.api/src/main/java/org/gvsig/exportto/swing/ExporttoSwingManager.java | ||
---|---|---|
39 | 39 |
* @version $Id$ |
40 | 40 |
*/ |
41 | 41 |
public interface ExporttoSwingManager { |
42 |
|
|
42 |
public static final int VECTORIAL_TABLE_WITH_GEOMETRY = 0; |
|
43 |
public static final int VECTORIAL_TABLE_WITHOUT_GEOMETRY = 1; |
|
44 |
|
|
45 |
|
|
43 | 46 |
/** |
44 | 47 |
* Returns the panel associated to a {@link ExporttoService}. |
45 | 48 |
* @param featureStore |
... | ... | |
68 | 71 |
*/ |
69 | 72 |
public JExporttoServicePanel createExportto(FeatureStore featureStore, |
70 | 73 |
IProjection projection, ExporttoServiceFinishAction exporttoServiceFinishAction); |
74 |
|
Also available in: Unified diff