Revision 38016

View differences:

tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/README.txt
1
The first time you checkout the current project to a new workspace, 
2
you have to prepare it to be able to work easily with maven from
3
eclipse itself.
4

  
5
Perform the following steps:
6

  
7
1.- Launch the *prepare-workspace.xml* ant build file. 
8
    You can do it by loading the file into the ant view, 
9
    and running the default task, or right-clicking the 
10
    file from the package explorer or the navigator and
11
    select the option: *Run as > Ant build*. 
12
    
13
2.- Restart eclipse.
14

  
15
3.- Import the subprojects of the project you have just checked out.
16

  
17
Those steps are only needed once per workspace.     
18

  
0 19

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.main/src/main/resources/README.txt
1
Put into this folder the resources needed by your classes.
2

  
3
This folder is added to the 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 classes.
0 9

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.main/src/main/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.exportto">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.main/src/main/java/org/gvsig/exportto/main/Main.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.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26
import java.awt.event.ActionEvent;
27

  
28
import javax.swing.AbstractAction;
29
import javax.swing.Action;
30
import javax.swing.JButton;
31
import javax.swing.JFrame;
32
import javax.swing.JMenu;
33
import javax.swing.JMenuBar;
34
import javax.swing.JMenuItem;
35
import javax.swing.JToolBar;
36
import javax.swing.WindowConstants;
37

  
38
import org.slf4j.Logger;
39
import org.slf4j.LoggerFactory;
40

  
41
import org.gvsig.exportto.ExporttoLocator;
42
import org.gvsig.exportto.ExporttoManager;
43
import org.gvsig.exportto.swing.ExporttoSwingLocator;
44
import org.gvsig.exportto.swing.ExporttoSwingManager;
45
import org.gvsig.exportto.swing.ExporttoWindowManager;
46
import org.gvsig.exportto.swing.JExporttoServicePanel;
47
import org.gvsig.exportto.swing.preferences.ExporttoSwingPreferencesComponent;
48
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderLocator;
49
import org.gvsig.fmap.crs.CRSFactory;
50
import org.gvsig.fmap.dal.DALLocator;
51
import org.gvsig.fmap.dal.DataManager;
52
import org.gvsig.fmap.dal.DataStoreParameters;
53
import org.gvsig.fmap.dal.exception.InitializeException;
54
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
55
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
56
import org.gvsig.fmap.dal.feature.FeatureStore;
57
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
58

  
59
/**
60
 * Main executable class for testing the Exportto library.
61
 * 
62
 * @author gvSIG Team
63
 * @version $Id$
64
 */
