public CredentialStore buildCredentialStore ( Map < String , Object > parameters ) { String ks_type = EncryptionConfigParser . getKeystoreType ( parameters ) ; String ks_path = EncryptionConfigParser . getKeystorePath ( parameters ) ; String ks_password = EncryptionConfigParser . getKeystorePassword ( parameters ) ; try { switch ( ks_type ) { // TODO this is yet another example of building a broad type (CredentialStore) based on a human-readable name // (json) with a bag of parameters. Need to pull out into its own pattern! case JCEKSKeystoreCredentialStore . TAG : return new JCEKSKeystoreCredentialStore ( ks_path , ks_password ) ; case JsonCredentialStore . TAG : return new JsonCredentialStore ( ks_path , buildKeyToStringCodec ( parameters ) ) ; default : return null ; } } catch ( IOException e ) { log . error ( "Error building credential store, returning null" , e ) ; return null ; } }
Build a credential store with the given parameters .