Changeset 26286 for other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java
- Timestamp:
- 2012-10-04T18:33:06+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.