sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r642176 - /incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java
Date Fri, 28 Mar 2008 09:56:07 GMT
Author: fmeschbe
Date: Fri Mar 28 02:55:59 2008
New Revision: 642176

URL: http://svn.apache.org/viewvc?rev=642176&view=rev
Log:
SLING-345 NonExistingResource is just another SyntheticResource

Modified:
    incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java

Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java?rev=642176&r1=642175&r2=642176&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java
(original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java
Fri Mar 28 02:55:59 2008
@@ -21,53 +21,22 @@
 /**
  * Simple helper class representing nonexisting resources.
  */
-public final class NonExistingResource implements Resource {
-
-    private final ResourceResolver resourceResolver;
-
-    private final String resourceURI;
-
-    private final ResourceMetadata resourceMetadata;
+public final class NonExistingResource extends SyntheticResource {
 
     public NonExistingResource(ResourceResolver resourceResolver,
             String resourceURI) {
-        this.resourceResolver = resourceResolver;
-        this.resourceURI = resourceURI;
-
-        resourceMetadata = new ResourceMetadata();
-        resourceMetadata.setResolutionPath(resourceURI);
+        super(resourceResolver, resourceURI, RESOURCE_TYPE_NON_EXISTING);
     }
 
-    public String getPath() {
-        return resourceURI;
-    }
-
-    public String getResourceType() {
+    public final String getResourceType() {
+        // overwrite to prevent overwriting of this method in extensions of
+        // this class because the specific resource type is the marker of a
+        // NonExistingResource
         return RESOURCE_TYPE_NON_EXISTING;
     }
 
-    // Non-existing resources have no super type
-    public String getResourceSuperType() {
-        return null;
-    }
-    
-    public ResourceMetadata getResourceMetadata() {
-        return resourceMetadata;
-    }
-
-    public ResourceResolver getResourceResolver() {
-        return resourceResolver;
-    }
-
-    /**
-     * Returns <code>null</code> because a non-existing resource cannot adapt
-     * to anything.
-     */
-    public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
-        return null;
-    }
-
     public String toString() {
+        // overwrite to only list the class name and path, type is irrelevant
         return getClass().getSimpleName() + ", path=" + getPath();
     }
 }



Mime
View raw message