Revision 142
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.catalog.lib</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
|
|
10 |
<description>Web Catalog Service library (geodata search)</description> |
|
11 |
|
|
12 |
<parent> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.catalog</artifactId> |
|
15 |
<version>2.0.17</version> |
|
16 |
</parent> |
|
17 |
|
|
18 |
<dependencies> |
|
19 |
|
|
20 |
<dependency> |
|
21 |
<groupId>org.slf4j</groupId> |
|
22 |
<artifactId>slf4j-api</artifactId> |
|
23 |
<scope>compile</scope> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
28 |
<scope>compile</scope> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.i18n</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.utils</artifactId> |
|
43 |
<scope>compile</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.remoteclient</artifactId> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>com.vividsolutions</groupId> |
|
52 |
<artifactId>jts</artifactId> |
|
53 |
</dependency> |
|
54 |
<dependency> |
|
55 |
<groupId>xerces</groupId> |
|
56 |
<artifactId>xercesImpl</artifactId> |
|
57 |
<scope>compile</scope> |
|
58 |
</dependency> |
|
59 |
<dependency> |
|
60 |
<groupId>org.dspace</groupId> |
|
61 |
<artifactId>cql-java</artifactId> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>jdom</groupId> |
|
65 |
<artifactId>jdom</artifactId> |
|
66 |
</dependency> |
|
67 |
<dependency> |
|
68 |
<groupId>commons-beanutils</groupId> |
|
69 |
<artifactId>commons-beanutils</artifactId> |
|
70 |
<scope>compile</scope> |
|
71 |
</dependency> |
|
72 |
<dependency> |
|
73 |
<groupId>commons-httpclient</groupId> |
|
74 |
<artifactId>commons-httpclient</artifactId> |
|
75 |
<scope>compile</scope> |
|
76 |
</dependency> |
|
77 |
<dependency> |
|
78 |
<groupId>soap</groupId> |
|
79 |
<artifactId>soap</artifactId> |
|
80 |
<scope>compile</scope> |
|
81 |
</dependency> |
|
82 |
<dependency> |
|
83 |
<groupId>org.jzkit</groupId> |
|
84 |
<artifactId>jzkit2-core</artifactId> |
|
85 |
<scope>compile</scope> |
|
86 |
</dependency> |
|
87 |
<dependency> |
|
88 |
<groupId>org.jzkit</groupId> |
|
89 |
<artifactId>jzkit2-z3950</artifactId> |
|
90 |
<scope>compile</scope> |
|
91 |
</dependency> |
|
92 |
<dependency> |
|
93 |
<groupId>org.jzkit</groupId> |
|
94 |
<artifactId>jzkit2-origin</artifactId> |
|
95 |
</dependency> |
|
96 |
<dependency> |
|
97 |
<groupId>org.jzkit</groupId> |
|
98 |
<artifactId>a2j-runtime</artifactId> |
|
99 |
</dependency> |
|
100 |
<dependency> |
|
101 |
<groupId>org.jzkit</groupId> |
|
102 |
<artifactId>a2j</artifactId> |
|
103 |
<scope>compile</scope> |
|
104 |
</dependency> |
|
105 |
<dependency> |
|
106 |
<groupId>org.springframework</groupId> |
|
107 |
<artifactId>spring</artifactId> |
|
108 |
<scope>compile</scope> |
|
109 |
</dependency> |
|
110 |
<dependency> |
|
111 |
<groupId>net.swing</groupId> |
|
112 |
<artifactId>amic-util</artifactId> |
|
113 |
<scope>compile</scope> |
|
114 |
</dependency> |
|
115 |
|
|
116 |
</dependencies> |
|
117 |
|
|
118 |
<build> |
|
119 |
|
|
120 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
121 |
<plugins> |
|
122 |
<plugin> |
|
123 |
<groupId>org.apache.maven.plugins</groupId> |
|
124 |
<artifactId>maven-surefire-plugin</artifactId> |
|
125 |
<configuration> |
|
126 |
<skipTests>true</skipTests> |
|
127 |
</configuration> |
|
128 |
</plugin> |
|
129 |
</plugins> |
|
130 |
|
|
131 |
</build> |
|
132 |
|
|
133 |
</project> |
|
0 | 134 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/drivers/ExampleNewDriver.java | ||
---|---|---|
1 |
package org.gvsig.catalog.catalog.drivers; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
|
|
5 |
import org.gvsig.catalog.CatalogLocator; |
|
6 |
import org.gvsig.catalog.CatalogManager; |
|
7 |
import org.gvsig.catalog.drivers.AbstractCatalogServiceDriver; |
|
8 |
import org.gvsig.catalog.drivers.CatalogCapabilities; |
|
9 |
import org.gvsig.catalog.drivers.DiscoveryServiceCapabilities; |
|
10 |
import org.gvsig.catalog.drivers.GetRecordsReply; |
|
11 |
import org.gvsig.catalog.querys.CatalogQuery; |
|
12 |
import org.gvsig.catalog.schemas.Record; |
|
13 |
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel; |
|
14 |
|
|
15 |
|
|
16 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
17 |
* |
|
18 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
19 |
* |
|
20 |
* This program is free software; you can redistribute it and/or |
|
21 |
* modify it under the terms of the GNU General Public License |
|
22 |
* as published by the Free Software Foundation; either version 2 |
|
23 |
* of the License, or (at your option) any later version. |
|
24 |
* |
|
25 |
* This program is distributed in the hope that it will be useful, |
|
26 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
27 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
28 |
* GNU General Public License for more details. |
|
29 |
* |
|
30 |
* You should have received a copy of the GNU General Public License |
|
31 |
* along with this program; if not, write to the Free Software |
|
32 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
33 |
* |
|
34 |
* For more information, contact: |
|
35 |
* |
|
36 |
* Generalitat Valenciana |
|
37 |
* Conselleria d'Infraestructures i Transport |
|
38 |
* Av. Blasco Ib??ez, 50 |
|
39 |
* 46010 VALENCIA |
|
40 |
* SPAIN |
|
41 |
* |
|
42 |
* +34 963862235 |
|
43 |
* gvsig@gva.es |
|
44 |
* www.gvsig.gva.es |
|
45 |
* |
|
46 |
* or |
|
47 |
* |
|
48 |
* IVER T.I. S.A |
|
49 |
* Salamanca 50 |
|
50 |
* 46005 Valencia |
|
51 |
* Spain |
|
52 |
* |
|
53 |
* +34 963163400 |
|
54 |
* dac@iver.es |
|
55 |
*/ |
|
56 |
/* CVS MESSAGES: |
|
57 |
* |
|
58 |
* $Id: ExampleNewDriver.java 537 2007-07-26 11:21:10Z jpiera $ |
|
59 |
* $Log$ |
|
60 |
* Revision 1.1.2.1 2007/07/13 12:00:35 jorpiell |
|
61 |
* Add the posibility to add a new panel |
|
62 |
* |
|
63 |
* |
|
64 |
*/ |
|
65 |
/** |
|
66 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
67 |
*/ |
|
68 |
public class ExampleNewDriver extends AbstractCatalogServiceDriver { |
|
69 |
private static final CatalogManager catalogManager = CatalogLocator.getCatalogManager(); |
|
70 |
|
|
71 |
/* |
|
72 |
* (non-Javadoc) |
|
73 |
* @see es.gva.cit.catalogClient.drivers.IDiscoveryServiceDriver#getCapabilities(java.net.URI) |
|
74 |
*/ |
|
75 |
public DiscoveryServiceCapabilities getCapabilities(URI uri) { |
|
76 |
return new CatalogCapabilities(); |
|
77 |
} |
|
78 |
|
|
79 |
/* |
|
80 |
* (non-Javadoc) |
|
81 |
* @see es.gva.cit.catalog.drivers.ICatalogServiceDriver#getRecords(java.net.URI, es.gva.cit.catalog.querys.CatalogQuery, int) |
|
82 |
*/ |
|
83 |
public GetRecordsReply getRecords(URI uri, CatalogQuery query, |
|
84 |
int firstRecord) { |
|
85 |
GetRecordsReply reply = new GetRecordsReply(1); |
|
86 |
Record record = catalogManager.createRecord(uri, null); |
|
87 |
record.setTitle("Record example"); |
|
88 |
record.setAbstract_("Just for testing"); |
|
89 |
reply.addRecord(record); |
|
90 |
return reply; |
|
91 |
} |
|
92 |
|
|
93 |
/* |
|
94 |
* (non-Javadoc) |
|
95 |
* @see es.gva.cit.catalog.drivers.IDiscoveryServiceDriver#getServiceName() |
|
96 |
*/ |
|
97 |
public String getServiceName() { |
|
98 |
return "My catalog service"; |
|
99 |
} |
|
100 |
|
|
101 |
/* |
|
102 |
* (non-Javadoc) |
|
103 |
* @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getAditionalSearchPanel() |
|
104 |
*/ |
|
105 |
public SearchAditionalPropertiesPanel getAditionalSearchPanel(){ |
|
106 |
return new ExampleNewPanel(); |
|
107 |
} |
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
} |
|
0 | 113 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/drivers/ExampleNewDriverTest.java | ||
---|---|---|
1 |
package org.gvsig.catalog.catalog.drivers; |
|
2 |
|
|
3 |
import javax.swing.UIManager; |
|
4 |
import javax.swing.UnsupportedLookAndFeelException; |
|
5 |
|
|
6 |
import org.gvsig.catalog.CatalogLocator; |
|
7 |
import org.gvsig.catalog.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:43Z 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 |
// DefaultCatalogLibrary library = new DefaultCatalogLibrary(); |
|
74 |
// library.initialize(); |
|
75 |
// library.postInitialize(); |
|
76 |
|
|
77 |
CatalogLocator.getCatalogManager().register("My catalog service", ExampleNewDriver.class); |
|
78 |
//Get the currently installed look and feel |
|
79 |
UIManager.getLookAndFeel(); |
|
80 |
// Install a different look and feel; specifically, the Windows look and feel |
|
81 |
try { |
|
82 |
UIManager.setLookAndFeel( |
|
83 |
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); |
|
84 |
} catch (InstantiationException e) { |
|
85 |
} catch (ClassNotFoundException e) { |
|
86 |
} catch (UnsupportedLookAndFeelException e) { |
|
87 |
} catch (IllegalAccessException e) { |
|
88 |
} |
|
89 |
|
|
90 |
new ServerConnectDialog(); |
|
91 |
} |
|
92 |
|
|
93 |
} |
|
0 | 94 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/drivers/ExampleNewPanel.java | ||
---|---|---|
1 |
package org.gvsig.catalog.catalog.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:10Z 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 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/utils/URIUtilsTest.java | ||
---|---|---|
1 |
package org.gvsig.catalog.catalog.utils; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
import java.net.URISyntaxException; |
|
5 |
|
|
6 |
import junit.framework.TestCase; |
|
7 |
|
|
8 |
import org.gvsig.catalog.utils.URIUtils; |
|
9 |
|
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
11 |
* |
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
13 |
* |
|
14 |
* This program is free software; you can redistribute it and/or |
|
15 |
* modify it under the terms of the GNU General Public License |
|
16 |
* as published by the Free Software Foundation; either version 2 |
|
17 |
* of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
* GNU General Public License for more details. |
|
23 |
* |
|
24 |
* You should have received a copy of the GNU General Public License |
|
25 |
* along with this program; if not, write to the Free Software |
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
27 |
* |
|
28 |
* For more information, contact: |
|
29 |
* |
|
30 |
* Generalitat Valenciana |
|
31 |
* Conselleria d'Infraestructures i Transport |
|
32 |
* Av. Blasco Ib??ez, 50 |
|
33 |
* 46010 VALENCIA |
|
34 |
* SPAIN |
|
35 |
* |
|
36 |
* +34 963862235 |
|
37 |
* gvsig@gva.es |
|
38 |
* www.gvsig.gva.es |
|
39 |
* |
|
40 |
* or |
|
41 |
* |
|
42 |
* IVER T.I. S.A |
|
43 |
* Salamanca 50 |
|
44 |
* 46005 Valencia |
|
45 |
* Spain |
|
46 |
* |
|
47 |
* +34 963163400 |
|
48 |
* dac@iver.es |
|
49 |
*/ |
|
50 |
/* CVS MESSAGES: |
|
51 |
* |
|
52 |
* $Id: URIUtilsTest.java,v 1.1.2.1 2007/07/10 11:18:04 jorpiell Exp $ |
|
53 |
* $Log: URIUtilsTest.java,v $ |
|
54 |
* Revision 1.1.2.1 2007/07/10 11:18:04 jorpiell |
|
55 |
* Added the registers |
|
56 |
* |
|
57 |
* |
|
58 |
*/ |
|
59 |
/** |
|
60 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
61 |
*/ |
|
62 |
public class URIUtilsTest extends TestCase { |
|
63 |
|
|
64 |
public void test1() throws URISyntaxException{ |
|
65 |
URI uri = URIUtils.createUri("http://www.upv.es", "http", 80); |
|
66 |
assertEquals(uri.getHost(), "www.upv.es"); |
|
67 |
assertEquals(uri.getScheme(), "http"); |
|
68 |
assertEquals(uri.getPort(), 80); |
|
69 |
assertEquals(uri.getPath(), ""); |
|
70 |
} |
|
71 |
|
|
72 |
public void test2() throws URISyntaxException{ |
|
73 |
URI uri = URIUtils.createUri("www.upv.es", "http", 80); |
|
74 |
assertEquals(uri.getHost(), "www.upv.es"); |
|
75 |
assertEquals(uri.getScheme(), "http"); |
|
76 |
assertEquals(uri.getPort(), 80); |
|
77 |
assertEquals(uri.getPath(), ""); |
|
78 |
} |
|
79 |
|
|
80 |
public void test3() throws URISyntaxException{ |
|
81 |
URI uri = URIUtils.createUri("www.upv.es", "z3950", 2100); |
|
82 |
assertEquals(uri.getHost(), "www.upv.es"); |
|
83 |
assertEquals(uri.getScheme(), "z3950"); |
|
84 |
assertEquals(uri.getPort(), 2100); |
|
85 |
assertEquals(uri.getPath(), ""); |
|
86 |
} |
|
87 |
|
|
88 |
public void test4() throws URISyntaxException{ |
|
89 |
URI uri = URIUtils.createUri("http://193.144.250.29/webservices/services/IDEC_GeoServeisPort", "http", 80); |
|
90 |
assertEquals(uri.getHost(), "193.144.250.29"); |
|
91 |
assertEquals(uri.getScheme(), "http"); |
|
92 |
assertEquals(uri.getPort(), 80); |
|
93 |
assertEquals(uri.getPath(), "/webservices/services/IDEC_GeoServeisPort"); |
|
94 |
} |
|
95 |
} |
|
0 | 96 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/srw/filters/IDEESRWFilter.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.catalog.srw.filters; |
|
43 |
import org.gvsig.catalog.filters.AbstractFilter; |
|
44 |
import org.gvsig.catalog.languages.FilterEncoding; |
|
45 |
import org.gvsig.catalog.querys.CatalogQuery; |
|
46 |
import org.gvsig.catalog.utils.Strings; |
|
47 |
import org.gvsig.i18n.Messages; |
|
48 |
|
|
49 |
/** |
|
50 |
* This class creates a RSW query for the IDEE server |
|
51 |
* |
|
52 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
53 |
*/ |
|
54 |
public class IDEESRWFilter extends AbstractFilter { |
|
55 |
|
|
56 |
public IDEESRWFilter() { |
|
57 |
super(); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Return a CQL-Text query |
|
62 |
* @param query |
|
63 |
* @return String |
|
64 |
* @param profile |
|
65 |
*/ |
|
66 |
public String getQuery(CatalogQuery query) { |
|
67 |
String pregunta = null; |
|
68 |
|
|
69 |
FilterEncoding filter = new FilterEncoding("", "*", "?", "\\"); |
|
70 |
|
|
71 |
if (query.getTitle() != null) { |
|
72 |
filter.addClauses("title", query.getTitle(), query.getTitleFilter(), |
|
73 |
"PropertyIsLike", "L", "And"); |
|
74 |
} |
|
75 |
|
|
76 |
if (query.isMinimized()){ |
|
77 |
if (query.getAbstract() != null) { |
|
78 |
filter.addClauses("subject", Strings.addAsteriscsFromAnArray(query.getAbstract()), |
|
79 |
"Y", "PropertyIsLike", "L", "Or"); |
|
80 |
} |
|
81 |
}else{ |
|
82 |
if (query.getAbstract() != null) { |
|
83 |
filter.addClauses("subject", Strings.addAsteriscsFromAnArray(query.getAbstract()), |
|
84 |
"Y", "PropertyIsLike", "L", "And"); |
|
85 |
} |
|
86 |
|
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
pregunta = filter.toString(); |
|
91 |
return pregunta; |
|
92 |
} |
|
93 |
|
|
94 |
/** |
|
95 |
* This function returns true only when the user has choosen the |
|
96 |
* "Fully Outside Of" of the coordinates option. |
|
97 |
* |
|
98 |
* |
|
99 |
* @return |
|
100 |
* @param translator |
|
101 |
* @param coordinatesOption |
|
102 |
*/ |
|
103 |
public boolean getCoordinatesOption(String coordinatesOption) { |
|
104 |
if ((coordinatesOption.equals(Messages.getText("coordinatesEqual"))) || |
|
105 |
(coordinatesOption.equals(Messages.getText("coordinatesContains"))) || |
|
106 |
(coordinatesOption.equals(Messages.getText("coordinatesEnclose")))) |
|
107 |
return false; |
|
108 |
|
|
109 |
return true; |
|
110 |
} |
|
111 |
|
|
112 |
} |
|
0 | 113 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/srw/filters/SRWFilter.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.catalog.srw.filters; |
|
43 |
import org.gvsig.catalog.filters.AbstractFilter; |
|
44 |
import org.gvsig.catalog.languages.CommonQueryLanguage; |
|
45 |
|
|
46 |
/** |
|
47 |
* This class create que query in the language suported by the SRW protocol |
|
48 |
* |
|
49 |
* |
|
50 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
51 |
*/ |
|
52 |
public class SRWFilter extends AbstractFilter { |
|
53 |
|
|
54 |
/** |
|
55 |
* |
|
56 |
* |
|
57 |
*/ |
|
58 |
public SRWFilter() { |
|
59 |
super(); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Devuelve un query en el lenguaje que soporte el protocolo SRW |
|
64 |
* |
|
65 |
* |
|
66 |
* @param query |
|
67 |
* @return String : query en el lenguaje soportado |
|
68 |
* @param profile |
|
69 |
*/ |
|
70 |
public String getQuery(org.gvsig.catalog.querys.CatalogQuery query) { |
|
71 |
String pregunta = null; |
|
72 |
// Construimos una RemoteBooleanQuery |
|
73 |
CommonQueryLanguage filter = new CommonQueryLanguage(); |
|
74 |
|
|
75 |
if (query.getTitle() != null) { |
|
76 |
filter.addClauses("dc.title", query.getTitle(), query.getTitleFilter(),"And"); |
|
77 |
} |
|
78 |
|
|
79 |
if (query.isMinimized()){ |
|
80 |
if (query.getAbstract() != null) { |
|
81 |
filter.addClauses("dc.subject", query.getAbstract(), "E", "Or"); |
|
82 |
} |
|
83 |
}else{ |
|
84 |
if (query.getAbstract() != null) { |
|
85 |
filter.addClauses("dc.subject", query.getAbstract(), "E", "And"); |
|
86 |
} |
|
87 |
|
|
88 |
if (query.getProvider() != null) { |
|
89 |
filter.addClauses("dc.creator", query.getProvider(), "E","And"); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
//if (this.getThemeKey() != null) |
|
94 |
//query.addClauses("", this.getThemeKey(),"Y"); |
|
95 |
//if (this.getScale() != null) |
|
96 |
//query.addClauses("map_scale", this.getScale(),"E"); |
|
97 |
|
|
98 |
//if (this.getDateFrom() != null) |
|
99 |
//query.addClauses("2072", "210", "4",this.getDateFrom(),"E"); |
|
100 |
//if (this.getDateTo() != null) |
|
101 |
//query.addClauses("2073", "210", "2",this.getDateTo(),"E"); |
|
102 |
pregunta = filter.toString(); |
|
103 |
System.out.println(pregunta); |
|
104 |
return pregunta; |
|
105 |
} |
|
106 |
} |
|
0 | 107 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/srw/drivers/SRWCatalogServiceDriver.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.catalog.srw.drivers; |
|
43 |
import java.net.MalformedURLException; |
|
44 |
import java.net.URI; |
|
45 |
import java.net.URL; |
|
46 |
import java.util.Collection; |
|
47 |
import java.util.StringTokenizer; |
|
48 |
|
|
49 |
import org.gvsig.catalog.drivers.AbstractCatalogServiceDriver; |
|
50 |
import org.gvsig.catalog.drivers.CatalogCapabilities; |
|
51 |
import org.gvsig.catalog.drivers.DiscoveryServiceCapabilities; |
|
52 |
import org.gvsig.catalog.drivers.GetRecordsReply; |
|
53 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
54 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
55 |
import org.gvsig.catalog.protocols.HTTPGetProtocol; |
|
56 |
import org.gvsig.catalog.protocols.SOAPProtocol; |
|
57 |
import org.gvsig.catalog.querys.CatalogQuery; |
|
58 |
import org.gvsig.catalog.srw.parsers.SrwCapabilitiesParser; |
|
59 |
import org.gvsig.utils.swing.jcomboServer.ServerData; |
|
60 |
|
|
61 |
/** |
|
62 |
* This class implements the CSW protocol. |
|
63 |
* |
|
64 |
* |
|
65 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
66 |
* @see http://www.loc.gov/z3950/agency/zing/srw/ |
|
67 |
*/ |
|
68 |
public class SRWCatalogServiceDriver extends AbstractCatalogServiceDriver { |
|
69 |
private String version = "1.1"; |
|
70 |
private String recordXPath; |
|
71 |
private String resultSetTTL; |
|
72 |
|
|
73 |
/* |
|
74 |
* (non-Javadoc) |
|
75 |
* @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getCapabilities(java.net.URI) |
|
76 |
*/ |
|
77 |
public DiscoveryServiceCapabilities getCapabilities(URI uri) { |
|
78 |
URL url = null; |
|
79 |
try { |
|
80 |
url = uri.toURL(); |
|
81 |
} catch (MalformedURLException e) { |
|
82 |
setServerAnswerReady("errorServerNotFound"); |
|
83 |
return null; |
|
84 |
} |
|
85 |
SRWMessages messages = new SRWMessages(this); |
|
86 |
Collection nodes = new HTTPGetProtocol().doQuery(url, |
|
87 |
messages.getHTTPGETCapabilities(true), 0); |
|
88 |
|
|
89 |
nodes = new SOAPProtocol().doQuery(url, messages.getSOAPCapabilities(), 0); |
|
90 |
new SrwCapabilitiesParser(this).parse((XMLNode)nodes.toArray()[0]); |
|
91 |
CatalogCapabilities capabilities = new CatalogCapabilities(); |
|
92 |
capabilities.setVersion(version); |
|
93 |
capabilities.setServerMessage(getServerAnswerReady()); |
|
94 |
return capabilities; |
|
95 |
} |
|
96 |
|
|
97 |
/* |
|
98 |
* (non-Javadoc) |
|
99 |
* @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getRecords(java.net.URI, es.gva.cit.catalogClient.querys.Query, int) |
|
100 |
*/ |
|
101 |
public GetRecordsReply getRecords(URI uri, CatalogQuery query, int firstRecord) { |
|
102 |
URL url = null; |
|
103 |
try { |
|
104 |
url = uri.toURL(); |
|
105 |
} catch (MalformedURLException e) { |
|
106 |
setServerAnswerReady("errorServerNotFound"); |
|
107 |
return null; |
|
108 |
} |
|
109 |
setQuery(query); |
|
110 |
SRWMessages messages = new SRWMessages(this); |
|
111 |
Collection nodes = new java.util.ArrayList(); |
|
112 |
|
|
113 |
//TODO remove this comparation |
|
114 |
if (url.getHost().equals("idee.unizar.es")){ |
|
115 |
try { |
|
116 |
url = new URL("http://idee.unizar.es/SRW/servlet/search/SRW"); |
|
117 |
} catch (MalformedURLException e) { |
|
118 |
// It will never throws |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
XMLNode root = null; |
|
123 |
nodes = new SOAPProtocol().doQuery(url, |
|
124 |
messages.getSOAPRecords(getQuery(), firstRecord), firstRecord); |
|
125 |
root = (XMLNode)nodes.toArray()[0]; |
|
126 |
root = root.getSubNode(0).getSubNode(0); |
|
127 |
|
|
128 |
String prefix = new StringTokenizer(root.getName(), ":").nextToken(); |
|
129 |
if (prefix.equals(root.getName())) { |
|
130 |
prefix = ""; |
|
131 |
} else { |
|
132 |
prefix = prefix + ":"; |
|
133 |
} |
|
134 |
int numberOfRecords = getNumberOfRecords(root, |
|
135 |
prefix + "numberOfRecords", |
|
136 |
null); |
|
137 |
|
|
138 |
if (numberOfRecords == -1) { |
|
139 |
return null; |
|
140 |
} |
|
141 |
GetRecordsReply recordsReply = new GetRecordsReply(numberOfRecords); |
|
142 |
|
|
143 |
parseRecords(root,recordsReply,uri,prefix,numberOfRecords,firstRecord); |
|
144 |
return recordsReply; |
|
145 |
} |
|
146 |
|
|
147 |
/** |
|
148 |
* Parser the XML |
|
149 |
* @param node |
|
150 |
* @param recordsReply |
|
151 |
* @param uri |
|
152 |
* @param prefix |
|
153 |
* @param numberOfRecords |
|
154 |
* @param firstRecord |
|
155 |
*/ |
|
156 |
private void parseRecords(XMLNode node, GetRecordsReply recordsReply, URI uri, String prefix, int numberOfRecords, int firstRecord) { |
|
157 |
|
|
158 |
XMLNode[] auxNodes = XMLTree.searchMultipleNode(node, |
|
159 |
prefix + "records->" + prefix + "record"); |
|
160 |
for (int i = 1; (i <= numberOfRecords) && (i <= 10) && (i <= (numberOfRecords - firstRecord + 1)); i++){ |
|
161 |
recordsReply.addRecord(uri, auxNodes[i - 1]); |
|
162 |
} |
|
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* |
|
168 |
* |
|
169 |
* |
|
170 |
* @return Returns the recordXPath. |
|
171 |
*/ |
|
172 |
public String getRecordXPath() { |
|
173 |
return recordXPath; |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
177 |
* |
|
178 |
* |
|
179 |
* |
|
180 |
* @param recordXPath The recordXPath to set. |
|
181 |
*/ |
|
182 |
public void setRecordXPath(String recordXPath) { |
|
183 |
this.recordXPath = recordXPath; |
|
184 |
} |
|
185 |
|
|
186 |
/** |
|
187 |
* |
|
188 |
* |
|
189 |
* |
|
190 |
* @return Returns the resultSetTTL. |
|
191 |
*/ |
|
192 |
public String getResultSetTTL() { |
|
193 |
return resultSetTTL; |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* |
|
198 |
* |
|
199 |
* |
|
200 |
* @param resultSetTTL The resultSetTTL to set. |
|
201 |
*/ |
|
202 |
public void setResultSetTTL(String resultSetTTL) { |
|
203 |
this.resultSetTTL = resultSetTTL; |
|
204 |
} |
|
205 |
|
|
206 |
/** |
|
207 |
* |
|
208 |
* |
|
209 |
* |
|
210 |
* @return Returns the version. |
|
211 |
*/ |
|
212 |
public String getVersion() { |
|
213 |
return version; |
|
214 |
} |
|
215 |
|
|
216 |
/** |
|
217 |
* |
|
218 |
* |
|
219 |
* |
|
220 |
* @param version The version to set. |
|
221 |
*/ |
|
222 |
public void setVersion(String version) { |
|
223 |
this.version = version; |
|
224 |
} |
|
225 |
|
|
226 |
/* |
|
227 |
* (non-Javadoc) |
|
228 |
* @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#isProtocolSupported(java.net.URI) |
|
229 |
*/ |
|
230 |
public boolean isProtocolSupported(URI uri) { |
|
231 |
return SOAPProtocol.isProtocolSupported(null); |
|
232 |
} |
|
233 |
|
|
234 |
/* |
|
235 |
* (non-Javadoc) |
|
236 |
* @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getServiceName() |
|
237 |
*/ |
|
238 |
public String getServiceName() { |
|
239 |
return ServerData.SERVER_SUBTYPE_CATALOG_SRW; |
|
240 |
} |
|
241 |
|
|
242 |
/* |
|
243 |
* (non-Javadoc) |
|
244 |
* @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getDefaultPort() |
|
245 |
*/ |
|
246 |
public int getDefaultPort() { |
|
247 |
return 80; |
|
248 |
} |
|
249 |
|
|
250 |
/* |
|
251 |
* (non-Javadoc) |
|
252 |
* @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getDefaultSchema() |
|
253 |
*/ |
|
254 |
public String getDefaultSchema() { |
|
255 |
return "http"; |
|
256 |
} |
|
257 |
} |
|
0 | 258 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/srw/drivers/SRWMessages.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 |
/* |
|
43 |
* CVS MESSAGES: |
|
44 |
* |
|
45 |
* $Id: SRWMessages.java 585 2007-09-03 10:21:55 +0000 (Mon, 03 Sep 2007) jpiera $ |
|
46 |
* $Log$ |
|
47 |
* Revision 1.6.10.1 2007/07/10 11:18:04 jorpiell |
|
48 |
* Added the registers |
|
49 |
* |
|
50 |
* Revision 1.6 2006/03/21 07:13:52 jorpiell |
|
51 |
* El gazetteer ya reproyecta. Se han tenido que modificar los parsers de todos los protocolos. |
|
52 |
* |
|
53 |
* Revision 1.4.2.2 2006/03/14 07:18:45 jorpiell |
|
54 |
* Se ha a?adido la goma de borrar y se ha cambiado el tama?o de los botones |
|
55 |
* |
|
56 |
* Revision 1.5 2006/03/01 13:23:20 jorpiell |
|
57 |
* Se ha a?adido al Head lo de la 0.6 y se ha hecho un commit |
|
58 |
* |
|
59 |
* Revision 1.4.2.1 2006/02/02 13:44:59 jorpiell |
|
60 |
* Se ha tenido que cambiar el driver SRW para acceder al servidor de cat?logo de la IDEE. Adem?s se ha creado un nuevo filtro para este servidor |
|
61 |
* |
|
62 |
* Revision 1.4 2006/01/12 13:52:24 jorpiell |
|
63 |
* Se ha a?adido un boton close en las dos pantallas de connect. Adem?s se ha cambiado el comportamiento de las ventanas para adaptarlo a la nueva forma de buscar multihilo |
|
64 |
* |
|
65 |
* Revision 1.3 2006/01/10 17:23:23 jorpiell |
|
66 |
* Se ha hecho una peque?a modificaci?n en el gazeteer: ahora funcionan las b?squedas restringiendo el ?rea en el WFSG. Hay muchos cambios porque se ha hecho un CONTROL+SHIFT+O sobre todo el proyecto para eliminar los imports y para ordenarlos |
|
67 |
* |
|
68 |
* Revision 1.2 2006/01/10 09:32:49 jorpiell |
|
69 |
* Se ha echo un commit de las versiones modificadas del catalogo y del gazetteer usando el Poseidon. Se han renombrado algunas clases por considerar que tenian un nombre confuso y se han cambiado algunas relaciones entre clases (con la intenci?n de separar GUI de la parte de control). Han habido clases que no han sido tocadas, pero como han sido formateadas usando el Poseidon TODAS las CLASES del proyecto han cambiado de versi?n. |
|
70 |
* |
|
71 |
* Revision 1.1 2005/12/22 08:31:43 jorpiell |
|
72 |
* Aqui tambien se han producido muchos cambis, porque hemos acabado de cambiar la estructura del cat?logo: Se han creado todas las clases "XXXMessages", que sacan toda la parte de los mensajes de los drivers. Ademas se ha incluido en "CatalogClient" la operaci?n "getCapabilities", que libera a la interfaz de algunas operaciones que hac?a anteriormente. |
|
73 |
* |
|
74 |
* |
|
75 |
*/ |
|
76 |
package org.gvsig.catalog.srw.drivers; |
|
77 |
import org.apache.commons.httpclient.NameValuePair; |
|
78 |
import org.gvsig.catalog.drivers.IProtocolMessages; |
|
79 |
import org.gvsig.catalog.protocols.SOAPProtocol; |
|
80 |
import org.gvsig.catalog.querys.CatalogQuery; |
|
81 |
import org.gvsig.catalog.srw.filters.IDEESRWFilter; |
|
82 |
import org.gvsig.catalog.srw.filters.SRWFilter; |
|
83 |
|
|
84 |
/** |
|
85 |
* This class create the SRW protocol messages |
|
86 |
* |
|
87 |
* |
|
88 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
89 |
*/ |
|
90 |
public class SRWMessages implements IProtocolMessages { |
|
91 |
/** |
|
92 |
* |
|
93 |
* |
|
94 |
*/ |
|
95 |
private SRWCatalogServiceDriver driver; |
|
96 |
|
|
97 |
/** |
|
98 |
* |
|
99 |
* |
|
100 |
* |
|
101 |
* @param driver |
|
102 |
*/ |
|
103 |
public SRWMessages(SRWCatalogServiceDriver driver) { |
|
104 |
this.driver = driver; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* |
|
109 |
* |
|
110 |
* |
|
111 |
* @return |
|
112 |
* @param upper |
|
113 |
*/ |
|
114 |
public NameValuePair[] getHTTPGETCapabilities(boolean upper) { |
|
115 |
NameValuePair nvp1 = new NameValuePair("OPERATION", "explain"); |
|
116 |
NameValuePair nvp2 = new NameValuePair("VERSION", driver.getVersion()); |
|
117 |
return new NameValuePair[] { nvp1, nvp2 }; |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* |
|
122 |
* |
|
123 |
* |
|
124 |
* @return |
|
125 |
*/ |
|
126 |
public NameValuePair[] getHTTPGETDescribeRecords() { |
|
127 |
// TODO Auto-generated method stub |
|
128 |
return null; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* |
|
133 |
* |
|
134 |
* |
|
135 |
* @return |
|
136 |
* @param query |
|
137 |
* @param firstRecord |
|
138 |
*/ |
|
139 |
public NameValuePair[] getHTTPGETRecords(CatalogQuery query, int firstRecord) { |
|
140 |
|
|
141 |
NameValuePair nvp1 = new NameValuePair("operation", "searchRetrieve"); |
|
142 |
NameValuePair nvp2 = new NameValuePair("version", driver.getVersion()); |
|
143 |
NameValuePair nvp3 = new NameValuePair("query", new SRWFilter().getQuery(query)); |
|
144 |
NameValuePair nvp4 = new NameValuePair("maximumRecords", "10"); |
|
145 |
NameValuePair nvp5 = new NameValuePair("recordPacking", |
|
146 |
driver.getOutputFormat()); |
|
147 |
NameValuePair nvp6 = new NameValuePair("startRecord", |
|
148 |
new String(new Integer(firstRecord).toString())); |
|
149 |
return new NameValuePair[] { nvp1, nvp2, nvp3, nvp4, nvp5, nvp6 }; |
|
150 |
} |
|
151 |
|
|
152 |
/** |
|
153 |
* |
|
154 |
* |
|
155 |
* |
|
156 |
* @return |
|
157 |
*/ |
|
158 |
public String getHTTPPOSTCapabilities() { |
|
159 |
// TODO Auto-generated method stub |
|
160 |
return null; |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* |
|
165 |
* |
|
166 |
* |
|
167 |
* @return |
|
168 |
*/ |
|
169 |
public String getHTTPPOSTDescribeRecords() { |
|
170 |
// TODO Auto-generated method stub |
|
171 |
return null; |
|
172 |
} |
|
173 |
|
|
174 |
/** |
|
175 |
* |
|
176 |
* |
|
177 |
* |
|
178 |
* @return |
|
179 |
* @param query |
|
180 |
* @param firstRecord |
|
181 |
*/ |
|
182 |
public String getHTTPPOSTRecords(CatalogQuery query, int firstRecord) { |
|
183 |
// TODO Auto-generated method stub |
|
184 |
return null; |
|
185 |
} |
|
186 |
|
|
187 |
/** |
|
188 |
* |
|
189 |
* |
|
190 |
* |
|
191 |
* @return |
|
192 |
*/ |
|
193 |
public String getSOAPCapabilities() { |
|
194 |
String soapMessage = |
|
195 |
"<SRW:explainRequest xmlns:SRW=\"http://www.loc.gov/zing/srw/\">" + |
|
196 |
"<SRW:version>" + driver.getVersion() + "</SRW:version>" + |
|
197 |
"</SRW:explainRequest>"; |
|
198 |
return SOAPProtocol.setSOAPMessage(soapMessage,null); |
|
199 |
} |
|
200 |
|
|
201 |
/** |
|
202 |
* |
|
203 |
* |
|
204 |
* |
|
205 |
* @return |
|
206 |
*/ |
|
207 |
public String getSOAPDescribeRecords() { |
|
208 |
// TODO Auto-generated method stub |
|
209 |
return null; |
|
210 |
} |
|
211 |
|
|
212 |
/** |
|
213 |
* |
|
214 |
* |
|
215 |
* |
|
216 |
* @return |
|
217 |
* @param query |
|
218 |
* @param firstRecord |
|
219 |
*/ |
|
220 |
public String getSOAPRecords(CatalogQuery query, int firstRecord) { |
|
221 |
|
|
222 |
String soapMessage = |
|
223 |
"<srw:searchRetrieveRequest xmlns:srw=\"http://www.loc.gov/zing/srw/\">" + |
|
224 |
"<srw:query><![CDATA[" + new IDEESRWFilter().getQuery(query) + "]]></srw:query>" + |
|
225 |
"<srw:sortKeys xsi:nil=\"true\"/>" + "<srw:startRecord>" + |
|
226 |
driver.getStartPosition() + "</srw:startRecord>" + "<srw:maximumRecords>" + |
|
227 |
driver.getMaxRecords() + "</srw:maximumRecords>" + "<srw:recordPacking>" + |
|
228 |
driver.getOutputFormat() + "</srw:recordPacking>" + "<srw:recordSchema>" + |
|
229 |
driver.getOutputSchema()[0] + "</srw:recordSchema>" + |
|
230 |
"<srw:resultSetTTL>" + driver.getResultSetTTL() + "</srw:resultSetTTL>" + |
|
231 |
"</srw:searchRetrieveRequest>"; |
|
232 |
return SOAPProtocol.setSOAPMessage(soapMessage,null); |
|
233 |
} |
|
234 |
} |
|
0 | 235 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/srw/parsers/SrwCapabilitiesParser.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.catalog.srw.parsers; |
|
43 |
import java.util.StringTokenizer; |
|
44 |
|
|
45 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
46 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
47 |
import org.gvsig.catalog.srw.drivers.SRWCatalogServiceDriver; |
|
48 |
|
|
49 |
/** |
|
50 |
* This class is used to parse the SRW capabilities |
|
51 |
* |
|
52 |
* |
|
53 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
54 |
*/ |
|
55 |
public class SrwCapabilitiesParser { |
|
56 |
/** |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
private SRWCatalogServiceDriver driver; |
|
61 |
|
|
62 |
/** |
|
63 |
* |
|
64 |
* |
|
65 |
* |
|
66 |
* @param driver |
|
67 |
*/ |
|
68 |
public SrwCapabilitiesParser(SRWCatalogServiceDriver driver) { |
|
69 |
this.driver = driver; |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* |
|
74 |
* |
|
75 |
* |
|
76 |
* @return |
|
77 |
* @param node |
|
78 |
*/ |
|
79 |
public boolean parse(XMLNode node) { |
|
80 |
if ((node == null) || (node.getName() == null)){ |
|
81 |
driver.setServerAnswerReady("errorNotSupportedProtocol"); |
|
82 |
return false; |
|
83 |
} |
|
84 |
|
|
85 |
if (node.getName().toLowerCase().equals("serviceexceptionreport")){ |
|
86 |
driver.setServerAnswerReady("errorServerException"); |
|
87 |
return false; |
|
88 |
} |
|
89 |
|
|
90 |
String prefix = new StringTokenizer(node.getName(), ":").nextToken(); |
|
91 |
prefix = prefix + ":"; |
|
92 |
driver.setOutputSchema(XMLTree.searchNodeValue(node, |
|
93 |
prefix + "record->" + prefix + "recordSchema")); |
|
94 |
driver.setOutputFormat(XMLTree.searchNodeValue(node, |
|
95 |
prefix + "record->" + prefix + "recordPacking")); |
|
96 |
driver.setStartPosition("1"); |
|
97 |
driver.setMaxRecords("10"); |
|
98 |
driver.setRecordXPath(""); |
|
99 |
driver.setResultSetTTL("0"); |
|
100 |
String title = XMLTree.searchNodeValue(node, |
|
101 |
prefix + "record->" + prefix + |
|
102 |
"recordData->explain->databaseInfo->title"); |
|
103 |
|
|
104 |
String description = XMLTree.searchNodeValue(node, |
|
105 |
prefix + "record->" + prefix + |
|
106 |
"recordData->explain->databaseInfo->description"); |
|
107 |
|
|
108 |
if (title != null){ |
|
109 |
driver.setServerAnswerReady(title + "\n"); |
|
110 |
if (description != null){ |
|
111 |
driver.setServerAnswerReady(driver.getServerAnswerReady() + |
|
112 |
description + "\n"); |
|
113 |
} |
|
114 |
}else{ |
|
115 |
driver.setServerAnswerReady(""); |
|
116 |
if (description != null){ |
|
117 |
driver.setServerAnswerReady(description + "\n"); |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
return true; |
|
124 |
|
|
125 |
} |
|
126 |
} |
|
0 | 127 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.17/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/CatalogAP.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 |
Also available in: Unified diff