Revision 36177

View differences:

tags/v2_0_0_Build_2032/libraries/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_2032/libraries/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.6-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

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

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

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

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

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

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

  
42
	</target>
43

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

  
46
		<mkdir dir="target" />
47

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

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

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

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

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

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

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

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

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

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

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

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

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

  
99
</project>
tags/v2_0_0_Build_2032/libraries/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
	<groupId>org.gvsig</groupId>
7
	<artifactId>org.gvsig.newlayer</artifactId>
8
	<packaging>pom</packaging>
9
	<version>1.0.0-SNAPSHOT</version>
10
	<name>org.gvsig.newlayer</name>
11
	<description>newlayer example project</description>
12
	<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.newlayer/${project.version}/basic/org.gvsig.newlayer</url>
13
	<parent>
14
		<groupId>org.gvsig</groupId>
15
		<artifactId>gvsig-base-library-pom</artifactId>
16
		<version>2.0-SNAPSHOT</version>
17
	</parent>
18

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

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

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

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

  
108
	<modules>
109
		<module>org.gvsig.newlayer.lib</module>
110
		<!-- <module>org.gvsig.newlayer.main</module> -->
111
		<module>org.gvsig.newlayer.prov</module>
112
		
113
	</modules>
114

  
115
    <properties>
116
        <build-dir>${basedir}/../build</build-dir>
117
    </properties>
118

  
119
</project>
tags/v2_0_0_Build_2032/libraries/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_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.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.
tags/v2_0_0_Build_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.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.newlayer">
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>
tags/v2_0_0_Build_2032/libraries/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.newlayer.NewLayerManager;
33
import org.gvsig.newlayer.NewLayerProviderFactory;
34
import org.gvsig.newlayer.NewLayerService;
35
import org.gvsig.newlayer.NewLayerWizard;
36
import org.gvsig.tools.ToolsLocator;
37
import org.gvsig.tools.extensionpoint.ExtensionPoint;
38
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
39
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
40
import org.slf4j.Logger;
41
import org.slf4j.LoggerFactory;
42

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

  
51
	private static final Logger LOG =
52
        LoggerFactory.getLogger(DefaultNewLayerManager.class);
53
	
54
	final static private String EP_NEWLAYER_NAME = "NewLayer.manager.providers";
55
	final static private String EP_NEWLAYER_DESCRIPTION = "NewLayer providers";    
56
    
57
	public NewLayerService createNewLayerService() {
58
		return new DefaultNewLayerService(this);
59
	}
60

  
61
	public void registerProvider(NewLayerProviderFactory factory) {
62
		ExtensionPointManager epmgr = ToolsLocator.getExtensionPointManager();
63
		ExtensionPoint ep = epmgr.add(EP_NEWLAYER_NAME,EP_NEWLAYER_DESCRIPTION);
64
		ep.append(factory.getName(), factory.getDescription(), factory);
65
	}
66

  
67
	public List<NewLayerProviderFactory> getProviders(STORETYPE filter) {
68
		ExtensionPointManager epmgr = ToolsLocator.getExtensionPointManager();
69
		ExtensionPoint ep = epmgr.add(EP_NEWLAYER_NAME,EP_NEWLAYER_DESCRIPTION);
70
		List<NewLayerProviderFactory> providers = new ArrayList<NewLayerProviderFactory>();
71
		Iterator it = ep.iterator();
72

  
73
			while (it.hasNext()) {
74
				Extension extension = (Extension) it.next();
75
				NewLayerProviderFactory factory;
76
				try {
77
					factory = (NewLayerProviderFactory) extension.create();
78
				} catch (InstantiationException e) {
79
					LOG.warn("Can't create NewLayerProviderFactory "+ extension.getName(), e);
80
					continue;
81
				} catch (IllegalAccessException e) {
82
					LOG.warn("Can't create NewLayerProviderFactory "+ extension.getName(), e);
83
					continue;
84
				}
85
//				if (filter == STORETYPE.TABULAR){
86
//					if (!factory.isSpatial()){
87
//						providers.add(factory);
88
//					}
89
//				} else {
90
					providers.add(factory);
91
//				}
92
			}
93

  
94
		return providers;
95
	}
