Revision 34981

View differences:

branches/v2_0_0_prep/libraries/org.gvsig.exportto/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2

  
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" />
4

  
5
	<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." />
6
	<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
7
	<property name="build.jar.version" value="1.0.6-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

  
10
	<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" />
11

  
12
	<target name="check-maven-base-build-available">
13
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" />
14
	</target>
15

  
16
	<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available">
17
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
18
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
19
			<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
20
				<patternset>
21
					<exclude name="META-INF/**" />
22
				</patternset>
23
			</zipfileset>
24
		</copy>
25
	</target>
26

  
27
	<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available">
28
		<mkdir dir="target" />
29

  
30
		<!-- Download the build jar file -->
31
		<get src="http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" />
32

  
33
		<!-- Unzip de build jar file into the workspace root folder -->
34
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
35
			<zipfileset src="target/${build.jar.file}">
36
				<patternset>
37
					<exclude name="META-INF/**" />
38
				</patternset>
39
			</zipfileset>
40
		</copy>
41

  
42
	</target>
43

  
44
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote">
45

  
46
		<mkdir dir="target" />
47

  
48
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
49

  
50
		<!-- Copy the maven launchers to the workspace metadata folder -->
51
		<copy todir="${workspace.basedir}/.metadata">
52
			<fileset dir="${build.basedir}/eclipse-launchers">
53
				<exclude name="**/org.eclipse.jdt.core.prefs" />
54
				<exclude name="**/org.eclipse.core.variables.prefs" />
55
			</fileset>
56
		</copy>
57

  
58
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true">
59
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" />
60
		</concat>
61
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true">
62
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" />
63
		</concat>
64

  
65
		<!-- Configure the eclipse workspace -->
66
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
67

  
68
		<!-- Configure the gvSIG profile -->
69
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" target="initialize" />
70

  
71
		<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
72

  
73
		<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
74
			<classpath>
75
				<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
76
			</classpath>
77
		</taskdef>
78

  
79
		<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
80
			<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" />
81
		</xmltask>
82

  
83
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
84
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
85

  
86
		<!-- Compile, install and generate eclipse projects -->
87
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
88

  
89
		<echo>INFORMATION!!!</echo>
90
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
91

  
92
		<!-- TODO: copiar al proyecto de configuraciĆ³n general -->
93
	</target>
94

  
95
	<target name="clean">
96
		<delete dir="target" />
97
	</target>
98

  
99
</project>
0 100

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/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"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
	<modelVersion>4.0.0</modelVersion>
6
	<groupId>org.gvsig</groupId>
7
	<artifactId>org.gvsig.exportto</artifactId>
8
	<packaging>pom</packaging>
9
	<version>1.0.0-SNAPSHOT</version>
10
	<name>org.gvsig.exportto</name>
11
	<description>Exportto example project</description>
12
	<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.exportto/${project.version}/basic/org.gvsig.exportto</url>
13
	<parent>
14
		<groupId>org.gvsig</groupId>
15
		<artifactId>org.gvsig.maven.base.pom</artifactId>
16
		<version>1.0.8-SNAPSHOT</version>
17
	</parent>
18

  
19
	<scm>
20
		<connection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-exportto/org.gvsig.exportto/library/trunk</connection>
21
		<developerConnection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-exportto/org.gvsig.exportto/library/trunk</developerConnection>
22
		<url>https://forge.osor.eu/plugins/scmsvn/viewcvs.php/org.gvsig.exportto/library/trunk/?root=gvsig-exportto</url>
23
	</scm>
24

  
25
	<developers>
26
        <developer>
27
            <id>jpiera</id>
28
            <name>Jorge Piera</name>
29
            <email>jpiera@gvsig.org</email>
30
            <roles>
31
                <role>Architect</role>
32
                <role>Developer</role>
33
            </roles>
34
        </developer>
35
        <developer>
36
            <id>jjdelcerro</id>
37
            <name>Joaqu?n Jos? del Cerro</name>
38
            <email>jjdelcerro@gvsig.org</email>
39
            <roles>
40
                <role>Architect</role>          
41
            </roles>
42
        </developer>        
43
    </developers>
44

  
45
	<distributionManagement>
46
		<site>
47
			<id>gvsig-repository</id>
48
			<url>scp://shell.forge.osor.eu/home/groups/gvsig-desktop/www/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.exportto/${project.version}/basic/org.gvsig.exportto</url>
49
		</site>
