Package com.iplanet.services.cdm
Class DefaultClientTypesManager
- java.lang.Object
-
- com.iplanet.services.cdm.DefaultClientTypesManager
-
- All Implemented Interfaces:
AMClientDataListener,ClientTypesManager
public class DefaultClientTypesManager extends Object implements ClientTypesManager, AMClientDataListener
This class gives out instances of Client object so that it hides the implementation from clients
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringCDM_SERVICE_NAME
-
Constructor Summary
Constructors Constructor Description DefaultClientTypesManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientaddClient(SSOToken token, String clientType, Map cMap, boolean store)Add the new client to internal DB, if store == true, else keep it only in memory.intaddClientExternal(SSOToken token, Map props)Wrapper methods for add/modify/remove APIs in AMClientCapData.protected ClientaddToClientMap(String ct, Map cMap)Add to the userAgentMap, clientTypeMap & ProfilesMap.protected ClientaddToClientMap(String ct, Map cMap, boolean addToStyles)protected ClientaddToIndexes(String ct, Map cMap)Create Client Object & add to all our indexes.protected ClientaddToIndexes(String ct, Map cMap, boolean addtoStyles)voidaddToPartialMatchMap(String ua, String clientType)Add client to our partialMatchMap.booleancanCreateClients()Check if we can create clients and add them to internal DB.voidclientChanged(String clientType, int dbType, int opType)AMClientDataListener method for client change notificationMapgetAllClientInstances()Gets all client instance as Map.SetgetAllClientTypes()Get names of all client typesSetgetBaseProfileNames()ClientgetClientInstance(String clientType)Get the clientType from clientTypeMap.ClientgetClientInstance(String clientType, SSOToken token)Gets client object for specified client type with specified tokenMapgetClients(String baseProfileName, String style)MapgetClientTypeData(String clientType)Returns properties of the requested client typeStringgetDefaultClientType()Get default client type nameClientgetFromUserAgentMap(String ua)StringgetPartiallyMatchedClient(String ua)Get a previously "partially" matched userAgent StringSetgetStyles(String baseProfileName)protected MapgetStylesProfileMap(String ct, Set p)Get the Style Map corresponding to the parentSet p.voidinitManager()Do stuff that needs to get the Manager working.protected ClientloadClient(String clientType)1.protected MaploadExternalClient(String clientType)Load client properties recursively from external DBprotected MaploadInternalClient(String clientType)Load client properties recursively from internal DBprotected voidloadMaps()Refactor method Load the userAgentMap.intmodifyClientExternal(SSOToken token, Map props)intremoveClientExternal(SSOToken token, String clientType)protected voidremoveFromClientMap(String ct, Client c)complements addToClientMap()protected voidremoveFromMaps(String clientType)Remove all references to this clientprotected voidremoveFromProfilesMap(String ct, Client c)complements storeInProfilesMapvoidsetDirty(String ct, Map data)Updates client data.protected voidsetParentStyles(Map clientData)Sets the styles and parent ids tree set for a clientvoidstore(SSOToken token)Save changed to persistent store.protected voidstoreInProfilesMap(Client client)Adds the client to its appropriate baseProfileMap & styleMap.voidupdateClientData()Reload all Client data.SetuserAgentSet()
-
-
-
Field Detail
-
CDM_SERVICE_NAME
protected static final String CDM_SERVICE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
initManager
public void initManager()
Do stuff that needs to get the Manager working.- Specified by:
initManagerin interfaceClientTypesManager
-
loadMaps
protected void loadMaps()
Refactor method Load the userAgentMap. The userAgentMap is used by the client detector to query clientType.
-
addToClientMap
protected Client addToClientMap(String ct, Map cMap)
Add to the userAgentMap, clientTypeMap & ProfilesMap.- Returns:
- the created Client Object
-
addToClientMap
protected Client addToClientMap(String ct, Map cMap, boolean addToStyles)
- Parameters:
addToStyles- Indicates if the Client should be added to the Styles Map. Will be false when a Client is added from CC/PP module, whose added clients shouldn't be visible in the admin console.
-
removeFromClientMap
protected void removeFromClientMap(String ct, Client c)
complements addToClientMap()
-
storeInProfilesMap
protected void storeInProfilesMap(Client client)
Adds the client to its appropriate baseProfileMap & styleMap. Ex: Nokia7110, with Nokia style & WML for its baseProfile, will go into wmlProfilesMap under Nokia styles. (Used only for displaying Styles & Clients under Base in the console plug-in). Currently Aligo only supports 1 level of Style. Only the baseProfiles immediate children are eligible to be Styles.
-
removeFromProfilesMap
protected void removeFromProfilesMap(String ct, Client c)
complements storeInProfilesMap
-
getStylesProfileMap
protected Map getStylesProfileMap(String ct, Set p)
Get the Style Map corresponding to the parentSet p.
-
addToIndexes
protected Client addToIndexes(String ct, Map cMap)
Create Client Object & add to all our indexes. Called only by addClient & on clientChanged notification.
-
addToIndexes
protected Client addToIndexes(String ct, Map cMap, boolean addtoStyles)
- Parameters:
addtoStyles- true only if the data is stored in ldap false for uaprof clients which only stay in memory.
-
userAgentSet
public Set userAgentSet()
-
getPartiallyMatchedClient
public String getPartiallyMatchedClient(String ua)
Get a previously "partially" matched userAgent String- Returns:
- the clientType string matched previously for this ua.
-
addToPartialMatchMap
public void addToPartialMatchMap(String ua, String clientType)
Add client to our partialMatchMap.
-
addClient
public Client addClient(SSOToken token, String clientType, Map cMap, boolean store) throws AMClientCapException
Add the new client to internal DB, if store == true, else keep it only in memory.- Throws:
AMClientCapException
-
canCreateClients
public boolean canCreateClients()
Check if we can create clients and add them to internal DB.
-
getAllClientInstances
public Map getAllClientInstances()
Description copied from interface:ClientTypesManagerGets all client instance as Map.- Specified by:
getAllClientInstancesin interfaceClientTypesManager- Returns:
- Map of clients. Key is the client type, value is the Client object
-
getAllClientTypes
public Set getAllClientTypes()
Description copied from interface:ClientTypesManagerGet names of all client types- Specified by:
getAllClientTypesin interfaceClientTypesManager- Returns:
- Set of client types as String
-
getClientInstance
public Client getClientInstance(String clientType)
Get the clientType from clientTypeMap.- Specified by:
getClientInstancein interfaceClientTypesManager- Parameters:
clientType- requested client type.- Returns:
- The requested Client object
-
getClientInstance
public Client getClientInstance(String clientType, SSOToken token)
Description copied from interface:ClientTypesManagerGets 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
-
getClientTypeData
public Map getClientTypeData(String clientType)
Description copied from interface:ClientTypesManagerReturns 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
-
loadClient
protected Client loadClient(String clientType)
1. Load internal client data and set parent data 2. Load External client data and merge with internal client data 3. Load merged client data to mergedClientData set 4. Construct Client object and add to loadedClientsMap
-
loadInternalClient
protected Map loadInternalClient(String clientType)
Load client properties recursively from internal DB- Returns:
- Map iMap
-
loadExternalClient
protected Map loadExternalClient(String clientType)
Load client properties recursively from external DB- Returns:
- Map eMap
-
getDefaultClientType
public String getDefaultClientType()
Get default client type name- Specified by:
getDefaultClientTypein interfaceClientTypesManager- Returns:
- The default client type name
-
updateClientData
public void updateClientData() throws ClientExceptionDescription copied from interface:ClientTypesManagerReload all Client data.- Specified by:
updateClientDatain interfaceClientTypesManager- Throws:
ClientException- if having problem update client data
-
store
public void store(SSOToken token) throws SMSException, SSOException
Description copied from interface:ClientTypesManagerSave changed to persistent store.- Specified by:
storein interfaceClientTypesManager- Parameters:
token- single sign on Token of the caller.- Throws:
SMSException- if having problem saving changes.SSOException- if the token is not valid.
-
setDirty
public void setDirty(String ct, Map data)
Description copied from interface:ClientTypesManagerUpdates client data. Need to callstore()after this method.- Specified by:
setDirtyin interfaceClientTypesManager- Parameters:
ct- client typedata- client data. Key is the property name and value is the property value as String.
-
clientChanged
public void clientChanged(String clientType, int dbType, int opType)
AMClientDataListener method for client change notification- Specified by:
clientChangedin interfaceAMClientDataListener- Parameters:
clientType-dbType-opType-
-
getBaseProfileNames
public Set getBaseProfileNames()
- Returns:
- a Set of baseProfileNames. sorted in ascending order.
-
getStyles
public Set getStyles(String baseProfileName)
- Parameters:
baseProfileName- A valid base profile name- Returns:
- A Set of all styles belonging to baseProfile
-
getClients
public Map getClients(String baseProfileName, String style)
- Parameters:
baseProfileName- A valid base profile namestyle- A valid style name- Returns:
- A Map of all clientTypes belonging to baseProfile & style
-
addClientExternal
public int addClientExternal(SSOToken token, Map props) throws AMClientCapException
Wrapper methods for add/modify/remove APIs in AMClientCapData. We have it here, so we dont have to wait for an event notification to arrive when this is called by the plugin.- Throws:
AMClientCapException
-
modifyClientExternal
public int modifyClientExternal(SSOToken token, Map props) throws AMClientCapException
- Parameters:
token-props-- Returns:
- 0 if everything went fine
- Throws:
AMClientCapException
-
removeClientExternal
public int removeClientExternal(SSOToken token, String clientType) throws AMClientCapException
- Parameters:
token-clientType-- Returns:
- 0 if everything went fine
- Throws:
AMClientCapException
-
removeFromMaps
protected void removeFromMaps(String clientType)
Remove all references to this client- Parameters:
clientType- The removable clientType
-
setParentStyles
protected void setParentStyles(Map clientData)
Sets the styles and parent ids tree set for a client- Parameters:
clientData-
-
-