96

  
97
	public NewLayerWizard createNewLayerWizard(NewLayerService service) {
98
        URL iconURL = getClass().getClassLoader().getResource("org/gvsig/newlayer/lib/impl/images/newlayericon.png");
99
        ImageIcon logo = null;
100
        if (iconURL != null){
101
        	logo = new ImageIcon(iconURL);
102
        }
103

  
104
		return new DefaultNewLayerWizard(logo, service);
105
	}
106
}
tags/v2_0_0_Build_2032/libraries/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.NewDataStoreParameters;
32
import org.gvsig.fmap.dal.exception.DataException;
33
import org.gvsig.fmap.dal.feature.EditableFeatureType;
34
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
35
import org.gvsig.newlayer.NewLayerException;
36
import org.gvsig.newlayer.NewLayerManager;
37
import org.gvsig.newlayer.NewLayerProvider;
38
import org.gvsig.newlayer.NewLayerProviderFactory;
39
import org.gvsig.newlayer.NewLayerService;
40
import org.gvsig.newlayer.NewLayerServiceException;
41

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

  
50
    private NewLayerManager newLayerManager;
51
    private NewLayerProviderFactory type;
52
    private NewLayerProvider provider;
53

  
54
    /**
55
     * {@link DefaultNewLayerService} constructor 
56

  
57
     */
58
    public DefaultNewLayerService(NewLayerManager manager) { 
59
        this.newLayerManager = manager;
60
    }
61

  
62
    public NewLayerProvider getProvider(){
63
		return provider;
64
    }
65
    
66
	public void createLayer()
67
			throws NewLayerServiceException {
68
		try {
69
			this.getExplorer().add(this.getStoreName(), this.getNewStoreParameters(), true);
70
		} catch (DataException e) {
71
			throw new CantCreateNewLayerException(e);
72
		}
73
		
74
	}
75
	
76
	public class CantCreateNewLayerException extends NewLayerServiceException {
77
		/**
78
		 * 
79
		 */
80
		private static final long serialVersionUID = 4208215791054246118L;
81

  
82
		public CantCreateNewLayerException(Throwable cause) {
83
			super("Can't create the layer", cause, "_cant_create_the_layer", serialVersionUID);
84
		}
85
	}
86

  
87
	public void setType(String type) {
88
		List<NewLayerProviderFactory> providers = this.newLayerManager.getProviders(NewLayerManager.STORETYPE.ANY);
89
		Iterator<NewLayerProviderFactory> it = providers.iterator();
90
		while (it.hasNext()) {
91
			NewLayerProviderFactory newLayerProviderFactory = it.next();
92
			if (newLayerProviderFactory.getName().equalsIgnoreCase(type)){
93
				this.type = newLayerProviderFactory;
94
				this.provider = newLayerProviderFactory.create(this);
95
				return;
96
			}
97
		}
98
		throw new IllegalArgumentException(type);
99
	}
100

  
101
	public DataServerExplorer getExplorer() {
102
		return getProvider().getExplorer();
103
	}
104

  
105
	public String getStoreName() {
106
		return getProvider().getStoreName();
107
	}
108

  
109
	public EditableFeatureType getFeatureType() {
110
		return getProvider().getFeatureType();
111
	}
112

  
113
	public NewFeatureStoreParameters getNewStoreParameters() {
114
		return getProvider().getNewStoreParameters();
115
	}
116

  
117
	public List<String> getTypes() {
118
		List<String> types = new ArrayList<String>();
119
		List<NewLayerProviderFactory> providers = this.newLayerManager.getProviders(NewLayerManager.STORETYPE.ANY);
120
		Iterator<NewLayerProviderFactory> it = providers.iterator();
121
		while (it.hasNext()) {
122
			NewLayerProviderFactory newLayerProviderFactory = it.next();
123
			types.add(newLayerProviderFactory.getName());
124
		}
125
		return types;
126
	}
127

  
128
	public String getType() {
129
		return this.type.getName();
130
	}
