Show TOC

How PCD Lookups are PerformedLocate this document in the navigation structure

Use

In the PCD, all objects are simply contexts with a set of attributes.

One attribute is the object class ( com.sap.portal.pcd.gl.ObjectClass ), which indicates the type of object. When a lookup is performed on an object, the PCD checks the object class attribute to determine which object provider to use for creating a Java object from the set of attributes.

The object class com.sap.portal.pcd.gl.GlContext indicates a folder object, which does not have a special object provider. All other values specify a semantic object.

Process

The following describes how PCD lookups are performed:

  1. A portal component or service creates a PCD initial context, including specifying the following environment variables:

    1. Initial Context Factory

    2. Aspect: Indicates to the object factory what type of Java object to return.

      More information: Aspects

    3. User: PCD checks if this user has permissions to perform this lookup.

    4. Personalization: Indicates whether to get a personalized object and, if so, for which user. This variable is optional.

      More information: Personalization

    The following is an example of setting the environment variables ( env is a Hashtable that holds the environment variables, and request is the IPortalComponentRequest for the current request):

    import javax.naming.Context;
    importcom.sapportals.portal.pcd.gl.IPcdContext;
    importcom.sap.portal.directory.Constants;
    importcom.sapportals.portal.pcd.gl.IPcdAttribute;
     
    env.put(Context.INITIAL_CONTEXT_FACTORY,   
        IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);
    env.put(Context.SECURITY_PRINCIPAL, request.getUser());
    env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL, request.getUser());
    
                   

    With the PCD initial context, the application requests a lookup, by calling lookup() on the initial context and providing a PCD name. More information: PCD Name

  2. The PCD checks that the name is valid.

  3. The PCD finds the object type of the object being looked up, and calls the appropriate object provider for that type of object. More information: Semantic Objects

    If the aspect was set to IPcdAttribute.PERSISTENCY_ASPECT , the PCD does not call the object provider but, instead, creates and returns a IPcdContext object, and the process stops here.

  4. The object provider checks the aspect, and creates the appropriate object for that aspect.

  5. The object is returned to the PCD provider, which returns it to the calling application.