com.sapportals.portal.pcd.gl

Interface IPcdUtils


public interface IPcdUtils

Provides miscellaneous factory methods and auxiliary functions. An instance of this interface can be retrieved via PcdAccess.

This interface is not intended to be implemented by clients.


Method Summary
 String convertShortNameToUrl(String shortName)
          Converts a short name to its corresponding URL (name including JNDI scheme).
 String convertUrlToShortName(String url)
          Converts a URL (name including JNDI scheme) to a short name.
 IPcdAttribute createPcdAttribute(PcdAttributeValueType type, IPcdAttributeId attributeId)
          Creates an ordered PcdAttribute of the specified value type and id.
 IPcdAttribute createPcdAttribute(PcdAttributeValueType type, IPcdAttributeId attributeId, boolean isOrdered)
          Creates a PcdAttribute of the specified value type and id and ordering
 IPcdAttribute createPcdAttribute(PcdAttributeValueType type, String attributeName)
          Creates an ordered PcdAttribute of the selected value type.
 IPcdAttribute createPcdAttribute(PcdAttributeValueType type, String attributeName, boolean isOrdered)
          Creates pcd attribute instance
 IPcdAttributeId createPcdAttributeId(String[] attributeNameElements)
          Creates a compound attribute identifier from the specified attribute ID components.
 IPcdAttributes createPcdAttributes()
          createPcdAttributes creates an instance of PcdAttributes
 String escapeShortName(String shortName)
          Escapes a short name so that it can be used as atomic name in PCD.
 Locale getDefaultLocale()
          Returns the default locale of the portal.
 ILockHandle getLockHandle(String nameInNamespace)
          Returns the ILockHandle for the specified name (i.e., without prefix), which allows to lock/unlock it etc.
 int getMaxLengthAtomicName()
          Returns the maximum length of atomic names.
 int getMaxLengthAttributeId()
          Deprecated. the restriction in the length of an attributes name has been removed
 int getMaxLengthTextType()
          Returns the maximum length of a text type.
 IPcdNameFactory getPcdNameFactory()
          Returns an IPcdNameFactory instance that provides various methods for creation of IPcdName objects.
 String getUrlSchemePrefix()
          Returns the pcd url scheme prefix (pcd:)
 WriteProtectInfo getWriteProtectInfo()
          Returns information about the write protect mode.
 boolean isADbSearch(String jndiFilterExpr, Object[] filterArgs, Locale locale)
           
 boolean matches(String objAtomicName, String objObjectClass, String objDeltalinkTarget, IPcdAttributes objAttributes, IPcdAttributes objUnitAttributes, IPcdAttributes matchingAttributes, String filterExpression, Locale locale)
          Performs the same comparison as is used internally during the search.
 boolean originalLocaleTextsOnly()
          If true, only texts in the original locale are returned.
 void publishChanges()
          Publishes changes to pcd objects to all other objects that depend on the changed one.
 DirContext recreateSchemaEntry(String atomicName, Attributes attrs, Object securityPrincipal)
          Ensures that the specified schema entry exists (after this call returns).
 boolean storesLongString(String longStr)
          Returns true if the long string longStr has already been converted to a short string.
 String unescapeShortName(String escapedShortName)
          Unescapes a short name that has been escaped with method escapeShortName(String).
 

Method Detail

createPcdAttribute

IPcdAttribute createPcdAttribute(PcdAttributeValueType type,
                                 String attributeName)
Creates an ordered PcdAttribute of the selected value type.

Parameters:
type -
attributeName -
Returns:
IPcdAttribute

createPcdAttribute

IPcdAttribute createPcdAttribute(PcdAttributeValueType type,
                                 String attributeName,
                                 boolean isOrdered)
Creates pcd attribute instance

Parameters:
type -
attributeName -
isOrdered -
Returns:
IPcdAttribute

createPcdAttribute

IPcdAttribute createPcdAttribute(PcdAttributeValueType type,
                                 IPcdAttributeId attributeId)
