Revision 37770
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.gvsig.newlayer</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
</buildSpec> |
|
9 |
<natures> |
|
10 |
</natures> |
|
11 |
</projectDescription> |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/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> |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/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 |
<artifactId>org.gvsig.newlayer</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<version>1.0.0-SNAPSHOT</version> |
|
9 |
<name>org.gvsig.newlayer</name> |
|
10 |
<description>newlayer example project</description> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.maven.base.pom</artifactId> |
|
14 |
<version>1.0.8-SNAPSHOT</version> |
|
15 |
</parent> |
|
16 |
<scm> |
|
17 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/org.gvsig.newlayer</connection> |
|
18 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/org.gvsig.newlayer</developerConnection> |
|
19 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/libraries/org.gvsig.newlayer</url> |
|
20 |
</scm> |
|
21 |
<developers> |
|
22 |
<developer> |
|
23 |
<id>jpiera</id> |
|
24 |
<name>Jorge Piera</name> |
|
25 |
<email>jpiera@gvsig.org</email> |
|
26 |
<roles> |
|
27 |
<role>Architect</role> |
|
28 |
<role>Developer</role> |
|
29 |
</roles> |
|
30 |
</developer> |
|
31 |
<developer> |
|
32 |
<id>jjdelcerro</id> |
|
33 |
<name>Joaqu?n Jos? del Cerro</name> |
|
34 |
<email>jjdelcerro@gvsig.org</email> |
|
35 |
<roles> |
|
36 |
<role>Architect</role> |
|
37 |
</roles> |
|
38 |
</developer> |
|
39 |
</developers> |
|
40 |
<repositories> |
|
41 |
<repository> |
|
42 |
<id>gvsig-public-http-repository</id> |
|
43 |
<name>gvSIG maven public HTTP repository</name> |
|
44 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
45 |
<releases> |
|
46 |
<enabled>true</enabled> |
|
47 |
<updatePolicy>daily</updatePolicy> |
|
48 |
<checksumPolicy>warn</checksumPolicy> |
|
49 |
</releases> |
|
50 |
<snapshots> |
|
51 |
<enabled>true</enabled> |
|
52 |
<updatePolicy>daily</updatePolicy> |
|
53 |
<checksumPolicy>warn</checksumPolicy> |
|
54 |
</snapshots> |
|
55 |
</repository> |
|
56 |
</repositories> |
|
57 |
<dependencyManagement> |
|
58 |
<dependencies> |
|
59 |
<dependency> |
|
60 |
<groupId>org.gvsig</groupId> |
|
61 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
62 |
<version>2.0.1-SNAPSHOT</version> |
|
63 |
<type>pom</type> |
|
64 |
<scope>import</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.gvsig</groupId> |
|
68 |
<artifactId>org.gvsig.geodb</artifactId> |
|
69 |
<version>2.0-SNAPSHOT</version> |
|
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 |
</dependencies> |
|
85 |
|
|
86 |
<modules> |
|
87 |
<module>org.gvsig.newlayer.lib</module> |
|
88 |
<module>org.gvsig.newlayer.prov</module> |
|
89 |
</modules> |
|
90 |
</project> |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/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 |
|
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.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.newlayer.lib.api</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.newlayer.lib.api</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.newlayer.lib</artifactId> |
|
11 |
<version>1.0.0-SNAPSHOT</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
17 |
<scope>compile</scope> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
22 |
<scope>compile</scope> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.projection</artifactId> |
|
27 |
<scope>compile</scope> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.ui</artifactId> |
|
32 |
<version>2.0.1-SNAPSHOT</version> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>jwizardcomponent</groupId> |
|
37 |
<artifactId>jwizardcomponent</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
43 |
<version>2.0-SNAPSHOT</version> |
|
44 |
<scope>compile</scope> |
|
45 |
</dependency> |
|
46 |
</dependencies> |
|
47 |
<build> |
|
48 |
<plugins> |
|
49 |
<plugin> |
|
50 |
<groupId>org.apache.maven.plugins</groupId> |
|
51 |
<artifactId>maven-jar-plugin</artifactId> |
|
52 |
<configuration> |
|
53 |
</configuration> |
|
54 |
<executions> |
|
55 |
<!-- |
|
56 |
Generates a jar file only with the test classes |
|
57 |
--> |
|
58 |
<execution> |
|
59 |
<goals> |
|
60 |
<goal>test-jar</goal> |
|
61 |
</goals> |
|
62 |
</execution> |
|
63 |
</executions> |
|
64 |
</plugin> |
|
65 |
</plugins> |
|
66 |
</build> |
|
67 |
</project> |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.newlayer.NewLayerLibrary |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/resources/filters.txt | ||
---|---|---|
1 |
point_geometries_only= |
|
2 |
curve_geometries_only= |
|
3 |
surface_geometries_only= |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerProviderFactory.java | ||
---|---|---|
1 |
package org.gvsig.newlayer; |
|
2 |
|
|
3 |
import org.gvsig.tools.service.spi.ProviderFactory; |
|
4 |
|
|
5 |
public interface NewLayerProviderFactory extends ProviderFactory{ |
|
6 |
|
|
7 |
public String getDescription(); |
|
8 |
public boolean isSpatial(); |
|
9 |
public NewLayerProvider create(NewLayerService service); |
|
10 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerLocator.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.newlayer; |
|
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 NewLayer library, providing |
|
30 |
* access to all NewLayer services through the {@link NewLayerManager} |
|
31 |
* . |
|
32 |
* |
|
33 |
* @author gvSIG team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class NewLayerLocator extends BaseLocator { |
|
37 |
|
|
38 |
/** |
|
39 |
* NewLayer manager name. |
|
40 |
*/ |
|
41 |
public static final String MANAGER_NAME = "NewLayer.manager"; |
|
42 |
|
|
43 |
/** |
|
44 |
* NewLayer manager description. |
|
45 |
*/ |
|
46 |
public static final String MANAGER_DESCRIPTION = "NewLayer Manager"; |
|
47 |
|
|
48 |
private static final String LOCATOR_NAME = "NewLayer.locator"; |
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance. |
|
52 |
*/ |
|
53 |
private static final NewLayerLocator INSTANCE = |
|
54 |
new NewLayerLocator(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Return the singleton instance. |
|
58 |
* |
|
59 |
* @return the singleton instance |
|
60 |
*/ |
|
61 |
public static NewLayerLocator 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 NewLayerManager. |
|
76 |
* |
|
77 |
* @return a reference to the NewLayerManager |
|
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 NewLayerManager getManager() throws LocatorException { |
|
84 |
return (NewLayerManager) getInstance().get(MANAGER_NAME); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Registers the Class implementing the NewLayerManager interface. |
|
89 |
* |
|
90 |
* @param clazz |
|
91 |
* implementing the NewLayerManager interface |
|
92 |
*/ |
|
93 |
public static void registerManager( |
|
94 |
Class<? extends NewLayerManager> clazz) { |
|
95 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
96 |
} |
|
97 |
|
|
98 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerLibrary.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.newlayer; |
|
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 NewLayerLibrary extends AbstractLibrary { |
|
35 |
|
|
36 |
@Override |
|
37 |
public void doRegistration() { |
|
38 |
registerAsAPI(NewLayerLibrary.class); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
protected void doInitialize() throws LibraryException { |
|
43 |
// Do nothing |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doPostInitialize() throws LibraryException { |
|
48 |
// Validate there is any implementation registered. |
|
49 |
NewLayerManager manager = NewLayerLocator.getManager(); |
|
50 |
if (manager == null) { |
|
51 |
throw new ReferenceNotRegisteredException( |
|
52 |
NewLayerLocator.MANAGER_NAME, NewLayerLocator |
|
53 |
.getInstance()); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/spi/AbstractNewLayerProvider.java | ||
---|---|---|
1 |
package org.gvsig.newlayer.spi; |
|
2 |
|
|
3 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
4 |
import org.gvsig.newlayer.NewLayerProvider; |
|
5 |
import org.gvsig.newlayer.NewLayerService; |
|
6 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
7 |
|
|
8 |
public abstract class AbstractNewLayerProvider implements NewLayerProvider{ |
|
9 |
|
|
10 |
private NewLayerService service; |
|
11 |
protected DataServerExplorer explorer; |
|
12 |
protected String storeName; |
|
13 |
|
|
14 |
protected AbstractNewLayerProvider(NewLayerService service){ |
|
15 |
this.service = service; |
|
16 |
} |
|
17 |
|
|
18 |
public NewLayerService getService() { |
|
19 |
return service; |
|
20 |
} |
|
21 |
|
|
22 |
public DataServerExplorer getExplorer() { |
|
23 |
return explorer; |
|
24 |
} |
|
25 |
|
|
26 |
public String getStoreName() { |
|
27 |
return storeName; |
|
28 |
} |
|
29 |
|
|
30 |
public void setProviderServices(ProviderServices services) { |
|
31 |
throw new UnsupportedOperationException(); |
|
32 |
} |
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/spi/AbstractNewLayerProviderFactory.java | ||
---|---|---|
1 |
package org.gvsig.newlayer.spi; |
|
2 |
|
|
3 |
import org.gvsig.newlayer.NewLayerProviderFactory; |
|
4 |
import org.gvsig.tools.dynobject.DynClass; |
|
5 |
import org.gvsig.tools.dynobject.DynObject; |
|
6 |
import org.gvsig.tools.service.ServiceException; |
|
7 |
import org.gvsig.tools.service.spi.Provider; |
|
8 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
9 |
|
|
10 |
public abstract class AbstractNewLayerProviderFactory implements NewLayerProviderFactory{ |
|
11 |
|
|
12 |
public final Provider doCreate(DynObject parameters, ProviderServices services) { |
|
13 |
throw new UnsupportedOperationException(); |
|
14 |
} |
|
15 |
|
|
16 |
public DynObject createParameters() { |
|
17 |
throw new UnsupportedOperationException(); |
|
18 |
} |
|
19 |
|
|
20 |
public void initialize() { |
|
21 |
throw new UnsupportedOperationException(); |
|
22 |
} |
|
23 |
|
|
24 |
protected DynClass createParametersDynClass() { |
|
25 |
throw new UnsupportedOperationException(); |
|
26 |
} |
|
27 |
|
|
28 |
public Provider create(DynObject parameters, ProviderServices services) |
|
29 |
throws ServiceException { |
|
30 |
throw new UnsupportedOperationException(); |
|
31 |
} |
|
32 |
|
|
33 |
|
|
34 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerManager.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.newlayer; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
27 |
import org.gvsig.tools.service.ServiceException; |
|
28 |
|
|
29 |
/** |
|
30 |
* This class is responsible of the management of the library's business logic. |
|
31 |
* It is the library's main entry point, and provides all the services to manage |
|
32 |
* {@link NewLayerService}s. |
|
33 |
* |
|
34 |
* @see NewLayerService |
|
35 |
* @author gvSIG team |
|
36 |
* @version $Id$ |
|
37 |
*/ |
|
38 |
public interface NewLayerManager { |
|
39 |
|
|
40 |
public enum STORETYPE{ANY,TABULAR,SPATIAL}; |
|
41 |
|
|
42 |
|
|
43 |
/** |
|
44 |
* Create an instance of a {@link NewLayerService}. |
|
45 |
* @return {@link NewLayerService} |
|
46 |
* @throws ServiceException |
|
47 |
* if there is an error getting the service |
|
48 |
*/ |
|
49 |
public NewLayerService createNewLayerService(MapContext mapContext); |
|
50 |
|
|
51 |
public void registerProvider(NewLayerProviderFactory factory); |
|
52 |
|
|
53 |
public List<NewLayerProviderFactory> getProviders(STORETYPE filter); |
|
54 |
|
|
55 |
public NewLayerWizard createNewLayerWizard(NewLayerService service); |
|
56 |
|
|
57 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerProvider.java | ||
---|---|---|
1 |
package org.gvsig.newlayer; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
6 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
7 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
8 |
import org.gvsig.tools.service.spi.Provider; |
|
9 |
|
|
10 |
public interface NewLayerProvider extends Provider{ |
|
11 |
|
|
12 |
public NewLayerService getService(); |
|
13 |
|
|
14 |
public DataServerExplorer getExplorer(); |
|
15 |
|
|
16 |
public String getStoreName(); |
|
17 |
|
|
18 |
public EditableFeatureType getFeatureType(); |
|
19 |
|
|
20 |
public NewFeatureStoreParameters getNewStoreParameters(); |
|
21 |
|
|
22 |
public List<NewLayerProviderPanel> getPanels(); |
|
23 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerProviderPanel.java | ||
---|---|---|
1 |
package org.gvsig.newlayer; |
|
2 |
|
|
3 |
import javax.swing.JPanel; |
|
4 |
|
|
5 |
|
|
6 |
public abstract class NewLayerProviderPanel extends JPanel{ |
|
7 |
|
|
8 |
|
|
9 |
protected NewLayerProvider provider; |
|
10 |
|
|
11 |
protected NewLayerProviderPanel(NewLayerProvider provider){ |
|
12 |
this.provider = provider; |
|
13 |
} |
|
14 |
|
|
15 |
public abstract String getTitle(); |
|
16 |
|
|
17 |
public abstract boolean isValidPanel(); |
|
18 |
|
|
19 |
public abstract void updatePanel(); |
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerException.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.newlayer; |
|
23 |
|
|
24 |
import org.gvsig.tools.exception.BaseException; |
|
25 |
|
|
26 |
/** |
|
27 |
* Generic exception thrown in the NewLayer 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 NewLayer API. |
|
30 |
* |
|
31 |
* @see {@link NewLayerService} |
|
32 |
* @see {@link NewLayerManager} |
|
33 |
* @author gvSIG team. |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class NewLayerException extends BaseException { |
|
37 |
|
|
38 |
/** |
|
39 |
* |
|
40 |
*/ |
|
41 |
private static final long serialVersionUID = -2954242107118688337L; |
|
42 |
|
|
43 |
private static final String MESSAGE = |
|
44 |
"An error has been produced in the NewLayer library"; |
|
45 |
|
|
46 |
private static final String KEY = "_NewLayerException"; |
|
47 |
|
|
48 |
/** |
|
49 |
* Constructor to be used in rare cases, usually you must create a new child |
|
50 |
* exception class for each case. |
|
51 |
* <strong>Don't use this constructor in child classes.</strong> |
|
52 |
*/ |
|
53 |
public NewLayerException() { |
|
54 |
super(MESSAGE, KEY, serialVersionUID); |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* Constructor to be used in rare cases, usually you must create a new child |
|
59 |
* exception class for each case. |
|
60 |
* <p> |
|
61 |
* <strong>Don't use this constructor in child classes.</strong> |
|
62 |
* </p> |
|
63 |
* |
|
64 |
* @param cause |
|
65 |
* the original cause of the exception |
|
66 |
*/ |
|
67 |
public NewLayerException(Exception cause) { |
|
68 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* @see BaseException#BaseException(String, String, long). |
|
73 |
* @param message |
|
74 |
* the default messageFormat to describe the exception |
|
75 |
* @param key |
|
76 |
* the key to use to search a localized messageFormnata |
|
77 |
* @param code |
|
78 |
* the unique code to identify the exception |
|
79 |
*/ |
|
80 |
protected NewLayerException(String message, String key, long code) { |
|
81 |
super(message, key, code); |
|
82 |
} |
|
83 |
|
|
84 |
/** |
|
85 |
* @see BaseException#BaseException(String, Throwable, String, long). |
|
86 |
* @param message |
|
87 |
* the default messageFormat to describe the exception |
|
88 |
* @param cause |
|
89 |
* the original cause of the exception |
|
90 |
* @param key |
|
91 |
* the key to use to search a localized messageFormnata |
|
92 |
* @param code |
|
93 |
* the unique code to identify the exception |
|
94 |
*/ |
|
95 |
protected NewLayerException(String message, Throwable cause, |
|
96 |
String key, long code) { |
|
97 |
super(message, cause, key, code); |
|
98 |
} |
|
99 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerServiceException.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.newlayer; |
|
23 |
|
|
24 |
import org.gvsig.tools.exception.BaseException; |
|
25 |
import org.gvsig.tools.service.ServiceException; |
|
26 |
|
|
27 |
/** |
|
28 |
* Exception thrown when there is an error getting a NewLayer message. |
|
29 |
* |
|
30 |
* @author gvSIG team |
|
31 |
* @version $Id$ |
|
32 |
*/ |
|
33 |
public class NewLayerServiceException extends ServiceException { |
|
34 |
/** |
|
35 |
* |
|
36 |
*/ |
|
37 |
private static final long serialVersionUID = -4395786952326742397L; |
|
38 |
|
|
39 |
private static final String MESSAGE = |
|
40 |
"An error has been produced creating a store"; |
|
41 |
|
|
42 |
private static final String KEY = "_NewLayerServiceException"; |
|
43 |
|
|
44 |
/** |
|
45 |
* @see BaseException#BaseException(String, String, long) |
|
46 |
*/ |
|
47 |
protected NewLayerServiceException(String message, String key, long code) { |
|
48 |
super(message, key, code); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
53 |
*/ |
|
54 |
protected NewLayerServiceException(String message, Throwable cause, String key, |
|
55 |
long code) { |
|
56 |
super(message, cause, key, code); |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Creates a new {@link NewLayerServiceException}. |
|
61 |
* |
|
62 |
* @param cause |
|
63 |
* the original cause |
|
64 |
*/ |
|
65 |
public NewLayerServiceException(Throwable cause) { |
|
66 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
67 |
} |
|
68 |
|
|
69 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerService.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.newlayer; |
|
24 |
|
|
25 |
import java.util.List; |
|
26 |
|
|
27 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
28 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
31 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
32 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
33 |
import org.gvsig.tools.task.MonitorableTask; |
|
34 |
|
|
35 |
/** |
|
36 |
* <p> |
|
37 |
* This service is used to export a source {@link FeatureStore} to a |
|
38 |
* target {@link FeatureStore}. |
|
39 |
* </p> |
|
40 |
* <p> |
|
41 |
* It inherits if {@link MonitorableTask}, and it means that the export |
|
42 |
* process can be monitorized by one or more observers that can listen |
|
43 |
* all the export events. |
|
44 |
* <p> |
|
45 |
* @author gvSIG team |
|
46 |
* @version $Id$ |
|
47 |
*/ |
|
48 |
public interface NewLayerService { |
|
49 |
|
|
50 |
public void setType(String type); |
|
51 |
|
|
52 |
public String getType(); |
|
53 |
|
|
54 |
public List<String> getTypes(); |
|
55 |
|
|
56 |
/** |
|
57 |
* This method create a {@link FeatureSet} to other {@link FeatureSet}. |
|
58 |
* The other necessary parameters to make this conversion are specific |
|
59 |
* for every {@link NewLayerService}. e.g: a shape exporter needs a |
|
60 |
* file and a projection, a database exporter needs a connection parameters... |
|
61 |
* @param featureSet |
|
62 |
* the set of features hat have to be exported. |
|
63 |
* @throws NewLayerServiceException |
|
64 |
* if there is any exception in the exporting process |
|
65 |
*/ |
|
66 |
public void createLayer() throws NewLayerServiceException; |
|
67 |
|
|
68 |
public void loadLayer() throws NewLayerServiceException; |
|
69 |
|
|
70 |
public DataServerExplorer getExplorer(); |
|
71 |
|
|
72 |
public String getStoreName(); |
|
73 |
|
|
74 |
public EditableFeatureType getFeatureType(); |
|
75 |
|
|
76 |
public NewFeatureStoreParameters getNewStoreParameters(); |
|
77 |
|
|
78 |
public NewLayerProvider getProvider(); |
|
79 |
|
|
80 |
public void addLayerToView(boolean b); |
|
81 |
|
|
82 |
public MapContext getMapContext(); |
|
83 |
|
|
84 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.api/src/main/java/org/gvsig/newlayer/NewLayerWizard.java | ||
---|---|---|
1 |
package org.gvsig.newlayer; |
|
2 |
|
|
3 |
import javax.swing.ImageIcon; |
|
4 |
|
|
5 |
import org.gvsig.gui.beans.wizard.WizardPanelWithLogo; |
|
6 |
|
|
7 |
|
|
8 |
public abstract class NewLayerWizard extends WizardPanelWithLogo{ |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
*/ |
|
13 |
private static final long serialVersionUID = -9070328984844239279L; |
|
14 |
|
|
15 |
public NewLayerWizard(ImageIcon logo) { |
|
16 |
super(logo); |
|
17 |
} |
|
18 |
|
|
19 |
public abstract NewLayerService getService(); |
|
20 |
|
|
21 |
public abstract void setType(String currentType); |
|
22 |
|
|
23 |
} |
|
0 | 24 |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
4 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
5 |
|
|
6 |
<modelVersion>4.0.0</modelVersion> |
|
7 |
<artifactId>org.gvsig.newlayer.lib</artifactId> |
|
8 |
<packaging>pom</packaging> |
|
9 |
<name>org.gvsig.newlayer.lib</name> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.newlayer</artifactId> |
|
13 |
<version>1.0.0-SNAPSHOT</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<modules> |
|
17 |
<module>org.gvsig.newlayer.lib.api</module> |
|
18 |
<module>org.gvsig.newlayer.lib.impl</module> |
|
19 |
</modules> |
|
20 |
</project> |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/java/org/gvsig/newlayer/impl/DefaultNewLayerManager.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.newlayer.impl; |
|
23 |
|
|
24 |
|
|
25 |
import java.net.URL; |
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.Iterator; |
|
28 |
import java.util.List; |
|
29 |
|
|
30 |
import javax.swing.ImageIcon; |
|
31 |
|
|
32 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
33 |
import org.gvsig.newlayer.NewLayerManager; |
|
34 |
import org.gvsig.newlayer.NewLayerProviderFactory; |
|
35 |
import org.gvsig.newlayer.NewLayerService; |
|
36 |
import org.gvsig.newlayer.NewLayerWizard; |
|
37 |
import org.gvsig.tools.ToolsLocator; |
|
38 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
39 |
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
|
40 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
41 |
import org.slf4j.Logger; |
|
42 |
import org.slf4j.LoggerFactory; |
|
43 |
|
|
44 |
/** |
|
45 |
* Default {@link NewLayerManager} implementation. |
|
46 |
* |
|
47 |
* @author gvSIG Team |
|
48 |
* @version $Id$ |
|
49 |
*/ |
|
50 |
public class DefaultNewLayerManager implements NewLayerManager { |
|
51 |
|
|
52 |
private static final Logger LOG = |
|
53 |
LoggerFactory.getLogger(DefaultNewLayerManager.class); |
|
54 |
|
|
55 |
final static private String EP_NEWLAYER_NAME = "NewLayer.manager.providers"; |
|
56 |
final static private String EP_NEWLAYER_DESCRIPTION = "NewLayer providers"; |
|
57 |
|
|
58 |
public NewLayerService createNewLayerService(MapContext mapContext) { |
|
59 |
return new DefaultNewLayerService(this, mapContext); |
|
60 |
} |
|
61 |
|
|
62 |
public void registerProvider(NewLayerProviderFactory factory) { |
|
63 |
ExtensionPointManager epmgr = ToolsLocator.getExtensionPointManager(); |
|
64 |
ExtensionPoint ep = epmgr.add(EP_NEWLAYER_NAME,EP_NEWLAYER_DESCRIPTION); |
|
65 |
ep.append(factory.getName(), factory.getDescription(), factory); |
|
66 |
} |
|
67 |
|
|
68 |
public List<NewLayerProviderFactory> getProviders(STORETYPE filter) { |
|
69 |
ExtensionPointManager epmgr = ToolsLocator.getExtensionPointManager(); |
|
70 |
ExtensionPoint ep = epmgr.add(EP_NEWLAYER_NAME,EP_NEWLAYER_DESCRIPTION); |
|
71 |
List<NewLayerProviderFactory> providers = new ArrayList<NewLayerProviderFactory>(); |
|
72 |
Iterator it = ep.iterator(); |
|
73 |
|
|
74 |
while (it.hasNext()) { |
|
75 |
Extension extension = (Extension) it.next(); |
|
76 |
NewLayerProviderFactory factory; |
|
77 |
try { |
|
78 |
factory = (NewLayerProviderFactory) extension.create(); |
|
79 |
} catch (InstantiationException e) { |
|
80 |
LOG.warn("Can't create NewLayerProviderFactory "+ extension.getName(), e); |
|
81 |
continue; |
|
82 |
} catch (IllegalAccessException e) { |
|
83 |
LOG.warn("Can't create NewLayerProviderFactory "+ extension.getName(), e); |
|
84 |
continue; |
|
85 |
} |
|
86 |
// if (filter == STORETYPE.TABULAR){ |
|
87 |
// if (!factory.isSpatial()){ |
|
88 |
// providers.add(factory); |
|
89 |
// } |
|
90 |
// } else { |
|
91 |
providers.add(factory); |
|
92 |
// } |
|
93 |
} |
|
94 |
|
|
95 |
return providers; |
|
96 |
} |
|
97 |
|
|
98 |
public NewLayerWizard createNewLayerWizard(NewLayerService service) { |
|
99 |
URL iconURL = getClass().getClassLoader().getResource("org/gvsig/newlayer/lib/impl/images/newlayericon.png"); |
|
100 |
ImageIcon logo = null; |
|
101 |
if (iconURL != null){ |
|
102 |
logo = new ImageIcon(iconURL); |
|
103 |
} |
|
104 |
|
|
105 |
return new DefaultNewLayerWizard(logo, service); |
|
106 |
} |
|
107 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/java/org/gvsig/newlayer/impl/AddNewLayerQuestionPanel.java | ||
---|---|---|
1 |
package org.gvsig.newlayer.impl; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
|
|
5 |
import javax.swing.JCheckBox; |
|
6 |
import javax.swing.JList; |
|
7 |
import javax.swing.JOptionPane; |
|
8 |
import javax.swing.JPanel; |
|
9 |
import javax.swing.JScrollPane; |
|
10 |
import javax.swing.ListModel; |
|
11 |
import javax.swing.event.ListSelectionEvent; |
|
12 |
import javax.swing.event.ListSelectionListener; |
|
13 |
|
|
14 |
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException; |
|
15 |
import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
|
16 |
import org.gvsig.i18n.Messages; |
|
17 |
import org.gvsig.newlayer.NewLayerService; |
|
18 |
import org.gvsig.newlayer.NewLayerWizard; |
|
19 |
|
|
20 |
public class AddNewLayerQuestionPanel extends JPanel implements OptionPanel{ |
|
21 |
|
|
22 |
private NewLayerWizard wizard; |
|
23 |
private JCheckBox questionCheckBox = null; |
|
24 |
|
|
25 |
public AddNewLayerQuestionPanel(NewLayerWizard wizard){ |
|
26 |
this.wizard = wizard; |
|
27 |
initializeComponents(); |
|
28 |
} |
|
29 |
|
|
30 |
public String getPanelTitle() { |
|
31 |
return "Add layer question panel"; |
|
32 |
} |
|
33 |
|
|
34 |
public void nextPanel() throws NotContinueWizardException { |
|
35 |
getService().addLayerToView(getAddLayerToView()); |
|
36 |
} |
|
37 |
|
|
38 |
public void lastPanel() { |
|
39 |
// do nothing |
|
40 |
|
|
41 |
} |
|
42 |
|
|
43 |
public void updatePanel() { |
|
44 |
initializeComponents(); |
|
45 |
} |
|
46 |
|
|
47 |
public JPanel getJPanel() { |
|
48 |
return this; |
|
49 |
} |
|
50 |
|
|
51 |
private void initializeComponents() { |
|
52 |
this.setLayout(new BorderLayout()); |
|
53 |
this.add(getQuestionCheckBox(), BorderLayout.CENTER); |
|
54 |
} |
|
55 |
|
|
56 |
private JCheckBox getQuestionCheckBox(){ |
|
57 |
if (this.questionCheckBox == null){ |
|
58 |
this.questionCheckBox = new JCheckBox(Messages.getText("add_layer_to_view_question"), true); |
|
59 |
} |
|
60 |
return this.questionCheckBox; |
|
61 |
} |
|
62 |
|
|
63 |
private NewLayerService getService() { |
|
64 |
return this.wizard.getService(); |
|
65 |
} |
|
66 |
|
|
67 |
public boolean getAddLayerToView(){ |
|
68 |
return getQuestionCheckBox().isSelected(); |
|
69 |
} |
|
70 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/java/org/gvsig/newlayer/impl/DefaultNewLayerService.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.newlayer.impl; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.Iterator; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import org.gvsig.fmap.dal.DALLocator; |
|
29 |
import org.gvsig.fmap.dal.DataManager; |
|
30 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
31 |
import org.gvsig.fmap.dal.DataStore; |
|
32 |
import org.gvsig.fmap.dal.exception.DataException; |
|
33 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
34 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
35 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
36 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
37 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
38 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
39 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
40 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
41 |
import org.gvsig.newlayer.NewLayerManager; |
|
42 |
import org.gvsig.newlayer.NewLayerProvider; |
|
43 |
import org.gvsig.newlayer.NewLayerProviderFactory; |
|
44 |
import org.gvsig.newlayer.NewLayerService; |
|
45 |
import org.gvsig.newlayer.NewLayerServiceException; |
|
46 |
|
|
47 |
/** |
|
48 |
* Default {@link NewLayerService} implementation. |
|
49 |
* |
|
50 |
* @author gvSIG Team |
|
51 |
* @version $Id$ |
|
52 |
*/ |
|
53 |
public class DefaultNewLayerService implements NewLayerService { |
|
54 |
|
|
55 |
private NewLayerManager newLayerManager; |
|
56 |
private NewLayerProviderFactory type; |
|
57 |
private NewLayerProvider provider; |
|
58 |
private boolean addLayerToView = true; |
|
59 |
private MapContext mapContext; |
|
60 |
|
|
61 |
/** |
|
62 |
* {@link DefaultNewLayerService} constructor |
|
63 |
|
|
64 |
*/ |
|
65 |
public DefaultNewLayerService(NewLayerManager manager , MapContext mapContext) { |
|
66 |
this.newLayerManager = manager; |
|
67 |
this.mapContext = mapContext; |
|
68 |
} |
|
69 |
|
|
70 |
public NewLayerProvider getProvider(){ |
|
71 |
return provider; |
|
72 |
} |
|
73 |
|
|
74 |
public void createLayer() |
|
75 |
throws NewLayerServiceException { |
|
76 |
try { |
|
77 |
this.getExplorer().add(this.getStoreName(), this.getNewStoreParameters(), true); |
|
78 |
} catch (DataException e) { |
|
79 |
throw new CantCreateNewLayerException(e); |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
public void loadLayer() throws NewLayerServiceException { |
|
84 |
try { |
|
85 |
String storeName = this.getStoreName(); |
|
86 |
NewFeatureStoreParameters storeParameters = this.getNewStoreParameters(); |
|
87 |
DataManager dataManager=DALLocator.getDataManager(); |
|
88 |
DataStore store = dataManager.openStore(storeName, storeParameters); |
|
89 |
String layerName = store.getName(); |
|
90 |
|
|
91 |
MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
|
92 |
FLayer lyr = mapContextManager.createLayer(layerName, store); |
|
93 |
lyr.setActive(true); |
|
94 |
lyr.setVisible(true); |
|
95 |
mapContext.getLayers().addLayer(lyr); |
|
96 |
|
|
97 |
lyr.dispose(); |
|
98 |
} catch (DataException e) { |
|
99 |
throw new CantOpenStoreException(e); |
|
100 |
} catch (ValidateDataParametersException e) { |
|
101 |
throw new CantOpenStoreException(e); |
|
102 |
} catch (LoadLayerException e) { |
|
103 |
throw new CantLoadNewLayerException(e); |
|
104 |
} |
|
105 |
|
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
public class CantCreateNewLayerException extends NewLayerServiceException { |
|
110 |
/** |
|
111 |
* |
|
112 |
*/ |
|
113 |
private static final long serialVersionUID = 4208215791054246118L; |
|
114 |
|
|
115 |
public CantCreateNewLayerException(Throwable cause) { |
|
116 |
super("Can't create the layer", cause, "_cant_create_the_layer", serialVersionUID); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
public class CantOpenStoreException extends NewLayerServiceException { |
|
121 |
|
|
122 |
/** |
|
123 |
* |
|
124 |
*/ |
|
125 |
private static final long serialVersionUID = -2245228621032918630L; |
|
126 |
|
|
127 |
public CantOpenStoreException(Throwable cause) { |
|
128 |
super("Can't open store", cause, "_cant_open_store", serialVersionUID); |
|
129 |
} |
|
130 |
} |
|
131 |
|
|
132 |
public class CantLoadNewLayerException extends NewLayerServiceException { |
|
133 |
|
|
134 |
/** |
|
135 |
* |
|
136 |
*/ |
|
137 |
private static final long serialVersionUID = -1711950651766745963L; |
|
138 |
|
|
139 |
public CantLoadNewLayerException(Throwable cause) { |
|
140 |
super("Can't load the new layer", cause, "_cant_load_the_new_layer", serialVersionUID); |
|
141 |
} |
|
142 |
} |
|
143 |
|
|
144 |
public void setType(String type) { |
|
145 |
List<NewLayerProviderFactory> providers = this.newLayerManager.getProviders(NewLayerManager.STORETYPE.ANY); |
|
146 |
Iterator<NewLayerProviderFactory> it = providers.iterator(); |
|
147 |
while (it.hasNext()) { |
|
148 |
NewLayerProviderFactory newLayerProviderFactory = it.next(); |
|
149 |
if (newLayerProviderFactory.getName().equalsIgnoreCase(type)){ |
|
150 |
this.type = newLayerProviderFactory; |
|
151 |
this.provider = newLayerProviderFactory.create(this); |
|
152 |
return; |
|
153 |
} |
|
154 |
} |
|
155 |
throw new IllegalArgumentException(type); |
|
156 |
} |
|
157 |
|
|
158 |
public DataServerExplorer getExplorer() { |
|
159 |
return getProvider().getExplorer(); |
|
160 |
} |
|
161 |
|
|
162 |
public String getStoreName() { |
|
163 |
return getProvider().getStoreName(); |
|
164 |
} |
|
165 |
|
|
166 |
public EditableFeatureType getFeatureType() { |
|
167 |
return getProvider().getFeatureType(); |
|
168 |
} |
|
169 |
|
|
170 |
public NewFeatureStoreParameters getNewStoreParameters() { |
|
171 |
return getProvider().getNewStoreParameters(); |
|
172 |
} |
|
173 |
|
|
174 |
public List<String> getTypes() { |
|
175 |
List<String> types = new ArrayList<String>(); |
|
176 |
List<NewLayerProviderFactory> providers = this.newLayerManager.getProviders(NewLayerManager.STORETYPE.ANY); |
|
177 |
Iterator<NewLayerProviderFactory> it = providers.iterator(); |
|
178 |
while (it.hasNext()) { |
|
179 |
NewLayerProviderFactory newLayerProviderFactory = it.next(); |
|
180 |
types.add(newLayerProviderFactory.getName()); |
|
181 |
} |
|
182 |
return types; |
|
183 |
} |
|
184 |
|
|
185 |
public String getType() { |
|
186 |
return this.type.getName(); |
|
187 |
} |
|
188 |
|
|
189 |
public void addLayerToView(boolean b) { |
|
190 |
this.addLayerToView = b; |
|
191 |
} |
|
192 |
|
|
193 |
public MapContext getMapContext() { |
|
194 |
return mapContext; |
|
195 |
} |
|
196 |
|
|
197 |
} |
tags/v2_0_0_Build_2043/libraries/org.gvsig.newlayer/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/java/org/gvsig/newlayer/impl/DefaultNewLayerWizard.java | ||
---|---|---|
1 |
package org.gvsig.newlayer.impl; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
import java.util.Iterator; |
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
import javax.swing.ImageIcon; |
|
8 |
import javax.swing.JOptionPane; |
|
9 |
import javax.swing.JPanel; |
|
10 |
|
|
11 |
import jwizardcomponent.CancelAction; |
|
12 |
import jwizardcomponent.DefaultJWizardComponents; |
|
13 |
import jwizardcomponent.FinishAction; |
|
14 |
import jwizardcomponent.JWizardComponents; |
|
15 |
|
|
16 |
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException; |
|
17 |
import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
|
18 |
import org.gvsig.newlayer.NewLayerProviderPanel; |
|
19 |
import org.gvsig.newlayer.NewLayerService; |
|
20 |
import org.gvsig.newlayer.NewLayerServiceException; |
|
21 |
import org.gvsig.newlayer.NewLayerWizard; |
Also available in: Unified diff