65
public class Main {
66

  
67
    private static final Logger LOG = LoggerFactory.getLogger(Main.class);
68

  
69
    private ExporttoManager manager;
70
    private ExporttoSwingManager swingManager;
71
    private DataManager dataManager;
72

  
73
    public static void main(String args[]) {
74
        new DefaultLibrariesInitializer().fullInitialize();
75
        Main main = new Main();
76
        main.show();
77
    }
78

  
79
    @SuppressWarnings("serial")
80
    public void show() {
81
        manager = ExporttoLocator.getManager();
82
        swingManager = ExporttoSwingLocator.getSwingManager();
83
        dataManager = DALLocator.getDataManager();
84

  
85
        Action showCookie = new AbstractAction("Get a Exportto") {
86

  
87
            public void actionPerformed(ActionEvent e) {
88
                showExportto(manager);
89
            }
90
        };
91

  
92
        Action preferences = new AbstractAction("Exportto preferences") {
93

  
94
            public void actionPerformed(ActionEvent e) {
95
                showExporttoPreferences();
96
            }
97

  
98
        };
99

  
100
        Action exit = new AbstractAction("Exit") {
101

  
102
            public void actionPerformed(ActionEvent e) {
103
                System.exit(0);
104
            }
105
        };
106

  
107
        JFrame frame = new JFrame("Exportto example app");
108
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
109

  
110
        // Create the menu bar.
111
        JMenuBar menuBar = new JMenuBar();
112

  
113
        // Build the menu.
114
        JMenu menuFile = new JMenu("File");
115
        menuFile.add(new JMenuItem(showCookie));
116
        menuFile.add(new JMenuItem(preferences));
117
        menuFile.add(new JMenuItem(exit));
118

  
119
        menuBar.add(menuFile);
120

  
121
        JToolBar toolBar = new JToolBar();
122
        toolBar.add(new JButton(showCookie));
123
        toolBar.add(new JButton(exit));
124

  
125
        frame.setPreferredSize(new Dimension(200, 100));
126
        frame.setJMenuBar(menuBar);
127
        frame.add(toolBar, BorderLayout.PAGE_START);
128

  
129
        // Display the window.
130
        frame.pack();
131
        frame.setVisible(true);
132
    }
133

  
134
    private void showExporttoPreferences() {
135
        ExporttoSwingPreferencesComponent preferences =
136
            ExporttoSwingProviderLocator.getManager()
137
                .createExporttoSwingProvidersPreferences();
138

  
139
        JFrame preferencesFrame = new JFrame("Export to preferences");
140
        preferencesFrame.add(preferences.asJComponent());
141

  
142
        preferencesFrame.pack();
143
        preferencesFrame.setVisible(true);
144
    }
145

  
146
    public void showExportto(ExporttoManager manager) {
147
        try {
148
            JExporttoServicePanel panel =
149
                swingManager.createExportto(createFeatureStore(),
150
                    CRSFactory.getCRS("EPSG:23030"));
151
            panel.setPreferredSize(new Dimension(800, 400));
152
            swingManager.getWindowManager().showWindow(panel, "Exportto",
153
                ExporttoWindowManager.MODE_WINDOW);
154
        } catch (ValidateDataParametersException e) {
155
            LOG.error("Error showing a Exportto", e);
156
        } catch (InitializeException e) {
157
            LOG.error("Error showing a Exportto", e);
158
        } catch (ProviderNotRegisteredException e) {
159
            LOG.error("Error showing a Exportto", e);
160
        }
161
    }
162

  
163
    private FeatureStore createFeatureStore() throws InitializeException,
164
        ProviderNotRegisteredException, ValidateDataParametersException {
165
        String sourceFileName =
166
            getClass().getClassLoader()
167
                .getResource("org/gvsig/exportto/data/andalucia.shp").getFile();
168
        DataStoreParameters sourceParameters =
169
            dataManager.createStoreParameters("Shape");
170
        sourceParameters.setDynValue("shpfile", sourceFileName);
171
        sourceParameters.setDynValue("crs", CRSFactory.getCRS("EPSG:23030"));
172
        return (FeatureStore) dataManager.openStore("Shape", sourceParameters);
173
    }
174
}
0 175

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.main/src/main/java/org/gvsig/exportto/main/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.exportto package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Exportto library testing and demo application.</p>
11

  
12
</body>
13
</html>
0 14

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.main/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.main</artifactId>
6
    <packaging>jar</packaging>
7
    <name>org.gvsig.exportto.main</name>
8
    <parent>
9
        <groupId>org.gvsig</groupId>
10
        <artifactId>org.gvsig.exportto</artifactId>
11
        <version>1.0.0-SNAPSHOT</version>
12
    </parent>
13
    <dependencies>
14
        <dependency>
15
            <groupId>org.gvsig</groupId>
16
            <artifactId>org.gvsig.exportto.lib.api</artifactId>
17
            <version>1.0.0-SNAPSHOT</version>
18
        </dependency>
19
        <dependency>
20
            <groupId>org.gvsig</groupId>
21
            <artifactId>org.gvsig.exportto.lib.impl</artifactId>
22
            <version>1.0.0-SNAPSHOT</version>
23
            <scope>runtime</scope>
24
        </dependency>
25
        <dependency>
26
            <groupId>org.gvsig</groupId>
27
            <artifactId>org.gvsig.exportto.swing.api</artifactId>
28
            <version>1.0.0-SNAPSHOT</version>
29
        </dependency>
30
        <dependency>
31
            <groupId>org.gvsig</groupId>
32
            <artifactId>org.gvsig.exportto.swing.spi</artifactId>
33
            <version>1.0.0-SNAPSHOT</version>
34
        </dependency>
35
        <dependency>
36
            <groupId>org.gvsig</groupId>
37
            <artifactId>org.gvsig.exportto.swing.impl</artifactId>
38
            <version>1.0.0-SNAPSHOT</version>
39
            <scope>runtime</scope>
40
        </dependency>
41
        <dependency>
42
            <groupId>org.gvsig</groupId>
43
            <artifactId>org.gvsig.exportto.swing.prov.generic</artifactId>
44
            <version>1.0.0-SNAPSHOT</version>
45
            <scope>runtime</scope>
46
        </dependency>
47
        <dependency>
48
            <groupId>org.gvsig</groupId>
49
            <artifactId>org.gvsig.exportto.swing.prov.shape</artifactId>
