]> source.dussan.org Git - archiva.git/commitdiff
Merge branch 'trunk' into 2.0.0-RC
authorOlivier Lamy <olamy@apache.org>
Sat, 15 Feb 2014 12:00:36 +0000 (12:00 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 15 Feb 2014 12:00:36 +0000 (12:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/2.0.0-RC@1568624 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/IndexWriter.java
archiva-modules/plugins/metadata-store-cassandra/pom.xml
pom.xml

index f53ae3fe70d6bf141a1fd23ed7bf274b8c235e49..425fd5270686df8acc5075fd560712b014fe4d33 100644 (file)
@@ -81,7 +81,14 @@ public class DefaultRepositoryGroupAdmin
         {
             for ( RepositoryGroup repositoryGroup : getRepositoriesGroups() )
             {
-                mergedRemoteIndexesScheduler.schedule( repositoryGroup, getMergedIndexDirectory( repositoryGroup.getId() ) );
+                mergedRemoteIndexesScheduler.schedule( repositoryGroup,
+                                                       getMergedIndexDirectory( repositoryGroup.getId() ) );
+                // create the directory for each group if not exists
+                File groupPath = new File( groupsDirectory, repositoryGroup.getId() );
+                if ( !groupPath.exists() )
+                {
+                    groupPath.mkdirs();
+                }
             }
         }
         catch ( RepositoryAdminException e )
@@ -244,7 +251,8 @@ public class DefaultRepositoryGroupAdmin
         {
             throw new RepositoryAdminException(
                 "repositoryGroup with id " + repositoryGroupId + " doesn't not contains repository with id"
-                    + repositoryId );
+                    + repositoryId
+            );
         }
 
         repositoryGroup.removeRepository( repositoryId );
index d7b1675f247eb48b8b57bfcd74ba3ee673fafe05..9450dd56bcdf0dc7977765875efe21ae719df860 100644 (file)
@@ -32,7 +32,6 @@
     <link rel="shortcut icon" href="favicon.ico"/>
     <link rel="stylesheet" href="css/prettify.css"/>
 
-
     <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
     <script type="text/javascript" src="js/jquery-ui.1.10.3.min.js"></script>
     <script type="text/javascript" src="js/sammy.0.7.4.js"></script>
index 95c73a163cf16288b1b0ea58ea3fedc4c101f690..909130fa85274a36a1f340b503a3ce9029c3fa97 100644 (file)
@@ -107,6 +107,7 @@ import javax.servlet.http.HttpSession;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -117,7 +118,7 @@ import java.util.Set;
 /**
  *
  */
-@Service("davResourceFactory#archiva")
+@Service( "davResourceFactory#archiva" )
 public class ArchivaDavResourceFactory
     implements DavResourceFactory, Auditable
 {
@@ -136,7 +137,7 @@ public class ArchivaDavResourceFactory
     private RepositoryRequest repositoryRequest;
 
     @Inject
-    @Named(value = "repositoryProxyConnectors#default")
+    @Named( value = "repositoryProxyConnectors#default" )
     private RepositoryProxyConnectors connectors;
 
     @Inject
@@ -151,7 +152,7 @@ public class ArchivaDavResourceFactory
     private ServletAuthenticator servletAuth;
 
     @Inject
-    @Named(value = "httpAuthenticator#basic")
+    @Named( value = "httpAuthenticator#basic" )
     private HttpAuthenticator httpAuth;
 
     @Inject
@@ -178,11 +179,11 @@ public class ArchivaDavResourceFactory
     private Digester digestMd5;
 
     @Inject
-    @Named(value = "archivaTaskScheduler#repository")
+    @Named( value = "archivaTaskScheduler#repository" )
     private RepositoryArchivaTaskScheduler scheduler;
 
     @Inject
-    @Named(value = "fileLockManager#default")
+    @Named( value = "fileLockManager#default" )
     private FileLockManager fileLockManager;
 
     private ApplicationContext applicationContext;
@@ -239,8 +240,14 @@ public class ArchivaDavResourceFactory
             {
                 try
                 {
-                    return getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator,
-                                                 repoGroupConfig );
+                    DavResource davResource =
+                        getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator,
+                                              repoGroupConfig );
+
+                    setHeaders( response, locator, davResource );
+
+                    return davResource;
+
                 }
                 catch ( RepositoryAdminException e )
                 {
@@ -309,7 +316,8 @@ public class ArchivaDavResourceFactory
             {
                 resource = processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
                                               managedRepositoryAdmin.getManagedRepository(
-                                                  archivaLocator.getRepositoryId() ) );
+                                                  archivaLocator.getRepositoryId() )
+                );
 
                 String logicalResource = getLogicalResource( archivaLocator, null, false );
                 resourcesInAbsolutePath.add(
@@ -408,8 +416,8 @@ public class ArchivaDavResourceFactory
                         catch ( DigesterException de )
                         {
                             throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                                                    "Error occurred while generating checksum files."
-                                                        + de.getMessage() );
+                                                    "Error occurred while generating checksum files." + de.getMessage()
+                            );
                         }
                     }
                 }
