Show TOC

Using the InitialContextFactory Class to Access the UCDLocate this document in the navigation structure

Use

You use the com.sapportals.portal.pcd.gl.ucd.UcdInitialContextFactory class to create the InitialContext in the UCD. More information about this class: http://java.sun.com/products/jndi/Information published on non-SAP site

The initial context points to a specific user folder in the UCD. If the user folder does not exist, it is created.

The following constant is defined in the class com.sapportals.portal.pcd.gl.IPcdContext :

public static final String UCD_INITIAL_CONTEXT_FACTORY = "com.sapportals.portal.pcd.gl.ucd.UcdInitialContextFactory";

Caution

To access the UCD, you must provide the user principal ID as the SECURITY_PRINCIPAL property in the JNDI environment.

Example
            private IPcdContext getUcdContext() throws NamingException
{
        Hashtable<Object, Object> env = new Hashtable<Object, Object>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.UCD_INITIAL_CONTEXT_FACTORY);
        env.put(Context.SECURITY_PRINCIPAL, user);
        InitialContext ctx = new InitialContext(env);
        return (IPcdContext) ctx.lookup("");
}