Statistics
| Revision:

root / trunk / applications / appCatalogAndGazetteerClient / src / es / gva / cit / catalog / srw / drivers / SRWMessages.java @ 15558

History | View | Annotate | Download (7.24 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 es.gva.cit.catalog.srw.drivers;
77
import org.apache.commons.httpclient.NameValuePair;
78

    
79
import es.gva.cit.catalog.drivers.IProtocolMessages;
80
import es.gva.cit.catalog.protocols.SOAPProtocol;
81
import es.gva.cit.catalog.querys.CatalogQuery;
82
import es.gva.cit.catalog.srw.filters.IDEESRWFilter;
83
import es.gva.cit.catalog.srw.filters.SRWFilter;
84

    
85
/**
86
 * This class create the SRW protocol messages
87
 * 
88
 * 
89
 * @author Jorge Piera Llodra (piera_jor@gva.es)
90
 */
91
public class SRWMessages implements IProtocolMessages {
92
/**
93
 * 
94
 * 
95
 */
96
    private SRWCatalogServiceDriver driver;
97

    
98
/**
99
 * 
100
 * 
101
 * 
102
 * @param driver 
103
 */
104
    public  SRWMessages(SRWCatalogServiceDriver driver) {        
105
        this.driver = driver;
106
    } 
107

    
108
/**
109
 * 
110
 * 
111
 * 
112
 * @return 
113
 * @param upper 
114
 */
115
    public NameValuePair[] getHTTPGETCapabilities(boolean upper) {        
116
     NameValuePair nvp1 = new NameValuePair("OPERATION", "explain");
117
     NameValuePair nvp2 = new NameValuePair("VERSION", driver.getVersion());
118
        return new NameValuePair[] { nvp1, nvp2 };
119
    } 
120

    
121
/**
122
 * 
123
 * 
124
 * 
125
 * @return 
126
 */
127
    public NameValuePair[] getHTTPGETDescribeRecords() {        
128
        // TODO Auto-generated method stub
129
        return null;
130
    } 
131

    
132
/**
133
 * 
134
 * 
135
 * 
136
 * @return 
137
 * @param query 
138
 * @param firstRecord 
139
 */
140
    public NameValuePair[] getHTTPGETRecords(CatalogQuery query, int firstRecord) {        
141
       
142
        NameValuePair nvp1 = new NameValuePair("operation", "searchRetrieve");
143
        NameValuePair nvp2 = new NameValuePair("version", driver.getVersion());
144
        NameValuePair nvp3 = new NameValuePair("query", new SRWFilter().getQuery(query));
145
        NameValuePair nvp4 = new NameValuePair("maximumRecords", "10");
146
        NameValuePair nvp5 = new NameValuePair("recordPacking",
147
                driver.getOutputFormat());
148
        NameValuePair nvp6 = new NameValuePair("startRecord",
149
                new String(new Integer(firstRecord).toString()));
150
        return new NameValuePair[] { nvp1, nvp2, nvp3, nvp4, nvp5, nvp6 };
151
    } 
152

    
153
/**
154
 * 
155
 * 
156
 * 
157
 * @return 
158
 */
159
    public String getHTTPPOSTCapabilities() {        
160
        // TODO Auto-generated method stub
161
        return null;
162
    } 
163

    
164
/**
165
 * 
166
 * 
167
 * 
168
 * @return 
169
 */
170
    public String getHTTPPOSTDescribeRecords() {        
171
        // TODO Auto-generated method stub
172
        return null;
173
    } 
174

    
175
/**
176
 * 
177
 * 
178
 * 
179
 * @return 
180
 * @param query 
181
 * @param firstRecord 
182
 */
183
    public String getHTTPPOSTRecords(CatalogQuery query, int firstRecord) {        
184
        // TODO Auto-generated method stub
185
        return null;
186
    } 
187

    
188
/**
189
 * 
190
 * 
191
 * 
192
 * @return 
193
 */
194
    public String getSOAPCapabilities() {        
195
        String soapMessage =
196
            "<SRW:explainRequest xmlns:SRW=\"http://www.loc.gov/zing/srw/\">" +
197
            "<SRW:version>" + driver.getVersion() + "</SRW:version>" +
198
            "</SRW:explainRequest>";
199
        return SOAPProtocol.setSOAPMessage(soapMessage,null);
200
    } 
201

    
202
/**
203
 * 
204
 * 
205
 * 
206
 * @return 
207
 */
208
    public String getSOAPDescribeRecords() {        
209
        // TODO Auto-generated method stub
210
        return null;
211
    } 
212

    
213
/**
214
 * 
215
 * 
216
 * 
217
 * @return 
218
 * @param query 
219
 * @param firstRecord 
220
 */
221
    public String getSOAPRecords(CatalogQuery query, int firstRecord) {        
222
            
223
        String soapMessage =
224
            "<srw:searchRetrieveRequest xmlns:srw=\"http://www.loc.gov/zing/srw/\">" +
225
            "<srw:query><![CDATA[" + new IDEESRWFilter().getQuery(query) + "]]></srw:query>" +
226
            "<srw:sortKeys xsi:nil=\"true\"/>" + "<srw:startRecord>" +
227
            driver.getStartPosition() + "</srw:startRecord>" + "<srw:maximumRecords>" +
228
            driver.getMaxRecords() + "</srw:maximumRecords>" + "<srw:recordPacking>" +
229
            driver.getOutputFormat() + "</srw:recordPacking>" + "<srw:recordSchema>" +
230
            driver.getOutputSchema()[0] + "</srw:recordSchema>" +
231
            "<srw:resultSetTTL>" + driver.getResultSetTTL() + "</srw:resultSetTTL>" +
232
            "</srw:searchRetrieveRequest>";
233
        return SOAPProtocol.setSOAPMessage(soapMessage,null);
234
    } 
235
 }