]> source.dussan.org Git - archiva.git/commitdiff
code formatting : NO CODE CHANGE
authorOlivier Lamy <olamy@apache.org>
Fri, 16 Sep 2011 07:16:06 +0000 (07:16 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 16 Sep 2011 07:16:06 +0000 (07:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171407 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceLocator.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavSession.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavSessionProvider.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaVirtualDavResource.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/BrowserRedirectException.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/LogicalResource.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/UnauthorizedDavException.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/MimeTypes.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/RepositoryPathUtil.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/WebdavMethodUtil.java

index a4c38e62716d950a64fb78ac3e63757c6aef8e64..41d0f32f3a0f4e97fb729167ac6328aa8bd298a0 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.configuration;
  */
 
 /**
- * ConfigurationListener 
+ * ConfigurationListener
  *
  * @version $Id$
  */
@@ -29,5 +29,5 @@ public interface ConfigurationListener
     /**
      * Generic event point to notify components that something has happend in the configuration.
      */
-    public void configurationEvent(ConfigurationEvent event);
+    public void configurationEvent( ConfigurationEvent event );
 }
index 044563524d6028156c242c8a2479848a0275cb56..06c5ce97a0a5ef611b801970432d5eb49eb99048 100644 (file)
@@ -59,13 +59,13 @@ import org.joda.time.format.ISODateTimeFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import javax.servlet.http.HttpServletResponse;
 
 /**
  */
@@ -265,8 +265,8 @@ public class ArchivaDavResource
             {
                 parentPath = "/";
             }
-            DavResourceLocator parentloc = locator.getFactory().createResourceLocator( locator.getPrefix(),
-                                                                                       parentPath );
+            DavResourceLocator parentloc =
+                locator.getFactory().createResourceLocator( locator.getPrefix(), parentPath );
             try
             {
                 parent = factory.createResource( parentloc, session );
@@ -308,8 +308,7 @@ public class ArchivaDavResource
             // length of -1 is given for a chunked request or unknown length, in which case we accept what was uploaded
             if ( expectedContentLength >= 0 && expectedContentLength != actualContentLength )
             {
-                String msg =
-                    "Content Header length was " + expectedContentLength + " but was " + actualContentLength;
+                String msg = "Content Header length was " + expectedContentLength + " but was " + actualContentLength;
                 log.debug( "Upload failed: {}", msg );
 
                 FileUtils.deleteQuietly( localFile );
@@ -319,8 +318,8 @@ public class ArchivaDavResource
             queueRepositoryTask( localFile );
 
             log.debug(
-                "File '" + resource.getDisplayName() + ( exists ? "' modified " : "' created " ) + "(current user '" +
-                    this.principal + "')" );
+                "File '" + resource.getDisplayName() + ( exists ? "' modified " : "' created " ) + "(current user '"
+                    this.principal + "')" );
 
             triggerAuditEvent( resource, exists ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE );
         }
@@ -334,8 +333,8 @@ public class ArchivaDavResource
         }
         else
         {
-            String msg = "Could not write member " + resource.getResourcePath() + " at " + getResourcePath() +
-                " as this is not a DAV collection";
+            String msg = "Could not write member " + resource.getResourcePath() + " at " + getResourcePath()
+                " as this is not a DAV collection";
             log.debug( msg );
             throw new DavException( HttpServletResponse.SC_BAD_REQUEST, msg );
         }
@@ -353,8 +352,8 @@ public class ArchivaDavResource
                     if ( !item.startsWith( HIDDEN_PATH_PREFIX ) )
                     {
                         String path = locator.getResourcePath() + '/' + item;
-                        DavResourceLocator resourceLocator = locator.getFactory().createResourceLocator(
-                            locator.getPrefix(), path );
+                        DavResourceLocator resourceLocator =
+                            locator.getFactory().createResourceLocator( locator.getPrefix(), path );
                         DavResource resource = factory.createResource( resourceLocator, session );
 
                         if ( resource != null )
@@ -400,8 +399,8 @@ public class ArchivaDavResource
 
                     triggerAuditEvent( member, AuditEvent.REMOVE_FILE );
                 }