131

  
132
}
tags/v2_0_0_Build_2032/libraries/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.JPanel;
9

  
10
import jwizardcomponent.CancelAction;
11
import jwizardcomponent.DefaultJWizardComponents;
12
import jwizardcomponent.FinishAction;
13
import jwizardcomponent.JWizardComponents;
14

  
15
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException;
16
import org.gvsig.gui.beans.wizard.panel.OptionPanel;
17
import org.gvsig.newlayer.NewLayerProviderPanel;
18
import org.gvsig.newlayer.NewLayerService;
19
import org.gvsig.newlayer.NewLayerServiceException;
20
import org.gvsig.newlayer.NewLayerWizard;
21

  
22
public class DefaultNewLayerWizard extends NewLayerWizard {
23

  
24
	/**
25
	 * 
26
	 */
27
	private static final long serialVersionUID = -5827106636136663823L;
28
	private NewLayerService service;
29

  
30
	public DefaultNewLayerWizard(ImageIcon logo, NewLayerService service) {
31
		super(logo);
32
		setPreferredSize(new Dimension(600,400));
33
		this.service = service;
34
		this.getWizardComponents().setFinishAction(new MyFinishAction(this.getWizardComponents()));
35
		this.getWizardComponents().setCancelAction(new MyCancelAction(this.getWizardComponents()));
36
		this.createTypeSelector();
37
	}
38

  
39
	public NewLayerService getService(){
40
		return this.service;
41
	}
42
	
43
	private void createTypeSelector() {
44
		
45
		TypeSelectorPanel panel = new TypeSelectorPanel(this);
46
		this.addOptionPanel(panel);
47
		
48
	}
49
	
50
	private void createFeatureTypePanel() {
51
		
52
		FeatureTypePanel panel = new FeatureTypePanel(this);
53
		this.addOptionPanel(panel);
54

  
55
	}
56

  
57
	private void createProviderPanels() {
58
	       DefaultJWizardComponents wizardComponents = this.getWizardComponents();              
59
	        for (int i=wizardComponents.getWizardPanelList().size()-1 ; i>=1 ; i--){
60
	            wizardComponents.removeWizardPanel(i);
61
	        }
62
	        List<NewLayerProviderPanel> panels = service.getProvider().getPanels();
63
	        Iterator<NewLayerProviderPanel> it = panels.iterator();
64
	        while (it.hasNext()) {
65
	        	NewLayerProviderPanel panel = it.next();
66
				this.addOptionPanel(new OptionPanelWrapper(panel));
67
			}
68
	        this.createFeatureTypePanel();
69
	}
70

  
71
	@Override
72
	public void setType(String currentType) {
73
		this.service.setType(currentType);
74
		createProviderPanels();
75
	}
76
	
77
	private class OptionPanelWrapper implements OptionPanel {
78
		
79
		private NewLayerProviderPanel panel;
80

  
81
		public OptionPanelWrapper(NewLayerProviderPanel panel) {
82
			this.panel = panel;
83
		}
84

  
85
		public String getPanelTitle() {
86
			return this.panel.getTitle();
87
		}
88

  
89
		public void nextPanel() throws NotContinueWizardException {
90
			
91
			if(!this.panel.isValidPanel()){
92
				throw new NotContinueWizardException("", null, false);
93
			}
94
			
95
		}
96

  
97
		public void lastPanel() {
98
		}
99

  
100
		public void updatePanel() {
101
			this.panel.updatePanel();
102
		}
103

  
104
		public JPanel getJPanel() {
105
			return this.panel;
106
		}
107
		
108
	}
109
	
110
	private class MyFinishAction extends FinishAction {
111

  
112
		public MyFinishAction(JWizardComponents arg0) {
113
			super(arg0);
114
		}
115

  
116
		public void performAction() {
117
			if (getService().getStoreName()==null){
118
				//TODO pedirlo
119
			}
120
			if (getService().getNewStoreParameters()==null){
121
				//TODO pedirlo
122
			}
123
			try {
124
				getService().createLayer();
125
			} catch (NewLayerServiceException e) {
126
				// TODO Auto-generated catch block
127
				e.printStackTrace();
128
			}
129
		}
130

  
131
	}
132
	
133
	private class MyCancelAction extends CancelAction {
134
		
135
		public MyCancelAction(DefaultJWizardComponents wizardComponents) {
136
			super(wizardComponents);
137
		}
138

  
139
		public void performAction() {
140
			
141
		}
142
		
143
	}
144
}
tags/v2_0_0_Build_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/java/org/gvsig/newlayer/impl/FeatureTypePanel.java
1
package org.gvsig.newlayer.impl;
2

  
3
import java.awt.BorderLayout;
4
import java.util.ArrayList;
5
import java.util.Iterator;
6

  
7
import javax.swing.DefaultCellEditor;
8
import javax.swing.JButton;
9
import javax.swing.JComboBox;
10
import javax.swing.JLabel;
11
import javax.swing.JPanel;
12
import javax.swing.JScrollPane;
13
import javax.swing.JTable;
14
import javax.swing.ListSelectionModel;
15
import javax.swing.event.ListSelectionEvent;
16
import javax.swing.event.ListSelectionListener;
17
import javax.swing.table.DefaultTableModel;
18
import javax.swing.table.TableColumn;
19

  
20
import org.gvsig.fmap.dal.DataServerExplorer;
21
import org.gvsig.fmap.dal.exception.DataException;
22
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
23
import org.gvsig.fmap.dal.feature.EditableFeatureType;
24
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
25
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
26
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException;
27
import org.gvsig.gui.beans.wizard.panel.OptionPanel;
28
import org.gvsig.i18n.Messages;
29
import org.gvsig.newlayer.NewLayerWizard;
30
import org.gvsig.tools.dataTypes.DataTypes;
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
33

  
34
public class FeatureTypePanel extends JPanel implements OptionPanel{
35

  
36
	/**
37
	 * 
38
	 */
39
	private static final long serialVersionUID = 263541873998597624L;
40
	private NewLayerWizard wizard;
41
	private static final  Logger logger = LoggerFactory.getLogger(FeatureTypePanel.class);
42

  
43
	private JLabel jLabel = null;
44
	private JScrollPane jScrollPane = null;
45
	protected JTable jTable = null;
46
	private JPanel jPanelEast = null;
47
	private JButton jButtonAddField = null;
48
	private JButton jButtonDeleteField = null;
49
	protected int MAX_FIELD_LENGTH = 254;
50

  
51
	private DataServerExplorer explorer = null;
52

  
53
	public FeatureTypePanel(NewLayerWizard wizard){
54
		this.wizard = wizard;
55
	}
56

  
57
    private void initializeComponents() {
58
        jLabel = new JLabel();
59
        jLabel.setText(Messages.getText("define_fields"));
60
        this.setLayout(new BorderLayout(5,5));
61
        this.setSize(new java.awt.Dimension(499,232));
62
        this.add(jLabel, java.awt.BorderLayout.NORTH);
63
        this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
64
        this.add(getJPanelEast(), java.awt.BorderLayout.EAST);
65
     
66
    }
67

  
68
	/**
69
	 * This method initializes jScrollPane
70
	 *
71
	 * @return javax.swing.JScrollPane
72
	 */
73
	private JScrollPane getJScrollPane() {
74
		if (jScrollPane == null) {
75
			jScrollPane = new JScrollPane();
76
			jScrollPane.setViewportView(getJTable());
77
		}
78
		return jScrollPane;
79
	}
80

  
81

  
82
	/**
83
	 * This method initializes jTable
84
	 *
85
	 * @return javax.swing.JTable
86
	 */
87
	private JTable getJTable() {
88
		if (jTable == null) {
89
			jTable = new JTable();
90

  
91
			DefaultTableModel tm = (DefaultTableModel) jTable.getModel();
92
			tm.addColumn(Messages.getText("field"));
93

  
94
			// TableColumn fieldTypeColumn = new TableColumn(1);
95
			// fieldTypeColumn.setHeaderValue("Type");
96
			// jTable.addColumn(fieldTypeColumn);
97
			tm.addColumn(Messages.getText("type"));
98
			// MIRAR EL C?DIGO DEL BOT?N DE A?ADIR CAMPO PARA VER EL CellEditor con comboBox
99

  
100
			/* TableColumn fieldLengthColumn = new TableColumn(2);
101
			fieldLengthColumn.setHeaderValue("Length");
102
			// fieldLengthColumn.setCellRenderer(new DefaultTableCellRenderer());
103
			jTable.addColumn(fieldLengthColumn); */
104
			tm.addColumn(Messages.getText("length"));
105

  
106
//			Ask to be notified of selection changes.
107
			ListSelectionModel rowSM = jTable.getSelectionModel();
108
			rowSM.addListSelectionListener(new ListSelectionListener() {
109
			    public void valueChanged(ListSelectionEvent e) {
110
			        //Ignore extra messages.
111
			        if (e.getValueIsAdjusting()) return;
112

  
113
			        ListSelectionModel lsm =
114
			            (ListSelectionModel)e.getSource();
115
			        if (lsm.isSelectionEmpty()) {
116
			            //no rows are selected
117
			        	jButtonDeleteField.setEnabled(false);
118
			        } else {
119
			            // int selectedRow = lsm.getMinSelectionIndex();
120
			            //selectedRow is selected
121
			        	jButtonDeleteField.setEnabled(true);
122
			        }
123
			    }
124
			});
125
			jTable.getColumn(Messages.getText("field")).setWidth(180);
126

  
127
			//Rellenado de la tabla
128
			EditableFeatureType featureType = this.wizard.getService().getProvider().getFeatureType();
129
			if( featureType != null ){
130
				int row = 0;
131
				int column = 0;
132
				Iterator it = featureType.iterator();
133
				while (it.hasNext()) {
134
					FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) it.next();
135
					tm.setValueAt(descriptor.getName(), row, 0);
136
					tm.setValueAt(descriptor.getType(), row, 1);
137
					tm.setValueAt(descriptor.getSize(), row, 2);
138
				}
139
			}
140
			
141
		}
142
		return jTable;
143
	}