50
	</distributionManagement>
51
	<repositories>
52
		<repository>
53
			<id>gvsig-public-http-repository</id>
54
			<name>gvSIG maven public HTTP repository</name>
55
			<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository</url>
56
			<releases>
57
				<enabled>true</enabled>
58
				<updatePolicy>daily</updatePolicy>
59
				<checksumPolicy>warn</checksumPolicy>
60
			</releases>
61
			<snapshots>
62
				<enabled>true</enabled>
63
				<updatePolicy>daily</updatePolicy>
64
				<checksumPolicy>warn</checksumPolicy>
65
			</snapshots>
66
		</repository>
67
	</repositories>
68
	<build>
69
		<plugins>
70
			<plugin>
71
				<groupId>org.apache.maven.plugins</groupId>
72
				<artifactId>maven-release-plugin</artifactId>
73
				<configuration>
74
					<tagBase>https://svn.forge.osor.eu/svn/gvsig-exportto/org.gvsig.exportto/library/tags</tagBase>
75
				</configuration>
76
			</plugin>
77
		</plugins>
78
	</build>
79
	<dependencyManagement>
80
		<dependencies>			
81
            <dependency>
82
                <groupId>org.gvsig</groupId>
83
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
84
                <version>2.0.1-SNAPSHOT</version>
85
                <type>pom</type>
86
                <scope>import</scope>
87
            </dependency>
88
            <dependency>
89
                <groupId>org.gvsig</groupId>
90
                <artifactId>org.gvsig.geodb</artifactId>
91
                <version>2.0-SNAPSHOT</version>
92
            </dependency>
93
		</dependencies>
94
	</dependencyManagement>
95

  
96
	<dependencies>
97
		<dependency>
98
			<groupId>org.gvsig</groupId>
99
			<artifactId>org.gvsig.tools.lib</artifactId>
100
		</dependency>
101
		<dependency>
102
			<groupId>org.gvsig</groupId>
103
			<artifactId>org.gvsig.tools.lib</artifactId>
104
			<type>test-jar</type>
105
		</dependency>	
106
	</dependencies>
107

  
108
	<modules>
109
		<module>org.gvsig.exportto.lib</module>
110
		<module>org.gvsig.exportto.swing</module>
111
		<module>org.gvsig.exportto.main</module>
112
		
113
	</modules>
114

  
115
</project>
0 116

  
branches/v2_0_0_prep/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

  
branches/v2_0_0_prep/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.impl</artifactId>
33
			<version>1.0.0-SNAPSHOT</version>
34
			<scope>runtime</scope>
35
		</dependency>
36
		<dependency>
37
            <groupId>org.gvsig</groupId>
38
            <artifactId>org.gvsig.exportto.swing.prov.generic</artifactId>
39
            <version>1.0.0-SNAPSHOT</version>
40
            <scope>runtime</scope>
41
        </dependency>
42
        <dependency>
43
            <groupId>org.gvsig</groupId>
44
            <artifactId>org.gvsig.exportto.swing.prov.shape</artifactId>
45
            <version>1.0.0-SNAPSHOT</version>
46
            <scope>runtime</scope>
47
        </dependency>
48
        <dependency>
49
            <groupId>org.gvsig</groupId>
50
            <artifactId>org.gvsig.exportto.swing.prov.dxf</artifactId>
51
            <version>1.0.0-SNAPSHOT</version>
52
            <scope>runtime</scope>
53
        </dependency>
54
        <dependency>
55
            <groupId>org.gvsig</groupId>
56
            <artifactId>org.gvsig.exportto.swing.prov.postgresql</artifactId>
57
            <version>1.0.0-SNAPSHOT</version>
58
            <scope>runtime</scope>
59
        </dependency>
60
        <dependency>
61
            <groupId>org.gvsig</groupId>
62
            <artifactId>org.gvsig.exportto.swing.prov.mysql</artifactId>
63
            <version>1.0.0-SNAPSHOT</version>
64
            <scope>runtime</scope>
65
        </dependency>
66
		<dependency>
67
            <groupId>org.gvsig</groupId>
68
            <artifactId>org.gvsig.tools.lib</artifactId>
69
            <scope>compile</scope>
70
        </dependency>
71
        <dependency>
72
            <groupId>org.gvsig</groupId>
73
            <artifactId>org.gvsig.projection</artifactId>
74
            <scope>compile</scope>
75
       </dependency>
76
       <dependency>
