W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 1997

Re: Global Information Store between resources

From: Karen Cheng <karenkay@sholink.com>
Date: Tue, 28 Jan 1997 22:02:02 -0800 (PST)
Message-Id: <m0vpT5u-0002zaC@PebbleBeach.sholink.com>
To: abaird@www10.w3.org
Cc: www-jigsaw@www10.w3.org
Hi Anselm,

>  > >  > 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.
>  > The following is my GlobalResource class:
>  > ...
> This looks ok to me,
> 
> Can you point out line 17 in getGlobalResource ?

I think I gave you the wrong method in my last mail.  It should be:

  public synchronized GlobalResource getGlobalResource() {
    if (gr == null) {
      // Get the container resource.
      Resource parent = getParent();
      if (parent == null) {
        System.out.println("No parent!!!");
      }
      // Lookup the global resource within that container.
line 17: gr = (GlobalResource) ((DirectoryResource) parent).lookup("globalResource\
");
    }
    return gr;
  }

The "No parent!!!" message that I have in the method got printed, so
I guess getParent() returned null.  How is the parent attribute computed,
btw?  How do I make it so that it's the same as the parent of globalResource?

Thanks,
Karen
Received on Wednesday, 29 January 1997 01:02:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:26 GMT