You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/01/30 17:39:55 UTC
svn commit: r616810 - in /incubator/sling/trunk:
api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Author: fmeschbe
Date: Wed Jan 30 08:39:50 2008
New Revision: 616810
URL: http://svn.apache.org/viewvc?rev=616810&view=rev
Log:
SLING-198 Provide accessor to the search path used by ResourceResolver#getResource(String)
Modified:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=616810&r1=616809&r2=616810&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java Wed Jan 30 08:39:50 2008
@@ -161,6 +161,17 @@
Resource getResource(Resource base, String path);
/**
+ * Returns the search path used by the {@link #getResource(String)} method
+ * to search for resources by relative path. If no search path is set an
+ * empty array is returned.
+ * <p>
+ * The returns array of Strings is a copy of the internal vaue, so
+ * modifications to this array have no influence on the operation of the
+ * ResourceResolver.
+ */
+ String[] getSearchPath();
+
+ /**
* Returns an <code>Iterator</code> of {@link Resource} objects loaded
* from the children of the given <code>Resource</code>.
* <p>
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=616810&r1=616809&r2=616810&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java Wed Jan 30 08:39:50 2008
@@ -132,7 +132,8 @@
}
// otherwise we have to apply the search path
- for (String prefix : factory.getPath()) {
+ // (don't use this.getSearchPath() to save a few cycle for not cloning)
+ for (String prefix : factory.getSearchPath()) {
Resource res = getResource(prefix + path);
if (res != null) {
return res;
@@ -152,6 +153,10 @@
return getResource(path);
}
+ public String[] getSearchPath() {
+ return factory.getSearchPath().clone();
+ }
+
public Iterator<Resource> listChildren(Resource parent) {
if (parent instanceof Descendable) {
return ((Descendable) parent).listChildren();