50
            <version>1.0.0-SNAPSHOT</version>
51
            <scope>runtime</scope>
52
        </dependency>
53
        <dependency>
54
            <groupId>org.gvsig</groupId>
55
            <artifactId>org.gvsig.exportto.swing.prov.dxf</artifactId>
56
            <version>1.0.0-SNAPSHOT</version>
57
            <scope>runtime</scope>
58
        </dependency>
59
        <dependency>
60
            <groupId>org.gvsig</groupId>
61
            <artifactId>org.gvsig.exportto.swing.prov.dbf</artifactId>
62
            <version>1.0.0-SNAPSHOT</version>
63
            <scope>runtime</scope>
64
        </dependency>
65
        <dependency>
66
            <groupId>org.gvsig</groupId>
67
            <artifactId>org.gvsig.exportto.swing.prov.postgresql</artifactId>
68
            <version>1.0.0-SNAPSHOT</version>
69
            <scope>runtime</scope>
70
        </dependency>
71
        <dependency>
72
            <groupId>org.gvsig</groupId>
73
            <artifactId>org.gvsig.exportto.swing.prov.mysql</artifactId>
74
            <version>1.0.0-SNAPSHOT</version>
75
            <scope>runtime</scope>
76
        </dependency>
77
        <dependency>
78
            <groupId>org.gvsig</groupId>
79
            <artifactId>org.gvsig.tools.lib</artifactId>
80
            <scope>compile</scope>
81
        </dependency>
82
        <dependency>
83
            <groupId>org.gvsig</groupId>
84
            <artifactId>org.gvsig.projection</artifactId>
85
            <scope>compile</scope>
86
        </dependency>
87
        <dependency>
88
            <groupId>org.gvsig</groupId>
89
            <artifactId>org.gvsig.fmap.dal</artifactId>
90
            <scope>compile</scope>
91
        </dependency>
92
        <dependency>
93
            <groupId>org.gvsig</groupId>
94
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
95
            <classifier>store.shp</classifier>
96
            <scope>runtime</scope>
97
        </dependency>
98
        <dependency>
99
            <groupId>org.gvsig</groupId>
100
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
101
            <classifier>store.dxf</classifier>
102
            <scope>runtime</scope>
103
        </dependency>
104
        <dependency>
105
            <groupId>org.gvsig</groupId>
106
            <artifactId>org.gvsig.fmap.dal.db</artifactId>
107
            <classifier>store.postgresql</classifier>
108
            <scope>runtime</scope>
109
        </dependency>
110
        <dependency>
111
            <groupId>org.gvsig</groupId>
112
            <artifactId>org.gvsig.fmap.mapcontext</artifactId>
113
            <scope>runtime</scope>
114
        </dependency>
115
        <dependency>
116
            <groupId>org.gvsig</groupId>
117
            <artifactId>org.gvsig.fmap.dal.db</artifactId>
118
            <classifier>store.mysql</classifier>
119
            <scope>runtime</scope>
120
        </dependency>
121
        <dependency>
122
            <groupId>org.gvsig</groupId>
123
            <artifactId>org.gvsig.tools.swing.api</artifactId>
124
            <scope>compile</scope>
125
        </dependency>
126
        <dependency>
127
            <groupId>org.gvsig</groupId>
128
            <artifactId>org.gvsig.tools.swing.serv.field</artifactId>
129
            <scope>compile</scope>
130
        </dependency>
131
        <dependency>
132
            <groupId>org.gvsig</groupId>
133
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
134
            <scope>compile</scope>
135
        </dependency>
136
        <dependency>
137
            <groupId>org.gvsig</groupId>
138
            <artifactId>org.gvsig.i18n</artifactId>
139
            <scope>runtime</scope>
140
        </dependency>
141
    </dependencies>
142
</project>
0 143

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/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
4
		 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5

  
6
	<modelVersion>4.0.0</modelVersion>
7
	<artifactId>org.gvsig.exportto.lib</artifactId>
8
	<packaging>pom</packaging>
9
	<name>org.gvsig.exportto.lib</name>
10
	<parent>
11
		<groupId>org.gvsig</groupId>
12
		<artifactId>org.gvsig.exportto</artifactId>
13
		<version>1.0.0-SNAPSHOT</version>
14
	</parent>
15

  
16
	<modules>
17
		<module>org.gvsig.exportto.lib.api</module>
18
		<module>org.gvsig.exportto.lib.impl</module>
19
	</modules>
