Class AMClientCapData
- java.lang.Object
-
- com.iplanet.services.cdm.clientschema.AMClientCapData
-
- All Implemented Interfaces:
IDSEventListener,EventListener
public class AMClientCapData extends Object implements IDSEventListener
The abstraction to get/set the clients stored in the DSAME. The Client is stored as a DIT in directory server with the properties as attributes.
-
-
Field Summary
Fields Modifier and Type Field Description static StringADD_PROP_SEPARATORstatic intADDEDThe type of modificationstatic StringADDITIONAL_PROPERTIES_ATTRstatic intEXTERNALstatic intINTERNALstatic intMODIFIEDprotected static intOPERATIONSstatic intREMOVEDprotected static StringSEARCH_FILTER-
Fields inherited from interface com.iplanet.services.ldap.event.IDSEventListener
CHANGE_ADD, CHANGE_DELETE, CHANGE_MOD_LOCATION, CHANGE_MODIFY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddClient(SSOToken token, Map props)Add a client.voidaddListener(AMClientDataListener cdl)register for listening to Client data changesvoidallEntriesChanged()This callback notifies listeners that EventService is restarting the Persistent Search connections due to connection errors, and there is no guarantee of what could have changed in the directory so mark all entries as modified.booleancanCreateInternalClients()Checks the enableClientCliention attr in Service.voidentryChanged(DSEvent event)This callback method is called by the EventService when the Directory Server triggers a PersistentSearch notificationvoideventError(String err)This callback method is called by the EventService when an error is encountered after setting a Persistent Search request in the Directory ServerAttributeSchemagetAttributeSchema(String propName)Returns the schema for an property given the name.StringgetBase()String[]getClassifications()static AMClientCapDatagetExternalInstance()Singleton method to get an external instanceStringgetFilter()static AMClientCapDatagetInternalInstance()Singleton method to get an internal instanceSetgetMinimalClientInfo()Gets a minimal set of client properties for all clients.intgetOperations()StringgetProfileManagerXML()Gets the profile manager xlob as a string.MapgetProperties(String clientType)Get a Map of all the properties for the Client.SetgetPropertyNames(String classification)Get a Set of all the Property names for the classification.static SetgetSchemaElements()This method returns the name of the "defined" client properties in the Schema.intgetScope()StringgetServiceName()booleanisClientPresent(String clientType)Checks if the clientType exists in the db.MaploadMinimalClient(String clientType)Gets the minimal client info for the specified client.intmodifyClient(SSOToken token, Map props)Modify the properties of the Client instance in externalDB.intremoveClient(SSOToken token, String clientType)Remove a Client - removes the client from the externalDB.voidsetListeners(Map listener)
-
-
-
Field Detail
-
INTERNAL
public static final int INTERNAL
- See Also:
- Constant Field Values
-
EXTERNAL
public static final int EXTERNAL
- See Also:
- Constant Field Values
-
ADDED
public static final int ADDED
The type of modification- See Also:
- Constant Field Values
-
REMOVED
public static final int REMOVED
- See Also:
- Constant Field Values
-
MODIFIED
public static final int MODIFIED
- See Also:
- Constant Field Values
-
ADD_PROP_SEPARATOR
public static final String ADD_PROP_SEPARATOR
- See Also:
- Constant Field Values
-
ADDITIONAL_PROPERTIES_ATTR
public static final String ADDITIONAL_PROPERTIES_ATTR
-
SEARCH_FILTER
protected static final String SEARCH_FILTER
-
OPERATIONS
protected static final int OPERATIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getServiceName
public String getServiceName()
- Returns:
- the serviceName. Used by the console plug-in to get to the resource bundle.
-
getInternalInstance
public static AMClientCapData getInternalInstance() throws AMClientCapException
Singleton method to get an internal instance- Throws:
AMClientCapException
-
getExternalInstance
public static AMClientCapData getExternalInstance() throws AMClientCapException
Singleton method to get an external instance- Throws:
AMClientCapException
-
getProperties
public Map getProperties(String clientType)
Get a Map of all the properties for the Client. The Map contains key of property names and a Set for the values.- Parameters:
clientType- Client Type Name.- Returns:
- Map of the properties or null if client not found
-
loadMinimalClient
public Map loadMinimalClient(String clientType)
Gets the minimal client info for the specified client.
-
getProfileManagerXML
public String getProfileManagerXML()
Gets the profile manager xlob as a string. Used by the MAPClientDetector.- Returns:
- ProfileManager.xml
-
getPropertyNames
public Set getPropertyNames(String classification)
Get a Set of all the Property names for the classification. Valid classifications are:- generalPropertyNames
- hardwarePlatformNames
- softwarePlatformNames
- networkCharacteristicsNames
- browserUANames
- wapCharacteristicsNames
- pushCharacteristicsNames
- additionalPropertiesNames
- Returns:
- Set of PropertyNames belonging to classification or null if nothing exists.
-
isClientPresent
public boolean isClientPresent(String clientType)
Checks if the clientType exists in the db.- Returns:
- true if present, false otherwise
-
addClient
public int addClient(SSOToken token, Map props) throws AMClientCapException
Add a client. For every property in the Map, it looks up the schema to check if the property is known, if not known adds it to the additionalProperties schema element.
Note: To add a property in the external db to mask the corresponding property value in internal db, add the property with a " " ("<space>") not an empty "" string. This is required because, when dsame fetches the value from directory and sees it has no value, it returns an empty set. (And we discard empty sets internally - bcos dsame stores values for every property defined in the schema).- Parameters:
token- SSOToken to validate the userprops- Map of profiles known to ClientCap. The Map "must" have a property "clientType"- Returns:
- 0 on success
- Throws:
AMClientCapException- if Client could not be added - permission problems or if the clientType property is mising in the Map.
-
modifyClient
public int modifyClient(SSOToken token, Map props) throws AMClientCapException
Modify the properties of the Client instance in externalDB. Valid only with instance of externalDB.
Note: To add a property in the external db to mask the corresponding property value in internal db, add the property with a " " ("<space>") not an empty "" string. This is required because, when dsame fetches the value from directory and sees it has no value, it returns an empty set. (And we discard empty sets internally - bcos dsame stores values for every property defined in the schema). Also, if the additionalProperties are being modified, it should contain both the modified and the unmodified ones. This is required since all the additionalProperties are stored in a single Attribute "additionalProperties".- Parameters:
token- SSOToken to validate the user.props- Map of profiles known to ClientCapabilities. The Map contains key of property name(s) and Set for the values. It wont overwrite the property names not in the Map. A key with an empty Set for the values will delete the property (DSAME cannot handle null values - throws NullPointerExcptn). The Map "must" have a property "clientType"- Returns:
- 0 on success
- Throws:
AMClientCapException- if Client could not be modified - permission problems OR if the clientType property is mising in the Map.
-
removeClient
public int removeClient(SSOToken token, String clientType) throws AMClientCapException
Remove a Client - removes the client from the externalDB. Valid only with instance of externalDB.- Parameters:
token- SSOToken to validate the userclientType- Client Type Name.- Returns:
- 0 on success
- Throws:
AMClientCapException- if Client could not be removed - permission problems
-
getSchemaElements
public static Set getSchemaElements()
This method returns the name of the "defined" client properties in the Schema. To get the AttributeSchema of these elements, iterate through each of these names and call the getAttributeSchema() on it. Can be used with internal/external instance (since they share the same schema).- Returns:
- a Set of "defined" property names.
-
getAttributeSchema
public AttributeSchema getAttributeSchema(String propName)
Returns the schema for an property given the name. Can be used with internal/external instance (since they share the same schema).- Parameters:
propName- Name of the property- Returns:
- com.sun.identity.sm.AttributeSchema Look at OpenSSO API
- See Also:
AttributeSchema
-
canCreateInternalClients
public boolean canCreateInternalClients()
Checks the enableClientCliention attr in Service. Used by the ClientTypesManager when creating new Clients in the internal DB.- Returns:
- true/false
-
addListener
public void addListener(AMClientDataListener cdl)
register for listening to Client data changes
-
eventError
public void eventError(String err)
Description copied from interface:IDSEventListenerThis callback method is called by the EventService when an error is encountered after setting a Persistent Search request in the Directory Server- Specified by:
eventErrorin interfaceIDSEventListener
-
entryChanged
public void entryChanged(DSEvent event)
Description copied from interface:IDSEventListenerThis callback method is called by the EventService when the Directory Server triggers a PersistentSearch notification- Specified by:
entryChangedin interfaceIDSEventListener
-
allEntriesChanged
public void allEntriesChanged()
Description copied from interface:IDSEventListenerThis callback notifies listeners that EventService is restarting the Persistent Search connections due to connection errors, and there is no guarantee of what could have changed in the directory so mark all entries as modified.- Specified by:
allEntriesChangedin interfaceIDSEventListener
-
getClassifications
public String[] getClassifications()
- Returns:
- the valid classifications.
-
getMinimalClientInfo
public Set getMinimalClientInfo()
Gets a minimal set of client properties for all clients.- Returns:
- Set of Maps. Each Map has the propertyNames for the Key and Value is Set of Property values. By default, the keys returned are clientType, userAgent & parentID.
-
getBase
public String getBase()
- Specified by:
getBasein interfaceIDSEventListener
-
getFilter
public String getFilter()
- Specified by:
getFilterin interfaceIDSEventListener
-
getOperations
public int getOperations()
- Specified by:
getOperationsin interfaceIDSEventListener
-
getScope
public int getScope()
- Specified by:
getScopein interfaceIDSEventListener
-
setListeners
public void setListeners(Map listener)
- Specified by:
setListenersin interfaceIDSEventListener
-
-