144

  
145

  
146
	/**
147
	 * This method initializes jPanelWest
148
	 *
149
	 * @return javax.swing.JPanel
150
	 */
151
	private JPanel getJPanelEast() {
152
		if (jPanelEast == null) {
153
			jPanelEast = new JPanel();
154
			jPanelEast.setLayout(null);
155
			jPanelEast.setPreferredSize(new java.awt.Dimension(170,100));
156
			jPanelEast.add(getJButtonAddField(), null);
157
			jPanelEast.add(getJButtonDeleteField(), null);
158
		}
159
		return jPanelEast;
160
	}
161

  
162

  
163
	/**
164
	 * This method initializes jButtonAddField
165
	 *
166
	 * @return javax.swing.JButton
167
	 */
168
	private JButton getJButtonAddField() {
169
		if (jButtonAddField == null) {
170
			jButtonAddField = new JButton();
171
			jButtonAddField.setText(Messages.getText("add_field"));
172
			jButtonAddField.setLocation(new java.awt.Point(7,5));
173
			jButtonAddField.setSize(new java.awt.Dimension(145,23));
174
			jButtonAddField.setPreferredSize(new java.awt.Dimension(100,26));
175
			jButtonAddField.addActionListener(new java.awt.event.ActionListener() {
176
				public void actionPerformed(java.awt.event.ActionEvent e) {
177
					DefaultTableModel tm = (DefaultTableModel) jTable.getModel();
178

  
179
					// Figure out a suitable field name
180
					ArrayList fieldNames = new ArrayList();
181
					for (int i = 0; i < jTable.getRowCount(); i++) {
182
						fieldNames.add(tm.getValueAt(i, 0));
183
					}
184
					String[] currentFieldNames = (String[]) fieldNames.toArray(new String[0]);
185
					String newField = Messages.getText("field").replaceAll(" +", "_");
186
					int index=0;
187
					for (int i = 0; i < currentFieldNames.length; i++) {
188
						if (currentFieldNames[i].startsWith(newField)) {
189
							try {
190
								index = Integer.parseInt(currentFieldNames[i].replaceAll(newField,""));
191
							} catch (Exception ex) { /* we don't care */}
192
						}
193
					}
194
					String newFieldName = newField+(++index);
195

  
196

  
197
					// Add a new row
198
					Object[] newRow = new Object[tm.getColumnCount()];
199
					newRow[0] = newFieldName;
200
					newRow[1] = "String";
201
					newRow[2] = "20";
202
					tm.addRow(newRow);
203

  
204
					// Esto lo a?ado aqu? porque si no tiene registros, no hace caso. (Por eso no
205
					// lo pongo en getJTable()
206
					TableColumn typeColumn = jTable.getColumnModel().getColumn(1);
207
					JComboBox comboBox = new JComboBox();
208
					comboBox.addItem("Boolean");
209
					comboBox.addItem("Date");
210
					comboBox.addItem("Integer");
211
					comboBox.addItem("Double");
212
					comboBox.addItem("String");
213
					typeColumn.setCellEditor(new DefaultCellEditor(comboBox));
214

  
215
					TableColumn widthColumn = jTable.getColumnModel().getColumn(2);
216

  
217
					// tm.setValueAt("NewField", tm.getRowCount()-1, 0);
218
				}
219
			});
220

  
221
		}
222
		return jButtonAddField;
223
	}