20
</project>
0 21

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/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.lib.impl</artifactId>
6
	<packaging>jar</packaging>
7
	<name>org.gvsig.exportto.lib.impl</name>
8
	<parent>
9
		<groupId>org.gvsig</groupId>
10
		<artifactId>org.gvsig.exportto.lib</artifactId>
11
		<version>1.0.0-SNAPSHOT</version>
12
	</parent>
13
	<dependencies>
14
		<dependency>
15
			<groupId>org.gvsig</groupId>
16
			<artifactId>org.gvsig.exportto.lib.api</artifactId>
17
			<version>1.0.0-SNAPSHOT</version>
18
		</dependency>
19
		<dependency>
20
			<groupId>org.gvsig</groupId>
21
			<artifactId>org.gvsig.exportto.lib.api</artifactId>
22
			<version>1.0.0-SNAPSHOT</version>
23
			<type>test-jar</type>
24
			<scope>test</scope>
25
		</dependency>
26
		<dependency>
27
            <groupId>org.gvsig</groupId>
28
            <artifactId>org.gvsig.tools.lib</artifactId>
29
            <scope>compile</scope>
30
        </dependency>
31
        <dependency>
32
            <groupId>org.gvsig</groupId>
33
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
34
            <scope>compile</scope>
35
        </dependency>
36
        <dependency>
37
            <groupId>org.gvsig</groupId>
38
            <artifactId>org.gvsig.fmap.dal</artifactId>    
39
            <scope>compile</scope>        
40
        </dependency>
41
        <dependency>
42
            <groupId>org.gvsig</groupId>
43
            <artifactId>org.gvsig.projection</artifactId>
44
            <scope>compile</scope>
45
        </dependency>
46
        <dependency>
47
            <groupId>org.gvsig</groupId>
48
            <artifactId>org.gvsig.projection</artifactId>  
49
            <classifier>cresques-impl</classifier>
50
            <scope>runtime</scope>      
51
        </dependency>   
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.fmap.geometry</artifactId>            
55
            <classifier>impl</classifier>
56
            <scope>runtime</scope>      
57
        </dependency>
58
        <dependency>
59
            <groupId>org.gvsig</groupId>
60
            <artifactId>org.gvsig.fmap.geometry</artifactId>
61
            <classifier>operation</classifier>      
62
            <scope>runtime</scope>
63
        </dependency>  
64
        <dependency>
65
            <groupId>org.gvsig</groupId>
66
            <artifactId>org.gvsig.fmap.dal</artifactId>         
67
            <classifier>impl</classifier>
68
            <scope>runtime</scope>
69
        </dependency> 
70
         <dependency>
71
            <groupId>org.gvsig</groupId>
72
            <artifactId>org.gvsig.fmap.dal.file</artifactId>           
73
            <scope>test</scope>
74
        </dependency>  
75
         <dependency>
76
            <groupId>org.gvsig</groupId>
77
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
78
            <classifier>store.dbf</classifier>
79
            <scope>test</scope>
80
        </dependency>  
81
        <dependency>
82
            <groupId>org.gvsig</groupId>
83
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
84
            <classifier>store.dbf</classifier>
85
            <scope>test</scope>
86
        </dependency>  
87
         <dependency>
88
            <groupId>org.gvsig</groupId>
89
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
90
            <classifier>store.shp</classifier>
91
            <scope>test</scope>
92
        </dependency>  
93
         <dependency>
94
            <groupId>org.gvsig</groupId>
95
            <artifactId>org.gvsig.symbology.lib.impl</artifactId>           
96
            <scope>test</scope>
97
        </dependency>           
98
        <dependency>
99
            <groupId>org.gvsig</groupId>
100
            <artifactId>org.gvsig.fmap.dal</artifactId>
101
            <classifier>spi</classifier>
102
            <scope>runtime</scope>      
103
        </dependency> 
104
        <dependency>
105
            <groupId>org.gvsig</groupId>
106
            <artifactId>org.gvsig.compat</artifactId>           
107
            <classifier>se</classifier>     
108
            <scope>runtime</scope>      
109
        </dependency>   
110
	</dependencies>
111
	<build>
112
		<plugins>
113
			<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
114
			<plugin>
115
				<groupId>org.apache.maven.plugins</groupId>
116
				<artifactId>maven-surefire-plugin</artifactId>
117
				<configuration>
118
                    <excludes>
