Looking Up Objects
Context
This section describes how to look up a PCD object and get the semantic object for the object.
Procedure
-
Set the parameters for a JNDI lookup in the PCD.
Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY); env.put(Context.SECURITY_PRINCIPAL, request.getUser()); env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS); -
Perform the lookup by supplying the PCD name of the object, and then cast the returned object to the appropriate semantic object interface.
InitialContext iCtx = null; try { String iViewID = "pcd:portal_content/myFolder/stocks"; iCtx = new InitialContext(env); IiView myIView =(IiView)iCtx.lookup(iViewID); } catch(NamingException e) { }