-                log.debug( ( resource.isDirectory() ? "Directory '" : "File '" ) + member.getDisplayName() +
-                    "' removed (current user '" + this.principal + "')" );
+                log.debug( ( resource.isDirectory() ? "Directory '" : "File '" ) + member.getDisplayName()
+                               + "' removed (current user '" + this.principal + "')" );
             }
             catch ( IOException e )
             {
@@ -453,8 +452,8 @@ public class ArchivaDavResource
                 triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_FILE );
             }
 
-            log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' moved to '" +
-                destination + "' (current user '" + this.principal + "')" );
+            log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' moved to '"
+                           + destination + "' (current user '" + this.principal + "')" );
         }
         catch ( IOException e )
         {
@@ -490,8 +489,8 @@ public class ArchivaDavResource
 
                 triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_FILE );
             }
-            log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' copied to '" +
-                destination + "' (current user '" + this.principal + "')" );
+            log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' copied to '"
+                           + destination + "' (current user '" + this.principal + "')" );
         }
         catch ( IOException e )
         {
@@ -522,7 +521,7 @@ public class ArchivaDavResource
     public ActiveLock[] getLocks()
     {
         ActiveLock writeLock = getLock( Type.WRITE, Scope.EXCLUSIVE );
-        return ( writeLock != null ) ? new ActiveLock[]{writeLock} : new ActiveLock[0];
+        return ( writeLock != null ) ? new ActiveLock[]{ writeLock } : new ActiveLock[0];
     }
 
     public ActiveLock lock( LockInfo lockInfo )
@@ -680,9 +679,8 @@ public class ArchivaDavResource
         }
         catch ( TaskQueueException e )
         {
-            log.error(
-                "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName() +
-                    "']." );
+            log.error( "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName()
+                           + "']." );
         }
     }
 }
index 18b3a23cabad9d563f1927df89dca7aa71301ae0..8d8082aad6d31654b806575307a0c1fef207eb66 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.archiva.audit.Auditable;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
+import org.apache.archiva.security.ServletAuthenticator;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.jackrabbit.webdav.DavException;
@@ -56,7 +57,6 @@ import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
 import org.apache.maven.archiva.repository.metadata.RepositoryMetadataMerge;
 import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
 import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
-import org.apache.archiva.security.ServletAuthenticator;
 import org.apache.maven.archiva.webdav.util.MimeTypes;
 import org.apache.maven.archiva.webdav.util.RepositoryPathUtil;
 import org.apache.maven.archiva.webdav.util.WebdavMethodUtil;
index 30c5335f77a46d12503440b9c1169bc4a9905a39..93c97c0e8fc4bc4cde213762dc85f183a7f2862c 100644 (file)
@@ -19,9 +19,9 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavLocatorFactory;
 import org.apache.jackrabbit.util.Text;
+import org.apache.jackrabbit.webdav.DavLocatorFactory;
+import org.apache.jackrabbit.webdav.DavResourceLocator;
 
 /**
  */
@@ -37,7 +37,7 @@ public class ArchivaDavResourceLocator
     private final String repositoryId;
 
     private final DavLocatorFactory davLocatorFactory;
-    
+
     // retains the trailing '/' at the end of the path, which is used to determine if it is a
     //      virtual repo browse request
     private final String origResourcePath;
@@ -48,10 +48,10 @@ public class ArchivaDavResourceLocator
         this.prefix = prefix;
         this.repositoryId = repositoryId;
         this.davLocatorFactory = davLocatorFactory;
-        
+
         String path = resourcePath;
-        
-        if (!resourcePath.startsWith("/"))
+
+        if ( !resourcePath.startsWith( "/" ) )
         {
             path = "/" + resourcePath;
         }
@@ -66,15 +66,15 @@ public class ArchivaDavResourceLocator
         }
 
         href = hrefPrefix + escapedPath;
-        
+
         this.origResourcePath = path;
-        
+
         //Remove trailing slashes otherwise Text.getRelativeParent fails
         if ( resourcePath.endsWith( "/" ) && resourcePath.length() > 1 )
         {
             path = resourcePath.substring( 0, resourcePath.length() - 1 );
         }
-        
+
         this.resourcePath = path;
     }
 
