Changeset 15437 for other-projects/trunk/gs3-webservices-democlient
- Timestamp:
- 2008-05-14T13:27:08+12:00 (16 years ago)
- Location:
- other-projects/trunk/gs3-webservices-democlient/src/GS3Fedora/org/greenstone/fedora/services
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/trunk/gs3-webservices-democlient/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java
r15331 r15437 29 29 import org.greenstone.fedora.services.FedoraGS3Exception.FedoraGS3RunException; 30 30 import org.greenstone.fedora.services.FedoraGS3Exception.NotAFedoraServerException; 31 import org.greenstone.fedora.services.FedoraToGS3Interface.Constants;32 31 import org.greenstone.gsdl3.util.GSXML; 33 32 import org.w3c.dom.Document; … … 111 110 protected String gSearchWSDLURL; 112 111 112 /** The name of the index that FedoraGSearch will index the GS3 113 * documents into. If no name is specified in the properties file, 114 * this will default to FedoraIndex. */ 115 protected String gSearchIndexName; 116 113 117 /** 5 argument constructor is the same as that of superclass FedoraConnection: 114 118 * @param protocol can be either http or https … … 175 179 * properties loaded from a propertiesFile. This method is overridden 176 180 * here in order to instantiate the gSearchConnection based on the 177 * gSearchWSDLURL.(If one was not provided in the properties file,181 * - gSearchWSDLURL (If one was not provided in the properties file, 178 182 * gSearchWSDLURL defaults to something of the form 179 183 * "http://localhost:8080/fedoragsearch/services/FgsOperations?wsdl" 180 184 * where http://localhost:8080/fedora is the baseURL of fedora and 181 185 * "gsearch/services/FgsOperations?wsdl" is the default gSearchWSDLSuffix.) 186 * - name of the index into which the GS3 documents have been indexed 187 * and which FedoraGenericSearch should use to perform searches. If none is 188 * given in the properties file, then the index name defaults "FedoraIndex". 182 189 * @param properties is the Properties Map loaded from a properties file 183 190 * (if there was any) which specifies such things as host and port of the 184 191 * FedoraServer, but can also specify the property "gsearch.wsdlURL". 185 192 * At the end of this method, properties' "gsearch.wsdlURL" will be set 186 * to whatever the final value of this.gSearchWSDLURL is. 193 * to whatever the final value of this.gSearchWSDLURL is, and 194 * "gsearch.indexName" will be set to to whatever the final value of 195 * this.gSearchIndexName is. 187 196 */ 188 197 protected void setInitialisationProperties(Properties properties) … … 200 209 // so that it will be written out to the properties file again 201 210 properties.setProperty("gsearch.wsdlURL", this.gSearchWSDLURL); 211 212 // Similarly for the name of the index FedoraGenericSearch should use 213 // when performing searches for GS3 docs stored in Fedora's repository. 214 this.gSearchIndexName = properties.getProperty( 215 "gsearch.indexName", "FedoraIndex"); // default to FedoraIndex 216 properties.setProperty("gsearch.indexName", this.gSearchIndexName); 202 217 // Create a connection to FedoraGSearch's web services: 203 218 initSearchFunctionality(); … … 212 227 { 213 228 try { 214 this.fedoraGSearch = new GSearchConnection(gSearchWSDLURL); 229 this.fedoraGSearch = null; 230 this.fedoraGSearch = new GSearchConnection( 231 gSearchWSDLURL, gSearchIndexName); 215 232 this.serviceNames = SERVICES; 216 233 } catch(Exception e){ … … 251 268 * @param url is the new url of the GSearch web services WSDL file */ 252 269 public void setGSearchWSDLURL(String url) { 253 gSearchWSDLURL = url; 270 this.gSearchWSDLURL = url; 271 initSearchFunctionality(); 272 } 273 274 /** @return the gSearchIndexName, the name of the index Fedora Generic 275 * Search will search in (where GS3 docs have been indexed into). */ 276 public String getGSearchIndexName() { return gSearchIndexName; } 277 278 /** Sets the member variable gSearchIndexName that specifies the name 279 * of the index containing indexed GS3 documents. Then it attempts 280 * to instantiate a connection to the Fedora GSearch web services using 281 * this changed value for indexName. 282 * @param indexName is the new name of the index containing indexed GS3 283 * docs that GSearch should search in. */ 284 public void setGSearchIndexName(String indexName) { 285 this.gSearchIndexName = indexName; 254 286 initSearchFunctionality(); 255 287 } -
other-projects/trunk/gs3-webservices-democlient/src/GS3Fedora/org/greenstone/fedora/services/FedoraToGS3Interface.java
r15222 r15437 23 23 import java.util.Map; 24 24 25 26 25 /** 27 * The following methods return the same data as FedoraGS3DL, but formatted as 28 * Greenstone Response-Message XML. This way our java-client can parse 29 * the returned XML in the same way and store them in the same datastructures. 26 * Most of the following methods return the same data as FedoraGS3DL, but 27 * formatted as Greenstone Response-Message XML. This way our java-client can 28 * parse the returned XML in the same way and store them in the same data 29 * structures. 30 30 * @author ak19 31 31 */ … … 54 54 public static final String COMMA = ","; 55 55 } 56 57 /* FEDORA GENERIC SEARCH RELATED */ 58 /** @return the gSearchWSDLURL, the url of the WSDL for the 59 * FedoraGSearch web services */ 60 public String getGSearchWSDLURL(); 61 62 /** Sets the member variable gSearchWSDLURL that specify the location of 63 * the WSDL file of FedoraGSearch's web services. Then it attempts 64 * to instantiate a connection to those web services. 65 * @param url is the new url of the GSearch web services WSDL file */ 66 public void setGSearchWSDLURL(String url); 67 68 /** @return the gSearchIndexName, the name of the index Fedora Generic 69 * Search will search in (where GS3 docs have been indexed into). */ 70 public String getGSearchIndexName(); 71 72 /** Sets the member variable gSearchIndexName that specifies the name 73 * of the index containing indexed GS3 documents. Then it attempts 74 * to instantiate a connection to the Fedora GSearch web services using 75 * this changed value for indexName. 76 * @param indexName is the new name of the index containing indexed GS3 77 * docs that GSearch should search in. */ 78 public void setGSearchIndexName(String indexName); 56 79 57 80 /* DESCRIBE SERVICES */ -
other-projects/trunk/gs3-webservices-democlient/src/GS3Fedora/org/greenstone/fedora/services/GSearchConnection.java
r15222 r15437 60 60 protected static String NAMESPACE_URI = "http://server.fedoragsearch.defxws.dk"; 61 61 protected static String SERVICE_NAME = "OperationsService"; 62 protected static final String INDEX_NAME = "FedoraIndex";63 62 64 63 /** The names of the methods we use of Fedora Generic Search's web services … … 78 77 /** separator used internally to separate values of a search field */ 79 78 protected static final String SPACE = " "; 79 80 /** The name of the Index wherein FedoraGSearch has indexed all the GS3 docs. 81 * This final member is public here so that others may read the indexName 82 * that this GSearchConnection works with. */ 83 public final String indexName; 80 84 81 85 /** The Service object used to connect to the FedoraGSearch web services */ … … 89 93 protected final DocumentBuilder builder; 90 94 95 96 91 97 /** Constructor that takes a String representing the url of the WSDL 92 98 * file for FedoraGSearch's web services, and tries to establish a 93 99 * connection to those web services. 94 100 * @param wsdlFileLocation is a String representing the url of the WSDL file 101 * @param indexName is the name of the index that Fedora Generic Search 102 * should work with (the index wherein the indexed GS3 documents have been 103 * placed). 95 104 */ 96 public GSearchConnection(String wsdlFileLocation )105 public GSearchConnection(String wsdlFileLocation, String indexName) 97 106 throws MalformedURLException, ServiceException, 98 107 ParserConfigurationException 99 108 { 109 this.indexName = indexName; 110 100 111 URL wsdlURL = new URL(wsdlFileLocation); 101 112 service = new Service(wsdlURL, new QName(NAMESPACE_URI, SERVICE_NAME)); … … 218 229 return gFindObjects(fullSearchTerm, sort, 219 230 hitPageStart, hitPageSize, snippetsMax, 220 fieldMaxLength, INDEX_NAME, resultPageXslt);231 fieldMaxLength, indexName, resultPageXslt); 221 232 } 222 233 … … 364 375 return gFindObjects(fieldedSearchTerms, sort, 365 376 hitPageStart, hitPageSize, snippetsMax, 366 fieldMaxLength, INDEX_NAME, resultPageXslt);377 fieldMaxLength, indexName, resultPageXslt); 367 378 } 368 379 … … 460 471 try { 461 472 GSearchConnection searcher = new GSearchConnection( 462 "http://localhost:8080/fedoragsearch/services/FgsOperations?wsdl" );473 "http://localhost:8080/fedoragsearch/services/FgsOperations?wsdl", "FedoraIndex"); 463 474 464 475
Note:
See TracChangeset
for help on using the changeset viewer.