Changeset 3054 for TI01-discovery
- Timestamp:
- 27/11/07 09:57:11 (13 years ago)
- Location:
- TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/AuthorSearchAgent.java
r2838 r3054 2 2 3 3 /** 4 * Agent class for full-text search4 * Agent class for author search. 5 5 * 6 * @author Matt Pritchard <m.j.pritchard@rl.ac.uk>6 * @author Matt Pritchard 7 7 */ 8 8 public class AuthorSearchAgent extends SearchAgent implements Searchable { 9 9 10 10 /** 11 * Default no-arg constructor.11 * Default no-argument constructor. 12 12 */ 13 13 public AuthorSearchAgent() {} 14 14 15 15 /** 16 * Constructor to set term. 16 * Constructor method, sets author search term 17 * @param term String containing author search term 17 18 */ 18 19 public AuthorSearchAgent(String term) … … 22 23 23 24 /** 24 * Sets the fullTextSearch term 25 * Overrides setTerm method of SearchAgent 26 * @param s String 25 * Sets the search term for an author search, wrapped in collection / xpath location template. 26 * @param s String containing author search term 27 27 */ 28 28 public void setTerm(String s) -
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/DiscoveryServiceClient.java
r2992 r3054 2 2 3 3 /** 4 * Helper class providing proxy methods for operations of NDG Discovery Web Service. Main() method demonstrate usage. 4 * Helper class providing proxy methods for operations of NDG Discovery Web Service. 5 * <p><code>main</code> method is hardcoded with example below to demonstrate usage:</p> 6 * <pre> 7 *try 8 *{ 9 * DiscoveryServiceClient client = new DiscoveryServiceClient("http://glue.badc.rl.ac.uk/axis2/services/DiscoveryService"); 10 * 11 * System.out.println( "Trying a doSearch..." ); 12 * String doSearchResult = client.doSearch( 13 * "<m:doSearch xmlns:m=\"urn:DiscoveryServiceAPI\"><m:term>*neodc*</m:term><m:termType>fullText</m:termType></m:doSearch>" 14 * ); 15 * System.out.println( doSearchResult ); 16 * 17 * System.out.println( "Trying a doPresent..." ); 18 * String doPresentResult = client.doPresent( 19 * "<m:doPresent xmlns:m=\"urn:DiscoveryServiceAPI\"><m:documents><m:document>neodc.nerc.ac.uk__DIF__dataent_11924879127625221.xml</m:document></m:documents><m:presentFormat>original</m:presentFormat></m:doPresent>" 20 * ); 21 * System.out.println( doPresentResult ); 22 * 23 *} 24 *catch (Exception e) 25 *{ 26 * System.out.println( e.toString() ); 27 *} 28 * </pre> 5 29 */ 6 30 public class DiscoveryServiceClient … … 46 70 47 71 /** 48 * Proxy method for doSearch operation72 * Acts as proxy method for doSearch operation 49 73 * @param reqDocAsString String containing XML request doc (see WSDL for structure) 50 74 * @return String containing SearchReturn (see WSDL for structure) … … 60 84 61 85 /** 62 * Proxy method for doPresent operation86 * Acts as proxy method for doPresent operation 63 87 * @param reqDocAsString String containing XML request doc (see WSDL for structure) 64 88 * @return String containing PresentReturn (see WSDL for structure) -
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/DiscoveryServiceSkeleton.java
r2840 r3054 9 9 10 10 /** 11 * DiscoveryServiceSkeleton 12 * Implementation class for NERC DataGrid Discovert Web Service 11 * Implementation class for NERC DataGrid Discovery Web Service. 13 12 * Based on DiscoveryServiceSkeleton.java which is generated by WSDL2Java 14 13 * @author Matt Pritchard … … 18 17 /** 19 18 * Performs the doFullTextSearch operation 19 * @param discoveryserviceapi.DoSearchDocument containing search request 20 * @return discoveryserviceapi.DoSearchReturnDocument containing search result 20 21 */ 21 22 public discoveryserviceapi.DoSearchReturnDocument doSearch … … 141 142 Hashtable document = (Hashtable)i.next(); 142 143 responseDocuments.addDocument( (String)document.get("name") ); 143 //thisDoc.setPosition( ((Integer)document.get("position")).intValue() );144 //thisDoc.setMatches( ((Integer)document.get("matches")).intValue() );145 //thisDoc.setUri( (String)document.get("name") );146 147 144 } 148 145 … … 161 158 /** 162 159 * Performs the doPresent operation 160 * @param discoveryserviceapi.DoPresentDocument containing search request 161 * @return discoveryserviceapi.DoPresentReturnDocument containing search result 163 162 */ 164 163 public discoveryserviceapi.DoPresentReturnDocument doPresent … … 216 215 /** 217 216 * Performs the getListNames operation 217 * @param discoveryserviceapi.GetListNamesDocument containing request 218 * @return discoveryserviceapi.GetListNamesReturnDocument containing result 218 219 */ 219 220 public discoveryserviceapi.GetListNamesReturnDocument getListNames … … 235 236 /** 236 237 * Performs the getList operation 238 * @param discoveryserviceapi.GetListDocument containing request 239 * @return discoveryserviceapi.GetListReturnDocument containing result 237 240 */ 238 241 public discoveryserviceapi.GetListReturnDocument getList -
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/FullTextSearchAgent.java
r1801 r3054 2 2 3 3 /** 4 * Agent class for full-text search 4 * Agent class for full-text search. 5 5 * 6 * @author Matt Pritchard <m.j.pritchard@rl.ac.uk>6 * @author Matt Pritchard 7 7 */ 8 8 public class FullTextSearchAgent extends SearchAgent implements Searchable { 9 9 10 10 /** 11 * Default no-arg constructor.11 * Default no-argument constructor. 12 12 */ 13 13 public FullTextSearchAgent() {} 14 14 15 15 /** 16 * Constructor to set term. 16 * Constructor method, sets full-text search term. 17 * @param term String containing full-text search term 17 18 */ 18 19 public FullTextSearchAgent(String term) … … 22 23 23 24 /** 24 * Sets the fullTextSearch term 25 * Overrides setTerm method of SearchAgent 26 * @param s String 25 * Sets the search term for a full-text search, wrapped in collection / xpath location template. 26 * @param s String containing author search term 27 27 */ 28 28 public void setTerm(String s) -
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/ParameterSearchAgent.java
r2514 r3054 2 2 3 3 /** 4 * Agent class for full-textsearch4 * Agent class for parameter search 5 5 * 6 6 * @author Matt Pritchard <m.j.pritchard@rl.ac.uk> … … 9 9 10 10 /** 11 * Default no-arg constructor.11 * Default no-argument constructor. 12 12 */ 13 13 public ParameterSearchAgent() {} 14 14 15 15 /** 16 * Constructor to set term. 16 * Constructor method, sets parameter search term. 17 * @param term String containing parameter search term 17 18 */ 18 19 public ParameterSearchAgent(String term) … … 22 23 23 24 /** 24 * Sets the fullTextSearch term 25 * Overrides setTerm method of SearchAgent 26 * @param s String 25 * Sets the search term for a parameter search, wrapped in collection / xpath location template. 26 * @param s String containing parameter search term 27 27 */ 28 28 public void setTerm(String s) -
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/PresentSummary.java
r1751 r3054 5 5 /** 6 6 * Simple container for the summary results of a present. 7 *8 7 */ 9 8 public class PresentSummary … … 14 13 private Vector documents; 15 14 16 /** Default no-arg constructor */ 15 /** 16 * Default no-argument constructor 17 */ 17 18 public PresentSummary() {} 18 19 … … 21 22 * 22 23 * @param status boolean, true for success, false for failure 23 * @param statusMessage String cont ianing message about success or failure of present24 * @param statusMessage String containing message about success or failure of present 24 25 * @param documents String containing XML document 25 26 */ -
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/SearchAgent.java
r2559 r3054 5 5 import java.util.Vector; 6 6 import java.util.Properties; 7 import java.util.Date;8 7 import java.math.BigInteger; // needed because xmlbeans uses this for xsd:positiveInteger 9 8 import java.math.BigDecimal; // needed because xmlbeans uses this for xsd:decimal 10 9 import java.util.Calendar; // needed because xmlbeans uses this for xsd:date 11 import java.io.BufferedReader;12 import java.io.InputStreamReader;13 10 import java.io.ByteArrayInputStream; 14 import java.io.IOException;15 11 import java.text.DecimalFormat; 16 12 import java.text.SimpleDateFormat; … … 18 14 import javax.xml.namespace.*; 19 15 import javax.xml.xpath.*; 20 import javax.xml.*;21 16 import org.xml.sax.InputSource; 22 17 import org.w3c.dom.*; … … 34 29 static Properties properties = new ServiceProperties().getProperties(); 35 30 36 // Defaults37 public static final BigInteger startDefault = new BigInteger("1");38 public static final BigInteger howManyDefault = new BigInteger("30");39 boolean doSpatio = false; // flags whether spati o search should be included in search40 boolean doTemporal = false; // flags whether temporal search should be included in search41 boolean doTerm = false; // flags whether term s hould be included in search42 boolean doScope = false; 43 boolean doOrderBy = false; 44 String xqueryStr = ""; // set in tial value from template45 46 // In put parameters31 // Internal defaults 32 static final BigInteger startDefault = new BigInteger("1"); // default value for first record to display in result set 33 static final BigInteger howManyDefault = new BigInteger("30"); // default values for how many results to display in result set 34 boolean doSpatio = false; // flags whether spatial search should be done 35 boolean doTemporal = false; // flags whether temporal search should be done 36 boolean doTerm = false; // flags whether term search should be done 37 boolean doScope = false; // flags whether search should be restricted by scope (dataCentre etc) 38 boolean doOrderBy = false; // flags whether ordering should be applied to result set 39 String xqueryStr = ""; // set initial value for xquery string 40 41 // Initiallise input parameters, setting values to internal defaults 47 42 int resultId = 0; 48 43 BigInteger start = startDefault; … … 72 67 73 68 /** 74 * Default no-arg constructor.69 * Default no-argument constructor. 75 70 */ 76 71 public SearchAgent() {} … … 104 99 /** 105 100 * Sets the search term. 106 * Overridden by FullTextSearchAgent107 101 * @param s String 108 102 */ … … 115 109 /** 116 110 * Sets the field by which to sort the result set 117 * @param s String, one of "date", "dataCentre" 111 * @param s String, one of "date", "dataCentre", list defined in <code>orderByFieldList</code> returned by <code>getList</code> operation. 118 112 */ 119 113 public void setOrderBy(String s) … … 135 129 /** 136 130 * Sets the direction in which to sort the result set 137 * @param s String, one of "ascending", "descending" 131 * <p>Works around current typo in WSDL which requires "descnding"</p> 132 * @param s String, one of "ascending", "descending". 133 * @see DiscoveryServiceSkeleton 138 134 */ 139 135 public void setOrderByDirection(String s) … … 151 147 /** 152 148 * Adds new scope item to the search, telling Agent to search only documents containing these keywords 153 * @param s String, one of "NERC-DDC", etc 149 * @param s String, values in list <code>scopeList</code> returned by <code>getList</code> operation. 150 * @see DiscoveryServiceSkeleton 154 151 */ 155 152 public void addNewScope(String s) … … 190 187 /** 191 188 * Sets north bound of BoundingBox. 192 * <p>Value should be BigDecimal. 193 * @param f value of north bound of search box 194 */ 195 196 189 * @param f BigDecimal value of north bound of search box 190 */ 197 191 public void setLimitNorth(BigDecimal f) 198 192 { … … 205 199 /** 206 200 * Sets south bound of BoundingBox. 207 * <p>Value should be BigDecimal. 208 * @param f value of south bound of search box 201 * @param f BigDecimal value of south bound of search box 209 202 */ 210 203 public void setLimitSouth(BigDecimal f) … … 218 211 /** 219 212 * Sets south bound of BoundingBox. 220 * <p>Value should be BigDecimal. 221 * @param f value of west bound of search box 213 * @param f BigDecimal value of west bound of search box 222 214 */ 223 215 public void setLimitWest(BigDecimal f) … … 231 223 /** 232 224 * Sets south bound of BoundingBox. 233 * <p>Value should be BigDecimal. 234 * @param f value of west bound of search box 225 * @param f BigDecimal value of west bound of search box 235 226 */ 236 227 public void setLimitEast(BigDecimal f) … … 244 235 /** 245 236 * Sets start of date range. 246 * <p>Value should be Date. 247 * @param f value of north bound of search box 237 * @param c Calendar value of start date of date range 248 238 */ 249 239 public void setDateRangeStart(Calendar c) … … 254 244 /** 255 245 * Sets start of date range. 256 * <p>Value should be Date. 257 * @param f value of north bound of search box 246 * @param c Calendar value of end date of date range 258 247 */ 259 248 public void setDateRangeEnd(Calendar c) … … 263 252 264 253 /** 265 * Sets whether spatio search should be done. 266 * <p>Value should be boolean. 267 * @param b 254 * Sets whether spatial search should be done. 255 * @param b boolean flag true if spatial search is to be done 268 256 */ 269 257 public void setDoSpatio(boolean b) … … 274 262 /** 275 263 * Sets whether temporal search should be done. 276 * <p>Value should be boolean. 277 * @param b 264 * @param b boolean flag true if temporal search is to be done 278 265 */ 279 266 public void setDoTemporal(boolean b) … … 284 271 /** 285 272 * Sets whether term search should be done. 286 * <p>Value should be boolean. 287 * @param b 273 * @param b boolean flag true if term search is to be done 288 274 */ 289 275 public void setDoTerm(boolean b) … … 293 279 294 280 /** 295 * Sets whether orderby should be done. 296 * <p>Value should be boolean. 297 * @param b 281 * Sets whether result set should be ordered. 282 * @param b boolean flag true if result set should be ordered 298 283 */ 299 284 public void setDoOrderBy(boolean b) … … 304 289 /** 305 290 * Sets whether scope check should be done. 306 * <p>Value should be boolean. 307 * @param b 291 * @param b boolean flag true if search should be limited to scope keywords 308 292 */ 309 293 public void setDoScope(boolean b) … … 314 298 /** 315 299 * Sets operator used for spatial search 316 * @param s va;id value from list <code>spatialOperatorsList</code>300 * @param s String spatial operator to be applied, must be member of list <code>spatialOperatorsList</code> returned by <code>getList</code> operation. 317 301 */ 318 302 public void setSpatialOperator(String s) … … 332 316 /** 333 317 * Executes the search and returns a SearchSummary object 318 * @return SearchSummary object containing result of search 334 319 */ 335 320 public SearchSummary doSearch() { … … 337 322 SearchSummary result = new SearchSummary(); 338 323 XmlRpc.setEncoding("UTF-8"); 339 Vector myResultDocuments = new Vector();340 324 xqueryStr = xqueryStrTemplate; //set initial value from template 341 325 … … 586 570 587 571 588 publicstatic String xqueryStrTemplate =572 static String xqueryStrTemplate = 589 573 "xquery version \"1.0\"; \n"+ 590 574 "import module namespace voclib=\"http://ndg.nerc.ac.uk/xquery/lib/vocab\" at \"xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery\"; \n"+ -
TI01-discovery/trunk/ws-Discovery2/src/ndg/services/discovery/SearchSummary.java
r1573 r3054 8 8 /** 9 9 * Simple container for the summary results of a search. 10 *11 10 */ 12 11 public class SearchSummary
Note: See TracChangeset
for help on using the changeset viewer.