@@ -116,7 +116,7 @@ public class ArchivaDavResourceLocator
     public String getHref( boolean isCollection )
     {
         // avoid doubled trailing '/' for the root item
-        String suffix = ( isCollection && !isRootLocation() && !href.endsWith("/") ) ? "/" : "";
+        String suffix = ( isCollection && !isRootLocation() && !href.endsWith( "/" ) ) ? "/" : "";
         return href + suffix;
     }
 
@@ -137,7 +137,7 @@ public class ArchivaDavResourceLocator
 
     /**
      * Computes the hash code from the href, which is built using the final fields prefix and resourcePath.
-     * 
+     *
      * @return the hash code
      */
     public int hashCode()
@@ -148,7 +148,7 @@ public class ArchivaDavResourceLocator
     /**
      * Equality of path is achieved if the specified object is a <code>DavResourceLocator</code> object with the same
      * hash code.
-     * 
+     *
      * @param obj the object to compare to
      * @return <code>true</code> if the 2 objects are equal; <code>false</code> otherwise
      */
index 0e85a3eea076b947b6c4f2c941a428e6f02c1673..ba82736a136ed221b36f35e3b96219d1379c1026 100644 (file)
@@ -19,35 +19,37 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
-import java.util.HashSet;
 import org.apache.jackrabbit.webdav.DavSession;
 
-public class ArchivaDavSession implements DavSession
+import java.util.HashSet;
+
+public class ArchivaDavSession
+    implements DavSession
 {
     private final HashSet<String> lockTokens = new HashSet<String>();
 
-    public void addLockToken(String token) 
+    public void addLockToken( String token )
     {
-        lockTokens.add(token);
+        lockTokens.add( token );
     }
 
-    public String[] getLockTokens() 
+    public String[] getLockTokens()
     {
-        return (String[]) lockTokens.toArray(new String[lockTokens.size()]);
+        return (String[]) lockTokens.toArray( new String[lockTokens.size()] );
     }
 
-    public void removeLockToken(String token) 
+    public void removeLockToken( String token )
     {
-        lockTokens.remove(token);
+        lockTokens.remove( token );
     }
 
-    public void removeReference(Object reference) 
+    public void removeReference( Object reference )
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        throw new UnsupportedOperationException( "Not supported yet." );
     }
 
-    public void addReference(Object reference) 
+    public void addReference( Object reference )
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        throw new UnsupportedOperationException( "Not supported yet." );
     }
 }
index 01d3fe91cb62229b4f2cc2534428200a7b8b7821..9872a2bd71730c1d165de6c1f2a26170cb12ec56 100644 (file)
@@ -19,11 +19,11 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
+import org.apache.archiva.security.ServletAuthenticator;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavServletRequest;
 import org.apache.jackrabbit.webdav.DavSessionProvider;
 import org.apache.jackrabbit.webdav.WebdavRequest;
-import org.apache.archiva.security.ServletAuthenticator;
 import org.apache.maven.archiva.webdav.util.RepositoryPathUtil;
 import org.apache.maven.archiva.webdav.util.WebdavMethodUtil;
 import org.codehaus.plexus.redback.authentication.AuthenticationException;
@@ -42,7 +42,7 @@ public class ArchivaDavSessionProvider
     private ServletAuthenticator servletAuth;
 
     private HttpAuthenticator httpAuth;
