Changeset 26286 for other-projects/gs3-webservices-java-client/trunk
- Timestamp:
- 2012-10-04T18:33:06+13:00 (12 years ago)
- Location:
- other-projects/gs3-webservices-java-client/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraConnection.java
r26270 r26286 95 95 protected static final String SUPPORTED_VERSION = "3.3"; //"2.2.1"; 96 96 // 3.3 works with genericSearch version 2.2 97 // 3.6.1 works with genericSearch version 2.5 97 98 98 99 /* Some fixed strings of known literals */ … … 545 546 "default", isUserSpecifiedPortAddressSuffix); 546 547 } 547 548 548 } 549 549 -
other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java
r26270 r26286 50 50 import java.io.IOException; 51 51 import javax.net.ssl.SSLHandshakeException; 52 import java.net.Authenticator; 52 53 import java.net.ConnectException; 53 54 import java.net.MalformedURLException; 55 import java.net.PasswordAuthentication; 54 56 import java.rmi.RemoteException; 55 57 import javax.xml.parsers.ParserConfigurationException; … … 73 75 74 76 /** Default name of Fedora index */ 75 private static final String DEFAULT_FEDORA_INDEX = " BasicIndex";76 77 /** Complete list of services that are supported our FedoraGS3 would78 * supportif everything goes well. If a connection to FedoraGSearch77 private static final String DEFAULT_FEDORA_INDEX = "FgsIndex"; //"BasicIndex" for older versions of GSearch 78 79 /** Complete list of services that our FedoraGS3 would support 80 * if everything goes well. If a connection to FedoraGSearch 79 81 * cannot be established, the query services will no longer be 80 82 * available. The actual services supported are given by member … … 182 184 * - name of the index into which the GS3 documents have been indexed 183 185 * and which FedoraGenericSearch should use to perform searches. If none is 184 * given in the properties file, then the index name defaults to "FedoraIndex". 186 * given in the properties file, then the index name defaults to "FgsIndex" 187 * (no longer BasicIndex or FedoraIndex). 185 188 * @param properties is the Properties Map loaded from a properties file 186 189 * (if there was any) which specifies such things as host and port of the … … 220 223 */ 221 224 protected void init(String protocol, String host, String port, 222 String fedoraServerUsername,String fedoraServerPassword)225 final String fedoraServerUsername, final String fedoraServerPassword) 223 226 throws ParserConfigurationException, MalformedURLException, 224 227 AuthenticationFailedException, RemoteException, Exception … … 228 231 this.gSearchWSDLURL = this.baseURL + this.gSearchWSDLSuffix; 229 232 this.gSearchIndexName = DEFAULT_FEDORA_INDEX; 233 234 // Now need to set username and password for accessing WSDL (after GSearch 2.2) 235 // http://stackoverflow.com/questions/3037221/401-error-when-consuming-a-web-service-with-http-basic-authentication-using-cxf 236 237 // The java.net.Authenticator can be used to send user credentials when needed. 238 Authenticator.setDefault(new Authenticator() { 239 @Override 240 protected PasswordAuthentication getPasswordAuthentication() { 241 return new PasswordAuthentication( 242 fedoraServerUsername, 243 fedoraServerPassword.toCharArray()); 244 } 245 }); 246 230 247 initSearchFunctionality(); 231 248 } … … 246 263 } catch(Exception e){ 247 264 LOG.error("Cannot connect to FedoraGSearch's web services at " 248 + gSearchWSDLURL + "\nQuery services will not be available."); 265 + gSearchWSDLURL + "\nQuery services will not be available.", e); 266 // Exception, e, as parameter prints the stacktrace of the exception to the log 267 249 268 // If an exception occurs, something has gone wrong when 250 269 // trying to connect to FedoraGSearch's web services. This -
other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/GSearchConnection.java
r21573 r26286 92 92 /** A DocumentBuilder object used to construct and parse XML */ 93 93 protected final DocumentBuilder builder; 94 95 94 96 95 … … 138 137 builder = factory.newDocumentBuilder(); // to create XML docs 139 138 } 140 141 139 142 140 /** 143 141 * Method to invoke gfindObjects operation of Fedora Generic Search … … 210 208 // for debugging 211 209 //javax.swing.JOptionPane.showMessageDialog(null, "GSearchConnection.gFindObjects:" + valueFound); 212 210 213 211 return valueFound; 214 212 } … … 292 290 // and put quotes around phrases, then combine all the terms 293 291 // together again with spaces to separate them. 294 allfields = formatSearchTermsInField(allfields, ALL_FIELDS); 292 allfields = formatSearchTermsInField(allfields, ALL_FIELDS); // search foxml.all.text 295 293 // ALL_FIELDS has no field name 296 294 titles = formatSearchTermsInField(titles, DC_TITLE_FIELD);
Note:
See TracChangeset
for help on using the changeset viewer.