Package com.netscape.cmscore.request
Class ExtAttrDynMapper
java.lang.Object
com.netscape.certsrv.dbs.DBAttrMapper
com.netscape.cmscore.request.DBDynAttrMapper
com.netscape.cmscore.request.ExtAttrDynMapper
Maps dynamic data for the extData- prefix to and from the extData Hashtable
in RequestRecord.
The data in RequestRecord is stored in a Hashtable. It comes in two forms:
1. String key1 String value1
String key2 String value2
This is stored in LDAP as:
extData-key1 value1
extData-key2 value2
2. String key Hashtable value
where value stores:
String key2 String value2
String key3 String value3
This is stored in LDAP as:
extData-key;key2 value2
extData-key;key3 value3
These can be mixed, but each top-level key can only be associated with
a String value or a Hashtable value.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecodes extdata encoded keys.Encoded extdata keys for storage in LDAP.Retrieves a list of LDAP attributes that are used in the mapper.protected boolean
isAlphaNum
(char in) void
mapLDAPAttributeSetToObject
(netscape.ldap.LDAPAttributeSet attrs, String name, IDBObj parent) Maps LDAP attributes into object, and puts the object into 'parent'.void
mapObjectToLDAPAttributeSet
(IDBObj parent, String name, Object obj, netscape.ldap.LDAPAttributeSet attrs) Maps object attribute into LDAP attributes.mapSearchFilter
(String name, String op, String value) Maps search filters into LDAP search filter.boolean
supportsLDAPAttributeName
(String attrName) Returns true if the LDAP attribute can be mapped by this dynamic mapper.
-
Field Details
-
logger
public static org.slf4j.Logger logger -
extAttrPrefix
- See Also:
-
mAttrs
-
-
Constructor Details
-
ExtAttrDynMapper
public ExtAttrDynMapper()
-
-
Method Details
-
supportsLDAPAttributeName
Description copied from class:DBDynAttrMapper
Returns true if the LDAP attribute can be mapped by this dynamic mapper.- Overrides:
supportsLDAPAttributeName
in classDBDynAttrMapper
- Parameters:
attrName
- LDAP attribute name to check- Returns:
- a list of supported attribute names
-
getSupportedLDAPAttributeNames
Description copied from class:DBAttrMapper
Retrieves a list of LDAP attributes that are used in the mapper. By having this, the framework can provide search on selective attributes.- Overrides:
getSupportedLDAPAttributeNames
in classDBDynAttrMapper
- Returns:
- a list of supported attribute names
-
decodeKey
Decodes extdata encoded keys. -- followed by a 4 digit hexadecimal string is decoded to the character representing the hex string. The routine is written to be highly efficient. It only allocates the StringBuffer if needed and copies the pieces in large chunks.- Parameters:
key
- The key to decode- Returns:
- The decoded key.
-
encodeKey
Encoded extdata keys for storage in LDAP. The rules for encoding are trickier than decoding. We want to allow '-' by itself to be stored in the database (for the common case of keys like 'Foo-Bar'. Therefore we are using '--' as the encoding character. The rules are: 1) All characters [^-a-zA-Z0-9] are encoded as --XXXX where XXXX is the hex representation of the digit. 2) [a-zA-Z0-9] are always passed through unencoded 3) [-] is passed through as long as it is preceded and followed by [a-zA-Z0-9] (or if it's at the beginning/end of the string) 4) If [-] is preceded or followed by [^a-zA-Z0-9] then the - as well as all following [^a-zA-Z0-9] characters are encoded as --XXXX. This routine tries to be as efficient as possible with StringBuffer and large copies. However, the encoding unfortunately requires several objects to be allocated.- Parameters:
key
- The key to encode- Returns:
- The encoded key
-
isAlphaNum
protected boolean isAlphaNum(char in) -
mapObjectToLDAPAttributeSet
public void mapObjectToLDAPAttributeSet(IDBObj parent, String name, Object obj, netscape.ldap.LDAPAttributeSet attrs) throws EBaseException Description copied from class:DBAttrMapper
Maps object attribute into LDAP attributes.- Overrides:
mapObjectToLDAPAttributeSet
in classDBDynAttrMapper
- Parameters:
parent
- parent object where the object comes fromname
- name of db attributeobj
- object itselfattrs
- LDAP attribute set where the result should be stored- Throws:
EBaseException
- failed to map object
-
mapLDAPAttributeSetToObject
public void mapLDAPAttributeSetToObject(netscape.ldap.LDAPAttributeSet attrs, String name, IDBObj parent) throws EBaseException Description copied from class:DBAttrMapper
Maps LDAP attributes into object, and puts the object into 'parent'.- Overrides:
mapLDAPAttributeSetToObject
in classDBDynAttrMapper
- Parameters:
attrs
- LDAP attribute setname
- name of db attribute to be processedparent
- parent object where the object should be added- Throws:
EBaseException
- failed to map object
-
mapSearchFilter
Description copied from class:DBAttrMapper
Maps search filters into LDAP search filter.- Overrides:
mapSearchFilter
in classDBDynAttrMapper
- Parameters:
name
- name of db attributeop
- filte operation (i.e. "=", ">=")value
- attribute value- Throws:
EBaseException
- failed to map filter
-