Statistics
| Revision:

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

History | View | Annotate | Download (6.84 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 3903 2006-02-02 13:44:59Z jorpiell $
46
* $Log$
47
* Revision 1.4.2.1  2006-02-02 13:44:59  jorpiell
48
* 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
49
*
50
* Revision 1.4  2006/01/12 13:52:24  jorpiell
51
* 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
52
*
53
* Revision 1.3  2006/01/10 17:23:23  jorpiell
54
* 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
55
*
56
* Revision 1.2  2006/01/10 09:32:49  jorpiell
57
* 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.
58
*
59
* Revision 1.1  2005/12/22 08:31:43  jorpiell
60
* 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.
61
*
62
*
63
*/
64
package es.gva.cit.catalogClient.srw.drivers;
65
import es.gva.cit.catalogClient.csw.filters.CSWFilter;
66
import es.gva.cit.catalogClient.drivers.IProtocolMessages;
67
import es.gva.cit.catalogClient.protocols.SOAPProtocol;
68
import es.gva.cit.catalogClient.querys.Query;
69
import es.gva.cit.catalogClient.schemas.Schemas;
70
import es.gva.cit.catalogClient.srw.filters.IDEESRWFilter;
71
import es.gva.cit.catalogClient.srw.filters.SRWFilter;
72
import org.apache.commons.httpclient.NameValuePair;
73

    
74
/**
75
 * This class create the SRW protocol messages
76
 * 
77
 * 
78
 * @author Jorge Piera Llodra (piera_jor@gva.es)
79
 */
80
public class SRWMessages implements IProtocolMessages {
81
/**
82
 * 
83
 * 
84
 */
85
    private SRWCatalogServiceDriver driver;
86

    
87
/**
88
 * 
89
 * 
90
 * 
91
 * @param driver 
92
 */
93
    public  SRWMessages(SRWCatalogServiceDriver driver) {        
94
        this.driver = driver;
95
    } 
96

    
97
/**
98
 * 
99
 * 
100
 * 
101
 * @return 
102
 * @param upper 
103
 */
104
    public NameValuePair[] getHTTPGETCapabilities(boolean upper) {        
105
     NameValuePair nvp1 = new NameValuePair("OPERATION", "explain");
106
     NameValuePair nvp2 = new NameValuePair("VERSION", driver.getVersion());
107
        return new NameValuePair[] { nvp1, nvp2 };
108
    } 
109

    
110
/**
111
 * 
112
 * 
113
 * 
114
 * @return 
115
 */
116
    public NameValuePair[] getHTTPGETDescribeRecords() {        
117
        // TODO Auto-generated method stub
118
        return null;
119
    } 
120

    
121
/**
122
 * 
123
 * 
124
 * 
125
 * @return 
126
 * @param query 
127
 * @param firstRecord 
128
 */
129
    public NameValuePair[] getHTTPGETRecords(Query query, int firstRecord) {        
130
       
131
        NameValuePair nvp1 = new NameValuePair("operation", "searchRetrieve");
132
        NameValuePair nvp2 = new NameValuePair("version", driver.getVersion());
133
        NameValuePair nvp3 = new NameValuePair("query", new SRWFilter().getQuery(query,null));
134
        NameValuePair nvp4 = new NameValuePair("maximumRecords", "10");
135
        NameValuePair nvp5 = new NameValuePair("recordPacking",
136
                driver.getOutputFormat());
137
        NameValuePair nvp6 = new NameValuePair("startRecord",
138
                new String(new Integer(firstRecord).toString()));
139
        return new NameValuePair[] { nvp1, nvp2, nvp3, nvp4, nvp5, nvp6 };
140
    } 
141

    
142
/**
143
 * 
144
 * 
145
 * 
146
 * @return 
147
 */
148
    public String getHTTPPOSTCapabilities() {        
149
        // TODO Auto-generated method stub
150
        return null;
151
    } 
152

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

    
164
/**
165
 * 
166
 * 
167
 * 
168
 * @return 
169
 * @param query 
170
 * @param firstRecord 
171
 */
172
    public String getHTTPPOSTRecords(Query query, int firstRecord) {        
173
        // TODO Auto-generated method stub
174
        return null;
175
    } 
176

    
177
/**
178
 * 
179
 * 
180
 * 
181
 * @return 
182
 */
183
    public String getSOAPCapabilities() {        
184
        String soapMessage =
185
            "<SRW:explainRequest xmlns:SRW=\"http://www.loc.gov/zing/srw/\">" +
186
            "<SRW:version>" + driver.getVersion() + "</SRW:version>" +
187
            "</SRW:explainRequest>";
188
        return SOAPProtocol.setSOAPMessage(soapMessage,null);
189
    } 
190

    
191
/**
192
 * 
193
 * 
194
 * 
195
 * @return 
196
 */
197
    public String getSOAPDescribeRecords() {        
198
        // TODO Auto-generated method stub
199
        return null;
200
    } 
201

    
202
/**
203
 * 
204
 * 
205
 * 
206
 * @return 
207
 * @param query 
208
 * @param firstRecord 
209
 */
210
    public String getSOAPRecords(Query query, int firstRecord) {        
211
            
212
        String soapMessage =
213
            "<srw:searchRetrieveRequest xmlns:srw=\"http://www.loc.gov/zing/srw/\">" +
214
            "<srw:query><![CDATA[" + new IDEESRWFilter().getQuery(query,null) + "]]></srw:query>" +
215
            "<srw:sortKeys xsi:nil=\"true\"/>" + "<srw:startRecord>" +
216
            driver.getStartPosition() + "</srw:startRecord>" + "<srw:maximumRecords>" +
217
            driver.getMaxRecords() + "</srw:maximumRecords>" + "<srw:recordPacking>" +
218
            driver.getOutputFormat() + "</srw:recordPacking>" + "<srw:recordSchema>" +
219
            driver.getOutputSchema()[0] + "</srw:recordSchema>" +
220
            "<srw:resultSetTTL>" + driver.getResultSetTTL() + "</srw:resultSetTTL>" +
221
            "</srw:searchRetrieveRequest>";
222
        return SOAPProtocol.setSOAPMessage(soapMessage,null);
223
    } 
224
 }