Friends,
I followed the SAP documentation example to store data on a subcontext.
My code is something like this:
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, IPcdAttribute.PERSISTENCY_ASPECT);
InitialContext iCtx = null;
try {
iCtx = new InitialContext(env);
// Get the top-level context
IPcdContext myPcdContext = (IPcdContext) iCtx.lookup("");
// Create an attribute and set its value to {"Value1","Value2"}
Attribute myAttr = new BasicAttribute("myAttribute","Value1");
myAttr.add("Value2");
Attributes myAttrs = new BasicAttributes();
myAttrs.put(myAttr);
// Create a subcontext with the predefined attributes
myPcdContext.createSubcontext("myContext",myAttrs);
} catch (NamingException e) {}
My doubt is now how can I access the data I stored ?
Is it possible ? Can anyone help me ?
regards,
Ramatís Oliveira dos Santos
Edited by: Ramatís on Jun 3, 2011 10:00 PM