com.sapportals.portal.pcd.gl

Interface IPcdAttributeId

All Superinterfaces:
Cloneable, Comparable<IPcdAttributeId>, Serializable

public interface IPcdAttributeId
extends Serializable, Cloneable, Comparable<IPcdAttributeId>

The JNDI standard has defined the java.util.String class as identifier for attributes. The PCD extends the JNDI standard by offering attribute identifiers with a richer semantic, such as identifiers for meta-attributes or attribute identifiers which are composed by several parts. Nevertheless, the usage of compound attribute IDs should be limited to very dedicated cases. In general, attribute identifiers should be stable and not dynamically constructed.

A compound attribute ID is defined as

<attr-id-part-1>/.../<attr-id-part-n>
A meta-attribute ID is defined as
<attr_name><meta_attribute_separator><meta-attribute-suffix>
while meta_attribute_separator defines the last occurrence of the IPcdAttribute.ATTR_META_SEPERATOR_CHAR character in the (concatenated) attribute ID.

A combination of compound attribute ID and meta-attribute ID is also possible. Note that in this case, only the

<attr_name>
can be composed by several parts - the meta-attribute suffix is then a suffix for a compound attribute name. This means in particular that meta-attribute separator characters are only considers after the last component separator character.

This interface declares methods for accessing such semantically rich attribute identifiers in an efficient way. Both compound attribute IDs and meta-attribute IDs are handled with the same interface. If the ID conforms to the syntax of compound attribute IDs, the single parts can be accessed by the get(int) and getElements() methods. If the id conforms to the meta-attribute syntax (i.e. contains at least one "-" character), the meta-attribute suffix is always set to the last element, i.e. the size of such an attribute ID is at least 2.

The String based access methods for javax.naming.directory.Attributes as defined in the JNDI standard are also supported for compound or meta-attribute IDs.

The usage of this type of attribute identifier allows to use memory efficient data structures for compound attribute IDs where the single components are used in many attributes. This optimization of the static memory consumption has the drawback that the dynamic memory consumption is increased when transforming PCD attribute IDs to strings. This especially applies to methods Attribute.getID() and Attributes.getIDs(). For performance critical use cases, it is therefore encouraged to

The PCD implementation guarantees to use instances of IPcdAttributeId for compound attribute IDs (IDs which contain component separator characters in their string representation). It is also guaranteed, that for meta-attributes of compound attribute IDs, the PCD-specific implementation is used. This means that if IPcdAttribute.getPcdId() == null for an attribute which was loaded from the repository, the attribute's identifier is not composed by several parts. But it is not guaranteed, that the PCD-specific implementation is used for meta-attributes of regular attribute IDs.

This interface may be extended in future releases. It is thus not intended to be implemented by client applications. New instances of IPcdAttributeId can be constructed using IPcdUtils.createPcdAttributeId(String[]), IPcdUtils#createPcdAttributeId(IPcdAttributeId, String) or IPcdUtils#createPcdAttributeId(String, String).


Field Summary
static char ATTR_COMPONENT_SEPARATOR_CHAR
          Constant defining the character used as separator for the attribute ID components.
 
Method Summary
 String get(int index)
          Returns the element at the specified position in this compound attribute ID.
 Enumeration<String> getElements()
          Gets an enumeration of the components of this attribute ID.
 String getMetaAttributeSuffix()
          Gets the suffix of a meta-attribute ID.
 boolean isMetaAttributeId()
          Checks wether this attribute ID is conform to the recommended syntax of identifiers for meta-attributes, i.e. whether the compound attribute ID contains at least one IPcdAttribute.ATTR_META_SEPERATOR_CHAR character.
 int size()
          Returns the number of elements in this compound attribute ID.
 String toString()
          Gets a string representation of this attribute ID.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

ATTR_COMPONENT_SEPARATOR_CHAR

static final char ATTR_COMPONENT_SEPARATOR_CHAR
Constant defining the character used as separator for the attribute ID components. The value of this constant is the forward slash character.

See Also:
Constant Field Values
Method Detail

get

String get(int index)
Returns the element at the specified position in this compound attribute ID.

Parameters:
index - index of element to return.
Returns:
the element at the specified position in this attribute ID
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).

size

int size()
Returns the number of elements in this compound attribute ID.

Returns:
the number of elements in this compound attribute ID

getElements

Enumeration<String> getElements()
Gets an enumeration of the components of this attribute ID.

Returns:
an enumeration of the components of this attribute ID

getMetaAttributeSuffix

String getMetaAttributeSuffix()
Gets the suffix of a meta-attribute ID. The recommended syntax of identifiers of meta-attributes is defined as <attr_name><attr_meta_seperator><meta-attribute-suffix> while the meta-attribute separator is defined by constant IPcdAttribute.ATTR_META_SEPERATOR_CHAR.

Returns:
the suffix of the meta-attribute ID or null, if this is not a meta-attribute ID.
See Also:
isMetaAttributeId()

isMetaAttributeId

boolean isMetaAttributeId()
Checks wether this attribute ID is conform to the recommended syntax of identifiers for meta-attributes, i.e. whether the compound attribute ID contains at least one IPcdAttribute.ATTR_META_SEPERATOR_CHAR character.

Returns:
true, if this attribute ID denotes a meta-attribute ID

toString

String toString()
Gets a string representation of this attribute ID. The single components are concatenated and separated by the separator character defined by IPcdAttributeId#COMPONENT_SEPARATOR_CHAR. If this attribute-ID denotes a meta-attribute-ID, the meta-attribute suffix is concatenated, separated by the IPcdAttribute.ATTR_META_SEPERATOR_CHAR.

Overrides:
toString in class Object
Returns:
a string representation of this attribute ID
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] EP-BASIS-API [sap.com] tc/epbc/pcd/gl/api - EP-PIN
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM
[sap.com] EP-BASIS [sap.com] tc/epbc/pcd/pars/srvgldeprecated api BC-PIN-PCD
[sap.com] EP-BASIS-API [sap.com] tc/epbc/pcd/gl/api api EP-PIN


Copyright 2011 SAP AG Complete Copyright Notice