77
            <groupId>org.gvsig</groupId>
78
            <artifactId>org.gvsig.fmap.dal</artifactId>    
79
            <scope>compile</scope>        
80
        </dependency>
81
        <dependency>
82
            <groupId>org.gvsig</groupId>
83
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
84
            <classifier>store.shp</classifier>
85
            <scope>runtime</scope>
86
        </dependency>
87
        <dependency>
88
            <groupId>org.gvsig</groupId>
89
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
90
            <classifier>store.dxf</classifier>
91
            <scope>runtime</scope>
92
        </dependency>
93
        <dependency>
94
            <groupId>org.gvsig</groupId>
95
            <artifactId>org.gvsig.fmap.dal.db</artifactId>
96
            <classifier>store.postgresql</classifier>
97
            <scope>runtime</scope>
98
        </dependency>   
99
        <dependency>
100
            <groupId>org.gvsig</groupId>
101
            <artifactId>org.gvsig.fmap.dal.db</artifactId>
102
            <classifier>store.mysql</classifier>
103
            <scope>runtime</scope>
104
        </dependency>   
105
        <dependency>
106
            <groupId>org.gvsig</groupId>
107
            <artifactId>org.gvsig.tools.swing.serv.field</artifactId>
108
            <scope>compile</scope>
109
        </dependency> 
110
        <dependency>
111
            <groupId>org.gvsig</groupId>
112
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
113
            <scope>compile</scope>
114
        </dependency>           
115
	</dependencies>
116
</project>
0 117

  
branches/v2_0_0_prep/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

  
branches/v2_0_0_prep/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.fmap.crs.CRSFactory;
48
import org.gvsig.fmap.dal.DALLocator;
49
import org.gvsig.fmap.dal.DataManager;
50
import org.gvsig.fmap.dal.DataStoreParameters;
51
import org.gvsig.fmap.dal.exception.InitializeException;
52
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
53
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
54
import org.gvsig.fmap.dal.feature.FeatureStore;
55
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
56

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

  
65
    private static final Logger LOG = LoggerFactory.getLogger(Main.class);
66

  
67
    private ExporttoManager manager;
68
    private ExporttoSwingManager swingManager;
69
    private DataManager dataManager;
70
    
71
    public static void main(String args[]) {
72
        new DefaultLibrariesInitializer().fullInitialize();
73
        Main main = new Main();
74
        main.show();
75
    }
76

  
77
    @SuppressWarnings("serial")
78
    public void show() {
79
        manager = ExporttoLocator.getManager();
80
        swingManager = ExporttoSwingLocator.getSwingManager();
81
        dataManager = DALLocator.getDataManager();
82
        
83
        Action showCookie = new AbstractAction("Get a Exportto") {
84

  
85
            public void actionPerformed(ActionEvent e) {
86
                showExportto(manager);
87
            }
88
        };
89

  
90
        Action exit = new AbstractAction("Exit") {
91

  
92
            public void actionPerformed(ActionEvent e) {
93
                System.exit(0);
94
            }
95
        };
96

  
97
        JFrame frame = new JFrame("Exportto example app");
98
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
99

  
100
        // Create the menu bar.
101
        JMenuBar menuBar = new JMenuBar();
102

  
103
        // Build the menu.
104
        JMenu menuFile = new JMenu("File");
105
        menuFile.add(new JMenuItem(showCookie));
106
        menuFile.add(new JMenuItem(exit));
107

  
108
        menuBar.add(menuFile);
109

  
110
        JToolBar toolBar = new JToolBar();
111
        toolBar.add(new JButton(showCookie));
112
        toolBar.add(new JButton(exit));
113

  
114
        frame.setPreferredSize(new Dimension(200, 100));
115
        frame.setJMenuBar(menuBar);
116
        frame.add(toolBar, BorderLayout.PAGE_START);
117

  
118
        // Display the window.
119
        frame.pack();
120
        frame.setVisible(true);
121
    }
122

  
123
    public void showExportto(ExporttoManager manager) {
124
        try {            
125
            JExporttoServicePanel panel =
126
                swingManager.createExportto(createFeatureStore(), CRSFactory.getCRS("EPSG:23030"));
127
            panel.setPreferredSize(new Dimension(800, 400));
128
            swingManager.getWindowManager().showWindow(panel, "Exportto",
129
                ExporttoWindowManager.MODE_WINDOW);
130
        } catch (ValidateDataParametersException e) {
131
            LOG.error("Error showing a Exportto", e);
132
        } catch (InitializeException e) {
133
            LOG.error("Error showing a Exportto", e);
134
        } catch (ProviderNotRegisteredException e) {
135
            LOG.error("Error showing a Exportto", e);
136
        }
137
    }