119
                        <exclude>**/**</exclude>
120
                    </excludes>
121
				</configuration>
122
			</plugin>		
123
		</plugins>
124
	</build>
125
</project>
0 126

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/test/java/org/gvsig/exportto/impl/DefaultExporttoManagerTest.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.impl;
23

  
24
import org.gvsig.exportto.ExporttoManager;
25
import org.gvsig.exportto.ExporttoManagerTest;
26

  
27
/**
28
 * {@link ExporttoManager} API compatibility tests for the
29
 * {@link DefaultExporttoManager} implementation.
30
 * 
31
 * @author gvSIG Team
32
 * @version $Id$
33
 */
34
public class DefaultExporttoManagerTest extends ExporttoManagerTest {
35

  
36
    // Nothing to add
37
}
0 38

  
tags/v2_0_0_Build_2045/libraries/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/v2_0_0_Build_2045/libraries/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
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.exportto">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
tags/v2_0_0_Build_2045/libraries/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
<!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.exportto package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Exportto library API default implementation.</p>
11

  
12
</body>
13
</html>
0 14

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/ExporttoDefaultImplLibrary.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.impl;
23

  
24
import org.gvsig.exportto.ExporttoLibrary;
25
import org.gvsig.exportto.ExporttoLocator;
26
import org.gvsig.tools.library.AbstractLibrary;
27
import org.gvsig.tools.library.LibraryException;
28

  
29
/**
30
 * Library for default implementation initialization and configuration.
31
 * 
32
 * @author gvSIG team
33
 * @version $Id$
34
 */
35
public class ExporttoDefaultImplLibrary extends AbstractLibrary {
36

  
37
    @Override
38
    public void doRegistration() {
39
        registerAsImplementationOf(ExporttoLibrary.class);
40
    }
41

  
42
    @Override
43
    protected void doInitialize() throws LibraryException {
44
        ExporttoLocator.registerManager(DefaultExporttoManager.class);
45
    }
46

  
47
    @Override
48
    protected void doPostInitialize() throws LibraryException {
49
        // Do nothing
50
    }
51

  
52
}
0 53

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/DefaultExporttoManager.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.impl;
23

  
24
import java.io.File;
25
import java.io.FileInputStream;
26
import java.io.FileOutputStream;
27
import java.io.IOException;
28
import java.io.InputStream;
29
import java.io.OutputStream;
30
import java.util.HashMap;
31
import java.util.Iterator;
32
import java.util.Map;
33
import java.util.Properties;
34

  
35
import org.slf4j.Logger;
36
import org.slf4j.LoggerFactory;
37

  
38
import org.gvsig.exportto.ExporttoManager;
39
import org.gvsig.exportto.ExporttoService;
40
import org.gvsig.fmap.dal.DataServerExplorer;
41
import org.gvsig.fmap.dal.NewDataStoreParameters;
42

  
43
/**
44
 * Default {@link ExporttoManager} implementation.
45
 * 
46
 * @author gvSIG Team
47
 * @version $Id$
48
 */
