- From: Anselm Baird_Smith <abaird@www43.inria.fr>
- Date: Thu, 23 Jan 1997 19:10:52 +0100 (MET)
- To: karenkay@sholink.com (Karen Cheng)
- Cc: www-jigsaw@www10.w3.org
Karen Cheng writes: > > And the in your resources, use: > > > > Resource r = SharedContext.getSomeResource(); > > r.getValue("some-attribute"); > > > > Anselm. > > Hi, > > Could you please give an example of how one can restore the resource > out of its store in the getSomeResource() method above? That is, > could you please fill in the code in the method? It really depends on a number of things. The simplest way is to assume that th resource is in the same resource store as the calling resource. In this case: public class MyResource ... { public Resource getSomeResource(String name) { // Get the container resource: Resource parent = getParent(); // Lookup the shared context resource within that container: if ( ! ( resource instanceof COntainerResource) ) throw new Exception(); return parent.lookup(name); } } Then, before using MyResource you should make sure to create the shared context resource in the store (ie either when initializing MyResource, or by using the /Admin/Editor) Anselm.
Received on Thursday, 23 January 1997 13:11:20 UTC