138

  
139
    private FeatureStore createFeatureStore() throws InitializeException, ProviderNotRegisteredException, ValidateDataParametersException{
140
        String sourceFileName = getClass().getClassLoader().getResource("org/gvsig/exportto/data/andalucia.shp").getFile();
141
        DataStoreParameters sourceParameters = dataManager.createStoreParameters("Shape");
142
        sourceParameters.setDynValue("shpfile", sourceFileName);
143
        sourceParameters.setDynValue("crs", CRSFactory.getCRS("EPSG:23030"));
144
        return (FeatureStore) dataManager.openStore("Shape", sourceParameters);
145
    }
146
}
0 147

  
branches/v2_0_0_prep/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

  
branches/v2_0_0_prep/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

  
branches/v2_0_0_prep/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() throws ValidateDataParametersException, DataException{
63
        DataServerExplorerParameters dataServerExplorerParameters = 
64
            dataManager.createServerExplorerParameters("FilesystemExplorer");
65
        DataServerExplorer dataServerExplorer =
66
            dataManager.openServerExplorer("FilesystemExplorer", dataServerExplorerParameters);
67
        NewDataStoreParameters newDataStoreParameters = dataServerExplorer.getAddParameters("Shape"); 
68
        return manager.getExporttoService(dataServerExplorer, newDataStoreParameters);       
69
    }
70

  
71
    /**
72
     * Test for the {@link ExporttoService#export(org.gvsig.fmap.dal.feature.FeatureSet)} method.
73
     */
74
    public void testExporttoServiceCreation() {
75
        ExporttoService exportService;
76
        try {
77
            exportService = createService();
78
            assertNotNull(exportService);
79
            //TODO a test for the export service
80
            //exportService.export(featureSet);
81
            
82
        } catch (ValidateDataParametersException e) {
83
           assertNull(e);
84
        } catch (DataException e) {
85
            assertNull(e);
86
        }      
87
    }  
88
    
89
    @SuppressWarnings("unused")
90
    private FeatureStore createMemoryFeatureStore() throws ValidateDataParametersException, DataException{        
91
        DataStoreParameters memoryParameters = dataManager.createStoreParameters("Memory");    
92
        FeatureStore featureStore = (FeatureStore) dataManager.openStore("Memory", memoryParameters);
93
        return (FeatureStore) featureStore.getFeatureSet();
94
    }
95
}
0 96

  
branches/v2_0_0_prep/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()}
53
     * method.
54
     * 
55
     * @throws Exception
56
     *             if there is any error in the tests
57
     */
58
    public void testGetExporttoService() throws Exception {
59
        ExporttoService exportService;
60
        try {
61
            exportService = createService();
62
            assertNotNull(exportService);
63
        } catch (ValidateDataParametersException e) {
64
           assertNull(e);
65
        } catch (DataException e) {
66
            assertNull(e);
67
        }       
68
    }
69
    
70
    protected ExporttoService createService() throws ValidateDataParametersException, DataException{
71
        DataServerExplorerParameters dataServerExplorerParameters = 
72
            dataManager.createServerExplorerParameters("FilesystemExplorer");
73
        DataServerExplorer dataServerExplorer =
74
            dataManager.openServerExplorer("FilesystemExplorer", dataServerExplorerParameters);
75
        NewDataStoreParameters newDataStoreParameters = dataServerExplorer.getAddParameters("Shape");      
76
        return manager.getExporttoService(dataServerExplorer, newDataStoreParameters);       
77
    }
78

  
79
}
0 80

  
branches/v2_0_0_prep/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">
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.</p>
11
	
12
	<p>
13
	It allows to get new Exportto and get their text.
14
	</p>
15

  
16
</body>
17
</html>
0 18

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoManager.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 java.util.Iterator;
25

  
26
import org.gvsig.fmap.dal.DataServerExplorer;
27
import org.gvsig.fmap.dal.NewDataStoreParameters;
28
import org.gvsig.tools.service.ServiceException;
29

  
30
/**
31
 * This class is responsible of the management of the library's business logic.
32
 * It is the library's main entry point, and provides all the services to manage
33
 * {@link ExporttoService}s.
34
 * 
35
 * @see ExporttoService
36
 * @author gvSIG team
37
 * @version $Id$
38
 */
