Author: kwright
Date: Tue Feb 4 00:07:18 2014
New Revision: 1564135
URL: http://svn.apache.org/r1564135
Log:
Add unique hash string construct to keystore manager, and use that for pool
key. Part of CONNECTORS-872.
Modified:
manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IKeystoreManager.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/keystore/KeystoreManager.java
Modified:
manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java?rev=1564135&r1=1564134&r2=1564135&view=diff
==============================================================================
---
manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java
(original)
+++
manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/ThrottledFetcher.java
Tue Feb 4 00:07:18 2014
@@ -182,7 +182,7 @@ public class ThrottledFetcher
if (trustStore != null)
{
baseFactory = trustStore.getSecureSocketFactory();
- trustStoreString = trustStore.getString();
+ trustStoreString = trustStore.getHashString();
}
else
{
Modified:
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IKeystoreManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IKeystoreManager.java?rev=1564135&r1=1564134&r2=1564135&view=diff
==============================================================================
---
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IKeystoreManager.java
(original)
+++
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IKeystoreManager.java
Tue Feb 4 00:07:18 2014
@@ -28,6 +28,13 @@ public interface IKeystoreManager
{
public static final String _rcsid = "@(#)$Id: IKeystoreManager.java 988245
2010-08-23 18:39:35Z kwright $";
+ /** Get a unique hashstring for this keystore. The hashcode depends only on
the certificates
+ * in the store.
+ *@return the hash string for this keystore.
+ */
+ public String getHashString()
+ throws ManifoldCFException;
+
/** Grab a list of the aliases in the key store.
*@return the list, as a string array.
*/
@@ -55,7 +62,8 @@ public interface IKeystoreManager
throws ManifoldCFException;
/** Convert to a base64 string.
- *@return the base64-encoded string.
+ *@return the base64-encoded string. This differs every time it is called,
and thus
+ * CANNOT be used for hashing.
*/
public String getString()
throws ManifoldCFException;
Modified:
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/keystore/KeystoreManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/keystore/KeystoreManager.java?rev=1564135&r1=1564134&r2=1564135&view=diff
==============================================================================
---
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/keystore/KeystoreManager.java
(original)
+++
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/keystore/KeystoreManager.java
Tue Feb 4 00:07:18 2014
@@ -36,9 +36,9 @@ public class KeystoreManager implements
public static final String _rcsid = "@(#)$Id: KeystoreManager.java 988245
2010-08-23 18:39:35Z kwright $";
// The keystore passcode
- protected String passcode;
+ protected final String passcode;
// The keystore itself
- protected KeyStore keystore;
+ protected final KeyStore keystore;
/** Create the keystore object.
*/
@@ -115,9 +115,29 @@ public class KeystoreManager implements
}
}
+ /** Get a unique hashstring for this keystore. The hashcode depends only on
the certificates
+ * in the store.
+ *@return the hash string for this keystore.
+ */
+ @Override
+ public String getHashString()
+ throws ManifoldCFException
+ {
+ StringBuilder sb = new StringBuilder();
+ // Get the certs in the store
+ String[] aliases = getContents();
+ for (String alias : aliases)
+ {
+ String description = getDescription(alias);
+ sb.append(":").append(alias).append(":").append(description);
+ }
+ return sb.toString();
+ }
+
/** Grab a list of the aliases in the key store.
*@return the list, as a string array.
*/
+ @Override
public String[] getContents()
throws ManifoldCFException
{
@@ -145,6 +165,7 @@ public class KeystoreManager implements
*@param alias is the alias name.
*@return a description of what's in the alias.
*/
+ @Override
public String getDescription(String alias)
throws ManifoldCFException
{
@@ -165,6 +186,7 @@ public class KeystoreManager implements
*@param alias is the name of the certificate.
*@param certData is the binary data for the certificate.
*/
+ @Override
public void importCertificate(String alias, InputStream certData)
throws ManifoldCFException
{
@@ -193,6 +215,7 @@ public class KeystoreManager implements
/** Read a certificate from the keystore.
*/
+ @Override
public java.security.cert.Certificate getCertificate(String alias)
throws ManifoldCFException
{
@@ -208,6 +231,7 @@ public class KeystoreManager implements
/** Add a certificate to the keystore.
*/
+ @Override
public void addCertificate(String alias, java.security.cert.Certificate
certificate)
throws ManifoldCFException
{
@@ -231,6 +255,7 @@ public class KeystoreManager implements
/** Remove a certificate.
*@param alias is the name of the certificate to remove.
*/
+ @Override
public void remove(String alias)
throws ManifoldCFException
{
@@ -245,8 +270,10 @@ public class KeystoreManager implements
}
/** Convert to a base64 string.
- *@return the base64-encoded string.
+ *@return the base64-encoded string. NOTE WELL: as of JDK 1.6, you will not
get the same exact string twice from this method --
+ * so it cannot be used for a hash!!
*/
+ @Override
public String getString()
throws ManifoldCFException
{
@@ -295,6 +322,7 @@ public class KeystoreManager implements
/** Build a secure socket factory based on this keystore.
*/
+ @Override
public javax.net.ssl.SSLSocketFactory getSecureSocketFactory()
throws ManifoldCFException
{