Revision 41608
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/test/java/org/gvsig/exportto/impl/DefaultExporttoManagerTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto.impl; |
|
25 |
|
|
26 |
import org.gvsig.exportto.ExporttoManager; |
|
27 |
import org.gvsig.exportto.ExporttoManagerTest; |
|
28 |
|
|
29 |
/** |
|
30 |
* {@link ExporttoManager} API compatibility tests for the |
|
31 |
* {@link DefaultExporttoManager} implementation. |
|
32 |
* |
|
33 |
* @author gvSIG Team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class DefaultExporttoManagerTest extends ExporttoManagerTest { |
|
37 |
|
|
38 |
// Nothing to add |
|
39 |
} |
|
0 | 40 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your test classes. |
|
2 |
|
|
3 |
This folder is added to the Tests classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your tests classes. |
|
0 | 9 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig.tools"> |
|
48 |
<priority value="DEBUG" /> |
|
49 |
</category> |
|
50 |
<category name="org.gvsig.exportto"> |
|
51 |
<priority value="DEBUG" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
|
0 | 63 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
29 |
<head> |
|
30 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
31 |
<title>org.gvsig.exportto package documentation</title> |
|
32 |
</head> |
|
33 |
<body> |
|
34 |
|
|
35 |
<p>Exportto library API default implementation.</p> |
|
36 |
|
|
37 |
</body> |
|
38 |
</html> |
|
0 | 39 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/ExporttoDefaultImplLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto.impl; |
|
25 |
|
|
26 |
import org.gvsig.exportto.ExporttoLibrary; |
|
27 |
import org.gvsig.exportto.ExporttoLocator; |
|
28 |
import org.gvsig.tools.library.AbstractLibrary; |
|
29 |
import org.gvsig.tools.library.LibraryException; |
|
30 |
|
|
31 |
/** |
|
32 |
* Library for default implementation initialization and configuration. |
|
33 |
* |
|
34 |
* @author gvSIG team |
|
35 |
* @version $Id$ |
|
36 |
*/ |
|
37 |
public class ExporttoDefaultImplLibrary extends AbstractLibrary { |
|
38 |
|
|
39 |
@Override |
|
40 |
public void doRegistration() { |
|
41 |
registerAsImplementationOf(ExporttoLibrary.class); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
protected void doInitialize() throws LibraryException { |
|
46 |
ExporttoLocator.registerManager(DefaultExporttoManager.class); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
protected void doPostInitialize() throws LibraryException { |
|
51 |
// Do nothing |
|
52 |
} |
|
53 |
|
|
54 |
} |
|
0 | 55 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/DefaultExporttoManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.exportto.impl; |
|
24 |
|
|
25 |
import java.io.File; |
|
26 |
import java.io.FileInputStream; |
|
27 |
import java.io.FileOutputStream; |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import java.io.OutputStream; |
|
31 |
import java.util.HashMap; |
|
32 |
import java.util.Iterator; |
|
33 |
import java.util.Map; |
|
34 |
import java.util.Properties; |
|
35 |
import java.util.logging.Level; |
|
36 |
|
|
37 |
import org.slf4j.Logger; |
|
38 |
import org.slf4j.LoggerFactory; |
|
39 |
|
|
40 |
import org.gvsig.exportto.ExporttoManager; |
|
41 |
import org.gvsig.exportto.ExporttoService; |
|
42 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
43 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
44 |
|
|
45 |
/** |
|
46 |
* Default {@link ExporttoManager} implementation. |
|
47 |
* |
|
48 |
* @author gvSIG Team |
|
49 |
* @version $Id$ |
|
50 |
*/ |
|
51 |
public class DefaultExporttoManager implements ExporttoManager { |
|
52 |
|
|
53 |
private static final Logger LOG = LoggerFactory |
|
54 |
.getLogger(DefaultExporttoManager.class); |
|
55 |
|
|
56 |
private Map<String, String> filters = null; |
|
57 |
private File homeFolder = null; |
|
58 |
|
|
59 |
public DefaultExporttoManager() { |
|
60 |
super(); |
|
61 |
filters = new HashMap<String, String>(); |
|
62 |
} |
|
63 |
|
|
64 |
public ExporttoService getExporttoService( |
|
65 |
DataServerExplorer dataServerExplorer, |
|
66 |
NewDataStoreParameters newDataStoreParameters) { |
|
67 |
return new DefaultExporttoService(dataServerExplorer, |
|
68 |
newDataStoreParameters); |
|
69 |
} |
|
70 |
|
|
71 |
public Iterator getPredefinedFilters() { |
|
72 |
if (this.filters == null) { |
|
73 |
if (this.homeFolder != null) { |
|
74 |
Properties properties = new Properties(); |
|
75 |
File filtersFile = new File(this.homeFolder, "filters"); |
|
76 |
if (filtersFile.exists()) { |
|
77 |
try { |
|
78 |
properties.load(new FileInputStream(filtersFile)); |
|
79 |
Iterator it = properties.keySet().iterator(); |
|
80 |
while (it.hasNext()) { |
|
81 |
String key = (String) it.next(); |
|
82 |
filters.put(key, (String) properties.get(key)); |
|
83 |
} |
|
84 |
} catch (IOException ex) { |
|
85 |
LOG.warn("Can't load filters file '" + filtersFile.getAbsolutePath() + "'.", ex); |
|
86 |
} |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
return filters.keySet().iterator(); |
|
91 |
} |
|
92 |
|
|
93 |
public String getFilter(String filterName) { |
|
94 |
if (filters.containsKey(filterName)) { |
|
95 |
return (String) filters.get(filterName); |
|
96 |
} |
|
97 |
return null; |
|
98 |
} |
|
99 |
|
|
100 |
public void addFilter(String name, String filter) { |
|
101 |
this.filters.put(name, filter); |
|
102 |
if (this.homeFolder != null) { |
|
103 |
Properties properties = new Properties(); |
|
104 |
Iterator<Map.Entry<String, String>> it = this.filters.entrySet().iterator(); |
|
105 |
while (it.hasNext()) { |
|
106 |
Map.Entry<String, String> entry = it.next(); |
|
107 |
properties.setProperty(entry.getKey(), entry.getValue()); |
|
108 |
} |
|
109 |
File filtersFile = new File(this.homeFolder, "filters"); |
|
110 |
try { |
|
111 |
properties.store(new FileOutputStream(filtersFile), ""); |
|
112 |
} catch (IOException ex) { |
|
113 |
LOG.warn("Can't load filters file '" + filtersFile.getAbsolutePath() + "'.", ex); |
|
114 |
} |
|
115 |
} |
|
116 |
} |
|
117 |
|
|
118 |
public void setHomeFolder(File homeFolder) { |
|
119 |
this.homeFolder = homeFolder; |
|
120 |
} |
|
121 |
|
|
122 |
} |
|
0 | 123 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/DefaultExporttoService.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto.impl; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
|
|
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.DataServerExplorer; |
|
34 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
35 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
36 |
import org.gvsig.fmap.dal.feature.Feature; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
40 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
41 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
42 |
import org.gvsig.tools.task.AbstractMonitorableTask; |
|
43 |
|
|
44 |
/** |
|
45 |
* Default {@link ExporttoService} implementation. |
|
46 |
* |
|
47 |
* @author gvSIG Team |
|
48 |
* @version $Id$ |
|
49 |
*/ |
|
50 |
public class DefaultExporttoService extends AbstractMonitorableTask implements |
|
51 |
ExporttoService { |
|
52 |
|
|
53 |
private DataServerExplorer dataServerExplorer; |
|
54 |
private NewDataStoreParameters newDataStoreParameters; |
|
55 |
|
|
56 |
private ExporttoServiceFinishAction exporttoServiceFinishAction; |
|
57 |
|
|
58 |
/** |
|
59 |
* {@link DefaultExporttoService} constructor |
|
60 |
*/ |
|
61 |
public DefaultExporttoService(DataServerExplorer dataServerExplorer, |
|
62 |
NewDataStoreParameters newDataStoreParameters) { |
|
63 |
super("Exportto"); |
|
64 |
this.dataServerExplorer = dataServerExplorer; |
|
65 |
this.newDataStoreParameters = newDataStoreParameters; |
|
66 |
} |
|
67 |
|
|
68 |
public void export(FeatureStore featureStore, IProjection projection, |
|
69 |
FeatureSet featureSet) throws ExporttoServiceException { |
|
70 |
// TODO Auto-generated method stub |
|
71 |
|
|
72 |
} |
|
73 |
|
|
74 |
public void export(FeatureSet featureSet) throws ExporttoServiceException { |
|
75 |
|
|
76 |
String providerName = newDataStoreParameters.getDataStoreName(); |
|
77 |
String explorerName = dataServerExplorer.getProviderName(); |
|
78 |
|
|
79 |
DisposableIterator it = null; |
|
80 |
FeatureStore target = null; |
|
81 |
EditableFeature newfeature = null; |
|
82 |
try { |
|
83 |
taskStatus.setRangeOfValues(0, featureSet.getSize()); |
|
84 |
|
|
85 |
DataManager dataManager = DALLocator.getDataManager(); |
|
86 |
|
|
87 |
dataManager.newStore(explorerName, providerName, |
|
88 |
newDataStoreParameters, true); |
|
89 |
target = |
|
90 |
(FeatureStore) dataManager.openStore(providerName, |
|
91 |
newDataStoreParameters); |
|
92 |
|
|
93 |
FeatureType targetType = target.getDefaultFeatureType(); |
|
94 |
|
|
95 |
target.edit(FeatureStore.MODE_APPEND); |
|
96 |
it = featureSet.fastIterator(); |
|
97 |
|
|
98 |
long featureCount = 0; |
|
99 |
while (it.hasNext()) { |
|
100 |
Feature feature = (Feature) it.next(); |
|
101 |
newfeature = target.createNewFeature(targetType, feature); |
|
102 |
target.insert(newfeature); |
|
103 |
|
|
104 |
featureCount++; |
|
105 |
this.taskStatus.setCurValue(featureCount); |
|
106 |
|
|
107 |
if (this.taskStatus.isCancellationRequested()) { |
|
108 |
return; |
|
109 |
} |
|
110 |
} |
|
111 |
target.finishEditing(); |
|
112 |
|
|
113 |
this.taskStatus.terminate(); |
|
114 |
this.taskStatus.remove(); |
|
115 |
} catch (Exception e) { |
|
116 |
throw new ExporttoServiceException(e, newfeature); |
|
117 |
} finally { |
|
118 |
if (target != null) { |
|
119 |
target.dispose(); |
|
120 |
} |
|
121 |
if (it != null) { |
|
122 |
it.dispose(); |
|
123 |
} |
|
124 |
if (featureSet != null) { |
|
125 |
featureSet.dispose(); |
|
126 |
} |
|
127 |
DisposeUtils.dispose(it); |
|
128 |
} |
|
129 |
|
|
130 |
if (exporttoServiceFinishAction != null) { |
|
131 |
exporttoServiceFinishAction.finished( |
|
132 |
newDataStoreParameters.getDataStoreName(), |
|
133 |
newDataStoreParameters); |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
137 |
public void setFinishAction( |
|
138 |
ExporttoServiceFinishAction exporttoServiceFinishAction) { |
|
139 |
this.exporttoServiceFinishAction = exporttoServiceFinishAction; |
|
140 |
} |
|
141 |
|
|
142 |
} |
|
0 | 143 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/resources/org/gvsig/exportto/lib/impl/exporttofilters.properties | ||
---|---|---|
1 |
#point_geometries_only= |
|
2 |
#curve_geometries_only= |
|
3 |
#surface_geometries_only= |
|
4 |
prov_demo=PROV < '10' |
|
0 | 5 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.exportto.impl.ExporttoDefaultImplLibrary |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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.lib.impl</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.exportto.lib</artifactId> |
|
11 |
<version>2.0.49</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.exportto.lib.api</artifactId> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
</dependencies> |
|
39 |
|
|
40 |
<build> |
|
41 |
<plugins> |
|
42 |
<plugin> |
|
43 |
<!-- Skip test execution --> |
|
44 |
<groupId>org.apache.maven.plugins</groupId> |
|
45 |
<artifactId>maven-surefire-plugin</artifactId> |
|
46 |
<configuration> |
|
47 |
<skipTests>true</skipTests> |
|
48 |
</configuration> |
|
49 |
</plugin> |
|
50 |
|
|
51 |
<plugin> |
|
52 |
<!-- Skip compilation tests --> |
|
53 |
<groupId>org.apache.maven.plugins</groupId> |
|
54 |
<artifactId>maven-compiler-plugin</artifactId> |
|
55 |
<executions> |
|
56 |
<execution> |
|
57 |
<id>default-testCompile</id> |
|
58 |
<phase>process-test-sources</phase> |
|
59 |
<goals> |
|
60 |
<goal>testCompile</goal> |
|
61 |
</goals> |
|
62 |
<configuration> |
|
63 |
<skip>true</skip> |
|
64 |
</configuration> |
|
65 |
</execution> |
|
66 |
</executions> |
|
67 |
</plugin> |
|
68 |
|
|
69 |
</plugins> |
|
70 |
</build> |
|
71 |
</project> |
|
72 |
|
|
0 | 73 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.exportto.lib.api</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.exportto.lib</artifactId> |
|
10 |
<version>2.0.49</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
</dependencies> |
|
29 |
</project> |
|
30 |
|
|
0 | 31 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/test/java/org/gvsig/exportto/ExporttoServiceTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.DALLocator; |
|
27 |
import org.gvsig.fmap.dal.DataManager; |
|
28 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
29 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
30 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
31 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
32 |
import org.gvsig.fmap.dal.exception.DataException; |
|
33 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
34 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
35 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
36 |
|
|
37 |
/** |
|
38 |
* API compatibility tests for {@link ExporttoService} implementations. |
|
39 |
* |
|
40 |
* @author gvSIG Team |
|
41 |
* @version $Id$ |
|
42 |
*/ |
|
43 |
public abstract class ExporttoServiceTest extends |
|
44 |
AbstractLibraryAutoInitTestCase { |
|
45 |
|
|
46 |
protected ExporttoManager manager; |
|
47 |
protected DataManager dataManager = null; |
|
48 |
|
|
49 |
@Override |
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
manager = ExporttoLocator.getManager(); |
|
52 |
dataManager = DALLocator.getDataManager(); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* Returns an instance of the {@link ExporttoService}. |
|
57 |
* |
|
58 |
* @return a {@link ExporttoService} instance |
|
59 |
* @throws ValidateDataParametersException |
|
60 |
* @throws DataException |
|
61 |
* @throws Exception |
|
62 |
* if there is any error creating the instance |
|
63 |
*/ |
|
64 |
protected ExporttoService createService() |
|
65 |
throws ValidateDataParametersException, DataException { |
|
66 |
DataServerExplorerParameters dataServerExplorerParameters = |
|
67 |
dataManager.createServerExplorerParameters("FilesystemExplorer"); |
|
68 |
DataServerExplorer dataServerExplorer = |
|
69 |
dataManager.openServerExplorer("FilesystemExplorer", |
|
70 |
dataServerExplorerParameters); |
|
71 |
NewDataStoreParameters newDataStoreParameters = |
|
72 |
dataServerExplorer.getAddParameters("Shape"); |
|
73 |
return manager.getExporttoService(dataServerExplorer, |
|
74 |
newDataStoreParameters); |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* Test for the |
|
79 |
* {@link ExporttoService#export(org.gvsig.fmap.dal.feature.FeatureSet)} |
|
80 |
* method. |
|
81 |
*/ |
|
82 |
public void testExporttoServiceCreation() { |
|
83 |
ExporttoService exportService; |
|
84 |
try { |
|
85 |
exportService = createService(); |
|
86 |
assertNotNull(exportService); |
|
87 |
// TODO a test for the export service |
|
88 |
// exportService.export(featureSet); |
|
89 |
|
|
90 |
} catch (ValidateDataParametersException e) { |
|
91 |
assertNull(e); |
|
92 |
} catch (DataException e) { |
|
93 |
assertNull(e); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
@SuppressWarnings("unused") |
|
98 |
private FeatureStore createMemoryFeatureStore() |
|
99 |
throws ValidateDataParametersException, DataException { |
|
100 |
DataStoreParameters memoryParameters = |
|
101 |
dataManager.createStoreParameters("Memory"); |
|
102 |
FeatureStore featureStore = |
|
103 |
(FeatureStore) dataManager.openStore("Memory", memoryParameters); |
|
104 |
return (FeatureStore) featureStore.getFeatureSet(); |
|
105 |
} |
|
106 |
} |
|
0 | 107 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/test/java/org/gvsig/exportto/ExporttoManagerTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.DALLocator; |
|
27 |
import org.gvsig.fmap.dal.DataManager; |
|
28 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
29 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
30 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
31 |
import org.gvsig.fmap.dal.exception.DataException; |
|
32 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
|
|
35 |
/** |
|
36 |
* API compatibility tests for {@link ExporttoManager} implementations. |
|
37 |
* |
|
38 |
* @author gvSIG Team |
|
39 |
* @version $Id$ |
|
40 |
*/ |
|
41 |
public abstract class ExporttoManagerTest extends |
|
42 |
AbstractLibraryAutoInitTestCase { |
|
43 |
|
|
44 |
protected ExporttoManager manager; |
|
45 |
protected DataManager dataManager = null; |
|
46 |
|
|
47 |
@Override |
|
48 |
protected void doSetUp() throws Exception { |
|
49 |
manager = ExporttoLocator.getManager(); |
|
50 |
dataManager = DALLocator.getDataManager(); |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* Test for the {@link ExporttoManager#getExporttoService()} method. |
|
55 |
* |
|
56 |
* @throws Exception |
|
57 |
* if there is any error in the tests |
|
58 |
*/ |
|
59 |
public void testGetExporttoService() throws Exception { |
|
60 |
ExporttoService exportService; |
|
61 |
try { |
|
62 |
exportService = createService(); |
|
63 |
assertNotNull(exportService); |
|
64 |
} catch (ValidateDataParametersException e) { |
|
65 |
assertNull(e); |
|
66 |
} catch (DataException e) { |
|
67 |
assertNull(e); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
protected ExporttoService createService() |
|
72 |
throws ValidateDataParametersException, DataException { |
|
73 |
DataServerExplorerParameters dataServerExplorerParameters = |
|
74 |
dataManager.createServerExplorerParameters("FilesystemExplorer"); |
|
75 |
DataServerExplorer dataServerExplorer = |
|
76 |
dataManager.openServerExplorer("FilesystemExplorer", |
|
77 |
dataServerExplorerParameters); |
|
78 |
NewDataStoreParameters newDataStoreParameters = |
|
79 |
dataServerExplorer.getAddParameters("Shape"); |
|
80 |
return manager.getExporttoService(dataServerExplorer, |
|
81 |
newDataStoreParameters); |
|
82 |
} |
|
83 |
|
|
84 |
} |
|
0 | 85 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.tools.exception.BaseException; |
|
27 |
|
|
28 |
/** |
|
29 |
* Generic exception thrown in the Exportto API when the exception or error |
|
30 |
* may be dealt by the program or the user of the program which is a client of |
|
31 |
* the Exportto API. |
|
32 |
* |
|
33 |
* @see {@link ExporttoService} |
|
34 |
* @see {@link ExporttoManager} |
|
35 |
* @author gvSIG team. |
|
36 |
* @version $Id$ |
|
37 |
*/ |
|
38 |
public class ExporttoException extends BaseException { |
|
39 |
|
|
40 |
private static final long serialVersionUID = 6756475060924237176L; |
|
41 |
|
|
42 |
private static final String MESSAGE = |
|
43 |
"An error has been produced in the Exportto library"; |
|
44 |
|
|
45 |
private static final String KEY = "_ExporttoException"; |
|
46 |
|
|
47 |
/** |
|
48 |
* Constructor to be used in rare cases, usually you must create a new child |
|
49 |
* exception class for each case. |
|
50 |
* <strong>Don't use this constructor in child classes.</strong> |
|
51 |
*/ |
|
52 |
public ExporttoException() { |
|
53 |
super(MESSAGE, KEY, serialVersionUID); |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Constructor to be used in rare cases, usually you must create a new child |
|
58 |
* exception class for each case. |
|
59 |
* <p> |
|
60 |
* <strong>Don't use this constructor in child classes.</strong> |
|
61 |
* </p> |
|
62 |
* |
|
63 |
* @param cause |
|
64 |
* the original cause of the exception |
|
65 |
*/ |
|
66 |
public ExporttoException(Exception cause) { |
|
67 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* @see BaseException#BaseException(String, String, long). |
|
72 |
* @param message |
|
73 |
* the default messageFormat to describe the exception |
|
74 |
* @param key |
|
75 |
* the key to use to search a localized messageFormnata |
|
76 |
* @param code |
|
77 |
* the unique code to identify the exception |
|
78 |
*/ |
|
79 |
protected ExporttoException(String message, String key, long code) { |
|
80 |
super(message, key, code); |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* @see BaseException#BaseException(String, Throwable, String, long). |
|
85 |
* @param message |
|
86 |
* the default messageFormat to describe the exception |
|
87 |
* @param cause |
|
88 |
* the original cause of the exception |
|
89 |
* @param key |
|
90 |
* the key to use to search a localized messageFormnata |
|
91 |
* @param code |
|
92 |
* the unique code to identify the exception |
|
93 |
*/ |
|
94 |
protected ExporttoException(String message, Throwable cause, String key, |
|
95 |
long code) { |
|
96 |
super(message, cause, key, code); |
|
97 |
} |
|
98 |
} |
|
0 | 99 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoServiceException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.feature.Feature; |
|
27 |
import org.gvsig.tools.service.ServiceException; |
|
28 |
|
|
29 |
/** |
|
30 |
* Exception thrown when there is an error getting a Exportto message. |
|
31 |
* |
|
32 |
* @author gvSIG team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public class ExporttoServiceException extends ServiceException { |
|
36 |
|
|
37 |
private static final long serialVersionUID = -7423501876634702709L; |
|
38 |
|
|
39 |
private static final String MESSAGE = |
|
40 |
"An error has been produced exporting a store"; |
|
41 |
|
|
42 |
private static final String KEY = "_ExporttoServiceException"; |
|
43 |
protected Feature feature = null; |
|
44 |
|
|
45 |
/** |
|
46 |
* Creates a new {@link ExporttoServiceException}. |
|
47 |
* |
|
48 |
* @param cause |
|
49 |
* the original cause |
|
50 |
*/ |
|
51 |
public ExporttoServiceException(Throwable cause) { |
|
52 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
53 |
} |
|
54 |
|
|
55 |
protected ExporttoServiceException(String message, Throwable cause, String key, long code) { |
|
56 |
super(message, cause, key, code); |
|
57 |
} |
|
58 |
|
|
59 |
public ExporttoServiceException(Throwable cause, Feature feature) { |
|
60 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
61 |
this.feature = feature; |
|
62 |
} |
|
63 |
|
|
64 |
public ExporttoServiceException(String message, Throwable cause) { |
|
65 |
super(message, cause, KEY, serialVersionUID); |
|
66 |
} |
|
67 |
|
|
68 |
public Feature getFeature() { |
|
69 |
return this.feature; |
|
70 |
} |
|
71 |
} |
|
0 | 72 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoServiceFinishAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 |
|
|
29 |
/** |
|
30 |
* Action that can be executed at the end of the export process. |
|
31 |
* An example of action can be load the destination {@link FeatureStore} like a |
|
32 |
* layer in a view. |
|
33 |
* |
|
34 |
* @author gvSIG Team |
|
35 |
* @version $Id$ |
|
36 |
* |
|
37 |
*/ |
|
38 |
public interface ExporttoServiceFinishAction { |
|
39 |
|
|
40 |
/** |
|
41 |
* This method is called at the end of an export process. |
|
42 |
* |
|
43 |
* @param layerName |
|
44 |
* name of the new layer that can be added to gvSIG. |
|
45 |
* @param dataStoreParameters |
|
46 |
* the parameters that can be used to create the exported store. |
|
47 |
*/ |
|
48 |
public void finished(String layerName, |
|
49 |
DataStoreParameters dataStoreParameters); |
|
50 |
} |
|
0 | 51 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoService.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 |
import org.gvsig.tools.task.MonitorableTask; |
|
29 |
|
|
30 |
/** |
|
31 |
* <p> |
|
32 |
* This service is used to export a source {@link FeatureStore} to a target |
|
33 |
* {@link FeatureStore}. |
|
34 |
* </p> |
|
35 |
* <p> |
|
36 |
* It inherits if {@link MonitorableTask}, and it means that the export process |
|
37 |
* can be monitorized by one or more observers that can listen all the export |
|
38 |
* events. |
|
39 |
* <p> |
|
40 |
* |
|
41 |
* @author gvSIG team |
|
42 |
* @version $Id$ |
|
43 |
*/ |
|
44 |
public interface ExporttoService extends MonitorableTask { |
|
45 |
|
|
46 |
/** |
|
47 |
* This method export a {@link FeatureSet} to other {@link FeatureSet}. |
|
48 |
* The other necessary parameters to make this conversion are specific |
|
49 |
* for every {@link ExporttoService}. e.g: a shape exporter needs a |
|
50 |
* file and a projection, a database exporter needs a connection |
|
51 |
* parameters... |
|
52 |
* |
|
53 |
* @param featureSet |
|
54 |
* the set of features hat have to be exported. |
|
55 |
* @throws ExporttoServiceException |
|
56 |
* if there is any exception in the exporting process |
|
57 |
*/ |
|
58 |
public void export(FeatureSet featureSet) throws ExporttoServiceException; |
|
59 |
|
|
60 |
/** |
|
61 |
* Sets the {@link ExporttoServiceFinishAction} that is used at the end |
|
62 |
* of the {@link ExporttoService}. |
|
63 |
* |
|
64 |
* @param exporttoServiceFinishAction |
|
65 |
* it contains an action that can be executed at the end of the |
|
66 |
* export process |
|
67 |
* |
|
68 |
*/ |
|
69 |
public void setFinishAction( |
|
70 |
ExporttoServiceFinishAction exporttoServiceFinishAction); |
|
71 |
|
|
72 |
} |
|
0 | 73 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoLocator.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.tools.locator.BaseLocator; |
|
27 |
import org.gvsig.tools.locator.Locator; |
|
28 |
import org.gvsig.tools.locator.LocatorException; |
|
29 |
|
|
30 |
/** |
|
31 |
* This locator is the entry point for the Exportto library, providing |
|
32 |
* access to all Exportto services through the {@link ExporttoManager} . |
|
33 |
* |
|
34 |
* @author gvSIG team |
|
35 |
* @version $Id$ |
|
36 |
*/ |
|
37 |
public class ExporttoLocator extends BaseLocator { |
|
38 |
|
|
39 |
/** |
|
40 |
* Exportto manager name. |
|
41 |
*/ |
|
42 |
public static final String MANAGER_NAME = "Exportto.manager"; |
|
43 |
|
|
44 |
/** |
|
45 |
* Exportto manager description. |
|
46 |
*/ |
|
47 |
public static final String MANAGER_DESCRIPTION = "Exportto Manager"; |
|
48 |
|
|
49 |
private static final String LOCATOR_NAME = "Exportto.locator"; |
|
50 |
|
|
51 |
/** |
|
52 |
* Unique instance. |
|
53 |
*/ |
|
54 |
private static final ExporttoLocator INSTANCE = new ExporttoLocator(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Return the singleton instance. |
|
58 |
* |
|
59 |
* @return the singleton instance |
|
60 |
*/ |
|
61 |
public static ExporttoLocator getInstance() { |
|
62 |
return INSTANCE; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Return the Locator's name. |
|
67 |
* |
|
68 |
* @return a String with the Locator's name |
|
69 |
*/ |
|
70 |
public final String getLocatorName() { |
|
71 |
return LOCATOR_NAME; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Return a reference to the ExporttoManager. |
|
76 |
* |
|
77 |
* @return a reference to the ExporttoManager |
|
78 |
* @throws LocatorException |
|
79 |
* if there is no access to the class or the class cannot be |
|
80 |
* instantiated |
|
81 |
* @see Locator#get(String) |
|
82 |
*/ |
|
83 |
public static ExporttoManager getManager() throws LocatorException { |
|
84 |
return (ExporttoManager) getInstance().get(MANAGER_NAME); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Registers the Class implementing the ExporttoManager interface. |
|
89 |
* |
|
90 |
* @param clazz |
|
91 |
* implementing the ExporttoManager interface |
|
92 |
*/ |
|
93 |
public static void registerManager(Class<? extends ExporttoManager> clazz) { |
|
94 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
95 |
} |
|
96 |
|
|
97 |
} |
|
0 | 98 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.exportto; |
|
25 |
|
|
26 |
import org.gvsig.tools.library.AbstractLibrary; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Library for API initialization and configuration. |
|
32 |
* |
|
33 |
* @author gvSIG team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class ExporttoLibrary extends AbstractLibrary { |
|
37 |
|
|
38 |
@Override |
|
39 |
public void doRegistration() { |
|
40 |
registerAsAPI(ExporttoLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void doInitialize() throws LibraryException { |
|
45 |
// Do nothing |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doPostInitialize() throws LibraryException { |
|
50 |
// Validate there is any implementation registered. |
|
51 |
ExporttoManager manager = ExporttoLocator.getManager(); |
|
52 |
if (manager == null) { |
|
53 |
throw new ReferenceNotRegisteredException( |
|
54 |
ExporttoLocator.MANAGER_NAME, ExporttoLocator.getInstance()); |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
} |
|
0 | 59 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
29 |
<head> |
|
30 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
31 |
<title>org.gvsig.exportto package documentation</title> |
|
32 |
</head> |
|
33 |
<body> |
|
34 |
|
|
35 |
<p>Exportto library API.</p> |
|
36 |
|
|
37 |
<p> |
|
38 |
It allows to get new Exportto and get their text. |
|
39 |
</p> |
|
40 |
|
|
41 |
</body> |
|
42 |
</html> |
|
0 | 43 |
tags/org.gvsig.desktop-2.0.49/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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 |
Also available in: Unified diff