Creates an ordered PcdAttribute of the specified value type and id.

Parameters:
type -
attributeId - the ID of the new attribute
Returns:
an ordered PcdAttribute of the specified value type and id

createPcdAttribute

IPcdAttribute createPcdAttribute(PcdAttributeValueType type,
                                 IPcdAttributeId attributeId,
                                 boolean isOrdered)
Creates a PcdAttribute of the specified value type and id and ordering

Parameters:
type -
attributeId - the ID of the new attribute
isOrdered -
Returns:
a PCD attribute instance of the specified value type and id and ordering

createPcdAttributeId

IPcdAttributeId createPcdAttributeId(String[] attributeNameElements)
Creates a compound attribute identifier from the specified attribute ID components.

Note: usage of compound attribute IDs should be restricted to special use-cases. This method is not intended for public use and might be discarded in future releases.

Parameters:
attributeNameElements - the elements of the compound attribute id
Returns:
a compound attribute identifier

createPcdAttributes

IPcdAttributes createPcdAttributes()
createPcdAttributes creates an instance of PcdAttributes

Returns:
IPcdAttributes

getMaxLengthAtomicName

int getMaxLengthAtomicName()
Returns the maximum length of atomic names.

Returns:
int

getMaxLengthAttributeId

@Deprecated
int getMaxLengthAttributeId()
Deprecated. the restriction in the length of an attributes name has been removed

Returns the maximum length of atribute ids.

Returns:
int

getMaxLengthTextType

int getMaxLengthTextType()
Returns the maximum length of a text type.

Returns:
int

convertUrlToShortName

String convertUrlToShortName(String url)
                             throws IllegalArgumentException
Converts a URL (name including JNDI scheme) to a short name. This method uses the SHA-1 algorithm. The result of this method is stored in the database, because the algorithm is not invertible. In theory name clashes are possible but not very likely. recognized as URL.

Parameters:
url -
Returns:
String
Throws:
IllegalArgumentException - if the parameter is not
See Also:
convertShortNameToUrl(String)

convertShortNameToUrl

String convertShortNameToUrl(String shortName)
Converts a short name to its corresponding URL (name including JNDI scheme). This method checks in the database if there is an entry for the short name. If an entry was found then the long string is returned, otherwise null.

Parameters:
shortName -
Returns:
String
See Also:
convertUrlToShortName(String)

escapeShortName

String escapeShortName(String shortName)
Escapes a short name so that it can be used as atomic name in PCD.

The short name generated by method convertUrlToShortName(String) can contain characters which are not allowed as part of an atomic name in PCD.
This method "escapes" these characters by replacing them with characters which are allowed for names in PCD but which are not part of the character encoding which is used by method convertUrlToShortName(String)

Parameters:
shortName - A short name generated by convertUrlToShortName(String)
Returns:
A short name as String which contains only characters that are valid for names in PCD
See Also:
unescapeShortName(String), convertUrlToShortName(String)

unescapeShortName

String unescapeShortName(String escapedShortName)
Unescapes a short name that has been escaped with method escapeShortName(String).

Parameters:
escapedShortName - A short name which was escaped by escapeShortName(String)
Returns:
The unescaped short name as String like originally generated by method convertUrlToShortName(String)
See Also:
escapeShortName(String)

storesLongString

boolean storesLongString(String longStr)
Returns true if the long string longStr has already been converted to a short string.

Parameters:
longStr - long string
Returns:
true if the long string longStr has already been converted to a short string, otherwise false

getUrlSchemePrefix

String getUrlSchemePrefix()
Returns the pcd url scheme prefix (pcd:)

Returns:
String

getDefaultLocale

Locale getDefaultLocale()
Returns the default locale of the portal. This is the first fallback locale in text handling common to all users if the text is not available in the requested (browser) locale.

Returns:
Locale

originalLocaleTextsOnly