@@ -852,8 +860,8 @@ public class ArchivaDavResourceFactory
     {
         // [MRM-503] - Metadata file need Pragma:no-cache response
         // header.
-        if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" )
-            || ( (ArchivaDavResource) resource ).getLocalResource().isDirectory() )
+        if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || ( resource instanceof ArchivaDavResource
+            && ( ArchivaDavResource.class.cast( resource ).getLocalResource().isDirectory() ) ) )
         {
             response.setHeader( "Pragma", "no-cache" );
             response.setHeader( "Cache-Control", "no-cache" );
@@ -861,10 +869,13 @@ public class ArchivaDavResourceFactory
         }
         // if the resource is a directory don't cache it as new groupId deployed will be available
         // without need of refreshing browser
-        else
+        else if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || (
+            resource instanceof ArchivaVirtualDavResource && ( new File(
+                ArchivaVirtualDavResource.class.cast( resource ).getLogicalResource() ).isDirectory() ) ) )
         {
-            // We need to specify this so connecting wagons can work correctly
-            response.setDateHeader( "Last-Modified", resource.getModificationTime() );
+            response.setHeader( "Pragma", "no-cache" );
+            response.setHeader( "Cache-Control", "no-cache" );
+            response.setDateHeader( "Last-Modified", new Date().getTime() );
         }
         // TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots)
     }
@@ -925,7 +936,8 @@ public class ArchivaDavResourceFactory
             return servletAuth.isAuthenticated( request, result ) && servletAuth.isAuthorized( request, securitySession,
                                                                                                repositoryId,
                                                                                                WebdavMethodUtil.getMethodPermission(
-                                                                                                   request.getMethod() ) );
+                                                                                                   request.getMethod() )
+            );
         }
         catch ( AuthenticationException e )
         {
@@ -972,11 +984,22 @@ public class ArchivaDavResourceFactory
                                               RepositoryGroupConfiguration repositoryGroupConfiguration )
         throws DavException, RepositoryAdminException
     {
+        if ( repositoryGroupConfiguration.getRepositories() == null
+            || repositoryGroupConfiguration.getRepositories().isEmpty() )
+        {
+            File file =
+                new File( System.getProperty( "appserver.base"), "groups/" + repositoryGroupConfiguration.getId() );
+
+            return new ArchivaDavResource( file.getPath(), "groups/" + repositoryGroupConfiguration.getId(),
+                                           null,request.getDavSession(), locator, this,
+                                           mimeTypes, auditListeners,
+                                           scheduler, fileLockManager );
+        }
         List<File> mergedRepositoryContents = new ArrayList<File>();
         // multiple repo types so we guess they are all the same type
         // so use the first one
         // FIXME add a method with group in the repository storage
-        String firstRepoId = repositoryGroupConfiguration.getRepositories().get( 1 );
+        String firstRepoId = repositoryGroupConfiguration.getRepositories().get( 0 );
 
         String path = getLogicalResource( locator, managedRepositoryAdmin.getManagedRepository( firstRepoId ), false );
         if ( path.startsWith( "/" ) )
@@ -1012,7 +1035,8 @@ public class ArchivaDavResourceFactory
                 {
                     File tmpDirectory = new File( SystemUtils.getJavaIoTmpDir(),
                                                   repositoryGroupConfiguration.getId() + "/"
-                                                      + repositoryGroupConfiguration.getMergedIndexPath() );
+                                                      + repositoryGroupConfiguration.getMergedIndexPath()
+                    );
                     if ( !tmpDirectory.exists() )
                     {
                         synchronized ( tmpDirectory.getAbsolutePath() )
@@ -1056,7 +1080,8 @@ public class ArchivaDavResourceFactory
                                 repoIndexDirectory = new File( managedRepository.getRepository().getLocation(),
                                                                StringUtils.isEmpty( repoIndexDirectory )
                                                                    ? ".indexer"
-                                                                   : repoIndexDirectory ).getAbsolutePath();
+                                                                   : repoIndexDirectory
+                                ).getAbsolutePath();
                             }
                         }
                         if ( StringUtils.isEmpty( repoIndexDirectory ) )