49
public class DefaultExporttoManager implements ExporttoManager {
50

  
51
    private static final Logger LOG = LoggerFactory
52
        .getLogger(DefaultExporttoManager.class);
53

  
54
    @SuppressWarnings("rawtypes")
55
    private Map filters = null;
56
    private static final String EXPORTTOFILTERS_FILENAME =
57
        "exporttofilters.properties";
58
    private static final String GVSIGPREFERENCES_FOLDERNAME = "gvSIG";
59

  
60
    @SuppressWarnings("rawtypes")
61
    public DefaultExporttoManager() {
62
        super();
63
        filters = new HashMap();
64
        try {
65
            initializeFilters();
66
        } catch (IOException e) {
67
            LOG.error("Error reading the exporttofilters.properties file");
68
        }
69
    }
70

  
71
    @SuppressWarnings({ "rawtypes", "unchecked" })
72
    private void initializeFilters() throws IOException {
73
        String path = System.getProperty("user.home");
74
        path = path + File.separatorChar + GVSIGPREFERENCES_FOLDERNAME;
75
        File directory = new File(path);
76
        if (!directory.exists()) {
77
            directory.mkdirs();
78
        }
79
        path = path + File.separatorChar + EXPORTTOFILTERS_FILENAME;
80
        File exporttoFiltersFile = new File(path);
81
        if (!exporttoFiltersFile.exists()) {
82
            File templateFile =
83
                new File(
84
                    getClass()
85
                        .getClassLoader()
86
                        .getResource(
87
                            "org/gvsig/exportto/lib/impl/exporttofilters.properties")
88
                        .getFile());
89
            if (!templateFile.exists()) {
90
                return;
91
            }
92
            copy(templateFile, exporttoFiltersFile);
93
        }
94
        Properties properties = new Properties();
95
        properties.load(new FileInputStream(exporttoFiltersFile));
96
        Iterator it = properties.keySet().iterator();
97
        while (it.hasNext()) {
98
            String key = (String) it.next();
99
            filters.put(key, properties.get(key));
100
        }
101
    }
102

  
103
    private void copy(File sourceLocation, File targetLocation)
104
        throws IOException {
105
        if (sourceLocation.isDirectory()) {
106
            if (!targetLocation.exists()) {
107
                targetLocation.mkdir();
108
            }
109

  
110
            String[] children = sourceLocation.list();
111
            for (int i = 0; i < children.length; i++) {
112
                copy(new File(sourceLocation, children[i]), new File(
113
                    targetLocation, children[i]));
114
            }
115
        } else {
116
            targetLocation.getParentFile().mkdirs();
117

  
118
            InputStream in = new FileInputStream(sourceLocation);
119
            OutputStream out = new FileOutputStream(targetLocation);
120

  
121
            // Copy the bits from instream to outstream
122
            byte[] buf = new byte[1024];
123
            int len;
124
            while ((len = in.read(buf)) > 0) {
125
                out.write(buf, 0, len);
126
            }
127
            in.close();
128
            out.close();
129
        }
130
    }
131

  
132
    public ExporttoService getExporttoService(
133
        DataServerExplorer dataServerExplorer,
134
        NewDataStoreParameters newDataStoreParameters) {
135
        return new DefaultExporttoService(dataServerExplorer,
136
            newDataStoreParameters);
137
    }
138

  
139
    @SuppressWarnings("rawtypes")
140
    public Iterator getPredefinedFilters() {
141
        return filters.keySet().iterator();
142
    }
143

  
144
    public String getFilter(String filterName) {
145
        if (filters.containsKey(filterName)) {
146
            return (String) filters.get(filterName);
147
        }
148
        return null;
149
    }
150

  
151
}
0 152

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/exportto/impl/DefaultExporttoService.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.impl;
23

  
24
import org.cresques.cts.IProjection;
25

  
26
import org.gvsig.exportto.ExporttoService;
27
import org.gvsig.exportto.ExporttoServiceException;
28
import org.gvsig.exportto.ExporttoServiceFinishAction;
29
import org.gvsig.fmap.dal.DALLocator;
30
import org.gvsig.fmap.dal.DataManager;
31
import org.gvsig.fmap.dal.DataServerExplorer;
32
import org.gvsig.fmap.dal.NewDataStoreParameters;
33
import org.gvsig.fmap.dal.feature.Feature;
34
import org.gvsig.fmap.dal.feature.FeatureSet;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36
import org.gvsig.fmap.dal.feature.FeatureType;
37
import org.gvsig.tools.dispose.DisposableIterator;
38
import org.gvsig.tools.dispose.DisposeUtils;
39
import org.gvsig.tools.task.AbstractMonitorableTask;
40

  
41
/**
42
 * Default {@link ExporttoService} implementation.
43
 * 
44
 * @author gvSIG Team
45
 * @version $Id$
46
 */
