Statistics
| Revision:

svn-gvsig-desktop / branches / v05 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / srw / drivers / SRWMessages.java @ 4488

History | View | Annotate | Download (7.36 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 4488 2006-03-21 07:18:18Z jorpiell $
46
* $Log$
47
* Revision 1.4.2.3  2006-03-21 07:17:48  jorpiell
48
* El gazetteer ya reproyecta. Se han tenido que modificar los parsers de todos los protocolos.
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.catalogClient.srw.drivers;
77
import es.gva.cit.catalogClient.csw.filters.CSWFilter;
78
import es.gva.cit.catalogClient.drivers.IProtocolMessages;
79
import es.gva.cit.catalogClient.protocols.SOAPProtocol;
80
import es.gva.cit.catalogClient.querys.Query;
81
import es.gva.cit.catalogClient.schemas.Schemas;
82
import es.gva.cit.catalogClient.srw.filters.IDEESRWFilter;
83
import es.gva.cit.catalogClient.srw.filters.SRWFilter;
84
import org.apache.commons.httpclient.NameValuePair;
85

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

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

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

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

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

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

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

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

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

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

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