com.ca.jcs.converter.eval
Class PropertyConverters

java.lang.Object
  extended by com.ca.jcs.converter.eval.PropertyConverters

public class PropertyConverters
extends Object

Stored for each property that requires one or more conversions be applied to it.


Nested Class Summary
protected static class PropertyConverters.AttributeConverterFilter
          Filter helper class for AttributeConverters
static class PropertyConverters.ConverterType
          Converter implementation classification
static class PropertyConverters.ForceSettingIndex
           
 
Constructor Summary
PropertyConverters()
           
 
Method Summary
 boolean applyFlatten(MetaObjectClassMapping classMap, Attribute unflattenedConnAttr)
          Runs any multi-valued structural converters for this property (including flatteners), but performs no other conversions.
protected  void applyNonStructural(MetaObjectClassMapping classMap, Attribute attr)
          Destructively apply non-structural converters registered against attribute targeted by provided item.
protected  void applyNonStructural(MetaObjectClassMapping classMap, Attribute attr, boolean toConnector, boolean beforeStructural, boolean afterStructural)
          A helper that can run non structural converters which can be registered to run either before or after structural converter or both
 void applyToLiteral(Attribute attr, boolean toConnector)
          Apply literal value converters to each of the values in an attribute
 String applyToLiteral(String value, boolean toConnector, Converter.ConverterFlag flag)
          Apply all contained non-structural converters to the provided value, in the direction specified by toConnector.
 String applyToLiteral(String value, boolean toConnector, Converter.ConverterFlag flag, Collection<PropertyConverters.ConverterType> includeConvTypes, Collection<PropertyConverters.ConverterType> excludeConvTypes)
           
 boolean applyUnflatten(MetaObjectClassMapping classMap, Attribute attr)
          Undoes changes performed by any multi-valued structural converters for this property (including flatteners), but performs no other un-conversions.
 void checkSanityConnectorDependantConverters(MetaObjectClassMappings classMaps)
           
static void convertAttribute(MetaObjectClassMapping classMap, Attribute attr, boolean toConnector, boolean runStructural)
          Run all converters that apply on a single attribute in either direction
static void convertAttributes(MetaObjectClassMapping classMap, Attributes attrs, boolean toConnector)
          Handle conversion of attributes in either direction, as dictated by the toConnector - including management of ConverterValueCache.
static ModificationItem[] convertModificationItems(ObjectInfo objInfo, ModificationItem[] items, LazyConnectorAttributesProxy attrs)
          Run all relevant converters on items passed to modify operation, using attrs if need to access current state of the target object.
static boolean forceModificationItemOp(ObjectInfo objInfo, boolean inConnectorSpeak, ModificationItem item, boolean[] forceSettings)
          Return true if provided ModificationItem requires modification mode to be forcibly changed, refer MetaDataDefs.MD_FORCE_MOD_MODE.
static boolean forceModificationItemOps(ObjectInfo objInfo, boolean inConnectorSpeak, ModificationItem[] items)
          Return true if forceModificationItemOp(com.ca.jcs.ObjectInfo, boolean, javax.naming.directory.ModificationItem, boolean[]) returns true for any of the provided items.
 List<MetaPluginConfig> getClassConverterConfigs()
           
static PropertyConverters getConvertersForAttr(MetaObjectClassMapping classMap, Attribute attr)
          Get all converters that are registered for a single attribute (attribute id in LDAP-speak)
static PropertyConverters getConvertersForLdapAttrId(MetaObjectClassMapping classMap, String attrId)
          Obtain converters for an LDAP-speak attribute ID that are registered
 List<PropertyConverter> getConvertersOfType(PropertyConverters.ConverterType type)
          Return converters matching type, null for all
 boolean getHasConnectorDependantConverter()
          At least one contained converter implements ConnectorDependantAttributeConverter.
 List<PropertyConverter> getPropertyConverters()
           
 AttributeConverter getValueConverter()
           
