com.ibm.portal.portlet.service.credentialvault.credentials
Class CredentialFactoryImpl

java.lang.Object
  extended by com.ibm.portal.portlet.service.credentialvault.credentials.CredentialFactoryImpl
All Implemented Interfaces:
CredentialFactory

public class CredentialFactoryImpl
extends java.lang.Object
implements 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: CredentialFactory.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
 
Fields inherited from interface com.ibm.portal.portlet.service.credentialvault.credentials.CredentialFactory
JNDI_NAME
 
Constructor Summary
CredentialFactoryImpl()
           
 
Method Summary
 Credential createCredential(java.lang.String credentialType)
          Returns an instance of the specified credential type but the instance is not initialized yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CredentialFactoryImpl

public CredentialFactoryImpl()
Method Detail

createCredential

public 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

Specified by:
createCredential in interface CredentialFactory
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.