Statistics
| Revision:

gvsig-catalog / org.gvsig.catalog / branches / org.gvsig.catalog-CSW2.0.2 / org.gvsig.catalog / org.gvsig.catalog.lib / src / main / java / org / gvsig / catalog / srw / drivers / SRWMessages.java @ 55

History | View | Annotate | Download (7.23 KB)

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
 }