static ModificationItem[] normalizeModificationItemOps(ObjectInfo objInfo, boolean inConnectorSpeak, ModificationItem[] items, LazyConnectorAttributesProxy attrs)
          Normalize the provided modification items, which may involve changing the modification op (and hence provided attribute's value list) for any multi-valued properties which have the MetaDataDefs.MD_FORCE_MOD_MODE metadata setting provided, as well as for single-valued properties being modified with modes other then DirContext.REPLACE_ATTRIBUTE.
 void registerConnectorWithDependantConverters(MetaConnector connector)
           
 void setClassConverterConfigs(List<MetaPluginConfig> convClasses)
           
 void setPropertyConverters(List<PropertyConverter> pvs)
           
 void setValueConverter(AttributeConverter valueConverter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyConverters

public PropertyConverters()
Method Detail

getHasConnectorDependantConverter

public boolean getHasConnectorDependantConverter()
At least one contained converter implements ConnectorDependantAttributeConverter.


getPropertyConverters

public List<PropertyConverter> getPropertyConverters()

setPropertyConverters

public void setPropertyConverters(List<PropertyConverter> pvs)

getValueConverter

public AttributeConverter getValueConverter()

setValueConverter

public void setValueConverter(AttributeConverter valueConverter)

getClassConverterConfigs

public List<MetaPluginConfig> getClassConverterConfigs()

setClassConverterConfigs

public void setClassConverterConfigs(List<MetaPluginConfig> convClasses)

applyUnflatten

public boolean applyUnflatten(MetaObjectClassMapping classMap,
                              Attribute attr)
                       throws NamingException
Undoes changes performed by any multi-valued structural converters for this property (including flatteners), but performs no other un-conversions.

Throws:
NamingException

applyFlatten

public boolean applyFlatten(MetaObjectClassMapping classMap,
                            Attribute unflattenedConnAttr)
                     throws NamingException
Runs any multi-valued structural converters for this property (including flatteners), but performs no other conversions.

Throws:
NamingException

applyToLiteral

public String applyToLiteral(String value,
                             boolean toConnector,
                             Converter.ConverterFlag flag,
                             Collection<PropertyConverters.ConverterType> includeConvTypes,
                             Collection<PropertyConverters.ConverterType> excludeConvTypes)
                      throws NamingException
Parameters:
value - Value to convert
toConnector - Conversion direction
flag - Conversion flags
includeConvTypes - Include converter types, null means all
excludeConvTypes - Exclude converter types, null means none
Returns:
Throws:
NamingException

applyToLiteral

public String applyToLiteral(String value,
                             boolean toConnector,
                             Converter.ConverterFlag flag)
                      throws NamingException
Apply all contained non-structural converters to the provided value, in the direction specified by toConnector. Used to provide the partial conversion, for instance like that required when dealing with literal values provided in search filters.

Throws:
NamingException

applyToLiteral

public void applyToLiteral(Attribute attr,
                           boolean toConnector)
                    throws NamingException
Apply literal value converters to each of the values in an attribute

Throws:
NamingException

convertAttributes

public static void convertAttributes(MetaObjectClassMapping classMap,
                                     Attributes attrs,
                                     boolean toConnector)
                              throws NamingException
Handle conversion of attributes in either direction, as dictated by the toConnector - including management of ConverterValueCache.

Throws:
NamingException

convertAttribute

public static void convertAttribute(MetaObjectClassMapping classMap,
                                    Attribute attr,
                                    boolean toConnector,
                                    boolean runStructural)
                             throws NamingException
Run all converters that apply on a single attribute in either direction

Throws:
NamingException

getConvertersForAttr

public static PropertyConverters getConvertersForAttr(MetaObjectClassMapping classMap,
                                                      Attribute attr)
Get all converters that are registered for a single attribute (attribute id in LDAP-speak)


getConvertersForLdapAttrId

public static PropertyConverters getConvertersForLdapAttrId(MetaObjectClassMapping classMap,
                                                            String attrId)
Obtain converters for an LDAP-speak attribute ID that are registered


convertModificationItems

public static ModificationItem[] convertModificationItems(ObjectInfo objInfo,
                                                          ModificationItem[] items,
                                                          LazyConnectorAttributesProxy attrs)
                                                   throws NamingException
Run all relevant converters on items passed to modify operation, using attrs if need to access current state of the target object.

Throws:
NamingException

forceModificationItemOp

public static boolean forceModificationItemOp(ObjectInfo objInfo,
                                              boolean inConnectorSpeak,
                                              ModificationItem item,
                                              boolean[] forceSettings)
Return true if provided ModificationItem requires modification mode to be forcibly changed, refer MetaDataDefs.MD_FORCE_MOD_MODE. If method returns true and forceSettings array is not null, then it will be populated with status for each ForceSettingIndex setting (by ordinal).


forceModificationItemOps

public static boolean forceModificationItemOps(ObjectInfo objInfo,
                                               boolean inConnectorSpeak,
                                               ModificationItem[] items)
Return true if forceModificationItemOp(com.ca.jcs.ObjectInfo, boolean, javax.naming.directory.ModificationItem, boolean[]) returns true for any of the provided items.


normalizeModificationItemOps

public static ModificationItem[] normalizeModificationItemOps(ObjectInfo objInfo,
                                                              boolean inConnectorSpeak,
                                                              ModificationItem[] items,
                                                              LazyConnectorAttributesProxy attrs)
                                                       throws NamingException
Normalize the provided modification items, which may involve changing the modification op (and hence provided attribute's value list) for any multi-valued properties which have the MetaDataDefs.MD_FORCE_MOD_MODE metadata setting provided, as well as for single-valued properties being modified with modes other then DirContext.REPLACE_ATTRIBUTE.

Parameters:
objInfo - Information for target object to which modifications are to be applied.
inConnectorSpeak - True if items are already mapped to connector-speak and false otherwise.
items - Array of modification items to be applied.
attrs - Proxy which can be used to lookup current attribute values for the target object, if required.
Returns:
Possibly modified array of items.
Throws:
NamingException

applyNonStructural

protected void applyNonStructural(MetaObjectClassMapping classMap,
                                  Attribute attr)
                           throws NamingException
Destructively apply non-structural converters registered against attribute targeted by provided item.

Throws:
NamingException

applyNonStructural

protected void applyNonStructural(MetaObjectClassMapping classMap,
                                  Attribute attr,
                                  boolean toConnector,
                                  boolean beforeStructural,
                                  boolean afterStructural)
                           throws NamingException
A helper that can run non structural converters which can be registered to run either before or after structural converter or both

Throws:
NamingException

getConvertersOfType

@Nullable
public List<PropertyConverter> getConvertersOfType(@Nullable
                                                            PropertyConverters.ConverterType type)
Return converters matching type, null for all


checkSanityConnectorDependantConverters

public void checkSanityConnectorDependantConverters(MetaObjectClassMappings classMaps)

registerConnectorWithDependantConverters

public void registerConnectorWithDependantConverters(MetaConnector connector)


Created 2011-07-14 13:27 EST