39
public interface ExporttoManager {
40

  
41
    /**
42
     * Create an instance of a {@link ExporttoService}.
43
     * @return {@link ExporttoService}
44
     * @throws ServiceException
45
     *             if there is an error getting the service
46
     */
47
    public ExporttoService getExporttoService(DataServerExplorer dataServerExplorer, NewDataStoreParameters newDataStoreParameters);
48
     
49
    @SuppressWarnings("rawtypes")
50
    public Iterator getPredefinedFilters();
51
    
52
    public String getFilter(String filterName);
53

  
54
}
0 55

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoException.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.tools.exception.BaseException;
25

  
26
/**
27
 * Generic exception thrown in the Exportto API when the exception or error
28
 * may be dealt by the program or the user of the program which is a client of
29
 * the Exportto API.
30
 * 
31
 * @see {@link ExporttoService}
32
 * @see {@link ExporttoManager}
33
 * @author gvSIG team.
34
 * @version $Id$
35
 */
36
public class ExporttoException extends BaseException {
37

  
38
    private static final long serialVersionUID = 6756475060924237176L;
39

  
40
    private static final String MESSAGE =
41
        "An error has been produced in the Exportto library";
42

  
43
    private static final String KEY = "_ExporttoException";
44

  
45
    /**
46
     * Constructor to be used in rare cases, usually you must create a new child
47
     * exception class for each case.
48
     * <strong>Don't use this constructor in child classes.</strong>
49
     */
50
    public ExporttoException() {
51
        super(MESSAGE, KEY, serialVersionUID);
52
    }
53

  
54
    /**
55
     * Constructor to be used in rare cases, usually you must create a new child
56
     * exception class for each case.
57
     * <p>
58
     * <strong>Don't use this constructor in child classes.</strong>
59
     * </p>
60
     * 
61
     * @param cause
62
     *            the original cause of the exception
63
     */
64
    public ExporttoException(Exception cause) {
65
        super(MESSAGE, cause, KEY, serialVersionUID);
66
    }
67

  
68
    /**
69
     * @see BaseException#BaseException(String, String, long).
70
     * @param message
71
     *            the default messageFormat to describe the exception
72
     * @param key
73
     *            the key to use to search a localized messageFormnata
74
     * @param code
75
     *            the unique code to identify the exception
76
     */
77
    protected ExporttoException(String message, String key, long code) {
78
        super(message, key, code);
79
    }
80

  
81
    /**
82
     * @see BaseException#BaseException(String, Throwable, String, long).
83
     * @param message
84
     *            the default messageFormat to describe the exception
85
     * @param cause
86
     *            the original cause of the exception
87
     * @param key
88
     *            the key to use to search a localized messageFormnata
89
     * @param code
90
     *            the unique code to identify the exception
91
     */
92
    protected ExporttoException(String message, Throwable cause,
93
        String key, long code) {
94
        super(message, cause, key, code);
95
    }
96
}
0 97

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoServiceException.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.tools.service.ServiceException;
25

  
26
/**
27
 * Exception thrown when there is an error getting a Exportto message.
28
 * 
29
 * @author gvSIG team
30
 * @version $Id$
31
 */
32
public class ExporttoServiceException extends ServiceException {
33
    private static final long serialVersionUID = -7423501876634702709L;
34

  
35
    private static final String MESSAGE =
36
        "An error has been produced exporting a store";
37

  
38
    private static final String KEY = "_ExporttoServiceException";
39

  
40
    /**
41
     * Creates a new {@link ExporttoServiceException}.
42
     * 
43
     * @param cause
44
     *            the original cause
45
     */
46
    public ExporttoServiceException(Throwable cause) {
47
        super(MESSAGE, cause, KEY, serialVersionUID);
48
    }
49
    
50
    public ExporttoServiceException(String message, Throwable cause) {
51
        super(message, cause, KEY, serialVersionUID);
52
    }
53
}
0 54

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoServiceFinishAction.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.DataStoreParameters;
25
import org.gvsig.fmap.dal.feature.FeatureStore;
26

  
27
/**
28
 * Action that can be executed at the end of the export process. 
29
 * An example of action can be load the destination {@link FeatureStore}
30
 * like a layer in a view.
31
 * 
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public interface ExporttoServiceFinishAction {
37
    
38
    /**
39
     * This method is called at the end of an export process.
40
     * @param layerName
41
     *          name of the new layer that can be added to gvSIG.
42
     * @param dataStoreParameters
43
     *          the parameters that can be used to create the exported store.
44
     */