224

  
225

  
226
	/**
227
	 * This method initializes jButton
228
	 *
229
	 * @return javax.swing.JButton
230
	 */
231
	private JButton getJButtonDeleteField() {
232
		if (jButtonDeleteField == null) {
233
			jButtonDeleteField = new JButton();
234
			jButtonDeleteField.setText(Messages.getText("delete_field"));
235
			jButtonDeleteField.setLocation(new java.awt.Point(7,33));
236
			jButtonDeleteField.setSize(new java.awt.Dimension(145,23));
237
			jButtonDeleteField.setEnabled(false);
238
			jButtonDeleteField.addActionListener(new java.awt.event.ActionListener() {
239
				public void actionPerformed(java.awt.event.ActionEvent e) {
240
					int[] selecteds = jTable.getSelectedRows();
241
					DefaultTableModel tm = (DefaultTableModel) jTable.getModel();
242

  
243
					for (int i=selecteds.length-1; i >=0; i--)
244
						tm.removeRow(selecteds[i]);
245
				}
246
			});
247
		}
248
		return jButtonDeleteField;
249
	}
250

  
251

  
252

  
253
	public String getPanelTitle() {
254
		return Messages.getText("fields_definitions");
255
	}
256

  
257
	public void nextPanel() throws NotContinueWizardException {
258
		/* 
259
		 * TODO Coge los datos del formulario y los guarda en
260
		 * this.service.getFeatureType()
261
		 */
262
		
263
		
264
	}