boolean originalLocaleTextsOnly()
If true, only texts in the original locale are returned. Please refer to the section "Text-Attributes" in the package description of com.sapportals.portal.pcd.gl for details.

Returns:
boolean

publishChanges

void publishChanges()
Publishes changes to pcd objects to all other objects that depend on the changed one. This method triggers all required notifications, local (in the same VM) and cross-server (to other VM's belonging to the same cluster), so that all objects that depend on the changed one can adapt to the new situation. If this method is not called by the application, then the notifications will be done automatically at some later point in time.


recreateSchemaEntry

DirContext recreateSchemaEntry(String atomicName,
                               Attributes attrs,
                               Object securityPrincipal)
                               throws NamingException
Ensures that the specified schema entry exists (after this call returns). If there is already a schema entry with the same ID and the same attributes then the schema entry is not rewritten. If there is a schema entry with the same ID but different attributes then the attributes are modified. If there is no schema entry with the same ID then the schema entry is created. Only non-technical attributes are relevant for the comparison with an existing schema entry.

Parameters:
atomicName - name of the schema entry
attrs - attributes of the schema entry
securityPrincipal - security principal, which is added to the environment of the context; can be null; in future releases this might become a required parameter
Returns:
DirContext
Throws:
NamingException

getLockHandle

ILockHandle getLockHandle(String nameInNamespace)
                          throws NamingException
Returns the ILockHandle for the specified name (i.e., without prefix), which allows to lock/unlock it etc. This method should be used if you need to lock a not yet existing unit. It is not checked whether the object exists, and whether it is a unit.

Parameters:
nameInNamespace - a pcd-internal "name in namespace", i.e., without url-prefix
Returns:
the respective locking handle
Throws:
NamingException

getWriteProtectInfo

WriteProtectInfo getWriteProtectInfo()
Returns information about the write protect mode.

Returns:
write protect mode information

getPcdNameFactory

IPcdNameFactory getPcdNameFactory()
Returns an IPcdNameFactory instance that provides various methods for creation of IPcdName objects.

Returns:
an IPcdNameFactory instance

matches

boolean matches(String objAtomicName,
                String objObjectClass,
                String objDeltalinkTarget,
                IPcdAttributes objAttributes,
                IPcdAttributes objUnitAttributes,
                IPcdAttributes matchingAttributes,
                String filterExpression,
                Locale locale)
                throws NamingException
Performs the same comparison as is used internally during the search. The "object" is represented by the parameters objAtomicName, objObjectClass, objDeltalinkTarget, objAttributes, and objUnitAttributes. The comparison is done against the parameters matchingAttributes and filterExpression for the given locale.

Parameters:
objAtomicName - maybe null if the comparison does not check the atomic name
objObjectClass - maybe null if the comparison does not check the obejct class
objDeltalinkTarget - maybe null if the comparison does not check the deltalink target
objAttributes - the attributes of the object
objUnitAttributes - maybe null if the comparison does not check the unit attributes of the object
matchingAttributes - maybe null if filterExpression is not null
filterExpression - maybe null if matchingAttributes is not null
locale - is relevant only if text attributes are compared
Returns:
true if the object matches
Throws:
NamingException - if e.g. the filterString cannot be parsed

isADbSearch

boolean isADbSearch(String jndiFilterExpr,
                    Object[] filterArgs,
                    Locale locale)
                    throws InvalidSearchFilterException
Parameters:
jndiFilterExpr -
filterArgs -
locale -
Returns:
true if the given expression can be executed on the database layer, i.e. only considers object class, atomic name and unit attributes - atomic name and object class may be case insensitive. In the case-insensitive case, the PL layer does the post filtering directly on the result set.
Throws:
InvalidSearchFilterException
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] EP-BASIS-API [sap.com] tc/epbc/pcd/gl/api api EP-PIN
[sap.com] EP-BASIS [sap.com] tc/epbc/pcd/pars/srvgldeprecated api BC-PIN-PCD
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2011 SAP AG Complete Copyright Notice