-    
+
     public ArchivaDavSessionProvider( ServletAuthenticator servletAuth, HttpAuthenticator httpAuth )
     {
         this.servletAuth = servletAuth;
@@ -51,20 +51,20 @@ public class ArchivaDavSessionProvider
 
     public boolean attachSession( WebdavRequest request )
         throws DavException
-    {    
+    {
         final String repositoryId = RepositoryPathUtil.getRepositoryName( removeContextPath( request ) );
-        
+
         try
         {
             AuthenticationResult result = httpAuth.getAuthenticationResult( request, null );
-            
+
             //Create a dav session
-            request.setDavSession(new ArchivaDavSession());
-            
+            request.setDavSession( new ArchivaDavSession() );
+
             return servletAuth.isAuthenticated( request, result );
         }
         catch ( AuthenticationException e )
-        {   
+        {
             // safety check for MRM-911            
             String guest = UserManager.GUEST_USERNAME;
             try
@@ -80,26 +80,26 @@ public class ArchivaDavSessionProvider
             catch ( UnauthorizedException ae )
             {
                 throw new UnauthorizedDavException( repositoryId,
-                    "You are not authenticated and authorized to access any repository." );
+                                                    "You are not authenticated and authorized to access any repository." );
             }
-            
-            throw new UnauthorizedDavException( repositoryId, "You are not authenticated." );            
+
+            throw new UnauthorizedDavException( repositoryId, "You are not authenticated." );
         }
         catch ( MustChangePasswordException e )
-        {         
+        {
             throw new UnauthorizedDavException( repositoryId, "You must change your password." );
         }
         catch ( AccountLockedException e )
-        {         
+        {
             throw new UnauthorizedDavException( repositoryId, "User account is locked." );
-        }        
+        }
     }
 
     public void releaseSession( WebdavRequest request )
     {
-        request.setDavSession(null);
+        request.setDavSession( null );
     }
-    
+
     private String removeContextPath( final DavServletRequest request )
     {
         String path = request.getRequestURI();
@@ -109,5 +109,5 @@ public class ArchivaDavSessionProvider
             path = path.substring( ctx.length() );
         }
         return path;
-    }    
+    }
 }
index 47bd88d1573756c15a349e8407b1b99a68ac6d86..f5fb1d8694496b7fa8d053b21726dc83978cf356 100644 (file)
@@ -19,12 +19,6 @@ package org.apache.maven.archiva.webdav;
  * under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResource;
@@ -52,9 +46,14 @@ import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormatter;
 import org.joda.time.format.ISODateTimeFormat;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 /**
  * DavResource for virtual repositories
- * 
  */
 public class ArchivaVirtualDavResource
     implements DavResource
@@ -69,12 +68,12 @@ public class ArchivaVirtualDavResource
 
     private DavPropertySet properties;
 
-    private boolean propsInitialized = false;  
+    private boolean propsInitialized = false;
 
     private static final String METHODS = "OPTIONS, GET, HEAD, POST, TRACE, PROPFIND, PROPPATCH, MKCOL";
-    
+
     private final List<File> localResources;