265

  
266
	public void lastPanel() {
267
		// TODO Auto-generated method stub
268
		
269
	}
270

  
271
	public void updatePanel() {
272
		initializeComponents();
273
		
274
	}
275

  
276
	public JPanel getJPanel() {
277
		return this;
278
	}
279

  
280
	/**
281
	 * Convierte lo que hay en la tabla en una definici?n de campos
282
	 * adecuada para crear un LayerDefinition
283
	 * @return
284
	 * @throws DataException 
285
	 */
286
	private EditableFeatureType getFeatureType() throws DataException {
287
		DefaultTableModel tm = (DefaultTableModel) jTable.getModel();
288
		NewFeatureStoreParameters addParameters = (NewFeatureStoreParameters) explorer.getAddParameters("");
289
		EditableFeatureType type = addParameters.getDefaultFeatureType();
290

  
291
		for (int i=0; i < tm.getRowCount(); i++)
292
		{
293
			int dataType=0;
294
			String strType = (String) tm.getValueAt(i,1);
295

  
296
			if (strType.equals("String"))
297
				dataType=DataTypes.STRING;
298
			else if (strType.equals("Double"))
299
				dataType=DataTypes.DOUBLE;
300
			else if (strType.equals("Integer"))
301
				dataType=DataTypes.INT;
302
			else if (strType.equals("Boolean"))
303
				dataType=DataTypes.BOOLEAN;
304
			else if (strType.equals("Date"))
305
				dataType=DataTypes.DATE;
306

  
307
			int fieldLength = Integer.parseInt((String) tm.getValueAt(i,2));
308
			// TODO: HACERLO BIEN
309
			if (strType.equals("Double"))
310
				fieldLength=5;
311
			EditableFeatureAttributeDescriptor efad1 = type.add((String) tm.getValueAt(i,0), dataType, fieldLength);
312
		}
313

  
314
		return type;
315
	}