45
    public void finished(String layerName, DataStoreParameters dataStoreParameters);
46
}
0 47

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoService.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

  
23
package org.gvsig.exportto;
24

  
25
import org.gvsig.fmap.dal.feature.FeatureSet;
26
import org.gvsig.fmap.dal.feature.FeatureStore;
27
import org.gvsig.tools.task.MonitorableTask;
28

  
29
/**
30
 * <p>
31
 * This service is used to export a source {@link FeatureStore} to a
32
 * target {@link FeatureStore}. 
33
 * </p>
34
 * <p>
35
 * It inherits if {@link MonitorableTask}, and it means that the export 
36
 * process can be monitorized by one or more observers that can listen
37
 * all the export events.
38
 * <p>
39
 * @author gvSIG team
40
 * @version $Id$
41
 */
42
public interface ExporttoService extends MonitorableTask {
43

  
44
    /**
45
     * This method export a {@link FeatureSet} to other {@link FeatureSet}. 
46
     * The other necessary parameters to make this conversion are specific
47
     * for every {@link ExporttoService}. e.g: a shape exporter needs a 
48
     * file and a projection, a database exporter needs a connection parameters...
49
     * @param featureSet
50
     *          the set of features hat have to be exported.     
51
     * @throws ExporttoServiceException
52
     *          if there is any exception in the exporting process
53
     */
54
    public void export(FeatureSet featureSet) throws ExporttoServiceException;
55
       
56
    /**
57
     * Sets the {@link ExporttoServiceFinishAction} that is used at the end
58
     * of the {@link ExporttoService}. 
59
     * @param exporttoServiceFinishAction
60
     *          it contains an action that can be executed at the end of the export process
61
     * 
62
     */
63
    public void setFinishAction(ExporttoServiceFinishAction exporttoServiceFinishAction);
64
    
65
   
66
}
0 67

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoLocator.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.tools.locator.BaseLocator;
25
import org.gvsig.tools.locator.Locator;
26
import org.gvsig.tools.locator.LocatorException;
27

  
28
/**
29
 * This locator is the entry point for the Exportto library, providing
30
 * access to all Exportto services through the {@link ExporttoManager}
31
 * .
32
 * 
33
 * @author gvSIG team
34
 * @version $Id$
35
 */
36
public class ExporttoLocator extends BaseLocator {
37

  
38
    /**
39
     * Exportto manager name.
40
     */
41
    public static final String MANAGER_NAME = "Exportto.manager";
42

  
43
    /**
44
     * Exportto manager description.
45
     */
46
    public static final String MANAGER_DESCRIPTION = "Exportto Manager";
47

  
48
    private static final String LOCATOR_NAME = "Exportto.locator";
49

  
50
    /**
51
     * Unique instance.
52
     */
53
    private static final ExporttoLocator INSTANCE =
54
        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(
94
        Class<? extends ExporttoManager> clazz) {
95
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
96
    }
97

  
98
}
0 99

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoLibrary.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.tools.library.AbstractLibrary;
25
import org.gvsig.tools.library.LibraryException;
26
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
27

  
28
/**
29
 * Library for API initialization and configuration.
30
 * 
31
 * @author gvSIG team
32
 * @version $Id$
33
 */
34
public class ExporttoLibrary extends AbstractLibrary {
35
       
36
    public ExporttoLibrary() {
37
        super(ExporttoLibrary.class, TYPE.API);       
38
    }
39

  
40
    @Override
41
    protected void doInitialize() throws LibraryException {
42
        // Do nothing
43
    }
44

  
45
    @Override
46
    protected void doPostInitialize() throws LibraryException {
47
        // Validate there is any implementation registered.
48
        ExporttoManager manager = ExporttoLocator.getManager();
49
        if (manager == null) {
50
            throw new ReferenceNotRegisteredException(
51
                ExporttoLocator.MANAGER_NAME, ExporttoLocator
52
                    .getInstance());
53
        }
54
    }
55

  
56
}
0 57

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/resources/filters.txt
1
point_geometries_only=
2
curve_geometries_only=
3
surface_geometries_only=
0 4

  
branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.exportto.ExporttoLibrary
branches/v2_0_0_prep/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>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff