Class BasicClientTypesManager
- java.lang.Object
-
- org.forgerock.openam.services.cdm.BasicClientTypesManager
-
- All Implemented Interfaces:
ClientTypesManager
public class BasicClientTypesManager extends Object implements ClientTypesManager
This class provides a basic implementation for the CDM ClientTypesManager interface. The different Client objects are constructed from the contents on the BasicClientTypesManager.properties file within the OpenAM web application.- Author:
- Steve Ferris steve.ferris@forgerock.com
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringATTRIBUTE_SUFFIXprotected static StringCDM_DEFAULT_CLIENT_TYPES_ATTRprotected static StringCDM_SERVICE_NAMEprotected static StringCLASS_NAMEprotected static StringCLIENTSprotected static StringCOMMAprotected static Debugdebugprotected static StringEQUALSprotected static StringNAME_SUFFIXprotected static StringPROPS_FILE
-
Constructor Summary
Constructors Constructor Description BasicClientTypesManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MapgetAllClientInstances()Gets all client instance as Map.SetgetAllClientTypes()Get names of all client typesClientgetClientInstance(String clientType)Gets client object for specified client type.ClientgetClientInstance(String clientType, SSOToken token)Gets client object for specified client type with specified tokenMapgetClientTypeData(String clientType)Returns properties of the requested client typeStringgetDefaultClientType()Gets default client type namevoidinitManager()Initializes theClientTypesManager.protected voidpopulateClient(String clientName, Properties props)Simple utility method that parsed the properties file for the different clients.protected voidprocessProps(Properties props)Utility method used to parse the properties file that configures this client types manager.voidsetDirty(String clientType, Map data)Updates client data.voidstore(SSOToken token)Save changed to persistent store.voidupdateClientData()Reload all Client data.
-
-
-
Field Detail
-
PROPS_FILE
protected static final String PROPS_FILE
- See Also:
- Constant Field Values
-
CLIENTS
protected static final String CLIENTS
- See Also:
- Constant Field Values
-
NAME_SUFFIX
protected static final String NAME_SUFFIX
- See Also:
- Constant Field Values
-
ATTRIBUTE_SUFFIX
protected static final String ATTRIBUTE_SUFFIX
- See Also:
- Constant Field Values
-
COMMA
protected static final String COMMA
- See Also:
- Constant Field Values
-
EQUALS
protected static final String EQUALS
- See Also:
- Constant Field Values
-
CLASS_NAME
protected static final String CLASS_NAME
- See Also:
- Constant Field Values
-
debug
protected static Debug debug
-
CDM_SERVICE_NAME
protected static final String CDM_SERVICE_NAME
- See Also:
- Constant Field Values
-
CDM_DEFAULT_CLIENT_TYPES_ATTR
protected static final String CDM_DEFAULT_CLIENT_TYPES_ATTR
- See Also:
- Constant Field Values
-
-
Method Detail
-
initManager
public void initManager()
Initializes theClientTypesManager.- Specified by:
initManagerin interfaceClientTypesManager
-
getAllClientInstances
public Map getAllClientInstances()
Gets all client instance as Map.- Specified by:
getAllClientInstancesin interfaceClientTypesManager- Returns:
- Map of clients. Key is the client type, value is the Client object
-
getClientInstance
public Client getClientInstance(String clientType)
Gets client object for specified client type.- Specified by:
getClientInstancein interfaceClientTypesManager- Parameters:
clientType- requested client type.- Returns:
- The requested Client object
-
getClientInstance
public Client getClientInstance(String clientType, SSOToken token)
Gets client object for specified client type with specified token- Specified by:
getClientInstancein interfaceClientTypesManager- Parameters:
clientType- requested client typetoken- SSO Token- Returns:
- The requested Client object, this can be null
-
getClientTypeData
public Map getClientTypeData(String clientType)
Returns properties of the requested client type- Specified by:
getClientTypeDatain interfaceClientTypesManager- Parameters:
clientType- requested client type- Returns:
- All properties of the request client type as Map
-
getDefaultClientType
public String getDefaultClientType()
Gets default client type name- Specified by:
getDefaultClientTypein interfaceClientTypesManager- Returns:
- The default client type name
-
getAllClientTypes
public Set getAllClientTypes()
Get names of all client types- Specified by:
getAllClientTypesin interfaceClientTypesManager- Returns:
- Set of client types as String
-
updateClientData
public void updateClientData() throws ClientExceptionReload all Client data.- Specified by:
updateClientDatain interfaceClientTypesManager- Throws:
ClientException- if having problem update client data
-
store
public void store(SSOToken token) throws SMSException, SSOException
Save changed to persistent store.- Specified by:
storein interfaceClientTypesManager- Parameters:
token- single sign on Token of the caller.- Throws:
SSOException- if the token is not valid.SMSException- if having problem saving changes.
-
setDirty
public void setDirty(String clientType, Map data)
Updates client data. Need to callstore()after this method.- Specified by:
setDirtyin interfaceClientTypesManager- Parameters:
clientType- client typedata- client data. Key is the property name and value is the property value as String.
-
processProps
protected void processProps(Properties props) throws InvalidPropertiesFormatException
Utility method used to parse the properties file that configures this client types manager. A simple entry in the properties file would look like this:clients=genericHtml,... genericHtml_name=Generic HTML genericHtml_attributes=filePath=html,contentType=text/html,cookieSupport=true,genericHtml=true,...The clients are the names of the different client types For each client type, there is a list of attributes; _attributes is a comma delimited list of attributes for the client type- Parameters:
props- The properties file to parse- Throws:
InvalidPropertiesFormatException- if the properties are missing the required client list or are malformed
-
populateClient
protected void populateClient(String clientName, Properties props) throws InvalidPropertiesFormatException
Simple utility method that parsed the properties file for the different clients.- Parameters:
clientName- The name of the client to populateprops- The incoming properties file- Throws:
InvalidPropertiesFormatException- if the client properties are malformed
-
-