Re: Global Information Store between resources

Hi Anselm,

> 
> Karen Cheng writes:
>  > Hi Anselm,
>  > 
>  > Thanks for your reply.
>  > 
>  > >  > public class ResourceManager extends HTTPResource {
>  > >  >   static GlobalResource gr;
>  > >  > 
>  > >  >   public ResourceManager() {}
>  > >  > 
>  > >  >   public synchronized GlobalResource getGlobalResource() {
>  > >  >     if (gr == null) {
>  > >  >       // Get the container resource.
>  > >  >       Resource parent = getParent();
>  > >  >       // Lookup the global resource within that container.
>  > >  >       gr = (GlobalResource) ((DirectoryResource) parent).lookup("globalResource\
>  > >  > ");
>  > >  >     }
>  > >  >     return gr;
>  > >  >   }
>  > >  > }
> 
> Where do you get the above "parent" from ? It should rather be
> getParent() by the way.

I have the line Resource parent = getParent(); right above the lookup line,
so I don't quite understand what you mean.

>  > The following is my GlobalResource class:
>  > ...
> This looks ok to me,
> 
> Can you point out line 17 in getGlobalResource ?

Yes, it's:

abstract public class HtmlPage extends PostableResource {

	:	:	:	:	:

  public HtmlPage() {
    ResourceManager rm = new ResourceManager();
    GlobalResource gr = rm.getGlobalResource();   <---- Line 17
	:	:	:	:	:

Thanks,
Karen

Received on Tuesday, 28 January 1997 11:57:15 UTC