47
public class DefaultExporttoService extends AbstractMonitorableTask implements
48
    ExporttoService {
49

  
50
    private DataServerExplorer dataServerExplorer;
51
    private NewDataStoreParameters newDataStoreParameters;
52

  
53
    private ExporttoServiceFinishAction exporttoServiceFinishAction;
54

  
55
    /**
56
     * {@link DefaultExporttoService} constructor
57
     */
58
    public DefaultExporttoService(DataServerExplorer dataServerExplorer,
59
        NewDataStoreParameters newDataStoreParameters) {
60
        super("Exportto");
61
        this.dataServerExplorer = dataServerExplorer;
62
        this.newDataStoreParameters = newDataStoreParameters;
63
    }
64

  
65
    public void export(FeatureStore featureStore, IProjection projection,
66
        FeatureSet featureSet) throws ExporttoServiceException {
67
        // TODO Auto-generated method stub
68

  
69
    }
70

  
71
    public void export(FeatureSet featureSet) throws ExporttoServiceException {
72

  
73
        String providerName = newDataStoreParameters.getDataStoreName();
74
        String explorerName = dataServerExplorer.getProviderName();
75

  
76
        DisposableIterator it = null;
77
        FeatureStore target = null;
78
        try {
79
            taskStatus.setRangeOfValues(0, featureSet.getSize());
80

  
81
            DataManager dataManager = DALLocator.getDataManager();
82

  
83
            dataManager.newStore(explorerName, providerName,
84
                newDataStoreParameters, true);
85
            target =
86
                (FeatureStore) dataManager.openStore(providerName,
87
                    newDataStoreParameters);
88

  
89
            FeatureType targetType = target.getDefaultFeatureType();
90

  
91
            target.edit(FeatureStore.MODE_APPEND);
92
            it = featureSet.fastIterator();
93

  
94
            long featureCount = 0;
95
            while (it.hasNext()) {
96
                Feature feature = (Feature) it.next();
97
                target.insert(target.createNewFeature(targetType, feature));
98

  
99
                featureCount++;
100
                this.taskStatus.setCurValue(featureCount);
101

  
102
                if (this.taskStatus.isCancellationRequested()) {
103
                    return;
104
                }
105
            }
106
            target.finishEditing();
107

  
108
            this.taskStatus.terminate();
109
            this.taskStatus.remove();
110
        } catch (Exception e) {
111
            throw new ExporttoServiceException(e);
112
        } finally {
113
            if (target != null) {
114
                target.dispose();
115
            }
116
            if (it != null) {
117
                it.dispose();
118
            }
119
            if (featureSet != null) {
120
                featureSet.dispose();
121
            }
122
            DisposeUtils.dispose(it);
123
        }
124

  
125
        if (exporttoServiceFinishAction != null) {
126
            exporttoServiceFinishAction.finished(
127
                newDataStoreParameters.getDataStoreName(),
128
                newDataStoreParameters);
129
        }
130
    }
131

  
132
    public void setFinishAction(
133
        ExporttoServiceFinishAction exporttoServiceFinishAction) {
134
        this.exporttoServiceFinishAction = exporttoServiceFinishAction;
135
    }
136

  
137
}
0 138

  
tags/v2_0_0_Build_2045/libraries/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/v2_0_0_Build_2045/libraries/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/v2_0_0_Build_2045/libraries/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"
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.lib.api</artifactId>
6
	<packaging>jar</packaging>
7
	<name>org.gvsig.exportto.lib.api</name>
8
	<parent>
9
		<groupId>org.gvsig</groupId>
10
		<artifactId>org.gvsig.exportto.lib</artifactId>
11
		<version>1.0.0-SNAPSHOT</version>
12
	</parent>
13
    <dependencies>
14
        <dependency>
15
            <groupId>org.gvsig</groupId>
16
            <artifactId>org.gvsig.tools.lib</artifactId>
17
            <scope>compile</scope>
18
        </dependency>
19
        <dependency>
20
            <groupId>org.gvsig</groupId>
21
            <artifactId>org.gvsig.fmap.dal</artifactId>    
22
            <scope>compile</scope>        
23
        </dependency>
24
        <dependency>
25
            <groupId>org.gvsig</groupId>
26
            <artifactId>org.gvsig.projection</artifactId>
27
            <scope>compile</scope>
28
        </dependency>
29
    </dependencies>  
30
	<build>
31
		<plugins>
32
			<plugin>
33
				<groupId>org.apache.maven.plugins</groupId>
34
				<artifactId>maven-jar-plugin</artifactId>
35
				<configuration>
36
				</configuration>
37
				<executions>
38
				<!--
39
				Generates a jar file only with the test classes
40
				-->
41
					<execution>
42
						<goals>
43
							<goal>test-jar</goal>
44
						</goals>
45
					</execution>
46
				</executions>
47
			</plugin>
48
		</plugins>
49
	</build>
50
</project>
0 51

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/test/java/org/gvsig/exportto/ExporttoServiceTest.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;
23

  
24
import org.gvsig.fmap.dal.DALLocator;
25
import org.gvsig.fmap.dal.DataManager;
26
import org.gvsig.fmap.dal.DataServerExplorer;
27
import org.gvsig.fmap.dal.DataServerExplorerParameters;
28
import org.gvsig.fmap.dal.DataStoreParameters;
29
import org.gvsig.fmap.dal.NewDataStoreParameters;
30
import org.gvsig.fmap.dal.exception.DataException;
31
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
32
import org.gvsig.fmap.dal.feature.FeatureStore;
33
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
34

  
35
/**
36
 * API compatibility tests for {@link ExporttoService} implementations.
37
 * 
38
 * @author gvSIG Team
39
 * @version $Id$
40
 */
