Revision 3566 trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/srw/drivers/SRWMessages.java
SRWMessages.java | ||
---|---|---|
1 |
|
|
1 | 2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
2 | 3 |
* |
3 | 4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
... | ... | |
43 | 44 |
* |
44 | 45 |
* $Id$ |
45 | 46 |
* $Log$ |
46 |
* Revision 1.1 2005-12-22 08:31:43 jorpiell |
|
47 |
* Revision 1.2 2006-01-10 09:32:49 jorpiell |
|
48 |
* 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. |
|
49 |
* |
|
50 |
* Revision 1.1 2005/12/22 08:31:43 jorpiell |
|
47 | 51 |
* 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. |
48 | 52 |
* |
49 | 53 |
* |
50 |
*/ |
|
51 |
|
|
52 |
|
|
54 |
*/ |
|
53 | 55 |
package es.gva.cit.catalogClient.srw.drivers; |
54 |
|
|
55 |
import org.apache.commons.httpclient.NameValuePair; |
|
56 |
|
|
57 | 56 |
import es.gva.cit.catalogClient.drivers.IProtocolMessages; |
58 | 57 |
import es.gva.cit.catalogClient.protocols.SOAPProtocol; |
59 | 58 |
import es.gva.cit.catalogClient.querys.Query; |
60 | 59 |
import es.gva.cit.catalogClient.srw.filters.SRWFilter; |
60 |
import org.apache.commons.httpclient.NameValuePair; |
|
61 | 61 |
|
62 | 62 |
/** |
63 | 63 |
* This class create the SRW protocol messages |
64 |
* |
|
65 |
* |
|
64 | 66 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
65 | 67 |
*/ |
66 |
public class SRWMessages implements IProtocolMessages{ |
|
67 |
private SRWCatalogServiceDriver driver; |
|
68 |
|
|
69 |
public SRWMessages(SRWCatalogServiceDriver driver){ |
|
68 |
public class SRWMessages implements IProtocolMessages { |
|
69 |
/** |
|
70 |
* |
|
71 |
* |
|
72 |
*/ |
|
73 |
private SRWCatalogServiceDriver driver; |
|
74 |
|
|
75 |
/** |
|
76 |
* |
|
77 |
* |
|
78 |
* |
|
79 |
* @param driver |
|
80 |
*/ |
|
81 |
public SRWMessages(SRWCatalogServiceDriver driver) { |
|
70 | 82 |
this.driver = driver; |
71 |
} |
|
72 |
|
|
73 |
public NameValuePair[] getHTTPGETCapabilities(boolean upper) { |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* |
|
87 |
* |
|
88 |
* |
|
89 |
* @return |
|
90 |
* @param upper |
|
91 |
*/ |
|
92 |
public NameValuePair[] getHTTPGETCapabilities(boolean upper) { |
|
74 | 93 |
NameValuePair nvp1 = new NameValuePair("OPERATION", "explain"); |
75 | 94 |
NameValuePair nvp2 = new NameValuePair("VERSION", driver.getVersion()); |
76 |
|
|
77 | 95 |
return new NameValuePair[] { nvp1, nvp2 }; |
78 |
} |
|
96 |
}
|
|
79 | 97 |
|
80 |
public NameValuePair[] getHTTPGETDescribeRecords() { |
|
98 |
/** |
|
99 |
* |
|
100 |
* |
|
101 |
* |
|
102 |
* @return |
|
103 |
*/ |
|
104 |
public NameValuePair[] getHTTPGETDescribeRecords() { |
|
81 | 105 |
// TODO Auto-generated method stub |
82 | 106 |
return null; |
83 |
} |
|
107 |
}
|
|
84 | 108 |
|
85 |
public NameValuePair[] getHTTPGETRecords(Query query, int firstRecord) { |
|
86 |
SRWFilter qsrwd = new SRWFilter(query); |
|
87 |
|
|
109 |
/** |
|
110 |
* |
|
111 |
* |
|
112 |
* |
|
113 |
* @return |
|
114 |
* @param query |
|
115 |
* @param firstRecord |
|
116 |
*/ |
|
117 |
public NameValuePair[] getHTTPGETRecords(Query query, int firstRecord) { |
|
118 |
|
|
88 | 119 |
NameValuePair nvp1 = new NameValuePair("operation", "searchRetrieve"); |
89 | 120 |
NameValuePair nvp2 = new NameValuePair("version", driver.getVersion()); |
90 |
NameValuePair nvp3 = new NameValuePair("query", qsrwd.getQuery(null));
|
|
121 |
NameValuePair nvp3 = new NameValuePair("query", new SRWFilter().getQuery(query,null));
|
|
91 | 122 |
NameValuePair nvp4 = new NameValuePair("maximumRecords", "10"); |
92 | 123 |
NameValuePair nvp5 = new NameValuePair("recordPacking", |
93 | 124 |
driver.getOutputFormat()); |
94 | 125 |
NameValuePair nvp6 = new NameValuePair("startRecord", |
95 | 126 |
new String(new Integer(firstRecord).toString())); |
96 |
|
|
97 | 127 |
return new NameValuePair[] { nvp1, nvp2, nvp3, nvp4, nvp5, nvp6 }; |
98 |
} |
|
128 |
}
|
|
99 | 129 |
|
100 |
public String getHTTPPOSTCapabilities() { |
|
130 |
/** |
|
131 |
* |
|
132 |
* |
|
133 |
* |
|
134 |
* @return |
|
135 |
*/ |
|
136 |
public String getHTTPPOSTCapabilities() { |
|
101 | 137 |
// TODO Auto-generated method stub |
102 | 138 |
return null; |
103 |
} |
|
139 |
}
|
|
104 | 140 |
|
105 |
public String getHTTPPOSTDescribeRecords() { |
|
141 |
/** |
|
142 |
* |
|
143 |
* |
|
144 |
* |
|
145 |
* @return |
|
146 |
*/ |
|
147 |
public String getHTTPPOSTDescribeRecords() { |
|
106 | 148 |
// TODO Auto-generated method stub |
107 | 149 |
return null; |
108 |
} |
|
150 |
}
|
|
109 | 151 |
|
110 |
public String getHTTPPOSTRecords(Query query, int firstRecord) { |
|
152 |
/** |
|
153 |
* |
|
154 |
* |
|
155 |
* |
|
156 |
* @return |
|
157 |
* @param query |
|
158 |
* @param firstRecord |
|
159 |
*/ |
|
160 |
public String getHTTPPOSTRecords(Query query, int firstRecord) { |
|
111 | 161 |
// TODO Auto-generated method stub |
112 | 162 |
return null; |
113 |
} |
|
163 |
}
|
|
114 | 164 |
|
115 |
public String getSOAPCapabilities() { |
|
165 |
/** |
|
166 |
* |
|
167 |
* |
|
168 |
* |
|
169 |
* @return |
|
170 |
*/ |
|
171 |
public String getSOAPCapabilities() { |
|
116 | 172 |
String soapMessage = |
117 | 173 |
"<SRW:explainRequest xmlns:SRW=\"http://www.loc.gov/zing/srw/\">" + |
118 | 174 |
"<SRW:version>" + driver.getVersion() + "</SRW:version>" + |
119 | 175 |
"</SRW:explainRequest>"; |
120 |
|
|
121 | 176 |
return SOAPProtocol.setSOAPMessage(soapMessage,null); |
122 |
} |
|
177 |
}
|
|
123 | 178 |
|
124 |
public String getSOAPDescribeRecords() { |
|
179 |
/** |
|
180 |
* |
|
181 |
* |
|
182 |
* |
|
183 |
* @return |
|
184 |
*/ |
|
185 |
public String getSOAPDescribeRecords() { |
|
125 | 186 |
// TODO Auto-generated method stub |
126 | 187 |
return null; |
127 |
} |
|
188 |
}
|
|
128 | 189 |
|
129 |
public String getSOAPRecords(Query query, int firstRecord) { |
|
130 |
SRWFilter qsrwd = new SRWFilter(query); |
|
131 |
|
|
190 |
/** |
|
191 |
* |
|
192 |
* |
|
193 |
* |
|
194 |
* @return |
|
195 |
* @param query |
|
196 |
* @param firstRecord |
|
197 |
*/ |
|
198 |
public String getSOAPRecords(Query query, int firstRecord) { |
|
199 |
|
|
132 | 200 |
String soapMessage = |
133 | 201 |
"<srw:searchRetrieveRequest xmlns:srw=\"http://www.loc.gov/zing/srw/\">" + |
134 |
"<srw:query><![CDATA[" + qsrwd.getQuery(null) + "]]></srw:query>" +
|
|
202 |
"<srw:query><![CDATA[" + new SRWFilter().getQuery(query,null) + "]]></srw:query>" +
|
|
135 | 203 |
"<srw:sortKeys xsi:nil=\"true\"/>" + "<srw:startRecord>" + |
136 | 204 |
driver.getStartPosition() + "</srw:startRecord>" + "<srw:maximumRecords>" + |
137 | 205 |
driver.getMaxRecords() + "</srw:maximumRecords>" + "<srw:recordPacking>" + |
... | ... | |
139 | 207 |
driver.getOutputSchema()[0] + "</srw:recordSchema>" + |
140 | 208 |
"<srw:resultSetTTL>" + driver.getResultSetTTL() + "</srw:resultSetTTL>" + |
141 | 209 |
"</srw:searchRetrieveRequest>"; |
142 |
|
|
143 | 210 |
return SOAPProtocol.setSOAPMessage(soapMessage,null); |
144 |
} |
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
} |
|
211 |
} |
|
212 |
} |
Also available in: Unified diff