Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-1193

Extend Resource interface and provide AbstractResource base class

    XMLWordPrintableJSON

Details

    Description

      Currently the Resource interface has only bare bones API to access its own local attributes, like getPath() or getResourceType().

      Accessing the resource in the context of its parent or its children is not currently possible and doing so requires getting the resource resolver out of the resource and asking the resource resolver.

      For convenience, we should add the following methods:

      getParent() – returns the parent resource (same as ResourceUtil.getParent(this))
      getName() – returns the name of the resource (same as ResourceUtil.getName(this))
      listChildren() – same as getResourceResolver().listChildren(this)
      getChild(String) – same as getResourceResolver().getResource(this, path)
      isResourceType(String) – same as ResourceUtil.isA(this, String)

      The new AbstractResource class will implement these methods as indicated.

      Implementors of the Resource interface are then advised to actually extend from the AbstractResource interface, which in the future will provide default implementations of any methods added to the Resource interface, if it makes sense.

      Attachments

        Activity

          People

            fmeschbe Felix Meschberger
            fmeschbe Felix Meschberger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: