Revision 36883

View differences:

tags/v2_0_0_Build_2038/applications/appGazetteer/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
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
5
                      http://maven.apache.org/maven-v4_0_0.xsd">
6

  
7
	<modelVersion>4.0.0</modelVersion>
8
	<groupId>org.gvsig</groupId>
9
	<artifactId>org.gvsig.gazetteer</artifactId>
10
	<packaging>jar</packaging>
11
	<version>2.0-SNAPSHOT</version>
12
	<name>appGazetteer</name>
13
	<description>Web Gazetteer Service client (geographic names locating)</description>
14
	<url>http://maven.apache.org</url>
15
	<parent>
16
		<groupId>org.gvsig</groupId>
17
		<artifactId>gvsig-base-library-pom</artifactId>
18
		<version>2.0-SNAPSHOT</version>
19
	</parent>	
20
	<distributionManagement>
21
		<site>
22
			<id>gvsig-repository</id>
23
			<url>${site-repository}/</url>
24
		</site>
25
	</distributionManagement>
26
	<dependencies>			
27
        <dependency>
28
            <groupId>org.slf4j</groupId>
29
            <artifactId>slf4j-api</artifactId>
30
            <scope>compile</scope>
31
        </dependency>
32
        <dependency>
33
            <groupId>org.gvsig</groupId>
34
            <artifactId>org.gvsig.tools.lib</artifactId>
35
            <scope>compile</scope>
36
        </dependency>
37
		<dependency>
38
			<groupId>org.gvsig</groupId>
39
			<artifactId>org.gvsig.i18n</artifactId>
40
            <scope>compile</scope>
41
		</dependency>
42
		<dependency>
43
			<groupId>org.gvsig</groupId>
44
			<artifactId>org.gvsig.utils</artifactId>
45
            <scope>compile</scope>
46
		</dependency>
47
		<dependency>
48
			<groupId>org.gvsig</groupId>
49
			<artifactId>org.gvsig.remoteclient</artifactId>
50
            <scope>compile</scope>
51
		</dependency>
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.catalog</artifactId>
55
            <scope>compile</scope>
56
        </dependency>
57
        <dependency>
58
            <groupId>org.gvsig</groupId>
59
            <artifactId>org.gvsig.gpe.extension</artifactId>
60
            <classifier>fmap</classifier>
61
            <version>2.0-SNAPSHOT</version>
62
            <scope>compile</scope>
63
        </dependency>
64
        <dependency>
65
            <groupId>org.gvsig</groupId>
66
            <artifactId>org.gvsig.compat</artifactId>
67
            <scope>compile</scope>
68
        </dependency>        
69
		<dependency>
70
			<groupId>com.vividsolutions</groupId>
71
			<artifactId>jts</artifactId>
72
            <scope>compile</scope>
73
		</dependency>
74
		<dependency>
75
			<groupId>org.gvsig</groupId>
76
			<artifactId>org.gvsig.gpe.lib.api</artifactId>		
77
            <scope>compile</scope>  
78
		</dependency>
79
		<dependency>
80
			<groupId>org.gvsig</groupId>
81
			<artifactId>org.gvsig.gpe.lib.impl</artifactId>
82
            <scope>compile</scope>	
83
		</dependency>
84
		<dependency>
85
			<groupId>org.geonames</groupId>
86
			<artifactId>geonames</artifactId>
87
			<classifier>java5</classifier>
88
            <scope>compile</scope>  
89
		</dependency>
90
		<dependency>
91
			<groupId>com.vividsolutions</groupId>
92
			<artifactId>jtsio</artifactId>
93
            <scope>compile</scope>  
94
		</dependency>
95
		<dependency>
96
            <groupId>org.gvsig</groupId>
97
            <artifactId>org.gvsig.xmlschema.lib.api</artifactId>
98
            <scope>compile</scope>
99
        </dependency>
100
        <dependency>
101
            <groupId>commons-httpclient</groupId>
102
            <artifactId>commons-httpclient</artifactId>
103
            <scope>compile</scope>
104
        </dependency>
105
	</dependencies>
106
	<properties>
107
		<build-dir>${basedir}/../build</build-dir>
108
        <eclipse.project.name>appGazetteer</eclipse.project.name>
109
	</properties>
110
	<build>
111
		<sourceDirectory>src</sourceDirectory>
112
		<testSourceDirectory>src-test</testSourceDirectory>
113
		<resources>
114
			<resource>
115
				<directory>src</directory>
116
				<includes>
117
					<include>**/*.gif</include>
118
					<include>**/*.png</include>
119
					<include>**/*.PNG</include>
120
					<include> **/*.bmp</include>