316

  
317
}
tags/v2_0_0_Build_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/java/org/gvsig/newlayer/impl/NewLayerDefaultImplLibrary.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 org.gvsig.newlayer.NewLayerLibrary;
25
import org.gvsig.newlayer.NewLayerLocator;
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 NewLayerDefaultImplLibrary extends AbstractLibrary {
36
    
37
    @Override
38
    public void doRegistration() {
39
        registerAsImplementationOf(NewLayerLibrary.class);
40
    }
41

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

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

  
52
}
tags/v2_0_0_Build_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/java/org/gvsig/newlayer/impl/TypeSelectorPanel.java
1
package org.gvsig.newlayer.impl;
2

  
3
import java.awt.BorderLayout;
4

  
5
import javax.swing.JList;
6
import javax.swing.JPanel;
7
import javax.swing.JScrollPane;
8
import javax.swing.ListModel;
9
import javax.swing.event.ListSelectionEvent;
10
import javax.swing.event.ListSelectionListener;
11

  
12
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException;
13
import org.gvsig.gui.beans.wizard.panel.OptionPanel;
14
import org.gvsig.newlayer.NewLayerService;
15
import org.gvsig.newlayer.NewLayerWizard;
16

  
17
public class TypeSelectorPanel extends JPanel implements OptionPanel{
18
	
19
	private NewLayerWizard wizard;
20
	private String currentType;
21

  
22
	public TypeSelectorPanel(NewLayerWizard wizard){
23
		this.wizard = wizard;
24
		initializeComponents();
25
	}
26

  
27
	public String getPanelTitle() {
28
		return "Type selector panel";
29
	}
30

  
31
	public void nextPanel() throws NotContinueWizardException {
32
		this.wizard.setType(currentType);
33
	}
34

  
35
	public void lastPanel() {
36
		// do nothing
37
		
38
	}
39

  
40
	public void updatePanel() {
41
		initializeComponents();
42
	}
43

  
44
	public JPanel getJPanel() {
45
		return this;
46
	}
47

  
48
    private void initializeComponents() {
49
        this.setLayout(new BorderLayout());
50

  
51
        JList types = new JList();     
52
        ListModel model = new org.gvsig.utils.DefaultListModel(this.getService().getTypes());
53
        types.setModel(model);
54
        
55
        types.addListSelectionListener(new ListSelectionListener() {
56
			public void valueChanged(ListSelectionEvent e) {
57
				if (e.getValueIsAdjusting() == false) {
58
					JList list = (JList) e.getSource();
59
					
60
			        if (list.getSelectedIndex() > -1) {
61
			        	currentType = (String) list.getSelectedValue();
62
			        }
63
			    }
64
			}
65
		});
66
        
67
        JScrollPane scrollPane = new JScrollPane();
68
        scrollPane.setViewportView(types);
69
        this.add(scrollPane, BorderLayout.CENTER);        
70
    }
71

  
72
	private NewLayerService getService() {
73
		return this.wizard.getService();
74
	} 
75
}
tags/v2_0_0_Build_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/resources/org/gvsig/newlayer/lib/impl/newlayerfilters.properties
1
#point_geometries_only=
2
#curve_geometries_only=
3
#surface_geometries_only=
4
prov_demo=PROV < '10'
tags/v2_0_0_Build_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.newlayer.impl.NewLayerDefaultImplLibrary
tags/v2_0_0_Build_2032/libraries/org.gvsig.newlayer/org.gvsig.newlayer.lib/org.gvsig.newlayer.lib.impl/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.newlayer.lib.impl</artifactId>
6
	<packaging>jar</packaging>
7
	<name>org.gvsig.newlayer.lib.impl</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.newlayer.lib.api</artifactId>
17
			<version>1.0.0-SNAPSHOT</version>
18
		</dependency>
19
		<dependency>
20
			<groupId>org.gvsig</groupId>
21
			<artifactId>org.gvsig.newlayer.lib.api</artifactId>
22
			<version>1.0.0-SNAPSHOT</version>
23
			<type>test-jar</type>
24
			<scope>test</scope>
25
		</dependency>
26
		<dependency>
27
            <groupId>org.gvsig</groupId>
28
            <artifactId>org.gvsig.tools.lib</artifactId>
29
            <scope>compile</scope>
30
        </dependency>
31
        <dependency>
32
            <groupId>org.gvsig</groupId>
33
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
34
            <scope>compile</scope>
35
        </dependency>
36
        <dependency>
37
            <groupId>org.gvsig</groupId>