-    
+
     public ArchivaVirtualDavResource( List<File> localResources, String logicalResource, MimeTypes mimeTypes,
                                       ArchivaDavResourceLocator locator, DavResourceFactory factory )
     {
@@ -88,7 +87,7 @@ public class ArchivaVirtualDavResource
     public void spool( OutputContext outputContext )
         throws IOException
     {
-        if (outputContext.hasStream())
+        if ( outputContext.hasStream() )
         {
             Collections.sort( localResources );
             List<File> localResourceFiles = new ArrayList<File>();
@@ -108,31 +107,31 @@ public class ArchivaVirtualDavResource
 
     public void addLockManager( LockManager arg0 )
     {
-        
+
     }
 
     public void addMember( DavResource arg0, InputContext arg1 )
         throws DavException
     {
-        
+
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public MultiStatusResponse alterProperties( List arg0 )
         throws DavException
-    {       
+    {
         return null;
     }
 
     public MultiStatusResponse alterProperties( DavPropertySet arg0, DavPropertyNameSet arg1 )
         throws DavException
-    {        
+    {
         return null;
     }
 
     public void copy( DavResource arg0, boolean arg1 )
         throws DavException
-    {        
+    {
 
     }
 
@@ -143,12 +142,12 @@ public class ArchivaVirtualDavResource
     }
 
     public ActiveLock getLock( Type arg0, Scope arg1 )
-    {       
+    {
         return null;
     }
 
     public ActiveLock[] getLocks()
-    {        
+    {
         return null;
     }
 
@@ -156,7 +155,7 @@ public class ArchivaVirtualDavResource
     {
         return null;
     }
-    
+
     public String getSupportedMethods()
     {
         return METHODS;
@@ -168,7 +167,7 @@ public class ArchivaVirtualDavResource
     }
 
     public boolean hasLock( Type arg0, Scope arg1 )
-    {       
+    {
         return false;
     }
 
@@ -178,7 +177,7 @@ public class ArchivaVirtualDavResource
     }
 
     public boolean isLockable( Type arg0, Scope arg1 )
-    {        
+    {
         return false;
     }
 
@@ -191,31 +190,31 @@ public class ArchivaVirtualDavResource
     public void move( DavResource arg0 )
         throws DavException
     {
-     
+
     }
 
     public ActiveLock refreshLock( LockInfo arg0, String arg1 )
         throws DavException
-    {        
+    {
         return null;
     }
 
     public void removeMember( DavResource arg0 )
         throws DavException
     {
-        
+
     }
 
     public void unlock( String arg0 )
         throws DavException
     {
-        
+
     }
 
     public String getComplianceClass()
     {
         return COMPLIANCE_CLASS;
-    }   
+    }
 
     public DavResourceLocator getLocator()
     {
@@ -231,7 +230,7 @@ public class ArchivaVirtualDavResource
     {
         return locator.getHref( isCollection() );
     }
-    
+
     public DavResourceFactory getFactory()
     {
         return factory;
@@ -240,12 +239,12 @@ public class ArchivaVirtualDavResource
     public String getDisplayName()
     {
         String resPath = getResourcePath();
-        
+
         return ( resPath != null ) ? Text.getName( resPath ) : resPath;
     }
-    
+
     public DavSession getSession()
-    {        
+    {
         return null;
     }
 
@@ -277,7 +276,7 @@ public class ArchivaVirtualDavResource
     }
 
     public DavResource getCollection()
-    {   
+    {
         DavResource parent = null;
         if ( getResourcePath() != null && !getResourcePath().equals( "/" ) )
         {
@@ -286,7 +285,8 @@ public class ArchivaVirtualDavResource
             {
                 parentPath = "/";
             }
-            DavResourceLocator parentloc = locator.getFactory().createResourceLocator( locator.getPrefix(), parentPath );
+            DavResourceLocator parentloc =
+                locator.getFactory().createResourceLocator( locator.getPrefix(), parentPath );
             try
             {
                 // go back to ArchivaDavResourceFactory!
@@ -299,7 +299,7 @@ public class ArchivaVirtualDavResource
         }
         return parent;
     }
-    
+
     /**
      * Fill the set of properties
      */
@@ -328,7 +328,7 @@ public class ArchivaVirtualDavResource
             // Windows XP support
             properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) );
         }
-       
+
         // Need to get the ISO8601 date for properties
         DateTime dt = new DateTime( 0 );
         DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
index bb8a3cc277effc04aa3e7d92fc3f189e3845208d..c05d406f85aa181aa412ab9d4d14b8275b84cd8f 100644 (file)
@@ -25,13 +25,14 @@ import javax.servlet.http.HttpServletResponse;
 
 /**
  */
-public class BrowserRedirectException extends DavException
+public class BrowserRedirectException
+    extends DavException
 {
     final String location;
 
-    public BrowserRedirectException(String location)
+    public BrowserRedirectException( String location )
     {
-        super(HttpServletResponse.SC_MOVED_PERMANENTLY);
+        super( HttpServletResponse.SC_MOVED_PERMANENTLY );
         this.location = location;
     }
 
index 2ac002a8be72939ffd56649e95239f9fabfd6cc5..b0931c8a6143dfbbc59eb1278b86919ffe3d7a31 100644 (file)
@@ -30,7 +30,7 @@ public class LogicalResource
         return path;
     }
 
-    public void setPath(String path)
+    public void setPath( String path )
     {
         this.path = path;
     }
index f92c9b4d7a91832387b6c34f8d8e21ca0054d67d..30f8a3eed7d08968b13d6f1658460228cf187955 100644 (file)
@@ -25,13 +25,14 @@ import javax.servlet.http.HttpServletResponse;
 
 /**
  */
-public class UnauthorizedDavException extends DavException
+public class UnauthorizedDavException
+    extends DavException
 {
     final private String repositoryName;
 
-    public UnauthorizedDavException(String repositoryName, String message)
+    public UnauthorizedDavException( String repositoryName, String message )
     {
-        super(HttpServletResponse.SC_UNAUTHORIZED, message);
+        super( HttpServletResponse.SC_UNAUTHORIZED, message );
         this.repositoryName = repositoryName;
     }
 
index 6fd36c07c36c98529a251bd841c68184d62a0d83..5edb60e6968ba418e73d47132d0ddc299cb3ff01 100644 (file)
@@ -23,6 +23,8 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.jackrabbit.webdav.DavResource;
 import org.apache.jackrabbit.webdav.io.OutputContext;
 
+import java.io.File;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -30,27 +32,25 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.io.PrintWriter;
-import java.io.File;
 
 /**
  */
 public class IndexWriter
 {
     private final String logicalResource;
-    
+
     private final List<File> localResources;
-    
+
     private final boolean isVirtual;
-    
-    public IndexWriter(DavResource resource, File localResource, String logicalResource)
+
+    public IndexWriter( DavResource resource, File localResource, String logicalResource )
     {
         this.localResources = new ArrayList<File>();
         this.localResources.add( localResource );
         this.logicalResource = logicalResource;
         this.isVirtual = false;
     }
-    
+
     public IndexWriter( DavResource resource, List<File> localResources, String logicalResource )
     {
         this.logicalResource = logicalResource;
@@ -58,89 +58,89 @@ public class IndexWriter
         this.isVirtual = true;
     }
 
-    public void write(OutputContext outputContext)
-    {   
-        outputContext.setModificationTime(new Date().getTime());
-        outputContext.setContentType("text/html");
-        outputContext.setETag("");
-        if (outputContext.hasStream())
+    public void write( OutputContext outputContext )
+    {
+        outputContext.setModificationTime( new Date().getTime() );
+        outputContext.setContentType( "text/html" );
+        outputContext.setETag( "" );
+        if ( outputContext.hasStream() )
         {
-            PrintWriter writer = new PrintWriter(outputContext.getOutputStream());
-            writeDocumentStart(writer);
-            writeHyperlinks(writer);
-            writeDocumentEnd(writer);
+            PrintWriter writer = new PrintWriter( outputContext.getOutputStream() );
+            writeDocumentStart( writer );
+            writeHyperlinks( writer );
+            writeDocumentEnd( writer );
             writer.flush();
             writer.close();
-        } 
+        }
     }
 
-    private void writeDocumentStart(PrintWriter writer)
+    private void writeDocumentStart( PrintWriter writer )
     {
-        writer.println("<html>");
-        writer.println("<head>");
-        writer.println("<title>Collection: /" + logicalResource + "</title>");
-        writer.println("</head>");
-        writer.println("<body>");
-        writer.println("<h3>Collection: /" + logicalResource + "</h3>");
+        writer.println( "<html>" );
+        writer.println( "<head>" );
+        writer.println( "<title>Collection: /" + logicalResource + "</title>" );
+        writer.println( "</head>" );
+        writer.println( "<body>" );
+        writer.println( "<h3>Collection: /" + logicalResource + "</h3>" );
 
         //Check if not root
-        if (logicalResource.length() > 0)
+        if ( logicalResource.length() > 0 )
         {
-            File file = new File(logicalResource);
+            File file = new File( logicalResource );
             String parentName = file.getParent() == null ? "/" : file.getParent();
-            
+
             //convert to unix path in case archiva is hosted on windows
-            parentName = StringUtils.replace(parentName, "\\", "/" );
+            parentName = StringUtils.replace( parentName, "\\", "/" );
 
-            writer.println("<ul>");
-            writer.println("<li><a href=\"../\">" + parentName + "</a> <i><small>(Parent)</small></i></li>");
-            writer.println("</ul>");
+            writer.println( "<ul>" );
+            writer.println( "<li><a href=\"../\">" + parentName + "</a> <i><small>(Parent)</small></i></li>" );
+            writer.println( "</ul>" );
         }
 
-        writer.println("<ul>");
+        writer.println( "<ul>" );
     }
 
-    private void writeDocumentEnd(PrintWriter writer)
+    private void writeDocumentEnd( PrintWriter writer )
     {
-        writer.println("</ul>");
-        writer.println("</body>");
-        writer.println("</html>");
+        writer.println( "</ul>" );
+        writer.println( "</body>" );
+        writer.println( "</html>" );
     }
 
-    private void writeHyperlinks(PrintWriter writer)
-    {   
-        if( !isVirtual )
+    private void writeHyperlinks( PrintWriter writer )
+    {
+        if ( !isVirtual )
         {
-            for( File localResource : localResources )
+            for ( File localResource : localResources )
             {
-                List<File> files = new ArrayList<File>( Arrays.asList( localResource.listFiles() ) ); 
+                List<File> files = new ArrayList<File>( Arrays.asList( localResource.listFiles() ) );
                 Collections.sort( files );
-                
+
                 for ( File file : files )
                 {
                     writeHyperlink( writer, file.getName(), file.isDirectory() );
                 }
             }
         }
-        else 
-        {            
+        else
+        {
             // virtual repository - filter unique directories
             Map<String, List<String>> uniqueChildFiles = new HashMap<String, List<String>>();
             List<String> sortedList = new ArrayList<String>();
-            for( File resource : localResources )
-            {   
-                List<File> files = new ArrayList<File>( Arrays.asList( resource.listFiles() ) ); 
+            for ( File resource : localResources )
+            {
+                List<File> files = new ArrayList<File>( Arrays.asList( resource.listFiles() ) );
                 for ( File file : files )
-                {   
+                {
                     List<String> mergedChildFiles = new ArrayList<String>();
-                    if( uniqueChildFiles.get( file.getName() ) == null )
+                    if ( uniqueChildFiles.get( file.getName() ) == null )
                     {
-                        mergedChildFiles.add( file.getAbsolutePath() );                        
+                        mergedChildFiles.add( file.getAbsolutePath() );
                     }
                     else
                     {
                         mergedChildFiles = uniqueChildFiles.get( file.getName() );
-                        if( !mergedChildFiles.contains( file.getAbsolutePath() ) )
+                        if ( !mergedChildFiles.contains( file.getAbsolutePath() ) )
                         {
                             mergedChildFiles.add( file.getAbsolutePath() );
                         }
@@ -149,34 +149,34 @@ public class IndexWriter
                     sortedList.add( file.getName() );
                 }
             }
-             
+
             Collections.sort( sortedList );
             List<String> written = new ArrayList<String>();
             for ( String fileName : sortedList )
-            {   
+            {
                 List<String> childFilesFromMap = uniqueChildFiles.get( fileName );
-                for( String childFilePath : childFilesFromMap )
-                {   
+                for ( String childFilePath : childFilesFromMap )
+                {
                     File childFile = new File( childFilePath );
-                    if( !written.contains( childFile.getName() ) )
-                    {   
+                    if ( !written.contains( childFile.getName() ) )
+                    {
                         written.add( childFile.getName() );
-                        writeHyperlink( writer, fileName, childFile.isDirectory() );                        
+                        writeHyperlink( writer, fileName, childFile.isDirectory() );
                     }
                 }
             }
         }
     }
 
-    private void writeHyperlink(PrintWriter writer, String resourceName, boolean directory )
-    {        
-        if (directory)
+    private void writeHyperlink( PrintWriter writer, String resourceName, boolean directory )
+    {
+        if ( directory )
         {
-            writer.println("<li><a href=\"" + resourceName + "/\">" + resourceName + "</a></li>");
+            writer.println( "<li><a href=\"" + resourceName + "/\">" + resourceName + "</a></li>" );
         }
         else
         {
-            writer.println("<li><a href=\"" + resourceName + "\">" + resourceName + "</a></li>");
+            writer.println( "<li><a href=\"" + resourceName + "\">" + resourceName + "</a></li>" );
         }
-    }    
+    }
 }
index a9372a96e68a7ae834eb4a8173abeb50d04af7e2..f3e906e27dc3964e2864330a8fdc46d5efdfbfe5 100644 (file)
@@ -39,25 +39,24 @@ import java.util.Map;
 import java.util.StringTokenizer;
 
 /**
- * MimeTypes 
+ * MimeTypes
  *
  * @version $Id: MimeTypes.java 7010 2007-10-25 23:35:02Z joakime $
- *
  */
-@Service("mimeTpes")
+@Service( "mimeTpes" )
 public class MimeTypes
 {
     private static final String DEFAULT_MIME_TYPE = "application/octet-stream";
 
     private String resource = "org/apache/maven/archiva/webdav/util/mime.types";
-    
+
     private Map<String, String> mimeMap = new HashMap<String, String>();
 
     private Logger log = LoggerFactory.getLogger( MimeTypes.class );
-    
+
     /**
      * Get the Mime Type for the provided filename.
-     * 
+     *
      * @param filename the filename to obtain the mime type for.
      * @return a mime type String, or null if filename is null, has no extension, or no mime type is associated with it.
      */
@@ -74,8 +73,7 @@ public class MimeTypes
             }
         }
 
-
-        if (value == null)
+        if ( value == null )
         {
             value = DEFAULT_MIME_TYPE;
         }
index 2b1c5d271b9cc3492677015df904f3c86d8f7441..aa29cecc9857b0e74534fea1f8d53a2086df6087 100644 (file)
@@ -19,42 +19,42 @@ package org.apache.maven.archiva.webdav.util;
  * under the License.
  */
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
 
 /**
  */
 public class RepositoryPathUtil
 {
-    public static String getLogicalResource(final String href)
+    public static String getLogicalResource( final String href )
     {
         String logicalResource = null;
         String requestPathInfo = StringUtils.defaultString( href );
 
         //remove prefix ie /repository/blah becomes /blah
-        requestPathInfo = removePrefix(requestPathInfo);
+        requestPathInfo = removePrefix( requestPathInfo );
 
         // Remove prefixing slash as the repository id doesn't contain it;
         if ( requestPathInfo.startsWith( "/" ) )
         {
             requestPathInfo = requestPathInfo.substring( 1 );
-        }        
+        }
 
         int slash = requestPathInfo.indexOf( '/' );
         if ( slash > 0 )
-        {   
+        {
             logicalResource = requestPathInfo.substring( slash );
-         
-            if (logicalResource.endsWith( "/.." ) )
+
+            if ( logicalResource.endsWith( "/.." ) )
             {
                 logicalResource += "/";
             }
-            
+
             if ( logicalResource != null && logicalResource.startsWith( "//" ) )
             {
                 logicalResource = logicalResource.substring( 1 );
             }
-            
+
             if ( logicalResource == null )
             {
                 logicalResource = "/";
@@ -67,12 +67,12 @@ public class RepositoryPathUtil
         return logicalResource;
     }
 
-    public static String getRepositoryName(final String href)
+    public static String getRepositoryName( final String href )
     {
         String requestPathInfo = StringUtils.defaultString( href );
 
         //remove prefix ie /repository/blah becomes /blah
-        requestPathInfo = removePrefix(requestPathInfo);
+        requestPathInfo = removePrefix( requestPathInfo );
 
         // Remove prefixing slash as the repository id doesn't contain it;
         if ( requestPathInfo.startsWith( "/" ) )
@@ -90,21 +90,21 @@ public class RepositoryPathUtil
         return requestPathInfo;
     }
 
-    private static String removePrefix(final String href)
+    private static String removePrefix( final String href )
     {
-        String[] parts = StringUtils.split(href, '/');
-        parts = (String[]) ArrayUtils.subarray(parts, 1, parts.length);
-        if (parts == null || parts.length == 0)
+        String[] parts = StringUtils.split( href, '/' );
+        parts = (String[]) ArrayUtils.subarray( parts, 1, parts.length );
+        if ( parts == null || parts.length == 0 )
         {
             return "/";
         }
-        
-        String joinedString = StringUtils.join(parts, '/');        
-        if( href.endsWith( "/" ) )
+
+        String joinedString = StringUtils.join( parts, '/' );
+        if ( href.endsWith( "/" ) )
         {
             joinedString = joinedString + "/";
         }
-        
+
         return joinedString;
     }
 }
index 70e055e6cfbf35f3911f6e854232fcae12d7d435..91a851b8552c1aa07cf043d3752fc49011ba4244 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.webdav.util;
  * under the License.
  */
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.archiva.security.ArchivaRoleConstants;
+import org.apache.commons.lang.StringUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -28,7 +28,7 @@ import java.util.Locale;
 
 /**
  * WebdavMethodUtil
- * 
+ *
  * @version $Id: WebdavMethodUtil.java 5412 2007-01-13 01:18:47Z joakime $
  */
 public class WebdavMethodUtil