121
					<include> **/*.jpg</include>
122
					<include> **/*.jpeg</include>
123
					<include> **/*.properties</include>
124
				</includes>
125
			</resource>
126
			<resource>
127
				<directory>${basedir}/resources</directory>
128
			</resource>
129
		</resources>
130

  
131
		<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
132
		<plugins>
133
			<plugin>
134
				<groupId>org.apache.maven.plugins</groupId>
135
				<artifactId>maven-surefire-plugin</artifactId>
136
				<configuration>
137
					<skipTests>true</skipTests>
138
				</configuration>
139
			</plugin>
140
		</plugins>
141

  
142
	</build>
143
</project>
0 144

  
tags/v2_0_0_Build_2038/applications/appGazetteer/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.gazetteer.GazetteerLibrary
2
org.gvsig.gazetteer.impl.DefaultGazetteerLibrary
tags/v2_0_0_Build_2038/applications/appGazetteer/text.properties
1
catalog_search=B\u00fasqueda de Geodatos
2
gazetteer_search=Localizar por Nomencl\u00e1tor
3
gazetteer_connect=Localizar por Nomencl\u00e1tor
4
metadata_catalog=B\u00fasqueda de Geodatos - Conexi\u00f3n
5
metadata_tree=\u00c1rbol del Metadato
6
search_results=Resultados de la b\u00fasqueda
7
resourceTypeColumn=Tipo
8
resourceLinkColumn=Enlace
9
resourceShowColumn=Ver
10
concordancia=Concordancia
11
exactSentence=Frase Exacta
12
anyWord=Cualquier Palabra
13
allWords=Todas las Palabras
14
cathegoryAny=cualquiera
15
cathegoryBiota=biota
16
cathegoryBoundaries=boundaries
17
cathegoryClimatologyMeteorologyAtmosphere=climatologyMeteorologyAtmosphere
18
cathegoryEconomy=economy
19
cathegoryElevation=elevation
20
cathegoryEnvironment=environment
21
cathegoryFarming=farming
22
cathegoryGeoscientificInformation=geoscientificInformation
23
cathegoryHealth=health
24
cathegoryImageryBaseMapsEarthCover=imageryBaseMapsEarthCover
25
cathegoryInlandWaters=inlandWaters
26
cathegoryIntelligenceMilitary=intelligenceMilitary
27
cathegoryLocation=location
28
cathegoryOceans=oceans
29
cathegoryPlanningCadastre=planningCadastre
30
cathegorySociety=society
31
cathegoryStructure=structure
32
cathegoryTransportation=transportation
33
cathegoryUtilitiesCommunication=utilitiesCommunication
34
scaleAny=qualquiera
35
scaleI=>1.000.000
36
scaleII=1.000.000 - 250.000
37
scaleIII=250.000 - 50.000
38
scaleIV=50.000 - 10.000
39
scaleV=10.000 - 5000
40
scaleVI=<5.000
41
scale=Escala
42
provider=Proveedor
43
from=De:
44
to=A:
45
upperCoordinates=Superiores
46
lowerCoordinates=Inferiores
47
ULX=ULX:
48
ULY=ULY:
49
BRX=BRX:
50
BRY=BRY:
51
abstract=Resumen
52
coordinates=Coordenadas
53
coordinatesEqual=igual
54
coordinatesContains=contiene
55
coordinatesEnclose=incluye
56
coordinatesFullyOutsideOf=est\u00e1 totalmente fuera de
57
title=Titulo
58
restrictArea=Restringir el area de B\u00fasqueda
59
protocolsGroup=Protocolos
60
serverReply=Respuesta del servidor
61
serverURL=Introduzca la direcci\u00f3n donde se encuentra el servidor de cat\u00e1logo
62
serverURLCat=Introduzca la direcci\u00f3n donde se encuentra el servidor de nomencl\u00e1tor
63
database=Nombre de la base de datos
64
connectButton=Conectar
65
searchButton=Buscar
66
results=Resultados
67
of=de
68
description=Descripcion
69
layer=A\u00f1adir Capa
70
next=Siquiente
71
last=Anterior
72
close=Cerrar
73
value=Valor
74
attributes=Atributos
75
keyWords=Palabras Clave
76
cathegory=Categor\u00eda
77
lastUpdateDate=Fecha de \u00faltima actualizaci\u00f3n
78
purpose=Prop\u00f3sito
79
errorServerNotFound=No se encuentra el servidor
80
errorNotSupportedProtocol=El servidor no soporta el protocolo especificado
81
errorNotSupportedCapabilities=Error al hacer un GetCapabilities.Esto puede ser debido a dos razones: O bien ha habido un error al intentar hacer la operaci\u00f3n, o bien el servidor no soporta el protocolo especificado
82
errorNotParsedReply=Error al procesar la respuesta. Se ha encontrado el servidor, pero posiblemente no soporta el protocolo especificado
83
name=Nombre
84
resutsByPage=Resultados por p\u00e1gina
85
type=Tipo
86
localize=Localizar
87
page=P\u00e1gina
88
errorNotThesaurusSelected=El protocolo WFS no permite hacer b\u00fasquedas si no se elige un elemento del tesauro
89
chooseAttribute=Elige un atributo para hacer la b\u00fasqueda
90
errorGetRecords=Se ha producido un error al hacer el getRecords
91
anyResult=La b\u00fasqueda no ha producido ning\u00fan resultado
92
rootName=Ra\u00edz
93
wcsColumn=Cobertura
94
wmsColumn=Mapa
95
wfsColumn=Feature
96
postgisColumn=Postgis
97
linkColumn=P\u00e1gina Web
98
downloadColumn=Descarga
99
errorNotCSWSupportedProtocol=Se ha encontrado el servidor, pero parece ser que no soporta el protocolo CS-W
100
errorIsASRWServer=Es un servidor SRW!
101
errorServerException=El servidor ha devuelto una excepci\u00f3n
102
errorSOAPProtocol=Error en el protocolo SOAP
103
errorFENotSupported=De momento solo se pueden hacer querys usando la codificaci\u00f3n FILTER ENCODING que no est\u00e1 soportada por el servidor
104
mantainold=Eliminar las busquedas anteriores
105
goto=Hacer un zoom a la b\u00fasqueda
106
paint=Dibujar el resultado
107
aspect=Configuracion de aspecto
108
unknown=Desconocido
109
cancelSearchButton=Cancelar
110
wmsError=Ha ocurrido un error al cargar el mapa
111
loadWMS=Carga de WMS
112
wfsError=Ha ocurrido un error al cargar la feature
113
wfsLoad=Carga de WFS
114
wcsError=Ha ocurrido un error al cargar la cobertura
115
wcsLoad=Carga de WCS
116
postgisError=Ha ocurrido un error al cargar la base de datos
117
postgisLoad=Carga de Postgis
118
linkError=Ha ocurrido un error al cargar el enlace
119
linkLoad=carga de un recurso web
120
link=Enlace
121
server=Servidor
122
layer=Capa
123
parameters=Par\u00e1metros
124
pluginNotFound=No tienes ninguna extensi\u00f3n para cargar recursos de este tipo
125
pluginNotFoundTitle=Carga de capas
126
inteligentSearch=B\u00fasqueda inteligente
127
inteligentSearchAscii=Todas las formas de la palabra
128
reproyectar_aviso=La proyecci\u00F3n de la capa no es igual que la de la vista.\nAVISO\: Puede ser inexacto con algunas transformaciones.\nPor favor, lea la documentaci\u00F3n.
129
reproyectar_pregunta=\u00BFDesea reproyectar?
130
elementName=ElementName
131
propertiesNameWindow=Ventana de propiedades
tags/v2_0_0_Build_2038/applications/appGazetteer/src-test/org/gvsig/gazetteer/drivers/ExampleNewDriver.java
1
package org.gvsig.gazetteer.drivers;
2

  
3
import java.awt.geom.Point2D;
4
import java.net.URI;
5

  
6
import org.gvsig.catalog.drivers.DiscoveryServiceCapabilities;
7
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
8
import org.gvsig.gazetteer.querys.Feature;
9
import org.gvsig.gazetteer.querys.GazetteerQuery;
10

  
11

  
12
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
13
 *
14
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
15
 *
16
 * This program is free software; you can redistribute it and/or
17
 * modify it under the terms of the GNU General Public License
18
 * as published by the Free Software Foundation; either version 2
19
 * of the License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
29
 *
30
 * For more information, contact:
31
 *
32
 *  Generalitat Valenciana
33
 *   Conselleria d'Infraestructures i Transport
34
 *   Av. Blasco Ib??ez, 50
35
 *   46010 VALENCIA
36
 *   SPAIN
37
 *
38
 *      +34 963862235
39
 *   gvsig@gva.es
40
 *      www.gvsig.gva.es
41
 *
42
 *    or
43
 *
44
 *   IVER T.I. S.A
45
 *   Salamanca 50
46
 *   46005 Valencia
47
 *   Spain
48
 *
49
 *   +34 963163400
50
 *   dac@iver.es
51
 */