38
            <artifactId>org.gvsig.fmap.dal</artifactId>    
39
            <scope>compile</scope>        
40
        </dependency>
41
        <dependency>
42
            <groupId>org.gvsig</groupId>
43
            <artifactId>org.gvsig.projection</artifactId>
44
            <scope>compile</scope>
45
        </dependency>
46
        <dependency>
47
            <groupId>org.gvsig</groupId>
48
            <artifactId>org.gvsig.projection</artifactId>  
49
            <classifier>cresques-impl</classifier>
50
            <scope>runtime</scope>      
51
        </dependency>   
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.fmap.geometry</artifactId>            
55
            <classifier>impl</classifier>
56
            <scope>runtime</scope>      
57
        </dependency>
58
        <dependency>
59
            <groupId>org.gvsig</groupId>
60
            <artifactId>org.gvsig.fmap.geometry</artifactId>
61
            <classifier>operation</classifier>      
62
            <scope>runtime</scope>
63
        </dependency>  
64
        <dependency>
65
            <groupId>org.gvsig</groupId>
66
            <artifactId>org.gvsig.fmap.dal</artifactId>         
67
            <classifier>impl</classifier>
68
            <scope>runtime</scope>
69
        </dependency> 
70
         <dependency>
71
            <groupId>org.gvsig</groupId>
72
            <artifactId>org.gvsig.fmap.dal.file</artifactId>           
73
            <scope>test</scope>
74
        </dependency>  
75
         <dependency>
76
            <groupId>org.gvsig</groupId>
77
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
78
            <classifier>store.dbf</classifier>
79
            <scope>test</scope>
80
        </dependency>  
81
        <dependency>
82
            <groupId>org.gvsig</groupId>
83
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
84
            <classifier>store.dbf</classifier>
85
            <scope>test</scope>
86
        </dependency>  
87
         <dependency>
88
            <groupId>org.gvsig</groupId>
89
            <artifactId>org.gvsig.fmap.dal.file</artifactId>
90
            <classifier>store.shp</classifier>
91
            <scope>test</scope>
92
        </dependency>  
93
         <dependency>
94
            <groupId>org.gvsig</groupId>
95
            <artifactId>org.gvsig.symbology.lib.impl</artifactId>           
96
            <scope>test</scope>
97
        </dependency>           
98
        <dependency>
99
            <groupId>org.gvsig</groupId>
100
            <artifactId>org.gvsig.fmap.dal</artifactId>
101
            <classifier>spi</classifier>
102
            <scope>runtime</scope>      
103
        </dependency> 
104
        <dependency>
105
            <groupId>org.gvsig</groupId>
106
            <artifactId>org.gvsig.compat</artifactId>           
107
            <classifier>se</classifier>     
108
            <scope>runtime</scope>      
109
        </dependency>   
110
        <dependency>
111
	        <groupId>org.gvsig</groupId>
112
	        <artifactId>org.gvsig.ui</artifactId>
113
	        <version>2.0.1-SNAPSHOT</version>
114
	        <scope>compile</scope>
115
		</dependency>
116
		<dependency>
117
			<groupId>org.gvsig</groupId>
118
			<artifactId>org.gvsig.utils</artifactId>
119
			<version>2.0-SNAPSHOT</version>
120
			<scope>compile</scope>
121
		</dependency>
122
		<dependency>
123
            <groupId>org.gvsig</groupId>
124
            <artifactId>org.gvsig.i18n</artifactId>
125
            <scope>compile</scope>
126
        </dependency>
127
         <dependency>
128
            <groupId>org.gvsig</groupId>
129
            <artifactId>org.gvsig.tools.swing.api</artifactId>
130
            <scope>compile</scope>
131
        </dependency>
132
          <dependency>
133
            <groupId>org.gvsig</groupId>
134
            <artifactId>org.gvsig.tools.swing.impl</artifactId>
135
            <scope>runtime</scope>
136
        </dependency>
137
	</dependencies>
138
	<properties>
139
        <build-dir>${basedir}/../../../build</build-dir>
140
    </properties>
141

  
142
</project>
0 143

  
tags/v2_0_0_Build_2032/libraries/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_2032/libraries/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_2032/libraries/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_2032/libraries/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
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff