incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r782945 [1/2] - in /incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager: post/ post/impl/ resource/
Date Tue, 09 Jun 2009 10:16:54 GMT
Author: fmeschbe
Date: Tue Jun  9 10:16:54 2009
New Revision: 782945

URL: http://svn.apache.org/viewvc?rev=782945&view=rev
Log:
Formatting ...

Modified:
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractAuthorizablePostServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractGroupPostServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractUserPostServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/ChangeUserPasswordServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateGroupServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateUserServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/DeleteAuthorizableServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateGroupServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateUserServlet.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/DateParser.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/RequestProperty.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/resource/AuthorizableResource.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/resource/AuthorizableResourceProvider.java
    incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/resource/AuthorizableValueMap.java

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractAuthorizablePostServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractAuthorizablePostServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractAuthorizablePostServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractAuthorizablePostServlet.java Tue Jun  9 10:16:54 2009
@@ -54,12 +54,13 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * Base class for all the POST servlets for the UserManager operations 
+ * Base class for all the POST servlets for the UserManager operations
  */
-public abstract class AbstractAuthorizablePostServlet extends SlingAllMethodsServlet {
-	private static final long serialVersionUID = -5918670409789895333L;
+public abstract class AbstractAuthorizablePostServlet extends
+        SlingAllMethodsServlet {
+    private static final long serialVersionUID = -5918670409789895333L;
 
-	/**
+    /**
      * default log
      */
     private final Logger log = LoggerFactory.getLogger(getClass());
@@ -71,9 +72,9 @@
      *               values.4="dd.MM.yyyy HH:mm:ss" values.5="dd.MM.yyyy"
      */
     private static final String PROP_DATE_FORMAT = "servlet.post.dateFormats";
-	
-	private DateParser dateParser;
-	
+
+    private DateParser dateParser;
+
     // ---------- SCR Integration ----------------------------------------------
 
     protected void activate(ComponentContext context) {
@@ -89,15 +90,18 @@
     protected void deactivate(ComponentContext context) {
         dateParser = null;
     }
-	
-    
-	/* (non-Javadoc)
-	 * @see org.apache.sling.api.servlets.SlingAllMethodsServlet#doPost(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.SlingHttpServletResponse)
-	 */
-	@Override
-	protected void doPost(SlingHttpServletRequest request,
-			SlingHttpServletResponse httpResponse) throws ServletException,
-			IOException {
+
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.sling.api.servlets.SlingAllMethodsServlet#doPost(org.apache
+     * .sling.api.SlingHttpServletRequest,
+     * org.apache.sling.api.SlingHttpServletResponse)
+     */
+    @Override
+    protected void doPost(SlingHttpServletRequest request,
+            SlingHttpServletResponse httpResponse) throws ServletException,
+            IOException {
         // prepare the response
         HtmlResponse htmlResponse = new HtmlResponse();
         htmlResponse.setReferer(request.getHeader("referer"));
@@ -112,30 +116,45 @@
         // parent location
         path = ResourceUtil.getParent(path);
         if (path != null) {
-        	htmlResponse.setParentLocation(externalizePath(request, path));
+            htmlResponse.setParentLocation(externalizePath(request, path));
         }
 
         Session session = request.getResourceResolver().adaptTo(Session.class);
 
         final List<Modification> changes = new ArrayList<Modification>();
-        
+
         try {
             handleOperation(request, htmlResponse, changes);
-            
-            //TODO: maybe handle SlingAuthorizablePostProcessor handlers here
-            
+
+            // TODO: maybe handle SlingAuthorizablePostProcessor handlers here
+
             // set changes on html response
-            for(Modification change : changes) {
-                switch ( change.getType() ) {
-                    case MODIFY : htmlResponse.onModified(change.getSource()); break;
-                    case DELETE : htmlResponse.onDeleted(change.getSource()); break;
-                    case MOVE :   htmlResponse.onMoved(change.getSource(), change.getDestination()); break;
-                    case COPY :   htmlResponse.onCopied(change.getSource(), change.getDestination()); break;
-                    case CREATE : htmlResponse.onCreated(change.getSource()); break;
-                    case ORDER : htmlResponse.onChange("ordered", change.getSource(), change.getDestination()); break;
+            for (Modification change : changes) {
+                switch (change.getType()) {
+                    case MODIFY:
+                        htmlResponse.onModified(change.getSource());
+                        break;
+                    case DELETE:
+                        htmlResponse.onDeleted(change.getSource());
+                        break;
+                    case MOVE:
+                        htmlResponse.onMoved(change.getSource(),
+                            change.getDestination());
+                        break;
+                    case COPY:
+                        htmlResponse.onCopied(change.getSource(),
+                            change.getDestination());
+                        break;
+                    case CREATE:
+                        htmlResponse.onCreated(change.getSource());
+                        break;
+                    case ORDER:
+                        htmlResponse.onChange("ordered", change.getSource(),
+                            change.getDestination());
+                        break;
                 }
             }
-            
+
             if (session.hasPendingChanges()) {
                 session.save();
             }
@@ -157,7 +176,7 @@
                     e.getMessage(), e);
             }
         }
-        
+
         // check for redirect URL if processing succeeded
         if (htmlResponse.isSuccessful()) {
             String redirect = getRedirectUrl(request, htmlResponse);
@@ -169,22 +188,22 @@
 
         // create a html response and send if unsuccessful or no redirect
         htmlResponse.send(httpResponse, isSetStatus(request));
-	}
+    }
+
+    /**
+     * Extending Servlet should implement this operation to do the work
+     * 
+     * @param request the sling http request to process
+     * @param htmlResponse the response
+     * @param changes
+     */
+    abstract protected void handleOperation(SlingHttpServletRequest request,
+            HtmlResponse htmlResponse, List<Modification> changes)
+            throws RepositoryException;
 
-	/**
-	 * Extending Servlet should implement this operation to do the work
-	 * 
-	 * @param request the sling http request to process
-	 * @param htmlResponse the response 
-	 * @param changes 
-	 */
-	abstract protected void handleOperation(SlingHttpServletRequest request,
-			HtmlResponse htmlResponse, List<Modification> changes) throws RepositoryException;
-	
-	
     /**
      * compute redirect URL (SLING-126)
-     *
+     * 
      * @param ctx the post processor
      * @return the redirect location or <code>null</code>
      */
@@ -255,17 +274,15 @@
             SlingPostConstants.RP_STATUS);
         return true;
     }
-	
-    
-    
-    // ------ The methods below are based on the private methods from the ModifyOperation class -----
-    
+
+    // ------ The methods below are based on the private methods from the
+    // ModifyOperation class -----
+
     /**
      * Collects the properties that form the content to be written back to the
-     * repository. 
+     * repository. NOTE: In the returned map, the key is the property name not a
+     * path.
      * 
-     * NOTE: In the returned map, the key is the property name not a path.
-     *
      * @throws RepositoryException if a repository error occurs
      * @throws ServletException if an internal error occurs
      */
@@ -295,13 +312,14 @@
             // ensure the paramName is an absolute property name
             String propPath;
             if (paramName.startsWith("./")) {
-            	propPath = paramName.substring(2);
+                propPath = paramName.substring(2);
             } else {
-            	propPath = paramName;
+                propPath = paramName;
             }
             if (propPath.indexOf('/') != -1) {
-            	//only one path segment is valid here, so this paramter can't be used.
-            	continue; //skip it.
+                // only one path segment is valid here, so this paramter can't
+                // be used.
+                continue; // skip it.
             }
 
             // @TypeHint example
@@ -374,7 +392,7 @@
             // causes the JCR Text property to be set by moving the /tmp/path
             // property to Text.
             if (propPath.endsWith(SlingPostConstants.SUFFIX_MOVE_FROM)) {
-            	//don't support @MoveFrom here
+                // don't support @MoveFrom here
                 continue;
             }
 
@@ -384,7 +402,7 @@
             // causes the JCR Text property to be set by copying the /tmp/path
             // property to Text.
             if (propPath.endsWith(SlingPostConstants.SUFFIX_COPY_FROM)) {
-            	//don't support @CopyFrom here
+                // don't support @CopyFrom here
                 continue;
             }
 
@@ -396,13 +414,12 @@
 
         return reqProperties;
     }
-	
-	
+
     /**
      * Returns the request property for the given property path. If such a
      * request property does not exist yet it is created and stored in the
      * <code>props</code>.
-     *
+     * 
      * @param props The map of already seen request properties.
      * @param paramName The absolute path of the property including the
      *            <code>suffix</code> to be looked up.
@@ -425,14 +442,14 @@
 
         return prop;
     }
-    
-    
+
     /**
      * Removes all properties listed as {@link RequestProperty#isDelete()} from
      * the authorizable.
-     *
-     * @param authorizable The <code>org.apache.jackrabbit.api.security.user.Authorizable</code> 
-     * 				that should have properties deleted.
+     * 
+     * @param authorizable The
+     *            <code>org.apache.jackrabbit.api.security.user.Authorizable</code>
+     *            that should have properties deleted.
      * @param reqProperties The map of request properties to check for
      *            properties to be removed.
      * @param response The <code>HtmlResponse</code> to be updated with
@@ -440,30 +457,29 @@
      * @throws RepositoryException Is thrown if an error occurrs checking or
      *             removing properties.
      */
-    protected void processDeletes(Authorizable resource, 
+    protected void processDeletes(Authorizable resource,
             Map<String, RequestProperty> reqProperties,
             List<Modification> changes) throws RepositoryException {
 
         for (RequestProperty property : reqProperties.values()) {
             if (property.isDelete()) {
-            	if (resource.hasProperty(property.getName())) {
-            		resource.removeProperty(property.getName());
+                if (resource.hasProperty(property.getName())) {
+                    resource.removeProperty(property.getName());
                     changes.add(Modification.onDeleted(property.getPath()));
-            	}
+                }
             }
         }
     }
 
-    
     /**
      * Writes back the content
-     *
+     * 
      * @throws RepositoryException if a repository error occurs
      * @throws ServletException if an internal error occurs
      */
     protected void writeContent(Session session, Authorizable authorizable,
-            Map<String, RequestProperty> reqProperties, List<Modification> changes)
-            throws RepositoryException {
+            Map<String, RequestProperty> reqProperties,
+            List<Modification> changes) throws RepositoryException {
 
         for (RequestProperty prop : reqProperties.values()) {
             if (prop.hasValues()) {
@@ -474,45 +490,47 @@
                 }
                 if (authorizable.isGroup()) {
                     if (prop.getName().equals("groupId")) {
-                    	//skip these
-                    	continue;
-                	}                	
+                        // skip these
+                        continue;
+                    }
                 } else {
-                    if (prop.getName().equals("userId") ||
-                    		prop.getName().equals("pwd") ||
-                    		prop.getName().equals("pwdConfirm")) {
-                    	//skip these
-                    	continue;
+                    if (prop.getName().equals("userId")
+                        || prop.getName().equals("pwd")
+                        || prop.getName().equals("pwdConfirm")) {
+                        // skip these
+                        continue;
                     }
                 }
                 if (prop.isFileUpload()) {
-                	//don't handle files for user properties for now.
-                	continue;
-                    //uploadHandler.setFile(parent, prop, changes);
+                    // don't handle files for user properties for now.
+                    continue;
+                    // uploadHandler.setFile(parent, prop, changes);
                 } else {
-                	setPropertyAsIs(session, authorizable, prop, changes);
+                    setPropertyAsIs(session, authorizable, prop, changes);
                 }
             }
         }
     }
-    
+
     /**
      * set property without processing, except for type hints
-     *
+     * 
      * @param parent the parent node
      * @param prop the request property
      * @throws RepositoryException if a repository error occurs.
      */
-    private void setPropertyAsIs(Session session, Authorizable parent, RequestProperty prop, List<Modification> changes)
+    private void setPropertyAsIs(Session session, Authorizable parent,
+            RequestProperty prop, List<Modification> changes)
             throws RepositoryException {
 
-    	String parentPath;
-    	if (parent.isGroup()) {
-    		parentPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PREFIX + parent.getID();
-    	} else {
-    		parentPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX + parent.getID();
-    	}
-
+        String parentPath;
+        if (parent.isGroup()) {
+            parentPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PREFIX
+                + parent.getID();
+        } else {
+            parentPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX
+                + parent.getID();
+        }
 
         // no explicit typehint
         int type = PropertyType.UNDEFINED;
@@ -525,29 +543,29 @@
         }
 
         String[] values = prop.getStringValues();
-		if (values == null) {
+        if (values == null) {
             // remove property
-	        boolean removedProp = removePropertyIfExists(parent, prop.getName());
-	        if (removedProp) {
-	            changes.add(Modification.onDeleted(
-	            		parentPath + "/" + prop.getName()
-	            ));
-	        }
+            boolean removedProp = removePropertyIfExists(parent, prop.getName());
+            if (removedProp) {
+                changes.add(Modification.onDeleted(parentPath + "/"
+                    + prop.getName()));
+            }
         } else if (values.length == 0) {
             // do not create new prop here, but clear existing
             if (parent.hasProperty(prop.getName())) {
-            	Value val = session.getValueFactory().createValue("");
-            	parent.setProperty(prop.getName(), val);
-                changes.add(Modification.onModified(
-                	parentPath + "/" + prop.getName()
-                ));
+                Value val = session.getValueFactory().createValue("");
+                parent.setProperty(prop.getName(), val);
+                changes.add(Modification.onModified(parentPath + "/"
+                    + prop.getName()));
             }
         } else if (values.length == 1) {
             boolean removedProp = removePropertyIfExists(parent, prop.getName());
-            // if the provided value is the empty string, we don't have to do anything.
-            if ( values[0].length() == 0 ) {
-                if ( removedProp ) {
-                    changes.add(Modification.onDeleted(parentPath + "/" + prop.getName()));
+            // if the provided value is the empty string, we don't have to do
+            // anything.
+            if (values[0].length() == 0) {
+                if (removedProp) {
+                    changes.add(Modification.onDeleted(parentPath + "/"
+                        + prop.getName()));
                 }
             } else {
                 // modify property
@@ -555,38 +573,41 @@
                     // try conversion
                     Calendar c = dateParser.parse(values[0]);
                     if (c != null) {
-                        if ( prop.hasMultiValueTypeHint() ) {
+                        if (prop.hasMultiValueTypeHint()) {
                             final Value[] array = new Value[1];
                             array[0] = session.getValueFactory().createValue(c);
                             parent.setProperty(prop.getName(), array);
-                            changes.add(Modification.onModified(
-                                parentPath + "/" + prop.getName()
-                            ));
+                            changes.add(Modification.onModified(parentPath
+                                + "/" + prop.getName()));
                         } else {
-                        	Value cVal = session.getValueFactory().createValue(c);
-                        	parent.setProperty(prop.getName(), cVal);
-                            changes.add(Modification.onModified(
-                                    parentPath + "/" + prop.getName()
-                                ));
+                            Value cVal = session.getValueFactory().createValue(
+                                c);
+                            parent.setProperty(prop.getName(), cVal);
+                            changes.add(Modification.onModified(parentPath
+                                + "/" + prop.getName()));
                         }
                         return;
                     }
                     // fall back to default behaviour
                 }
-                if ( type == PropertyType.UNDEFINED ) {
-                	Value val = session.getValueFactory().createValue(values[0], PropertyType.STRING);
-                	parent.setProperty(prop.getName(), val);
+                if (type == PropertyType.UNDEFINED) {
+                    Value val = session.getValueFactory().createValue(
+                        values[0], PropertyType.STRING);
+                    parent.setProperty(prop.getName(), val);
                 } else {
-                    if ( prop.hasMultiValueTypeHint() ) {
+                    if (prop.hasMultiValueTypeHint()) {
                         final Value[] array = new Value[1];
-                        array[0] = session.getValueFactory().createValue(values[0], type);
+                        array[0] = session.getValueFactory().createValue(
+                            values[0], type);
                         parent.setProperty(prop.getName(), array);
                     } else {
-                    	Value val = session.getValueFactory().createValue(values[0], type);
+                        Value val = session.getValueFactory().createValue(
+                            values[0], type);
                         parent.setProperty(prop.getName(), val);
                     }
                 }
-                changes.add(Modification.onModified(parentPath + "/" + prop.getName()));
+                changes.add(Modification.onModified(parentPath + "/"
+                    + prop.getName()));
             }
         } else {
             removePropertyIfExists(parent, prop.getName());
@@ -595,51 +616,52 @@
                 ValueFactory valFac = session.getValueFactory();
                 Value[] c = dateParser.parse(values, valFac);
                 if (c != null) {
-                	parent.setProperty(prop.getName(), c);
-                    changes.add(Modification.onModified(
-                    		parentPath + "/" + prop.getName()
-                    ));
+                    parent.setProperty(prop.getName(), c);
+                    changes.add(Modification.onModified(parentPath + "/"
+                        + prop.getName()));
                     return;
                 }
                 // fall back to default behaviour
             }
 
-            Value [] vals = new Value[values.length];
-            if ( type == PropertyType.UNDEFINED ) {
-            	for(int i=0; i < values.length; i++) {
-            		vals[i] = session.getValueFactory().createValue(values[i]);
-            	}
+            Value[] vals = new Value[values.length];
+            if (type == PropertyType.UNDEFINED) {
+                for (int i = 0; i < values.length; i++) {
+                    vals[i] = session.getValueFactory().createValue(values[i]);
+                }
             } else {
-            	for(int i=0; i < values.length; i++) {
-            		vals[i] = session.getValueFactory().createValue(values[i], type);
-            	}
+                for (int i = 0; i < values.length; i++) {
+                    vals[i] = session.getValueFactory().createValue(values[i],
+                        type);
+                }
             }
-        	parent.setProperty(prop.getName(), vals);
-            changes.add(Modification.onModified(parentPath + "/" + prop.getName()));
+            parent.setProperty(prop.getName(), vals);
+            changes.add(Modification.onModified(parentPath + "/"
+                + prop.getName()));
         }
-    
+
     }
 
     /**
      * Removes the property with the given name from the parent resource if it
      * exists.
-     *
+     * 
      * @param parent the parent resource
      * @param name the name of the property to remove
-     * @return path of the property that was removed or <code>null</code> if
-     *         it was not removed
+     * @return path of the property that was removed or <code>null</code> if it
+     *         was not removed
      * @throws RepositoryException if a repository error occurs.
      */
-	private boolean removePropertyIfExists(Authorizable resource, String name) throws RepositoryException {
-    	if (resource.getProperty(name) != null) {
-    		resource.removeProperty(name);
-    		return true;
-    	}
-    	return false;
-	}
+    private boolean removePropertyIfExists(Authorizable resource, String name)
+            throws RepositoryException {
+        if (resource.getProperty(name) != null) {
+            resource.removeProperty(name);
+            return true;
+        }
+        return false;
+    }
 
-	
-	// ------ These methods were copied from AbstractSlingPostOperation ------
+    // ------ These methods were copied from AbstractSlingPostOperation ------
 
     /**
      * Returns the path of the resource of the request as the item path.
@@ -654,7 +676,7 @@
     /**
      * Returns an external form of the given path prepending the context path
      * and appending a display extension.
-     *
+     * 
      * @param path the path to externalize
      * @return the url
      */
@@ -675,20 +697,20 @@
 
         return ret.toString();
     }
-	
+
     /**
-     * Returns <code>true</code> if the <code>name</code> starts with either
-     * of the prefixes
-     * {@link SlingPostConstants#ITEM_PREFIX_RELATIVE_CURRENT <code>./</code>},
-     * {@link SlingPostConstants#ITEM_PREFIX_RELATIVE_PARENT <code>../</code>}
-     * and {@link SlingPostConstants#ITEM_PREFIX_ABSOLUTE <code>/</code>}.
+     * Returns <code>true</code> if the <code>name</code> starts with either of
+     * the prefixes {@link SlingPostConstants#ITEM_PREFIX_RELATIVE_CURRENT
+     * <code>./</code>}, {@link SlingPostConstants#ITEM_PREFIX_RELATIVE_PARENT
+     * <code>../</code>} and {@link SlingPostConstants#ITEM_PREFIX_ABSOLUTE
+     * <code>/</code>}.
      */
     protected boolean hasItemPathPrefix(String name) {
         return name.startsWith(SlingPostConstants.ITEM_PREFIX_ABSOLUTE)
             || name.startsWith(SlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT)
             || name.startsWith(SlingPostConstants.ITEM_PREFIX_RELATIVE_PARENT);
     }
-    
+
     /**
      * Returns true if any of the request parameters starts with
      * {@link SlingPostConstants#ITEM_PREFIX_RELATIVE_CURRENT <code>./</code>}.
@@ -713,5 +735,5 @@
 
         return requirePrefix;
     }
-    
+
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractGroupPostServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractGroupPostServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractGroupPostServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractGroupPostServlet.java Tue Jun  9 10:16:54 2009
@@ -32,64 +32,70 @@
 /**
  * Base class for servlets manipulating groups
  */
-public abstract class AbstractGroupPostServlet extends AbstractAuthorizablePostServlet {
-	private static final long serialVersionUID = 1159063041816944076L;
+public abstract class AbstractGroupPostServlet extends
+        AbstractAuthorizablePostServlet {
+    private static final long serialVersionUID = 1159063041816944076L;
 
-	/**
-     * Update the group membership based on the ":member" request
-     * parameters.  If the ":member" value ends with @Delete it is removed
-     * from the group membership, otherwise it is added to the group membership.
+    /**
+     * Update the group membership based on the ":member" request parameters. If
+     * the ":member" value ends with @Delete it is removed from the group
+     * membership, otherwise it is added to the group membership.
      * 
      * @param request
      * @param authorizable
      * @throws RepositoryException
      */
-	protected void updateGroupMembership(SlingHttpServletRequest request,
-			Authorizable authorizable, List<Modification> changes) throws RepositoryException {
-		if (authorizable.isGroup()) {
-			Group group = ((Group)authorizable);
-    		String groupPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PREFIX + group.getID(); 
-
-	    	ResourceResolver resolver = request.getResourceResolver();
-	    	Resource baseResource = request.getResource();
-	    	boolean changed = false;
-
-	    	//first remove any members posted as ":member@Delete"
-	    	String[] membersToDelete = request.getParameterValues(SlingPostConstants.RP_PREFIX + "member" + SlingPostConstants.SUFFIX_DELETE);
-	    	if (membersToDelete != null) {
-				for (String member : membersToDelete) {
-	                Resource res = resolver.getResource(baseResource, member);
-	                if (res != null) {
-	                	Authorizable memberAuthorizable = res.adaptTo(Authorizable.class);
-	                	if (memberAuthorizable != null) {
-	                		group.removeMember(memberAuthorizable);
-	                		changed = true;
-	                	}
-	                }
-					
-				}
-	    	}
-	    	
-	    	//second add any members posted as ":member"
-	    	String[] membersToAdd = request.getParameterValues(SlingPostConstants.RP_PREFIX + "member");
-	    	if (membersToAdd != null) {
-				for (String member : membersToAdd) {
-	                Resource res = resolver.getResource(baseResource, member);
-	                if (res != null) {
-	                	Authorizable memberAuthorizable = res.adaptTo(Authorizable.class);
-	                	if (memberAuthorizable != null) {
-	                		group.addMember(memberAuthorizable);
-	                		changed = true;
-	                	}
-	                }
-				}
-	    	}
-
-	    	if (changed) {
-        		//add an entry to the changes list to record the membership change
-        		changes.add(Modification.onModified(groupPath + "/members"));
-	    	}
-		}
-	}
-	
+    protected void updateGroupMembership(SlingHttpServletRequest request,
+            Authorizable authorizable, List<Modification> changes)
+            throws RepositoryException {
+        if (authorizable.isGroup()) {
+            Group group = ((Group) authorizable);
+            String groupPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PREFIX
+                + group.getID();
+
+            ResourceResolver resolver = request.getResourceResolver();
+            Resource baseResource = request.getResource();
+            boolean changed = false;
+
+            // first remove any members posted as ":member@Delete"
+            String[] membersToDelete = request.getParameterValues(SlingPostConstants.RP_PREFIX
+                + "member" + SlingPostConstants.SUFFIX_DELETE);
+            if (membersToDelete != null) {
+                for (String member : membersToDelete) {
+                    Resource res = resolver.getResource(baseResource, member);
+                    if (res != null) {
+                        Authorizable memberAuthorizable = res.adaptTo(Authorizable.class);
+                        if (memberAuthorizable != null) {
+                            group.removeMember(memberAuthorizable);
+                            changed = true;
+                        }
+                    }
+
+                }
+            }
+
+            // second add any members posted as ":member"
+            String[] membersToAdd = request.getParameterValues(SlingPostConstants.RP_PREFIX
+                + "member");
+            if (membersToAdd != null) {
+                for (String member : membersToAdd) {
+                    Resource res = resolver.getResource(baseResource, member);
+                    if (res != null) {
+                        Authorizable memberAuthorizable = res.adaptTo(Authorizable.class);
+                        if (memberAuthorizable != null) {
+                            group.addMember(memberAuthorizable);
+                            changed = true;
+                        }
+                    }
+                }
+            }
+
+            if (changed) {
+                // add an entry to the changes list to record the membership
+                // change
+                changes.add(Modification.onModified(groupPath + "/members"));
+            }
+        }
+    }
+
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractUserPostServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractUserPostServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractUserPostServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractUserPostServlet.java Tue Jun  9 10:16:54 2009
@@ -26,30 +26,34 @@
 /**
  * Base class for servlets manipulating users
  */
-public abstract class AbstractUserPostServlet extends AbstractAuthorizablePostServlet {
-	private static final long serialVersionUID = -8401210711297654453L;
+public abstract class AbstractUserPostServlet extends
+        AbstractAuthorizablePostServlet {
+    private static final long serialVersionUID = -8401210711297654453L;
 
-	/**
+    /**
      * To be used for the encryption. E.g. for passwords in
-     * {@link javax.jcr.SimpleCredentials#getPassword()}  SimpleCredentials} 
+     * {@link javax.jcr.SimpleCredentials#getPassword()} SimpleCredentials}
+     * 
      * @scr.property valueRef="DEFAULT_PASSWORD_DIGEST_ALGORITHM"
      */
     private static final String PROP_PASSWORD_DIGEST_ALGORITHM = "password.digest.algorithm";
+
     private static final String DEFAULT_PASSWORD_DIGEST_ALGORITHM = "sha1";
+
     private String passwordDigestAlgoritm = null;
 
     // ---------- SCR Integration ----------------------------------------------
 
     protected void activate(ComponentContext context) {
         super.activate(context);
-        
+
         Dictionary<?, ?> props = context.getProperties();
 
         Object propValue = props.get(PROP_PASSWORD_DIGEST_ALGORITHM);
         if (propValue instanceof String) {
-        	passwordDigestAlgoritm = (String)propValue;
+            passwordDigestAlgoritm = (String) propValue;
         } else {
-        	passwordDigestAlgoritm = DEFAULT_PASSWORD_DIGEST_ALGORITHM;
+            passwordDigestAlgoritm = DEFAULT_PASSWORD_DIGEST_ALGORITHM;
         }
     }
 
@@ -57,7 +61,7 @@
         super.deactivate(context);
         passwordDigestAlgoritm = null;
     }
-    
+
     /**
      * Digest the given password using the configured digest algorithm
      * 
@@ -69,7 +73,8 @@
         try {
             StringBuffer password = new StringBuffer();
             password.append("{").append(passwordDigestAlgoritm).append("}");
-            password.append(Text.digest(passwordDigestAlgoritm, pwd.getBytes("UTF-8")));
+            password.append(Text.digest(passwordDigestAlgoritm,
+                pwd.getBytes("UTF-8")));
             return password.toString();
         } catch (NoSuchAlgorithmException e) {
             throw new IllegalArgumentException(e.toString());
@@ -77,5 +82,5 @@
             throw new IllegalArgumentException(e.toString());
         }
     }
-    
+
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/ChangeUserPasswordServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/ChangeUserPasswordServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/ChangeUserPasswordServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/ChangeUserPasswordServlet.java Tue Jun  9 10:16:54 2009
@@ -31,77 +31,83 @@
 import org.apache.sling.servlets.post.Modification;
 
 /**
- * Sling Post Operation implementation for updating the password of a user in the 
- * jackrabbit UserManager.
+ * Sling Post Operation implementation for updating the password of a user in
+ * the jackrabbit UserManager.
  * 
  * @scr.component metatype="no" immediate="true"
  * @scr.service interface="javax.servlet.Servlet"
  * @scr.property name="sling.servlet.resourceTypes" value="sling/user"
- * @scr.property name="sling.servlet.methods" value="POST" 
- * @scr.property name="sling.servlet.selectors" value="changePassword" 
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="changePassword"
  */
 public class ChangeUserPasswordServlet extends AbstractUserPostServlet {
-	private static final long serialVersionUID = 1923614318474654502L;
+    private static final long serialVersionUID = 1923614318474654502L;
 
-	/* (non-Javadoc)
-	 * @see org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
-	 */
-	@Override
-	protected void handleOperation(SlingHttpServletRequest request,
-			HtmlResponse htmlResponse, List<Modification> changes)
-			throws RepositoryException {
-		Authorizable authorizable = null;
-		Resource resource = request.getResource();
-		if (resource != null) {
-			authorizable = resource.adaptTo(Authorizable.class);
-		}
-		
-		//check that the user was located.
-		if (authorizable == null || authorizable.isGroup()) {
-			throw new ResourceNotFoundException("User to update could not be determined.");
-		}
-
-		if ("anonymous".equals(authorizable.getID())) {
-			throw new RepositoryException("Can not change the password of the anonymous user.");
-		}
-
-		Session session = request.getResourceResolver().adaptTo(Session.class);
-		if (session == null) {
-			throw new RepositoryException("JCR Session not found");
-		}
-
-		//check that the submitted parameter values have valid values.
-		String oldPwd = request.getParameter("oldPwd");
-		if (oldPwd == null || oldPwd.length() == 0) {
-			throw new RepositoryException("Old Password was not submitted");
-		}
-		String newPwd = request.getParameter("newPwd");
-		if (newPwd == null || newPwd.length() == 0) {
-			throw new RepositoryException("New Password was not submitted");
-		}
-		String newPwdConfirm = request.getParameter("newPwdConfirm");
-		if (!newPwd.equals(newPwdConfirm)) {
-			throw new RepositoryException("New Password does not match the confirmation password");
-		}
-		
-		try {
-			String digestedOldPwd = digestPassword(oldPwd);
-			Value[] pwdProperty = ((User)authorizable).getProperty("rep:password");
-			if (pwdProperty != null && pwdProperty.length > 0) {
-				String repPasswordValue = pwdProperty[0].getString();
-				if (!digestedOldPwd.equals(repPasswordValue)) {
-					//submitted oldPwd value is not correct.
-					throw new RepositoryException("Old Password does not match");
-				}
-			}
-				
-			((User)authorizable).changePassword(digestPassword(newPwd));
-			
-            changes.add(Modification.onModified(
-                	resource.getPath() + "/rep:password"
-                ));
-		} catch (RepositoryException re) {
-			throw new RepositoryException("Failed to change user password.", re);
-		}
-	}
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet
+     * #handleOperation(org.apache.sling.api.SlingHttpServletRequest,
+     * org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+     */
+    @Override
+    protected void handleOperation(SlingHttpServletRequest request,
+            HtmlResponse htmlResponse, List<Modification> changes)
+            throws RepositoryException {
+        Authorizable authorizable = null;
+        Resource resource = request.getResource();
+        if (resource != null) {
+            authorizable = resource.adaptTo(Authorizable.class);
+        }
+
+        // check that the user was located.
+        if (authorizable == null || authorizable.isGroup()) {
+            throw new ResourceNotFoundException(
+                "User to update could not be determined.");
+        }
+
+        if ("anonymous".equals(authorizable.getID())) {
+            throw new RepositoryException(
+                "Can not change the password of the anonymous user.");
+        }
+
+        Session session = request.getResourceResolver().adaptTo(Session.class);
+        if (session == null) {
+            throw new RepositoryException("JCR Session not found");
+        }
+
+        // check that the submitted parameter values have valid values.
+        String oldPwd = request.getParameter("oldPwd");
+        if (oldPwd == null || oldPwd.length() == 0) {
+            throw new RepositoryException("Old Password was not submitted");
+        }
+        String newPwd = request.getParameter("newPwd");
+        if (newPwd == null || newPwd.length() == 0) {
+            throw new RepositoryException("New Password was not submitted");
+        }
+        String newPwdConfirm = request.getParameter("newPwdConfirm");
+        if (!newPwd.equals(newPwdConfirm)) {
+            throw new RepositoryException(
+                "New Password does not match the confirmation password");
+        }
+
+        try {
+            String digestedOldPwd = digestPassword(oldPwd);
+            Value[] pwdProperty = ((User) authorizable).getProperty("rep:password");
+            if (pwdProperty != null && pwdProperty.length > 0) {
+                String repPasswordValue = pwdProperty[0].getString();
+                if (!digestedOldPwd.equals(repPasswordValue)) {
+                    // submitted oldPwd value is not correct.
+                    throw new RepositoryException("Old Password does not match");
+                }
+            }
+
+            ((User) authorizable).changePassword(digestPassword(newPwd));
+
+            changes.add(Modification.onModified(resource.getPath()
+                + "/rep:password"));
+        } catch (RepositoryException re) {
+            throw new RepositoryException("Failed to change user password.", re);
+        }
+    }
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateGroupServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateGroupServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateGroupServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateGroupServlet.java Tue Jun  9 10:16:54 2009
@@ -38,63 +38,73 @@
  * Sling Post Servlet implementation for creating a group in the jackrabbit
  * UserManager.
  * 
- * @scr.component immediate="true" 
+ * @scr.component immediate="true"
  * @scr.service interface="javax.servlet.Servlet"
  * @scr.property name="sling.servlet.resourceTypes" value="sling/groups"
- * @scr.property name="sling.servlet.methods" value="POST" 
- * @scr.property name="sling.servlet.selectors" value="create" 
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="create"
  */
 public class CreateGroupServlet extends AbstractGroupPostServlet {
-	private static final long serialVersionUID = -1084915263933901466L;
+    private static final long serialVersionUID = -1084915263933901466L;
 
-	/* (non-Javadoc)
-	 * @see org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
-	 */
-	@Override
-	protected void handleOperation(SlingHttpServletRequest request,
-			HtmlResponse response, List<Modification> changes) throws RepositoryException {
-		
-		//check that the submitted parameter values have valid values.
-		final String principalName = request.getParameter(SlingPostConstants.RP_NODE_NAME);
-		if (principalName == null) {
-			throw new RepositoryException("Group name was not submitted");
-		}
-
-		Session session = request.getResourceResolver().adaptTo(Session.class);
-		if (session == null) {
-			throw new RepositoryException("JCR Session not found");
-		}
-
-		try {
-			UserManager userManager = AccessControlUtil.getUserManager(session);
-			Authorizable authorizable = userManager.getAuthorizable(principalName);
-			
-			if (authorizable != null) {
-				//principal already exists!
-				throw new RepositoryException("A principal already exists with the requested name: " + principalName);
-			} else {
-				Map<String, RequestProperty> reqProperties = collectContent(request, response);
-
-				Group group = userManager.createGroup(new Principal() {
-					public String getName() {
-						return principalName;
-					}
-				});
-
-				String groupPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PREFIX + group.getID();
-				response.setPath(groupPath);
-				response.setLocation(externalizePath(request, groupPath));
-				response.setParentLocation(externalizePath(request, AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PATH));
-				changes.add(Modification.onCreated(groupPath));
-				
-		        // write content from form
-		        writeContent(session, group, reqProperties, changes);
-		        
-		        //update the group memberships
-		        updateGroupMembership(request, group, changes);
-			}
-		} catch (RepositoryException re) {
-			throw new RepositoryException("Failed to create new group.", re);
-		}
-	}
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet
+     * #handleOperation(org.apache.sling.api.SlingHttpServletRequest,
+     * org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+     */
+    @Override
+    protected void handleOperation(SlingHttpServletRequest request,
+            HtmlResponse response, List<Modification> changes)
+            throws RepositoryException {
+
+        // check that the submitted parameter values have valid values.
+        final String principalName = request.getParameter(SlingPostConstants.RP_NODE_NAME);
+        if (principalName == null) {
+            throw new RepositoryException("Group name was not submitted");
+        }
+
+        Session session = request.getResourceResolver().adaptTo(Session.class);
+        if (session == null) {
+            throw new RepositoryException("JCR Session not found");
+        }
+
+        try {
+            UserManager userManager = AccessControlUtil.getUserManager(session);
+            Authorizable authorizable = userManager.getAuthorizable(principalName);
+
+            if (authorizable != null) {
+                // principal already exists!
+                throw new RepositoryException(
+                    "A principal already exists with the requested name: "
+                        + principalName);
+            } else {
+                Map<String, RequestProperty> reqProperties = collectContent(
+                    request, response);
+
+                Group group = userManager.createGroup(new Principal() {
+                    public String getName() {
+                        return principalName;
+                    }
+                });
+
+                String groupPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PREFIX
+                    + group.getID();
+                response.setPath(groupPath);
+                response.setLocation(externalizePath(request, groupPath));
+                response.setParentLocation(externalizePath(request,
+                    AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PATH));
+                changes.add(Modification.onCreated(groupPath));
+
+                // write content from form
+                writeContent(session, group, reqProperties, changes);
+
+                // update the group memberships
+                updateGroupMembership(request, group, changes);
+            }
+        } catch (RepositoryException re) {
+            throw new RepositoryException("Failed to create new group.", re);
+        }
+    }
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateUserServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateUserServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateUserServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateUserServlet.java Tue Jun  9 10:16:54 2009
@@ -46,29 +46,31 @@
  *                description="%createUser.post.operation.description"
  * @scr.service interface="javax.servlet.Servlet"
  * @scr.property name="sling.servlet.resourceTypes" value="sling/users"
- * @scr.property name="sling.servlet.methods" value="POST" 
- * @scr.property name="sling.servlet.selectors" value="create" 
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="create"
  */
 public class CreateUserServlet extends AbstractUserPostServlet {
-	private static final long serialVersionUID = 6871481922737658675L;
+    private static final long serialVersionUID = 6871481922737658675L;
 
-	/**
+    /**
      * default log
      */
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    /** @scr.property label="%self.registration.enabled.name" 
-     * 					description="%self.registration.enabled.description" 
-     * 					valueRef="DEFAULT_SELF_REGISTRATION_ENABLED" 
+    /**
+     * @scr.property label="%self.registration.enabled.name"
+     *               description="%self.registration.enabled.description"
+     *               valueRef="DEFAULT_SELF_REGISTRATION_ENABLED"
      */
     private static final String PROP_SELF_REGISTRATION_ENABLED = "self.registration.enabled";
+
     private static final Boolean DEFAULT_SELF_REGISTRATION_ENABLED = Boolean.TRUE;
 
     private Boolean selfRegistrationEnabled = DEFAULT_SELF_REGISTRATION_ENABLED;
 
     /**
      * The JCR Repository we access to resolve resources
-     *
+     * 
      * @scr.reference
      */
     private SlingRepository repository;
@@ -89,7 +91,7 @@
      * Return the administrative session and close it.
      */
     private void ungetSession(final Session session) {
-        if ( session != null ) {
+        if (session != null) {
             try {
                 session.logout();
             } catch (Throwable t) {
@@ -102,83 +104,94 @@
 
     /**
      * Activates this component.
-     *
+     * 
      * @param componentContext The OSGi <code>ComponentContext</code> of this
-     *      component.
+     *            component.
      */
     protected void activate(ComponentContext componentContext) {
-    	super.activate(componentContext);
+        super.activate(componentContext);
         Dictionary<?, ?> props = componentContext.getProperties();
         Object propValue = props.get(PROP_SELF_REGISTRATION_ENABLED);
         if (propValue instanceof String) {
-        	selfRegistrationEnabled = Boolean.parseBoolean((String)propValue);
+            selfRegistrationEnabled = Boolean.parseBoolean((String) propValue);
         } else {
-        	selfRegistrationEnabled = DEFAULT_SELF_REGISTRATION_ENABLED;
+            selfRegistrationEnabled = DEFAULT_SELF_REGISTRATION_ENABLED;
         }
     }
 
-    
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet
+     * #handleOperation(org.apache.sling.api.SlingHttpServletRequest,
+     * org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+     */
+    @Override
+    protected void handleOperation(SlingHttpServletRequest request,
+            HtmlResponse response, List<Modification> changes)
+            throws RepositoryException {
+        // make sure user self-registration is enabled
+        if (!selfRegistrationEnabled) {
+            throw new RepositoryException(
+                "Sorry, registration of new users is not currently enabled.  Please try again later.");
+        }
 
-	/* (non-Javadoc)
-	 * @see org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
-	 */
-	@Override
-	protected void handleOperation(SlingHttpServletRequest request,
-			HtmlResponse response, List<Modification> changes) throws RepositoryException {
-		//make sure user self-registration is enabled
-		if (!selfRegistrationEnabled) {
-			throw new RepositoryException("Sorry, registration of new users is not currently enabled.  Please try again later.");
-		}
-
-		Session session = request.getResourceResolver().adaptTo(Session.class);
-		if (session == null) {
-			throw new RepositoryException("JCR Session not found");
-		}
-		
-		//check that the submitted parameter values have valid values.
-		String principalName = request.getParameter(SlingPostConstants.RP_NODE_NAME);
-		if (principalName == null) {
-			throw new RepositoryException("User name was not submitted");
-		}
-		String pwd = request.getParameter("pwd");
-		if (pwd == null) {
-			throw new RepositoryException("Password was not submitted");
-		}
-		String pwdConfirm = request.getParameter("pwdConfirm");
-		if (!pwd.equals(pwdConfirm)) {
-			throw new RepositoryException("Password value does not match the confirmation password");
-		}
-		
-		Session selfRegSession = null;
-		try {
-			selfRegSession = getSession();
-
-			UserManager userManager = AccessControlUtil.getUserManager(selfRegSession);
-			Authorizable authorizable = userManager.getAuthorizable(principalName);
-			
-			if (authorizable != null) {
-				//user already exists!
-				throw new RepositoryException("A principal already exists with the requested name: " + principalName);
-			} else {
-				Map<String, RequestProperty> reqProperties = collectContent(request, response);
-
-				User user = userManager.createUser(principalName, digestPassword(pwd));
-				String userPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX + user.getID();
-				
-				response.setPath(userPath);
-				response.setLocation(externalizePath(request, userPath));
-				response.setParentLocation(externalizePath(request, AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PATH));
-				changes.add(Modification.onCreated(userPath));
-				
-		        // write content from form
-		        writeContent(selfRegSession, user, reqProperties, changes);
-				
-				if (selfRegSession.hasPendingChanges()) {
-					selfRegSession.save();
-				}
-			}
-		} finally {
-			ungetSession(selfRegSession);
-		}
-	}
+        Session session = request.getResourceResolver().adaptTo(Session.class);
+        if (session == null) {
+            throw new RepositoryException("JCR Session not found");
+        }
+
+        // check that the submitted parameter values have valid values.
+        String principalName = request.getParameter(SlingPostConstants.RP_NODE_NAME);
+        if (principalName == null) {
+            throw new RepositoryException("User name was not submitted");
+        }
+        String pwd = request.getParameter("pwd");
+        if (pwd == null) {
+            throw new RepositoryException("Password was not submitted");
+        }
+        String pwdConfirm = request.getParameter("pwdConfirm");
+        if (!pwd.equals(pwdConfirm)) {
+            throw new RepositoryException(
+                "Password value does not match the confirmation password");
+        }
+
+        Session selfRegSession = null;
+        try {
+            selfRegSession = getSession();
+
+            UserManager userManager = AccessControlUtil.getUserManager(selfRegSession);
+            Authorizable authorizable = userManager.getAuthorizable(principalName);
+
+            if (authorizable != null) {
+                // user already exists!
+                throw new RepositoryException(
+                    "A principal already exists with the requested name: "
+                        + principalName);
+            } else {
+                Map<String, RequestProperty> reqProperties = collectContent(
+                    request, response);
+
+                User user = userManager.createUser(principalName,
+                    digestPassword(pwd));
+                String userPath = AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PREFIX
+                    + user.getID();
+
+                response.setPath(userPath);
+                response.setLocation(externalizePath(request, userPath));
+                response.setParentLocation(externalizePath(request,
+                    AuthorizableResourceProvider.SYSTEM_USER_MANAGER_USER_PATH));
+                changes.add(Modification.onCreated(userPath));
+
+                // write content from form
+                writeContent(selfRegSession, user, reqProperties, changes);
+
+                if (selfRegSession.hasPendingChanges()) {
+                    selfRegSession.save();
+                }
+            }
+        } finally {
+            ungetSession(selfRegSession);
+        }
+    }
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/DeleteAuthorizableServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/DeleteAuthorizableServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/DeleteAuthorizableServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/DeleteAuthorizableServlet.java Tue Jun  9 10:16:54 2009
@@ -33,34 +33,40 @@
 import org.apache.sling.servlets.post.SlingPostConstants;
 
 /**
- * Sling Post Operation implementation for deleting one or more users and/or groups from the 
- * jackrabbit UserManager.
+ * Sling Post Operation implementation for deleting one or more users and/or
+ * groups from the jackrabbit UserManager.
  * 
  * @scr.component metatype="no" immediate="true"
  * @scr.service interface="javax.servlet.Servlet"
- * @scr.property name="sling.servlet.resourceTypes" values.0="sling/user" values.1="sling/group" values.2="sling/userManager"
- * @scr.property name="sling.servlet.methods" value="POST" 
- * @scr.property name="sling.servlet.selectors" value="delete" 
+ * @scr.property name="sling.servlet.resourceTypes" values.0="sling/user"
+ *               values.1="sling/group" values.2="sling/userManager"
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="delete"
  */
 public class DeleteAuthorizableServlet extends AbstractAuthorizablePostServlet {
-	private static final long serialVersionUID = 5874621724096106496L;
+    private static final long serialVersionUID = 5874621724096106496L;
 
-	/* (non-Javadoc)
-	 * @see org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
-	 */
-	@Override
-	protected void handleOperation(SlingHttpServletRequest request,
-			HtmlResponse htmlResponse, List<Modification> changes)
-			throws RepositoryException {
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet
+     * #handleOperation(org.apache.sling.api.SlingHttpServletRequest,
+     * org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+     */
+    @Override
+    protected void handleOperation(SlingHttpServletRequest request,
+            HtmlResponse htmlResponse, List<Modification> changes)
+            throws RepositoryException {
 
         Iterator<Resource> res = getApplyToResources(request);
         if (res == null) {
             Resource resource = request.getResource();
             Authorizable item = resource.adaptTo(Authorizable.class);
             if (item == null) {
-  	            String msg = "Missing source " + resource.getPath() + " for delete";
-  	            htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND, msg);
-               	throw new ResourceNotFoundException(msg);
+                String msg = "Missing source " + resource.getPath()
+                    + " for delete";
+                htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND, msg);
+                throw new ResourceNotFoundException(msg);
             }
 
             item.remove();
@@ -75,17 +81,16 @@
                 }
             }
         }
-	}
-	
-	
+    }
+
     /**
      * Returns an iterator on <code>Resource</code> instances addressed in the
      * {@link SlingPostConstants#RP_APPLY_TO} request parameter. If the request
-     * parameter is not set, <code>null</code> is returned. If the parameter
-     * is set with valid resources an empty iterator is returned. Any resources
+     * parameter is not set, <code>null</code> is returned. If the parameter is
+     * set with valid resources an empty iterator is returned. Any resources
      * addressed in the {@link SlingPostConstants#RP_APPLY_TO} parameter is
      * ignored.
-     *
+     * 
      * @param request The <code>SlingHttpServletRequest</code> object used to
      *            get the {@link SlingPostConstants#RP_APPLY_TO} parameter.
      * @return The iterator of resources listed in the parameter or
@@ -105,7 +110,9 @@
     private static class ApplyToIterator implements Iterator<Resource> {
 
         private final ResourceResolver resolver;
+
         private final Resource baseResource;
+
         private final String[] paths;
 
         private int pathIndex;
@@ -155,5 +162,5 @@
             return null;
         }
     }
-	
+
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateGroupServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateGroupServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateGroupServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateGroupServlet.java Tue Jun  9 10:16:54 2009
@@ -31,55 +31,61 @@
 import org.apache.sling.servlets.post.Modification;
 
 /**
- * Sling Post Operation implementation for updating a group in the 
- * jackrabbit UserManager.
+ * Sling Post Operation implementation for updating a group in the jackrabbit
+ * UserManager.
  * 
  * @scr.component metatype="no" immediate="true"
  * @scr.service interface="javax.servlet.Servlet"
  * @scr.property name="sling.servlet.resourceTypes" values="sling/group"
- * @scr.property name="sling.servlet.methods" value="POST" 
- * @scr.property name="sling.servlet.selectors" value="update" 
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="update"
  */
 public class UpdateGroupServlet extends AbstractGroupPostServlet {
-	private static final long serialVersionUID = -8292054361992488797L;
+    private static final long serialVersionUID = -8292054361992488797L;
 
-	/* (non-Javadoc)
-	 * @see org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
-	 */
-	@Override
-	protected void handleOperation(SlingHttpServletRequest request,
-			HtmlResponse htmlResponse, List<Modification> changes)
-			throws RepositoryException {
-		Authorizable authorizable = null;
-		Resource resource = request.getResource();
-		if (resource != null) {
-			authorizable = resource.adaptTo(Authorizable.class);
-		}
-		
-		//check that the group was located.
-		if (authorizable == null) {
-			throw new ResourceNotFoundException("Group to update could not be determined");
-		}
-
-		Session session = request.getResourceResolver().adaptTo(Session.class);
-		if (session == null) {
-			throw new RepositoryException("JCR Session not found");
-		}
-
-		Map<String, RequestProperty> reqProperties = collectContent(request, htmlResponse);
-		try {
-	        // cleanup any old content (@Delete parameters)
-	        processDeletes(authorizable, reqProperties, changes);
-				
-	        // write content from form
-	        writeContent(session, authorizable, reqProperties, changes);
-	        
-	        //update the group memberships
-			if (authorizable.isGroup()) {
-		        updateGroupMembership(request, authorizable, changes);
-			}
-		} catch (RepositoryException re) {
-			throw new RepositoryException("Failed to update group.", re);
-		}
-	}
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet
+     * #handleOperation(org.apache.sling.api.SlingHttpServletRequest,
+     * org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+     */
+    @Override
+    protected void handleOperation(SlingHttpServletRequest request,
+            HtmlResponse htmlResponse, List<Modification> changes)
+            throws RepositoryException {
+        Authorizable authorizable = null;
+        Resource resource = request.getResource();
+        if (resource != null) {
+            authorizable = resource.adaptTo(Authorizable.class);
+        }
+
+        // check that the group was located.
+        if (authorizable == null) {
+            throw new ResourceNotFoundException(
+                "Group to update could not be determined");
+        }
+
+        Session session = request.getResourceResolver().adaptTo(Session.class);
+        if (session == null) {
+            throw new RepositoryException("JCR Session not found");
+        }
+
+        Map<String, RequestProperty> reqProperties = collectContent(request,
+            htmlResponse);
+        try {
+            // cleanup any old content (@Delete parameters)
+            processDeletes(authorizable, reqProperties, changes);
+
+            // write content from form
+            writeContent(session, authorizable, reqProperties, changes);
+
+            // update the group memberships
+            if (authorizable.isGroup()) {
+                updateGroupMembership(request, authorizable, changes);
+            }
+        } catch (RepositoryException re) {
+            throw new RepositoryException("Failed to update group.", re);
+        }
+    }
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateUserServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateUserServlet.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateUserServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateUserServlet.java Tue Jun  9 10:16:54 2009
@@ -31,51 +31,57 @@
 import org.apache.sling.servlets.post.Modification;
 
 /**
- * Sling Post Operation implementation for updating a user in the 
- * jackrabbit UserManager.
+ * Sling Post Operation implementation for updating a user in the jackrabbit
+ * UserManager.
  * 
  * @scr.component metatype="no" immediate="true"
  * @scr.service interface="javax.servlet.Servlet"
  * @scr.property name="sling.servlet.resourceTypes" value="sling/user"
- * @scr.property name="sling.servlet.methods" value="POST" 
- * @scr.property name="sling.servlet.selectors" value="update" 
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="update"
  */
 public class UpdateUserServlet extends AbstractUserPostServlet {
-	private static final long serialVersionUID = 5874621724096106496L;
+    private static final long serialVersionUID = 5874621724096106496L;
 
-	/* (non-Javadoc)
-	 * @see org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
-	 */
-	@Override
-	protected void handleOperation(SlingHttpServletRequest request,
-			HtmlResponse htmlResponse, List<Modification> changes)
-			throws RepositoryException {
-		Authorizable authorizable = null;
-		Resource resource = request.getResource();
-		if (resource != null) {
-			authorizable = resource.adaptTo(Authorizable.class);
-		}
-		
-		//check that the group was located.
-		if (authorizable == null) {
-			throw new ResourceNotFoundException("User to update could not be determined");
-		}
-
-		Session session = request.getResourceResolver().adaptTo(Session.class);
-		if (session == null) {
-			throw new RepositoryException("JCR Session not found");
-		}
-
-		Map<String, RequestProperty> reqProperties = collectContent(request, htmlResponse);
-		try {
-	        // cleanup any old content (@Delete parameters)
-	        processDeletes(authorizable, reqProperties, changes);
-				
-	        // write content from form
-	        writeContent(session, authorizable, reqProperties, changes);
-
-		} catch (RepositoryException re) {
-			throw new RepositoryException("Failed to update user.", re);
-		}
-	}
+    /*
+     * (non-Javadoc)
+     * @see
+     * org.apache.sling.jackrabbit.usermanager.post.AbstractAuthorizablePostServlet
+     * #handleOperation(org.apache.sling.api.SlingHttpServletRequest,
+     * org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+     */
+    @Override
+    protected void handleOperation(SlingHttpServletRequest request,
+            HtmlResponse htmlResponse, List<Modification> changes)
+            throws RepositoryException {
+        Authorizable authorizable = null;
+        Resource resource = request.getResource();
+        if (resource != null) {
+            authorizable = resource.adaptTo(Authorizable.class);
+        }
+
+        // check that the group was located.
+        if (authorizable == null) {
+            throw new ResourceNotFoundException(
+                "User to update could not be determined");
+        }
+
+        Session session = request.getResourceResolver().adaptTo(Session.class);
+        if (session == null) {
+            throw new RepositoryException("JCR Session not found");
+        }
+
+        Map<String, RequestProperty> reqProperties = collectContent(request,
+            htmlResponse);
+        try {
+            // cleanup any old content (@Delete parameters)
+            processDeletes(authorizable, reqProperties, changes);
+
+            // write content from form
+            writeContent(session, authorizable, reqProperties, changes);
+
+        } catch (RepositoryException re) {
+            throw new RepositoryException("Failed to update user.", re);
+        }
+    }
 }

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/DateParser.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/DateParser.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/DateParser.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/DateParser.java Tue Jun  9 10:16:54 2009
@@ -48,8 +48,9 @@
     private final List<DateFormat> formats = new LinkedList<DateFormat>();
 
     /**
-     * Registers a format string to the list of internally checked ones.
-     * Uses the {@link SimpleDateFormat}.
+     * Registers a format string to the list of internally checked ones. Uses
+     * the {@link SimpleDateFormat}.
+     * 
      * @param format format as in {@link SimpleDateFormat}
      * @throws IllegalArgumentException if the format is not valid.
      */
@@ -59,6 +60,7 @@
 
     /**
      * Registers a date format to the list of internally checked ones.
+     * 
      * @param format date format
      */
     public void register(DateFormat format) {
@@ -70,16 +72,17 @@
      * instance. If no format matches returns <code>null</code>.
      * <p/>
      * Note: method is synchronized because SimpleDateFormat is not.
-     *
+     * 
      * @param source date time source string
      * @return calendar representation of the source or <code>null</code>
      */
     public synchronized Calendar parse(String source) {
-        for (DateFormat fmt: formats) {
+        for (DateFormat fmt : formats) {
             try {
                 Date d = fmt.parse(source);
                 if (log.isDebugEnabled()) {
-                    log.debug("Parsed " + source + " using " + fmt + " into " + d);
+                    log.debug("Parsed " + source + " using " + fmt + " into "
+                        + d);
                 }
                 Calendar c = Calendar.getInstance();
                 c.setTime(d);
@@ -95,38 +98,38 @@
 
     /**
      * Parses the given source strings and returns the respective calendar
-     * instances. If no format matches for any of the sources
-     * returns <code>null</code>.
+     * instances. If no format matches for any of the sources returns
+     * <code>null</code>.
      * <p/>
      * Note: method is synchronized because SimpleDateFormat is not.
-     *
+     * 
      * @param sources date time source strings
      * @return calendar representations of the source or <code>null</code>
      */
     public synchronized Calendar[] parse(String sources[]) {
         Calendar ret[] = new Calendar[sources.length];
-        for (int i=0; i< sources.length; i++) {
+        for (int i = 0; i < sources.length; i++) {
             if ((ret[i] = parse(sources[i])) == null) {
                 return null;
             }
         }
         return ret;
     }
-    
+
     /**
      * Parses the given source strings and returns the respective jcr date value
-     * instances. If no format matches for any of the sources
-     * returns <code>null</code>.
+     * instances. If no format matches for any of the sources returns
+     * <code>null</code>.
      * <p/>
      * Note: method is synchronized because SimpleDateFormat is not.
-     *
+     * 
      * @param sources date time source strings
      * @param factory the value factory
      * @return jcr date value representations of the source or <code>null</code>
      */
     public synchronized Value[] parse(String sources[], ValueFactory factory) {
         Value ret[] = new Value[sources.length];
-        for (int i=0; i< sources.length; i++) {
+        for (int i = 0; i < sources.length; i++) {
             Calendar c = parse(sources[i]);
             if (c == null) {
                 return null;

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/RequestProperty.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/RequestProperty.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/RequestProperty.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/impl/RequestProperty.java Tue Jun  9 10:16:54 2009
@@ -21,10 +21,9 @@
 import org.apache.sling.servlets.post.SlingPostConstants;
 
 /**
- * This is a copy of the class from 'org.apache.sling.servlets.post.impl.helper' which is not exported.
- * 
- * Encapsulates all infos from the respective request parameters that are needed
- * to create the repository property
+ * This is a copy of the class from 'org.apache.sling.servlets.post.impl.helper'
+ * which is not exported. Encapsulates all infos from the respective request
+ * parameters that are needed to create the repository property
  */
 public class RequestProperty {
 
@@ -74,7 +73,7 @@
     }
 
     public void setTypeHintValue(String typeHint) {
-        if ( typeHint != null && typeHint.endsWith("[]") ) {
+        if (typeHint != null && typeHint.endsWith("[]")) {
             this.typeHint = typeHint.substring(0, typeHint.length() - 2);
             this.hasMultiValueTypeHint = true;
         } else {
@@ -126,7 +125,7 @@
     /**
      * Checks if this property provides any values. this is the case if one of
      * the values is not empty or if the default handling is not 'ignore'
-     *
+     * 
      * @return <code>true</code> if this property provides values
      */
     public boolean providesValue() {
@@ -148,7 +147,7 @@
     /**
      * Returns the assembled string array out of the provided request values and
      * default values.
-     *
+     * 
      * @return a String array or <code>null</code> if the property needs to be
      *         removed.
      */
@@ -185,7 +184,7 @@
     /**
      * Specifies whether this property should be deleted before any new content
      * is to be set according to the values stored.
-     *
+     * 
      * @param isDelete <code>true</code> if the repository item described by
      *            this is to be deleted before any other operation.
      */
@@ -194,8 +193,8 @@
     }
 
     /**
-     * Returns <code>true</code> if the repository item described by this is
-     * to be deleted before setting new content to it.
+     * Returns <code>true</code> if the repository item described by this is to
+     * be deleted before setting new content to it.
      */
     public boolean isDelete() {
         return isDelete;
@@ -205,7 +204,7 @@
      * Sets the path of the repository item from which the content for this
      * property is to be copied or moved. The path may be relative in which case
      * it will be resolved relative to the absolute path of this property.
-     *
+     * 
      * @param sourcePath The path of the repository item to get the content from
      * @param isMove <code>true</code> if the source content is to be moved,
      *            otherwise the source content is copied from the repository
@@ -224,9 +223,9 @@
     }
 
     /**
-     * Returns <code>true</code> if the content of this property is to be set
-     * by moving content from another repository item.
-     *
+     * Returns <code>true</code> if the content of this property is to be set by
+     * moving content from another repository item.
+     * 
      * @see #getRepositorySource()
      */
     public boolean hasRepositoryMoveSource() {
@@ -234,9 +233,9 @@
     }
 
     /**
-     * Returns <code>true</code> if the content of this property is to be set
-     * by copying content from another repository item.
-     *
+     * Returns <code>true</code> if the content of this property is to be set by
+     * copying content from another repository item.
+     * 
      * @see #getRepositorySource()
      */
     public boolean hasRepositoryCopySource() {
@@ -246,7 +245,7 @@
     /**
      * Returns the absolute path of the repository item from which the content
      * for this property is to be copied or moved.
-     *
+     * 
      * @see #hasRepositoryCopySource()
      * @see #hasRepositoryMoveSource()
      * @see #setRepositorySource(String, boolean)

Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/resource/AuthorizableResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/resource/AuthorizableResource.java?rev=782945&r1=782944&r2=782945&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/resource/AuthorizableResource.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/resource/AuthorizableResource.java Tue Jun  9 10:16:54 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.sling.jackrabbit.usermanager.resource;
 
-
 import java.util.Map;
 
 import javax.jcr.RepositoryException;
@@ -29,91 +28,102 @@
 import org.apache.sling.api.resource.ValueMap;
 
 /**
- * Resource implementation for Authorizable 
+ * Resource implementation for Authorizable
  */
 public class AuthorizableResource extends SlingAdaptable implements Resource {
-	private Authorizable authorizable = null;
-	private ResourceResolver resourceResolver = null;
+    private Authorizable authorizable = null;
+
+    private ResourceResolver resourceResolver = null;
+
     private final String path;
+
     private final String resourceType;
+
     private final ResourceMetadata metadata;
-	
-	public AuthorizableResource(Authorizable authorizable,
-			ResourceResolver resourceResolver, String path) {
-		super();
 
-		this.resourceResolver = resourceResolver;
+    public AuthorizableResource(Authorizable authorizable,
+            ResourceResolver resourceResolver, String path) {
+        super();
+
+        this.resourceResolver = resourceResolver;
         this.authorizable = authorizable;
         this.path = path;
         if (authorizable.isGroup()) {
-        	this.resourceType = "sling:group";
+            this.resourceType = "sling:group";
         } else {
-        	this.resourceType = "sling:user";
+            this.resourceType = "sling:user";
         }
 
         this.metadata = new ResourceMetadata();
         metadata.setResolutionPath(path);
-	}
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.sling.api.resource.Resource#getPath()
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.sling.api.resource.Resource#getResourceMetadata()
+     */
+    public ResourceMetadata getResourceMetadata() {
+        return metadata;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.sling.api.resource.Resource#getResourceResolver()
+     */
+    public ResourceResolver getResourceResolver() {
+        return resourceResolver;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.sling.api.resource.Resource#getResourceSuperType()
+     */
+    public String getResourceSuperType() {
+        return null;
+    }
 
-	/* (non-Javadoc)
-	 * @see org.apache.sling.api.resource.Resource#getPath()
-	 */
-	public String getPath() {
-		return path;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.apache.sling.api.resource.Resource#getResourceMetadata()
-	 */
-	public ResourceMetadata getResourceMetadata() {
-		return metadata;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.sling.api.resource.Resource#getResourceResolver()
-	 */
-	public ResourceResolver getResourceResolver() {
-		return resourceResolver;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.sling.api.resource.Resource#getResourceSuperType()
-	 */
-	public String getResourceSuperType() {
-		return null;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.sling.api.resource.Resource#getResourceType()
-	 */
-	public String getResourceType() {
-		return resourceType;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.sling.api.adapter.Adaptable#adaptTo(java.lang.Class)
-	 */
-	@SuppressWarnings("unchecked")
-	public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
-		if (type == Map.class || type == ValueMap.class) {
-			return (AdapterType) new AuthorizableValueMap(authorizable); // unchecked cast
-		} else if (type == Authorizable.class) {
-			return (AdapterType)authorizable;
-		}
-		
-		return super.adaptTo(type);
-	}
+    /*
+     * (non-Javadoc)
+     * @see org.apache.sling.api.resource.Resource#getResourceType()
+     */
+    public String getResourceType() {
+        return resourceType;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.sling.api.adapter.Adaptable#adaptTo(java.lang.Class)
+     */
+    @SuppressWarnings("unchecked")
+    public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
+        if (type == Map.class || type == ValueMap.class) {
+            return (AdapterType) new AuthorizableValueMap(authorizable); // unchecked
+                                                                         // cast
+        } else if (type == Authorizable.class) {
+            return (AdapterType) authorizable;
+        }
+
+        return super.adaptTo(type);
+    }
 
     public String toString() {
         String id = null;
         if (authorizable != null) {
             try {
-				id = authorizable.getID();
-			} catch (RepositoryException e) {
-				//ignore it.
-			}
+                id = authorizable.getID();
+            } catch (RepositoryException e) {
+                // ignore it.
+            }
         }
-        return getClass().getSimpleName() + ", id=" + id
-            + ", path=" + getPath();
+        return getClass().getSimpleName() + ", id=" + id + ", path="
+            + getPath();
     }
 }



Mime
View raw message