示例#1
0
 private static void reloadDefaultCredential() throws CredentialException {
   String proxyLocation = CoGProperties.getDefault().getProxyFile();
   defaultCred = new X509Credential(proxyLocation);
   credentialFile = new File(proxyLocation);
   credentialLastModified = credentialFile.lastModified();
   defaultCred.verify();
 }
示例#2
0
 /**
  * Returns the default credential. The default credential is usually the user proxy certificate.
  * <br>
  * The credential will be loaded on the initial call. It must not be expired. All subsequent calls
  * to this function return cached credential object. Once the credential is cached, and the
  * underlying file changes, the credential will be reloaded.
  *
  * @return the default credential.
  * @exception CredentialException if the credential expired or some other error with the
  *     credential.
  */
 public static synchronized X509Credential getDefaultCredential() throws CredentialException {
   if (defaultCred == null) {
     reloadDefaultCredential();
   } else if (!credentialSet) {
     if (credentialFile.lastModified() == credentialLastModified) {
       defaultCred.verify();
     } else {
       defaultCred = null;
       reloadDefaultCredential();
     }
   }
   return defaultCred;
 }