Revision 40085
tags/libraries/org.gvsig.exportto/1.0.0/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.8-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://devel.gvsig.org/m2repo/j2se/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="find.depends.natives.file"> |
|
45 |
<condition property="depends.natives.file.exists"> |
|
46 |
<available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/> |
|
47 |
</condition> |
|
48 |
</target> |
|
49 |
|
|
50 |
<target name="find.gvsig.platform.properties.file" |
|
51 |
depends="find.depends.natives.file" |
|
52 |
if="depends.natives.file.exists"> |
|
53 |
<condition property="gvsig.platform.exists"> |
|
54 |
<available file="${user.home}/.gvsig.platform.properties"/> |
|
55 |
</condition> |
|
56 |
</target> |
|
57 |
|
|
58 |
<target name="check.gvsig.platform.properties" |
|
59 |
depends="find.gvsig.platform.properties.file"> |
|
60 |
<fail if="depends.natives.file.exists" unless="gvsig.platform.exists"> |
|
61 |
ERROR!! |
|
62 |
|
|
63 |
You have to define your gvSIG platform properties, |
|
64 |
by creating the file: ${user.home}/.gvsig.platform.properties |
|
65 |
with the following content: |
|
66 |
|
|
67 |
native_platform=linux |
|
68 |
native_distribution=all |
|
69 |
native_compiler=gcc4 |
|
70 |
native_arch=i386 |
|
71 |
native_libraryType=dynamic |
|
72 |
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType} |
|
73 |
|
|
74 |
Replace the fifth initial variables values with the ones appropiate |
|
75 |
to your platform. |
|
76 |
|
|
77 |
If you use maven in the command line, you can use the previous file also |
|
78 |
to define the MAVEN_OPTS environment variable, by adding to your |
|
79 |
.bash_rc file something like this: |
|
80 |
|
|
81 |
if [ -f "${HOME}/.gvsig.platform.properties" ] |
|
82 |
then |
|
83 |
. ${HOME}/.gvsig.platform.properties |
|
84 |
export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}" |
|
85 |
else |
|
86 |
export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m" |
|
87 |
fi |
|
88 |
|
|
89 |
It will work if you use the bash shell. In any other case or platform, you'll |
|
90 |
have to define your MAVEN_OPTS environment variable and set the |
|
91 |
"native-classifier" parameter directly. |
|
92 |
</fail> |
|
93 |
|
|
94 |
</target> |
|
95 |
|
|
96 |
<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties"> |
|
97 |
|
|
98 |
<mkdir dir="target" /> |
|
99 |
|
|
100 |
<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" /> |
|
101 |
|
|
102 |
<!-- Copy the maven launchers to the workspace metadata folder --> |
|
103 |
<copy todir="${workspace.basedir}/.metadata"> |
|
104 |
<fileset dir="${build.basedir}/eclipse-launchers"> |
|
105 |
<exclude name="**/org.eclipse.jdt.core.prefs" /> |
|
106 |
<exclude name="**/org.eclipse.core.variables.prefs" /> |
|
107 |
</fileset> |
|
108 |
</copy> |
|
109 |
|
|
110 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true"> |
|
111 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" /> |
|
112 |
</concat> |
|
113 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true"> |
|
114 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" /> |
|
115 |
</concat> |
|
116 |
|
|
117 |
<!-- Configure the eclipse workspace --> |
|
118 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" /> |
|
119 |
|
|
120 |
<!-- Configure the gvSIG profile --> |
|
121 |
<ant antfile="${build.basedir}/check-gvsig-profile.xml" /> |
|
122 |
|
|
123 |
<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" /> |
|
124 |
|
|
125 |
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"> |
|
126 |
<classpath> |
|
127 |
<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" /> |
|
128 |
</classpath> |
|
129 |
</taskdef> |
|
130 |
|
|
131 |
<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}"> |
|
132 |
<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" /> |
|
133 |
</xmltask> |
|
134 |
|
|
135 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
136 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
137 |
|
|
138 |
<!-- Compile, install and generate eclipse projects --> |
|
139 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" /> |
|
140 |
|
|
141 |
<echo>INFORMATION!!!</echo> |
|
142 |
<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo> |
|
143 |
|
|
144 |
<!-- TODO: copiar al proyecto de configuraciĆ³n general --> |
|
145 |
</target> |
|
146 |
|
|
147 |
<target name="clean"> |
|
148 |
<delete dir="target" /> |
|
149 |
</target> |
|
150 |
|
|
151 |
</project> |
|
0 | 152 |
tags/libraries/org.gvsig.exportto/1.0.0/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.exportto</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<version>1.0.0</version> |
|
8 |
<name>org.gvsig.exportto</name> |
|
9 |
<description>Exportto example project</description> |
|
10 |
|
|
11 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop</url> |
|
12 |
|
|
13 |
|
|
14 |
<parent> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.maven.base.pom</artifactId> |
|
17 |
<version>1.0.9</version> |
|
18 |
</parent> |
|
19 |
|
|
20 |
<scm> |
|
21 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/tags/libraries/org.gvsig.exportto/1.0.0</connection> |
|
22 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/tags/libraries/org.gvsig.exportto/1.0.0</developerConnection> |
|
23 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/tags/libraries/org.gvsig.exportto/1.0.0</url> |
|
24 |
</scm> |
|
25 |
|
|
26 |
<developers> |
|
27 |
<developer> |
|
28 |
<id>jpiera</id> |
|
29 |
<name>Jorge Piera</name> |
|
30 |
<email>jpiera@gvsig.org</email> |
|
31 |
<roles> |
|
32 |
<role>Architect</role> |
|
33 |
<role>Developer</role> |
|
34 |
</roles> |
|
35 |
</developer> |
|
36 |
<developer> |
|
37 |
<id>jjdelcerro</id> |
|
38 |
<name>Joaqu?n Jos? del Cerro</name> |
|
39 |
<email>jjdelcerro@gvsig.org</email> |
|
40 |
<roles> |
|
41 |
<role>Architect</role> |
|
42 |
</roles> |
|
43 |
</developer> |
|
44 |
</developers> |
|
45 |
<repositories> |
|
46 |
<repository> |
|
47 |
<id>gvsig-public-http-repository</id> |
|
48 |
<name>gvSIG maven public HTTP repository</name> |
|
49 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
50 |
<releases> |
|
51 |
<enabled>true</enabled> |
|
52 |
<updatePolicy>daily</updatePolicy> |
|
53 |
<checksumPolicy>warn</checksumPolicy> |
|
54 |
</releases> |
|
55 |
<snapshots> |
|
56 |
<enabled>true</enabled> |
|
57 |
<updatePolicy>daily</updatePolicy> |
|
58 |
<checksumPolicy>warn</checksumPolicy> |
|
59 |
</snapshots> |
|
60 |
</repository> |
|
61 |
</repositories> |
|
62 |
<dependencyManagement> |
|
63 |
<dependencies> |
|
64 |
<dependency> |
|
65 |
<groupId>org.gvsig</groupId> |
|
66 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
67 |
<version>2.0.1</version> |
|
68 |
<type>pom</type> |
|
69 |
<scope>import</scope> |
|
70 |
</dependency> |
|
71 |
</dependencies> |
|
72 |
</dependencyManagement> |
|
73 |
|
|
74 |
<dependencies> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
78 |
</dependency> |
|
79 |
<dependency> |
|
80 |
<groupId>org.gvsig</groupId> |
|
81 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
82 |
<type>test-jar</type> |
|
83 |
</dependency> |
|
84 |
|
|
85 |
<!-- |
|
86 |
<dependency> |
|
87 |
<groupId>org.gvsig</groupId> |
|
88 |
<artifactId>org.gvsig.geodb</artifactId> |
|
89 |
<version>2.0-SNAPSHOT</version> |
|
90 |
<scope>compile</scope> |
|
91 |
</dependency> |
|
92 |
--> |
|
93 |
</dependencies> |
|
94 |
|
|
95 |
<build> |
|
96 |
<plugins> |
|
97 |
<plugin> |
|
98 |
<artifactId>maven-release-plugin</artifactId> |
|
99 |
<version>2.0</version> |
|
100 |
<configuration> |
|
101 |
<tagBase>https://devel.gvsig.org/svn/gvsig-desktop/tags/libraries/${artifactId}</tagBase> |
|
102 |
</configuration> |
|
103 |
</plugin> |
|
104 |
</plugins> |
|
105 |
</build> |
|
106 |
|
|
107 |
<modules> |
|
108 |
<module>org.gvsig.exportto.lib</module> |
|
109 |
<module>org.gvsig.exportto.swing</module> |
|
110 |
<module>org.gvsig.exportto.main</module> |
|
111 |
</modules> |
|
112 |
</project> |
|
113 |
|
|
114 |
|
|
0 | 115 |
tags/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.exportto.main</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.exportto.main</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.exportto</artifactId> |
|
10 |
<version>1.0.0</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.exportto.lib.api</artifactId> |
|
16 |
<version>1.0.0</version> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.exportto.lib.impl</artifactId> |
|
21 |
<version>1.0.0</version> |
|
22 |
<scope>runtime</scope> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.exportto.swing.api</artifactId> |
|
27 |
<version>1.0.0</version> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.exportto.swing.spi</artifactId> |
|
32 |
<version>1.0.0</version> |
|
33 |
</dependency> |
|
34 |
<dependency> |
|
35 |
<groupId>org.gvsig</groupId> |
|
36 |
<artifactId>org.gvsig.exportto.swing.impl</artifactId> |
|
37 |
<version>1.0.0</version> |
|
38 |
<scope>runtime</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.exportto.swing.prov.generic</artifactId> |
|
43 |
<version>1.0.0</version> |
|
44 |
<scope>runtime</scope> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.gvsig</groupId> |
|
48 |
<artifactId>org.gvsig.exportto.swing.prov.shape</artifactId> |
|
49 |
<version>1.0.0</version> |
|
50 |
<scope>runtime</scope> |
|
51 |
</dependency> |
|
52 |
<dependency> |
|
53 |
<groupId>org.gvsig</groupId> |
|
54 |
<artifactId>org.gvsig.exportto.swing.prov.dxf</artifactId> |
|
55 |
<version>1.0.0</version> |
|
56 |
<scope>runtime</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.exportto.swing.prov.dbf</artifactId> |
|
61 |
<version>1.0.0</version> |
|
62 |
<scope>runtime</scope> |
|
63 |
</dependency> |
|
64 |
<dependency> |
|
65 |
<groupId>org.gvsig</groupId> |
|
66 |
<artifactId>org.gvsig.exportto.swing.prov.postgresql</artifactId> |
|
67 |
<version>1.0.0</version> |
|
68 |
<scope>runtime</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.exportto.swing.prov.mysql</artifactId> |
|
73 |
<version>1.0.0</version> |
|
74 |
<scope>runtime</scope> |
|
75 |
</dependency> |
|
76 |
<dependency> |
|
77 |
<groupId>org.gvsig</groupId> |
|
78 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
79 |
<scope>compile</scope> |
|
80 |
</dependency> |
|
81 |
<dependency> |
|
82 |
<groupId>org.gvsig</groupId> |
|
83 |
<artifactId>org.gvsig.projection</artifactId> |
|
84 |
<scope>compile</scope> |
|
85 |
</dependency> |
|
86 |
<dependency> |
|
87 |
<groupId>org.gvsig</groupId> |
|
88 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
89 |
<scope>compile</scope> |
|
90 |
</dependency> |
|
91 |
<dependency> |
|
92 |
<groupId>org.gvsig</groupId> |
|
93 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
94 |
<classifier>store.shp</classifier> |
|
95 |
<scope>runtime</scope> |
|
96 |
</dependency> |
|
97 |
<dependency> |
|
98 |
<groupId>org.gvsig</groupId> |
|
99 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
100 |
<classifier>store.dxf</classifier> |
|
101 |
<scope>runtime</scope> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.fmap.dal.db</artifactId> |
|
106 |
<classifier>store.postgresql</classifier> |
|
107 |
<scope>runtime</scope> |
|
108 |
</dependency> |
|
109 |
<dependency> |
|
110 |
<groupId>org.gvsig</groupId> |
|
111 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
112 |
<scope>runtime</scope> |
|
113 |
</dependency> |
|
114 |
<dependency> |
|
115 |
<groupId>org.gvsig</groupId> |
|
116 |
<artifactId>org.gvsig.fmap.dal.db</artifactId> |
|
117 |
<classifier>store.mysql</classifier> |
|
118 |
<scope>runtime</scope> |
|
119 |
</dependency> |
|
120 |
<dependency> |
|
121 |
<groupId>org.gvsig</groupId> |
|
122 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
123 |
<scope>compile</scope> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>org.gvsig</groupId> |
|
127 |
<artifactId>org.gvsig.tools.swing.serv.field</artifactId> |
|
128 |
<scope>compile</scope> |
|
129 |
</dependency> |
|
130 |
<dependency> |
|
131 |
<groupId>org.gvsig</groupId> |
|
132 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
133 |
<scope>compile</scope> |
|
134 |
</dependency> |
|
135 |
<dependency> |
|
136 |
<groupId>org.gvsig</groupId> |
|
137 |
<artifactId>org.gvsig.i18n</artifactId> |
|
138 |
<scope>runtime</scope> |
|
139 |
</dependency> |
|
140 |
</dependencies> |
|
141 |
</project> |
|
142 |
|
|
0 | 143 |
tags/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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/libraries/org.gvsig.exportto/1.0.0/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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.exportto.lib.impl</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.exportto.lib.impl</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.exportto.lib</artifactId> |
|
10 |
<version>1.0.0</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.exportto.lib.api</artifactId> |
|
16 |
<version>1.0.0</version> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.exportto.lib.api</artifactId> |
|
21 |
<version>1.0.0</version> |
|
22 |
<type>test-jar</type> |
|
23 |
<scope>test</scope> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
28 |
<scope>compile</scope> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.projection</artifactId> |
|
43 |
<scope>compile</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.projection</artifactId> |
|
48 |
<classifier>cresques-impl</classifier> |
|
49 |
<scope>runtime</scope> |
|
50 |
</dependency> |
|
51 |
<dependency> |
|
52 |
<groupId>org.gvsig</groupId> |
|
53 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
54 |
<classifier>impl</classifier> |
|
55 |
<scope>runtime</scope> |
|
56 |
</dependency> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
60 |
<classifier>operation</classifier> |
|
61 |
<scope>runtime</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
66 |
<classifier>impl</classifier> |
|
67 |
<scope>runtime</scope> |
|
68 |
</dependency> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
72 |
<scope>test</scope> |
|
73 |
</dependency> |
|
74 |
<dependency> |
|
75 |
<groupId>org.gvsig</groupId> |
|
76 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
77 |
<classifier>store.dbf</classifier> |
|
78 |
<scope>test</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
83 |
<classifier>store.dbf</classifier> |
|
84 |
<scope>test</scope> |
|
85 |
</dependency> |
|
86 |
<dependency> |
|
87 |
<groupId>org.gvsig</groupId> |
|
88 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
89 |
<classifier>store.shp</classifier> |
|
90 |
<scope>test</scope> |
|
91 |
</dependency> |
|
92 |
<dependency> |
|
93 |
<groupId>org.gvsig</groupId> |
|
94 |
<artifactId>org.gvsig.symbology.lib.impl</artifactId> |
|
95 |
<scope>test</scope> |
|
96 |
</dependency> |
|
97 |
<dependency> |
|
98 |
<groupId>org.gvsig</groupId> |
|
99 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
100 |
<classifier>spi</classifier> |
|
101 |
<scope>runtime</scope> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.compat</artifactId> |
|
106 |
<classifier>se</classifier> |
|
107 |
<scope>runtime</scope> |
|
108 |
</dependency> |
|
109 |
</dependencies> |
|
110 |
<build> |
|
111 |
<plugins> |
|
112 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
113 |
<plugin> |
|
114 |
<groupId>org.apache.maven.plugins</groupId> |
|
115 |
<artifactId>maven-surefire-plugin</artifactId> |
|
116 |
<configuration> |
|
117 |
<excludes> |
|
118 |
<exclude>**/**</exclude> |
|
119 |
</excludes> |
|
120 |
</configuration> |
|
121 |
</plugin> |
|
122 |
</plugins> |
|
123 |
</build> |
|
124 |
</project> |
|
0 | 125 |
tags/libraries/org.gvsig.exportto/1.0.0/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, |
Also available in: Unified diff