com.ibm.portal.portlet.service.credentialvault.credentials
Interface CredentialFactory

All Known Implementing Classes:
CredentialFactoryImpl

public interface CredentialFactory

Factory to create credentials of any appropriate type. This factory can be used to instantiate credentials that implement Credential.

A factory instance can be retrieved using a JNDI lookup for the JNDI name that is available via a constant of the Interface: JNDI_NAME.
To get an instance of the factory use:

InitialContext ctx = new InitialContext();
CredentialFactory cF = (CredentialFactory)ctx.lookup(CredentialFactory.JNDI_NAME);
After retrieving an instance, credentials can be created:
cF.createCredential(credentialType);
where credentialType must be a registered credential type in CredentialTypeRegistry - See com.ibm.wps.portletservice.credentialvault.CredentialVaultService interface for available credential types. Default credential type strings are defined as constants in the interface CredentialTypes.

Before the credential object can be used, it needs to be initialized by calling its init method.

Since:
6.0

Field Summary
static java.lang.String JNDI_NAME
          The name can be used to lookup the CredentialFactory from JNDI
 
Method Summary
 Credential createCredential(java.lang.String credentialType)
          Returns an instance of the specified credential type but the instance is not initialized yet.
 

Field Detail

JNDI_NAME

static final java.lang.String JNDI_NAME
The name can be used to lookup the CredentialFactory from JNDI

See Also:
Constant Field Values
Method Detail

createCredential

Credential createCredential(java.lang.String credentialType)
                            throws CredentialVaultException
Returns an instance of the specified credential type but the instance is not initialized yet. Before the object can be used, it needs to be initialized by calling its Credential.init(Map) method. See CredentialVaultService#getCredentialTypes() for available credential types

Parameters:
credentialType - credentialType The credential type identifier.
Returns:
A Credential of the specified type
Throws:
CredentialVaultException - an exception is thrown, if the credential type is not avaialable in the system, or if the credential object could not be created.