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
-
public class ExtAttrDynMapper extends DBDynAttrMapper
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 Modifier and Type Field Description protected static java.lang.String
extAttrPrefix
static org.slf4j.Logger
logger
protected static java.util.Vector<java.lang.String>
mAttrs
-
Constructor Summary
Constructors Constructor Description ExtAttrDynMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
decodeKey(java.lang.String key)
Decodes extdata encoded keys.java.lang.String
encodeKey(java.lang.String key)
Encoded extdata keys for storage in LDAP.java.util.Enumeration<java.lang.String>
getSupportedLDAPAttributeNames()
Retrieves a list of LDAP attributes that are used in the mapper.protected boolean
isAlphaNum(char in)
void
mapLDAPAttributeSetToObject(netscape.ldap.LDAPAttributeSet attrs, java.lang.String name, IDBObj parent)
Maps LDAP attributes into object, and puts the object into 'parent'.void
mapObjectToLDAPAttributeSet(IDBObj parent, java.lang.String name, java.lang.Object obj, netscape.ldap.LDAPAttributeSet attrs)
Maps object attribute into LDAP attributes.java.lang.String
mapSearchFilter(java.lang.String name, java.lang.String op, java.lang.String value)
Maps search filters into LDAP search filter.boolean
supportsLDAPAttributeName(java.lang.String attrName)
Returns true if the LDAP attribute can be mapped by this dynamic mapper.
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
extAttrPrefix
protected static final java.lang.String extAttrPrefix
- See Also:
- Constant Field Values
-
mAttrs
protected static final java.util.Vector<java.lang.String> mAttrs
-
-
Method Detail
-
supportsLDAPAttributeName
public boolean supportsLDAPAttributeName(java.lang.String attrName)
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
public java.util.Enumeration<java.lang.String> 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
public java.lang.String decodeKey(java.lang.String key)
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
public java.lang.String encodeKey(java.lang.String key)
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, java.lang.String name, java.lang.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, java.lang.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
public java.lang.String mapSearchFilter(java.lang.String name, java.lang.String op, java.lang.String value) throws EBaseException
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
-
-