41
public abstract class ExporttoServiceTest 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
     * Returns an instance of the {@link ExporttoService}.
55
     * 
56
     * @return a {@link ExporttoService} instance
57
     * @throws ValidateDataParametersException
58
     * @throws DataException
59
     * @throws Exception
60
     *             if there is any error creating the instance
61
     */
62
    protected ExporttoService createService()
63
        throws ValidateDataParametersException, DataException {
64
        DataServerExplorerParameters dataServerExplorerParameters =
65
            dataManager.createServerExplorerParameters("FilesystemExplorer");
66
        DataServerExplorer dataServerExplorer =
67
            dataManager.openServerExplorer("FilesystemExplorer",
68
                dataServerExplorerParameters);
69
        NewDataStoreParameters newDataStoreParameters =
70
            dataServerExplorer.getAddParameters("Shape");
71
        return manager.getExporttoService(dataServerExplorer,
72
            newDataStoreParameters);
73
    }
74

  
75
    /**
76
     * Test for the
77
     * {@link ExporttoService#export(org.gvsig.fmap.dal.feature.FeatureSet)}
78
     * method.
79
     */
80
    public void testExporttoServiceCreation() {
81
        ExporttoService exportService;
82
        try {
83
            exportService = createService();
84
            assertNotNull(exportService);
85
            // TODO a test for the export service
86
            // exportService.export(featureSet);
87

  
88
        } catch (ValidateDataParametersException e) {
89
            assertNull(e);
90
        } catch (DataException e) {
91
            assertNull(e);
92
        }
93
    }
94

  
95
    @SuppressWarnings("unused")
96
    private FeatureStore createMemoryFeatureStore()
97
        throws ValidateDataParametersException, DataException {
98
        DataStoreParameters memoryParameters =
99
            dataManager.createStoreParameters("Memory");
100
        FeatureStore featureStore =
101
            (FeatureStore) dataManager.openStore("Memory", memoryParameters);
102
        return (FeatureStore) featureStore.getFeatureSet();
103
    }
104
}
0 105

  
tags/v2_0_0_Build_2045/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/test/java/org/gvsig/exportto/ExporttoManagerTest.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;
23

  
24
import org.gvsig.fmap.dal.DALLocator;
25
import org.gvsig.fmap.dal.DataManager;
26
import org.gvsig.fmap.dal.DataServerExplorer;
27
import org.gvsig.fmap.dal.DataServerExplorerParameters;
28
import org.gvsig.fmap.dal.NewDataStoreParameters;
29
import org.gvsig.fmap.dal.exception.DataException;
30
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
31
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
32

  
33
/**
34
 * API compatibility tests for {@link ExporttoManager} implementations.
35
 * 
36
 * @author gvSIG Team
37
 * @version $Id$
38
 */
39
public abstract class ExporttoManagerTest extends
40
    AbstractLibraryAutoInitTestCase {
41

  
42
    protected ExporttoManager manager;
43
    protected DataManager dataManager = null;
44

  
45
    @Override
46
    protected void doSetUp() throws Exception {
47
        manager = ExporttoLocator.getManager();
48
        dataManager = DALLocator.getDataManager();
49
    }
50

  
51
    /**
52
     * Test for the {@link ExporttoManager#getExporttoService()} method.
53
     * 
54
     * @throws Exception
55
     *             if there is any error in the tests
56
     */
57
    public void testGetExporttoService() throws Exception {
58
        ExporttoService exportService;
59
        try {
60
            exportService = createService();
61
            assertNotNull(exportService);
62
        } catch (ValidateDataParametersException e) {
63
            assertNull(e);
64
        } catch (DataException e) {
65
            assertNull(e);
66
        }
67
    }
68

  
69
    protected ExporttoService createService()
70
        throws ValidateDataParametersException, DataException {
71
        DataServerExplorerParameters dataServerExplorerParameters =
72
            dataManager.createServerExplorerParameters("FilesystemExplorer");
73
        DataServerExplorer dataServerExplorer =
74
            dataManager.openServerExplorer("FilesystemExplorer",
75
                dataServerExplorerParameters);
76
        NewDataStoreParameters newDataStoreParameters =
77
            dataServerExplorer.getAddParameters("Shape");
78
        return manager.getExporttoService(dataServerExplorer,
79
            newDataStoreParameters);
80
    }
81

  
82
}
0 83

  
tags/v2_0_0_Build_2045/libraries/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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff