Global Information Store between resources

> Kai Schmidt writes:
> > Hi,
> > 
> > could someone get me started on this:
> > 
> > I would like a 'GlobalResource', which I can use to store some global and persistant information 
> > into.   Of cource one should be able to read this info by name from another resource. I tried with 
> > Resource Attributes and am able to create and store infos (in the java code, and in /Admin/Editor). 
> > like:
> > 
> > GlobalResource=Class.forName("w3c.jigsaw.tutorials.GlobalResource");
> > a = new StringAttribute("AGlobalAttribut", "Some Default", Attribute.EDITABLE);
> > MY_INDEX = AttributeRegistry.registerAttribute(GlobalResource, a) ;
> > 
> > but I can only read within the same program with:
> > 
> > getValue("MyOwnAttribut",null);
> > 
> > How can I read from another Resource? Or is there a better way to pass information from one 
> > (postable) resource to the other?
>
> Look in trhe mail archive, I outlined a simple solution to
> this. Basically:
>
> class SharedContext {
>     static Resource getSomeResource() {
>         // Restore the resource out of its store, or whatever
>     }
}
>
>  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?

Thanks,
Karen

Received on Thursday, 23 January 1997 03:23:32 UTC