org.apache.sling.api.resource
Class SyntheticResource

java.lang.Object
  extended by org.apache.sling.api.adapter.SlingAdaptable
      extended by org.apache.sling.api.resource.AbstractResource
          extended by org.apache.sling.api.resource.SyntheticResource
All Implemented Interfaces:
Adaptable, Resource
Direct Known Subclasses:
MergedMultiResource, NonExistingResource

public class SyntheticResource
extends AbstractResource

The SyntheticResource class is a simple implementation of the Resource interface which may be used to provide a resource object which has no actual resource data.


Field Summary
 
Fields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
 
Constructor Summary
SyntheticResource(ResourceResolver resourceResolver, ResourceMetadata rm, String resourceType)
          Creates a synthetic resource with the given ResourceMetadata and resourceType.
SyntheticResource(ResourceResolver resourceResolver, String path, String resourceType)
          Creates a synthetic resource with the given path and resourceType.
 
Method Summary
 String getPath()
          Returns the absolute path of this resource in the resource tree.
 ResourceMetadata getResourceMetadata()
          Returns a resource metadata object containing just the path of this resource as the ResourceMetadata.RESOLUTION_PATH property.
 ResourceResolver getResourceResolver()
          Returns the ResourceResolver with which this synthetic resource is related or null if none.
 String getResourceSuperType()
          Synthetic resources by default do not have a resource super type.
 String getResourceType()
          The resource type is meant to point to rendering/processing scripts, editing dialogs, etc.
 String toString()
           
 
Methods inherited from class org.apache.sling.api.resource.AbstractResource
getChild, getChildren, getName, getParent, isResourceType, listChildren
 
Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable
adaptTo, setAdapterManager, unsetAdapterManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.sling.api.adapter.Adaptable
adaptTo
 

Constructor Detail

SyntheticResource

public SyntheticResource(ResourceResolver resourceResolver,
                         String path,
                         String resourceType)
Creates a synthetic resource with the given path and resourceType.


SyntheticResource

public SyntheticResource(ResourceResolver resourceResolver,
                         ResourceMetadata rm,
                         String resourceType)
Creates a synthetic resource with the given ResourceMetadata and resourceType.

Method Detail

getPath

public String getPath()
Description copied from interface: Resource
Returns the absolute path of this resource in the resource tree.

See Also:
Resource.getPath()

getResourceType

public String getResourceType()
Description copied from interface: Resource
The resource type is meant to point to rendering/processing scripts, editing dialogs, etc. It is usually a path in the repository, where scripts and other tools definitions are found, but the ResourceResolver is free to set this to any suitable value such as the primary node type of the JCR node from which the resource is created.

If the resource instance represents a resource which is not actually existing, this method returns Resource.RESOURCE_TYPE_NON_EXISTING.

See Also:
Resource.getResourceType()

getResourceSuperType

public String getResourceSuperType()
Synthetic resources by default do not have a resource super type.


getResourceMetadata

public ResourceMetadata getResourceMetadata()
Returns a resource metadata object containing just the path of this resource as the ResourceMetadata.RESOLUTION_PATH property.

See Also:
ResourceMetadata

getResourceResolver

public ResourceResolver getResourceResolver()
Returns the ResourceResolver with which this synthetic resource is related or null if none.


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011-2013 Adobe Systems Incorporated. All Rights Reserved.