52
/* CVS MESSAGES:
53
 *
54
 * $Id: ExampleNewDriver.java 537 2007-07-26 11:21:10 +0000 (Thu, 26 Jul 2007) jpiera $
55
 * $Log$
56
 * Revision 1.1.2.1  2007/07/13 12:00:35  jorpiell
57
 * Add the posibility to add a new panel
58
 *
59
 *
60
 */
61
/**
62
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
63
 */
64
public class ExampleNewDriver extends AbstractGazetteerServiceDriver {
65

  
66
	/*
67
	 * (non-Javadoc)
68
	 * @see es.gva.cit.catalogClient.drivers.IDiscoveryServiceDriver#getCapabilities(java.net.URI)
69
	 */
70
	public DiscoveryServiceCapabilities getCapabilities(URI uri) {
71
		return new GazetteerCapabilities();
72
	}
73

  
74
	/*
75
	 * (non-Javadoc)
76
	 * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getFeature(java.net.URI, es.gva.cit.gazetteer.querys.Query)
77
	 */
78
	public Feature[] getFeature(URI uri, GazetteerQuery query) throws Exception {
79
		String prop = (String)query.getProperty("PROP1");
80
		Feature[] features = new Feature[1];
81
		features[0] = new Feature("1","Result 1","description 1",new Point2D.Double(0,0));
82
		return features;
83
	}
84

  
85
	/*
86
	 * (non-Javadoc)
87
	 * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getServiceName()
88
	 */
89
	public String getServiceName() {
90
		return "My service";
91
	}
92
	
93
	/*
94
	 * (non-Javadoc)
95
	 * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getAditionalSearchPanel()
96
	 */
97
	public SearchAditionalPropertiesPanel getAditionalSearchPanel(){
98
		return new ExampleNewPanel();
99
	}
100

  
101
}
0 102

  
tags/v2_0_0_Build_2038/applications/appGazetteer/src-test/org/gvsig/gazetteer/drivers/ExampleNewDriverTest.java
1
package org.gvsig.gazetteer.drivers;
2

  
3
import javax.swing.UIManager;
4
import javax.swing.UnsupportedLookAndFeelException;
5

  
6
import org.gvsig.gazetteer.GazetteerLocator;
7
import org.gvsig.gazetteer.ui.serverconnect.ServerConnectDialog;
8
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
9

  
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: ExampleNewDriverTest.java 512 2007-07-24 11:25:43 +0000 (Tue, 24 Jul 2007) jorpiell $
54
 * $Log$
55
 * Revision 1.1.2.2  2007/07/24 11:25:42  jorpiell
56
 * The registers has been refactorized
57
 *
58
 * Revision 1.1.2.1  2007/07/13 12:00:35  jorpiell
59
 * Add the posibility to add a new panel
60
 *
61
 *
62
 */
63
/**
64
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
65
 */
66
public class ExampleNewDriverTest {
67

  
68
	/**
69
	 * @param args
70
	 */
71
	public static void main(String[] args) {
72
		new DefaultLibrariesInitializer().fullInitialize();
73
		
74
		GazetteerLocator.getGazetteerManager().register("example", ExampleNewDriver.class);
75
		//Get the currently installed look and feel
76
		UIManager.getLookAndFeel();
77
		// Install a different look and feel; specifically, the Windows look and feel
78
		try {
79
			UIManager.setLookAndFeel(
80
					"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
81
		} catch (InstantiationException e) {
82
		} catch (ClassNotFoundException e) {
83
		} catch (UnsupportedLookAndFeelException e) {
84
		} catch (IllegalAccessException e) {
85
		}
86

  
87
		new ServerConnectDialog();
88
	}
89

  
90
}
0 91

  
tags/v2_0_0_Build_2038/applications/appGazetteer/src-test/org/gvsig/gazetteer/drivers/ExampleNewPanel.java
1
package org.gvsig.gazetteer.drivers;
2

  
3
import java.util.Properties;
4

  
5
import javax.swing.JLabel;
6
import javax.swing.JTextField;
7

  
8
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
9

  
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: ExampleNewPanel.java 537 2007-07-26 11:21:10 +0000 (Thu, 26 Jul 2007) jpiera $
54
 * $Log$
55
 * Revision 1.1.2.1  2007/07/13 12:00:35  jorpiell
56
 * Add the posibility to add a new panel
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
62
 */
63
public class ExampleNewPanel extends SearchAditionalPropertiesPanel{
64
	JLabel label = null;
65
	JTextField text = null;
66
	
67
	public ExampleNewPanel(){
68
		label = new JLabel();
69
		text = new JTextField();		
70
		setLayout(new java.awt.BorderLayout());
71
		label.setText("Label");
72
		add(label, java.awt.BorderLayout.WEST);		
73
		add(text, java.awt.BorderLayout.CENTER);
74
	}
75
	
76
	/*
77
	 * (non-Javadoc)
78
	 * @see es.gva.cit.gazetteer.ui.search.SearchAditionalPropertiesPanel#getProperties()
79
	 */
80
	public Properties getProperties() {
81
		Properties properties = new Properties();
82
		properties.put("PROP1", text.getText());
83
		return properties;
84
	}
85

  
86
}
0 87

  
tags/v2_0_0_Build_2038/applications/appGazetteer/src-test/org/gvsig/gazetteer/URIs.java
1
package org.gvsig.gazetteer;
2

  
3
import java.net.URISyntaxException;
4

  
5

  
6
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
7
 *
8
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
23
 *
24
 * For more information, contact:
25
 *
26
 *  Generalitat Valenciana
27
 *   Conselleria d'Infraestructures i Transport
28
 *   Av. Blasco Ib??ez, 50
29
 *   46010 VALENCIA
30
 *   SPAIN
31
 *
32
 *      +34 963862235
33
 *   gvsig@gva.es
34
 *      www.gvsig.gva.es
35
 *
36
 *    or
37
 *
38
 *   IVER T.I. S.A
39
 *   Salamanca 50
40
 *   46005 Valencia
41
 *   Spain
42
 *
43
 *   +34 963163400
44
 *   dac@iver.es
45
 */
46
/* CVS MESSAGES:
47
 *
48
 * $Id: URIs.java 499 2007-07-10 11:18:10 +0000 (Tue, 10 Jul 2007) jorpiell $
49
 * $Log$
50
 * Revision 1.1.2.1  2007/07/10 11:18:03  jorpiell
51
 * Added the registers
52
 *
53
 *
54
 */
55
/**
56
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
57
 */
58
public class URIs {
59

  
60
	/**
61
	 * @param args
62
	 * @throws URISyntaxException 
63
	 */
64
	public static void main(String[] args) throws URISyntaxException {
65
		java.net.URI uri = new java.net.URI("www.upv.es");
66
		System.out.println(uri.getHost());
67
		System.out.println(uri.getPort());
68
		System.out.println(uri.getScheme());
69
		java.net.URI uri1 = new java.net.URI("z3950://www.upv.es");
70
		System.out.println(uri1.getHost());
71
		System.out.println(uri1.getPort());
72
		System.out.println(uri1.getScheme());
73
	}
74

  
75
}
0 76

  
tags/v2_0_0_Build_2038/applications/appGazetteer/src/org/gvsig/gazetteer/adl/languages/AdlLanguage.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.gazetteer.adl.languages;
43

  
44
import java.util.Iterator;
45

  
46
import org.gvsig.catalog.languages.AbstractGeneralLanguage;
47

  
48
/**
49
 * This class is used to create a query in the language supported
50
 * by the ADL protocol
51
 * 
52
 * 
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 * @see http://www.alexandria.ucsb.edu/gazetteer/protocol/
55
 */
56
public class AdlLanguage extends AbstractGeneralLanguage {
57

  
58
/**
59
 * It Adds a new clause of the query
60
 * 
61
 * @param value Parameter value
62
 * 
63
 * @param parameter Parameter name
64
 * @param line 
65
 * @param concordancia "E" (Exact phrase), "A" (All words) or "Y" (anY word).
66
 * @param option operation option
67
 */
68
    public void addClauses(String parameter, String line, String concordancia, String option) {        
69
        currentClause = null;
70
      
71
        Iterator values = parseValues(line, concordancia);
72
        addClauses(parameter, values, concordancia,option);
73
    } 
74

  
75
/**
76
 * 
77
 * 
78
 * 
79
 * @param parameter 
80
 * @param values 
81
 * @param concordancia 
82
 * @param operator 
83
 */
84
    public void addClauses(String parameter, Iterator values, String concordancia, String operator) {        
85
           while (values.hasNext())
86
               addTerm(parameter, (String) values.next(), concordancia);
87
           addCurrentClauseQuery(operator);
88
    } 
89

  
90
/**
91
 * It adds a new term to the full query
92
 * 
93
 * 
94
 * @param parameter Parameter name
95
 * @param value Parameter Value
96
 * @param concordancia "E" (Exact phrase), "A" (All words) or "Y" (anY word).
97
 */
98
    private void addTerm(String parameter, String value, String concordancia) {        
99
       StringBuffer term = new StringBuffer();
100
       term.append(switchOperation(parameter,value));
101
       if (currentClause == null) {
102
           currentClause = term.toString();
103
       } else {
104
           currentClause = currentClause + term.toString();
105
           currentClause = enterLabel(currentClause, getOperator(concordancia));
106
       }
107
    } 
108

  
109
/**
110
 * It adds the "and" label to join different operations
111
 * 
112
 * 
113
 * @param operator 
114
 */
115
    protected void addCurrentClauseQuery(String operator) {        
116
       if (currentClause != null) {
117
           if (currentQuery == null) {
118
               currentQuery = currentClause;
119
           } else {
120
               currentQuery = currentQuery + currentClause;
121
               currentQuery = enterLabel(currentQuery,operator);
122
           }
123
       }
124
    } 
125

  
126
/**
127
 * Envuelve a una pregunta con una etiqueta
128
 * 
129
 * 
130
 * @return String : parte de la query en el lenguaje soportado
131
 * @param pregunta Pregunta a envolver
132
 * @param etiqueta Nombre de la etiqueta
133
 */
134
    public String enterLabel(String pregunta, String etiqueta) {        
135
           return "<" + etiqueta + ">" + pregunta + "</" + etiqueta + ">";
136
       
137
    } 
138

  
139
/**
140
 * It returns the encoded query
141
 * 
142
 * 
143
 * @return 
144
 */
145
    public String toString() {        
146
            return "<query-request>" +
147
                    "<gazetteer-query>" + 
148
            		currentQuery +
149
            		"</gazetteer-query>" +
150
            	    "<report-format>standard</report-format>" +
151
            	    "</query-request>";
152
               
153
    } 
154

  
155
/**
156
 * it is used to choose the opeartion.
157
 * 
158
 * 
159
 * @return 
160
 * @param parameter Parameter name
161
 * @param value Parameter value
162
 */
163
    public String switchOperation(String parameter, String value) {        
164
            if (parameter.toLowerCase().equals("title")){
165
                return containsPhrase(value);
166
            }
167
            if (parameter.toLowerCase().equals("thesaurus")){
168
                return classQuery(value);
169
            }
170
            if (parameter.toLowerCase().equals("coordinates")){
171
                return addBoundingBox(value);
172
            }
173
            return "";
174
    } 
175

  
176
/**
177
 * It writes a contains-phase operator of the ADL language
178
 * 
179
 * 
180
 * @return 
181
 * @param value Toponim value
182
 */
183
    public String containsPhrase(String value) {        
184
             return "<name-query operator=\"contains-phrase\" "
185
             	+ "text=\"" + value + "\"/>";
186
    } 
187

  
188
/**
189
 * It writes a class-query operator of the ADL language
190
 * 
191
 * 
192
 * @return 
193
 * @param value Thesaurus value
194
 */
195
    public String classQuery(String value) {        
196
            return "<class-query " +
197
            	"thesaurus=\"ADL Feature Type Thesaurus\" " +
198
            	"term=\"" + value + "\"/>";
199
    } 
200

  
201
/**
202
 * It Adds a Bounding Box query
203
 * 
204
 * 
205
 * @return 
206
 * @param coordinates Coordinates to find
207
 * @param option 
208
 */
209
    public String addBoundingBox(String coordinates) {        
210
            return "<footprint-query operator=\"overlaps\">" +
211
            		"<gml:Box>" +
212
            		"<gml:coordinates>" + coordinates + "</gml:coordinates>" +
213
            		"</gml:Box>" +
214
            		"</footprint-query>";
215
        
216
    } 
217

  
218
/**
219
 * Return logic operators
220
 * 
221
 * 
222
 * @return Or or And
223
 * @param titleKeys E,A o Y --> Exact, All, anY
224
 */
225
    public String getOperator(String titleKeys) {        
226
             if (titleKeys.equals("Y")) {
227
                return "or";
228
            } else {
229
                return "and";
230
            }
231
    } 
232
 }
0 233

  
tags/v2_0_0_Build_2038/applications/appGazetteer/src/org/gvsig/gazetteer/adl/filters/ADLFilter.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.gazetteer.adl.filters;
43
import java.util.Vector;
44

  
45
import org.gvsig.catalog.utils.Strings;
46
import org.gvsig.gazetteer.adl.languages.AdlLanguage;
47
import org.gvsig.gazetteer.filters.AbstractFilter;
48
import org.gvsig.gazetteer.querys.GazetteerQuery;
49

  
50

  
51
/**
52
 * This class create a query using the gazetteer query language used by
53
 * ADL
54
 * 
55
 * 
56
 * @author Jorge Piera Llodra (piera_jor@gva.es)
57
 * @see http://www.alexandria.ucsb.edu/gazetteer/protocol/
58
 */
59
public class ADLFilter extends AbstractFilter {
60
	private boolean withAccents = true;
61
/**
62
 * 
63
 * 
64
 */
65
    public  ADLFilter(boolean withAccents) {        
66
        super();
67
        this.withAccents = withAccents;
68
    } 
69

  
70
/**
71
 * 
72
 * 
73
 * 
74
 * @return 
75
 * @param query 
76
 */
77
    public String getQuery(GazetteerQuery query) {        
78
        AdlLanguage filter = new AdlLanguage();
79
                
80
        if (query.getName() != null) {
81
        	if (query.getOptions().getSearch().isWithAccents()){
82
        		Vector v = Strings.allWordForms(query.getName(),withAccents);
83
        		for (int i=0 ; i<v.size() ; i++){
84
        			String str = (String)v.get(i);
85
        			filter.addClauses("title",str,query.getNameFilter(),"or");
86
        		}        		
87
        	}else{
88
        		filter.addClauses("title",query.getName(),query.getNameFilter(),"and");
89
        	}        	
90
        }  
91
                
92
        if ((query.getFeatures() != null) && (query.getFeatures().length != 0)){
93
            if (!(query.getFeatures()[0].getName().equals("ThesaurusRoot")))
94
                filter.addClauses("thesaurus",query.getFeatures()[0].getName(),"E","and");
95
        }
96
        
97
        if ((query.getCoordinates() != null) && (query.isCoordinatesClicked())){
98
            String sNorth = query.getCoordinates().getUly();
99
            String sWest = query.getCoordinates().getUlx();
100
            String sSouth = query.getCoordinates().getBry();
101
            String sEast = query.getCoordinates().getBrx();
102
            String sCoordinates = sWest + "," + sSouth + " " + sEast + "," + sNorth;
103
            
104
            filter.addClauses("coordinates",sCoordinates,"E",getRelation(query.getCoordinatesFilter()));
105
        }
106
              
107
        return filter.toString();
108
    } 
109

  
110
/**
111
 * Return a value for the option of the 'Coordenates Filter'
112
 * 
113
 * @param relation String in the combo. Possible values:
114
 * encloses
115
 * overlaps
116
 * fullyOutsideOf
117
 * equals
118
 * 
119
 * @return String
120
 * Possible values:
121
 * overlaps
122
 * within
123
 * contains
124
 * @param relacion 
125
 */
126
    private static String getRelation(String relacion) {        
127
        if (relacion.equals("igual")) {
128
            return "contains";
129
        }
130
        if (relacion.equals("contiene")) {
131
            return "contains";
132
        }
133
        if (relacion.equals("incluye")) {
134
            return "within";
135
            
136
        } else {
137
            return "overlaps";
138
        }
139
    } 
140
 }
0 141

  
tags/v2_0_0_Build_2038/applications/appGazetteer/src/org/gvsig/gazetteer/adl/drivers/ADLSearchByName.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42
package org.gvsig.gazetteer.adl.drivers;
43
import java.net.URI;
44
import java.net.URISyntaxException;
45

  
46
import org.gvsig.gazetteer.querys.Feature;
47
import org.gvsig.gazetteer.querys.GazetteerQuery;
48

  
49

  
50
/**
51
 * This class is used to find and return the coordinates for a place.
52
 * 
53
 * 
54
 * @author Jorge Piera Llodra (piera_jor@gva.es)
55
 */
56
public class ADLSearchByName extends ADLGazetteerServiceDriver {
57
	public String serverURL = "http://testbed.alexandria.ucsb.edu:8080/gaz/adl_gaz2/dispatch";
58

  
59
	/**
60
	 * This class needs the server URL to work
61
	 * @param url Server URL
62
	 */
63
	public  ADLSearchByName(String uri) {        
64
		super();
65
		setServerURI(uri);
66
	} 
67

  
68
	/**
69
	 * Constructor witout fileds
70
	 * 
71
	 */
72
	public  ADLSearchByName() {        
73
		super();
74
	} 
75

  
76
	/**
77
	 * It searches and returns an array of features.
78
	 * 
79
	 * 
80
	 * @return 
81
	 * @param placeName String with the place name to find.
82
	 */
83
	public Feature[] search(String placeName) {        
84
		GazetteerQuery query = new GazetteerQuery(placeName,"populated places");
85
		try {
86
			return getFeature(new URI(getServerURI()),query);
87
		} catch (URISyntaxException e) {
88
			// TODO Auto-generated catch block
89
			e.printStackTrace();
90
		}
91
		return null;
92
	} 
93

  
94
	/**
95
	 * 
96
	 * 
97
	 * 
98
	 * @return Returns the serverURL.
99
	 */
100
	public String getServerURI() {        
101
		return serverURL;
102
	} 
103

  
104
	/**
105
	 * 
106
	 * 
107
	 * 
108
	 * @param serverURL The serverURL to set.
109
	 */
110
	public void setServerURI(String serverURL) {        
111
		this.serverURL = serverURL;
112
	} 
113
}
0 114

  
tags/v2_0_0_Build_2038/applications/appGazetteer/src/org/gvsig/gazetteer/adl/drivers/ADLGazetteerServiceDriver.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42
package org.gvsig.gazetteer.adl.drivers;
43
import java.net.MalformedURLException;
44
import java.net.URI;
45
import java.net.URL;
46
import java.util.Collection;
47

  
48
import org.gvsig.catalog.drivers.DiscoveryServiceCapabilities;
49
import org.gvsig.catalog.metadataxml.XMLNode;
50
import org.gvsig.catalog.protocols.HTTPPostProtocol;
51
import org.gvsig.gazetteer.adl.filters.ADLFilter;
52
import org.gvsig.gazetteer.adl.parsers.AdlCapabilitiesParser;
53
import org.gvsig.gazetteer.adl.parsers.AdlFeatureParser;
54
import org.gvsig.gazetteer.drivers.AbstractGazetteerServiceDriver;
55
import org.gvsig.gazetteer.drivers.GazetteerCapabilities;
56
import org.gvsig.gazetteer.drivers.IGazetteerServiceDriver;
57
import org.gvsig.gazetteer.querys.Feature;
58
import org.gvsig.gazetteer.querys.GazetteerQuery;
59
import org.gvsig.utils.swing.jcomboServer.ServerData;
60

  
61

  
62

  
63
/**
64
 * This class implements the driver to connect with a
65
 * ADL gazetteer service
66
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
67
 * @see http://alexandria.sdc.ucsb.edu/
68
 */
69
public class ADLGazetteerServiceDriver extends AbstractGazetteerServiceDriver implements IGazetteerServiceDriver {
70

  
71
	/*
72
	 * (non-Javadoc)
73
	 * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getCapabilities(java.net.URI)
74
	 */
75
	public DiscoveryServiceCapabilities getCapabilities(URI uri) {        
76
		GazetteerCapabilities capabilities = new GazetteerCapabilities();
77
		Collection nodes = new java.util.ArrayList();  
78
		URL url = null;
79
			try {
80
				url = uri.toURL();
81
			} catch (MalformedURLException e) {
82
				capabilities.setServerMessage("errorServerNotFound");
83
				capabilities.setAvailable(false);
84
				return capabilities;
85
			}        
86
		try {
87
			nodes = new HTTPPostProtocol().doQuery(uri.toURL(),
88
					getPOSTMessageCapabilities(), 0);
89
		} catch (MalformedURLException e) {
90
			capabilities.setServerMessage(e.getMessage());
91
			capabilities.setAvailable(false);
92
			return capabilities;
93
		}		
94
		AdlCapabilitiesParser parser = new AdlCapabilitiesParser(this, capabilities);
95
		parser.parse(nodes);
96
		return capabilities;
97
	} 
98
	
99
	/**
100
	 * It creates the XML for the getCapabilities request
101
	 * @return Name-value pair with a XML request
102
	 */
103
	private String getPOSTMessageCapabilities() {        
104
		return "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
105
		"<gazetteer-service " +
106
		"xmlns=\"http://www.alexandria.ucsb.edu/gazetteer\" " +
107
		"version=\"1.2\">" +
108
		"<get-capabilities-request/>" +
109
		"</gazetteer-service>";        
110
	} 	
111
	
112
	/*
113
	 * (non-Javadoc)
114
	 * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getFeature(java.net.URI, es.gva.cit.gazetteer.querys.Query)
115
	 */
116
	public Feature[] getFeature(URI uri, GazetteerQuery query) {        
117
		Collection nodes = new java.util.ArrayList();
118
		setQuery(query);
119
		URL url = null;
120
		try {
121
			url = uri.toURL();
122
		} catch (MalformedURLException e) {
123
			setServerAnswerReady("errorServerNotFound");
124
			return null;
125
		}    
126
		System.out.println("**************POST*************");
127
		System.out.println(getPOSTGetFeature(getQuery(),true));
128
		nodes = new HTTPPostProtocol().doQuery(url,
129
				getPOSTGetFeature(getQuery(),true), 0);
130

  
131
		if (nodes == null){
132
			System.out.println(getPOSTGetFeature(getQuery(),false));
133
			nodes = new HTTPPostProtocol().doQuery(url,
134
					getPOSTGetFeature(getQuery(),false), 0);
135
		}
136
		if ((nodes != null) && (nodes.size() == 1)){
137
			return AdlFeatureParser.parse((XMLNode)nodes.toArray()[0]);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff