Author: cziegeler
Date: Sat Jun 13 15:42:38 2015
New Revision: 1685277

URL: http://svn.apache.org/r1685277
Log:
SLING-4601 : throws information is missing on Resource, ResourceUtil, and 
ResourceResolver.

Modified:
    
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
    
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
    
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java

Modified: 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java?rev=1685277&r1=1685276&r2=1685277&view=diff
==============================================================================
--- 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
 (original)
+++ 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
 Sat Jun 13 15:42:38 2015
@@ -79,6 +79,10 @@ public interface Resource extends Adapta
      * Returns the parent resource or <code>null</code> if this resource
      * represents the root of the resource tree.
      *
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get the resource object from the path.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.1 (Sling API Bundle 2.1.0)
      */
     @CheckForNull Resource getParent();
@@ -89,6 +93,10 @@ public interface Resource extends Adapta
      * This method is a convenience and returns exactly the same resources as
      * calling <code>getResourceResolver().listChildren(resource)</code>.
      *
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get the resource iterator.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.1 (Sling API Bundle 2.1.0)
      * @see ResourceResolver#listChildren(Resource)
      */
@@ -100,6 +108,10 @@ public interface Resource extends Adapta
      * This method is a convenience and returns exactly the same resources as
      * calling <code>getResourceResolver().getChildren(resource)</code>.
      *
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get the resource iterator.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.2 (Sling API Bundle 2.2.0)
      * @see ResourceResolver#getChildren(Resource)
      */
@@ -112,6 +124,10 @@ public interface Resource extends Adapta
      * This method is a convenience and returns exactly the same resources as
      * calling <code>getResourceResolver().getResource(resource, 
relPath)</code>.
      *
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get the resource object from the path.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.1 (Sling API Bundle 2.1.0)
      * @see ResourceResolver#getResource(Resource, String)
      */
@@ -137,6 +153,9 @@ public interface Resource extends Adapta
      * resource type hierarchy.
      * If a client is interested in the effective resource super type
      * of a resource, it should call {@link 
ResourceResolver#getParentResourceType(Resource)}.
+     * @return The super type of the resource or {@code null}.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      */
     @CheckForNull String getResourceSuperType();
 
@@ -144,6 +163,8 @@ public interface Resource extends Adapta
      * Checks if the resource has any child resources.
      *
      * @return <code>true</code> if the resource has any child resources
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.4.4 (Sling API Bundle 2.5.0)
      */
     boolean hasChildren();
@@ -157,6 +178,8 @@ public interface Resource extends Adapta
      *         super type(s) equals the given resource type. <code>false</code>
      *         is also returned if <code>resourceType</code> is
      *         <code>null</code>.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.1.0 (Sling API Bundle 2.1.0)
      */
     boolean isResourceType(String resourceType);

Modified: 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=1685277&r1=1685276&r2=1685277&view=diff
==============================================================================
--- 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
 (original)
+++ 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
 Sat Jun 13 15:42:38 2015
@@ -466,6 +466,8 @@ public interface ResourceResolver extend
      * @param resource
      *            the resource to check for direct children
      * @return <code>true</code> if the resource has any child resources
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.4.4 (Sling API Bundle 2.5.0)
      */
     boolean hasChildren(@Nonnull Resource resource);
@@ -577,6 +579,8 @@ public interface ResourceResolver extend
      * @throws UnsupportedOperationException If the resource provider does not 
allow to
      *                                       delete this resource.
      * @throws PersistenceException If the operation fails.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
     void delete(@Nonnull Resource resource)
@@ -594,6 +598,8 @@ public interface ResourceResolver extend
      * @throws UnsupportedOperationException If the resource provider does not 
allow to
      *                                       create a resource at that 
location.
      * @throws PersistenceException If the operation fails.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
     @Nonnull Resource create(@Nonnull Resource parent, @Nonnull String name, 
Map<String, Object> properties)
@@ -601,6 +607,8 @@ public interface ResourceResolver extend
 
     /**
      * Revert all pending changes.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
     void revert();
@@ -609,12 +617,16 @@ public interface ResourceResolver extend
      * Persist all pending changes.
      *
      * @throws PersistenceException
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
     void commit() throws PersistenceException;
 
     /**
      * Are there any pending changes?
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
     boolean hasChanges();
@@ -630,6 +642,8 @@ public interface ResourceResolver extend
      * @return The resource super type or <code>null</code>. This
      *         method also returns <code>null</code> if the
      *         provided resource is <code>null</code>
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.3 (Sling API Bundle 2.4.0)
      */
     @CheckForNull String getParentResourceType(final Resource resource);
@@ -645,6 +659,8 @@ public interface ResourceResolver extend
      *         <code>null</code> if the resource type does not exist or returns
      *         <code>null</code> for its super type. It also returns
      *         <code>null</code> if <code>resourceType> is null.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.3 (Sling API Bundle 2.4.0)
      */
     public @CheckForNull String getParentResourceType(final String 
resourceType);
@@ -659,6 +675,8 @@ public interface ResourceResolver extend
      *         super type(s) equals the given resource type. <code>false</code>
      *         is also returned if <code>resource</code> 
or<code>resourceType</code>
      *         are <code>null</code>.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.3 (Sling API Bundle 2.4.0)
      */
     boolean isResourceType(final Resource resource, final String resourceType);
@@ -666,6 +684,8 @@ public interface ResourceResolver extend
     /**
      * The resolver is updated to reflect the latest state.
      * Resources which have changes pending are not discarded.
+     * @throws IllegalStateException if this resource resolver has already been
+     *             {@link #close() closed}.
      * @since 2.3 (Sling API Bundle 2.4.0)
      */
     void refresh();

Modified: 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java?rev=1685277&r1=1685276&r2=1685277&view=diff
==============================================================================
--- 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
 (original)
+++ 
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
 Sat Jun 13 15:42:38 2015
@@ -207,6 +207,10 @@ public class ResourceUtil {
      * Utility method returns the parent resource of the resource.
      *
      * @throws NullPointerException If <code>rsrc</code> is <code>null</code>.
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get the resource object from the path.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @return The parent resource or null if the rsrc is the root.
      * @deprecated since 2.1.0, use {@link Resource#getParent()} instead
      */
@@ -339,6 +343,8 @@ public class ResourceUtil {
      * @param parent The {@link Resource Resource} whose children are 
requested.
      * @return An <code>Iterator</code> of {@link Resource} objects.
      * @throws NullPointerException If <code>parent</code> is 
<code>null</code>.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @throws org.apache.sling.api.SlingException If any error occurs 
acquiring
      *             the child resource iterator.
      * @see ResourceResolver#listChildren(Resource)
@@ -404,6 +410,8 @@ public class ResourceUtil {
      * @return the super type of the <code>resourceType</code> or
      *         <code>null</code> if the resource type does not exists or 
returns
      *         <code>null</code> for its super type.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.0.6 (Sling API Bundle 2.0.6)
      * @deprecated Use {@link ResourceResolver#getParentResourceType(String)}
      */
@@ -423,6 +431,8 @@ public class ResourceUtil {
      * @param resource The resource to return the resource super type for.
      * @return the super type of the <code>resource</code> or <code>null</code>
      *         if no super type could be computed.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.0.6 (Sling API Bundle 2.0.6)
      * @deprecated Use {@link ResourceResolver#getParentResourceType(Resource)}
      */
@@ -445,6 +455,8 @@ public class ResourceUtil {
      *         Otherwise returns the result of calling
      *         {@link Resource#isResourceType(String)} with the given
      *         <code>resourceType</code>.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.0.6 (Sling API Bundle 2.0.6)
      * @deprecated Use {@link ResourceResolver#isResourceType(Resource, 
String)}
      */
@@ -474,10 +486,12 @@ public class ResourceUtil {
 
             private T nextObject = seek();
 
+            @Override
             public boolean hasNext() {
                 return nextObject != null;
             }
 
+            @Override
             public T next() {
                 if (!hasNext()) {
                     throw new NoSuchElementException();
@@ -487,6 +501,7 @@ public class ResourceUtil {
                 return object;
             }
 
+            @Override
             public void remove() {
                 throw new UnsupportedOperationException();
             }
@@ -510,6 +525,11 @@ public class ResourceUtil {
      * @param resourceType The optional resource type of the final resource to 
create
      * @param intermediateResourceType THe optional resource type of all 
intermediate resources
      * @param autoCommit If set to true, a commit is performed after each 
resource creation.
+     * @return The resource for the path.
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get/create the resource object from the path.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.3.0  (Sling API Bundle 2.4.0)
      */
     public static @Nonnull Resource getOrCreateResource(
@@ -539,6 +559,11 @@ public class ResourceUtil {
      * @param resourceProperties The optional resource properties of the final 
resource to create
      * @param intermediateResourceType THe optional resource type of all 
intermediate resources
      * @param autoCommit If set to true, a commit is performed after each 
resource creation.
+     * @return The resource for the path.
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get/create the resource object from the path.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.3.0  (Sling API Bundle 2.4.0)
      */
     public static @Nonnull Resource getOrCreateResource(
@@ -578,6 +603,11 @@ public class ResourceUtil {
      * @param resourceProperties The optional resource properties of the final 
resource to create
      * @param intermediateResourceType THe optional resource type of all 
intermediate resources
      * @param autoCommit If set to true, a commit is performed after each 
resource creation.
+     * @return The resource for the path.
+     * @throws org.apache.sling.api.SlingException If an error occurs trying to
+     *             get/create the resource object from the path.
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      */
     private static Resource getOrCreateResourceInternal(
             final ResourceResolver resolver,
@@ -661,6 +691,8 @@ public class ResourceUtil {
      *
      * @throws PersistenceException if it can not find unique name for child 
resource.
      * @throws NullPointerException if <code>parent</code> is null
+     * @throws IllegalStateException if the resource resolver has already been
+     *             closed}.
      * @since 2.5 (Sling API Bundle 2.7.0)
      */
     public static String createUniqueChildName(final Resource parent, final 
String name)


Reply via email to