Class CredentialStoreFactory


  • public class CredentialStoreFactory
    extends java.lang.Object
    Factory class providing instances of a {linkplain CredentialStore credential store}.

    If the file backing a credential store does not already exist, it is created on the first call to CredentialStore.addPassword(java.lang.String, java.lang.String, java.lang.String). If the default file is being used, its directory will also be created if necessary.

    Each method of the returned credential store acquires a lock on the store for the duration of the method call, blocking if necessary to do so. The implementation may time out (throwing IOException) if the lock cannot be acquired within a reasonable amount of time, on the order of a minute. Locks are acquired on behalf of the entire Java virtual machine, not just the current thread.

    The methods in this class may be invoked concurrently by multiple threads.

    • Constructor Detail

      • CredentialStoreFactory

        public CredentialStoreFactory()
    • Method Detail

      • getCredentialStore

        public static CredentialStore getCredentialStore()
                                                  throws java.io.IOException
        Returns the default credential store.
        Throws:
        java.io.IOException
      • getCredentialStore

        public static CredentialStore getCredentialStore​(java.io.File file)
                                                  throws java.io.IOException
        Returns a credential store given the file backing it.
        Parameters:
        file - the file to use, or null to use the default
        Returns:
        the credential store for the specified file
        Throws:
        java.io.IOException