@@ -1096,7 +1121,8 @@ public class ArchivaDavResourceFactory
                                 {
                                     if ( servletAuth.isAuthorized( activePrincipal, repository,
                                                                    WebdavMethodUtil.getMethodPermission(
-                                                                       request.getMethod() ) ) )
+                                                                       request.getMethod() )
+                                    ) )
                                     {
                                         mergedRepositoryContents.add( resourceFile );
                                         log.debug( "Repository '{}' accessed by '{}'", repository, activePrincipal );
@@ -1312,13 +1338,14 @@ public class ArchivaDavResourceFactory
             File tempRepoFile = Files.createTempDir();
             tempRepoFile.deleteOnExit();
 
-            IndexMergerRequest indexMergerRequest = new IndexMergerRequest( authzRepos, true, repositoryGroupConfiguration.getId(),
-                                    repositoryGroupConfiguration.getMergedIndexPath(),
-                                    repositoryGroupConfiguration.getMergedIndexTtl() ).mergedIndexDirectory( tempRepoFile )
-                                    .temporary( true );
+            IndexMergerRequest indexMergerRequest =
+                new IndexMergerRequest( authzRepos, true, repositoryGroupConfiguration.getId(),
+                                        repositoryGroupConfiguration.getMergedIndexPath(),
+                                        repositoryGroupConfiguration.getMergedIndexTtl() ).mergedIndexDirectory(
+                    tempRepoFile ).temporary( true );
 
             MergedRemoteIndexesTaskRequest taskRequest =
-                new MergedRemoteIndexesTaskRequest(indexMergerRequest, indexMerger);
+                new MergedRemoteIndexesTaskRequest( indexMergerRequest, indexMerger );
 
             MergedRemoteIndexesTask job = new MergedRemoteIndexesTask( taskRequest );
 
index 0ff1dfc6fa0acca85a3270aa594ae79ca649087a..f11c9a2cd392d90541ec634a221515784b1686e2 100644 (file)
@@ -343,4 +343,13 @@ public class ArchivaVirtualDavResource
         propsInitialized = true;
     }
 
+    public String getLogicalResource()
+    {
+        return logicalResource;
+    }
+
+    public void setLogicalResource( String logicalResource )
+    {
+        this.logicalResource = logicalResource;
+    }
 }
index 8c28a35470f601bbc61fbbb6c1a9a80eeac847a9..d1a995ea66787f087a32e9bee2478c9409e6287c 100644 (file)
@@ -86,7 +86,7 @@ public class IndexWriter
         writer.println( "ul{list-style:none;}" ); 
         
         StringBuilder relative = new StringBuilder("../../");
-        if ( logicalResource.length() > 0 ) 
+        if ( logicalResource != null && logicalResource.length() > 0 )
         {
             String tmpRelative = StringUtils.replace( logicalResource, "\\", "/" );
             for (int i=0;i<tmpRelative.split("/").length;i++) 
@@ -109,7 +109,7 @@ public class IndexWriter
         writer.println( "<h3>Collection: /" + logicalResource + "</h3>" );
 
         //Check if not root
-        if ( logicalResource.length() > 0 )
+        if ( logicalResource != null && logicalResource.length() > 0 )
         {
             File file = new File( logicalResource );
             String parentName = file.getParent() == null ? "/" : file.getParent();
index 4106996b8562dc7530ac88b358f5cbc51697c6ee..69a268cbd3b903523ee891861dd9680b79c0d08d 100644 (file)
@@ -37,7 +37,7 @@
     2.x has 1.7 required
     <cassandraVersion>2.0.2</cassandraVersion>
     -->
-    <astyanax.version>1.56.44</astyanax.version>
+    <astyanax.version>1.56.48</astyanax.version>
   </properties>
 
   <dependencies>
diff --git a/pom.xml b/pom.xml
index a648a2a3f8407bc060565d4fc3f0b18cc99da101..a4d64387ea8e7863ffb73504060390bcbef8e47e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
 
     <sirona.version>0.1-incubating</sirona.version>
 
-    <cxfVersion>2.6.10</cxfVersion>
+    <cxfVersion>2.6.13</cxfVersion>
     <derbyVersion>10.10.1.1</derbyVersion>
     <httpclient.version>4.3.1</httpclient.version>
     <httpclient.core.version>4.3</httpclient.core.version>
               <exclude>.repository/**</exclude>
               <exclude>*.patch</exclude>
               <exclude>**/target/**</exclude>
-              <exclude>.java-version</exclude>
+              <exclude>**/.java-version</exclude>
               <exclude>patch.diff</exclude>
             </excludes>
           </configuration>
       </snapshots>
     </pluginRepository>
   </pluginRepositories>
-
 </project>