diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java index f53ae3fe7..425fd5270 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java @@ -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 ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html index d7b1675f2..9450dd56b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html @@ -32,7 +32,6 @@ - diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 95c73a163..909130fa8 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -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 mergedRepositoryContents = new ArrayList(); // 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 ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java index 0ff1dfc6f..f11c9a2cd 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java @@ -343,4 +343,13 @@ public class ArchivaVirtualDavResource propsInitialized = true; } + public String getLogicalResource() + { + return logicalResource; + } + + public void setLogicalResource( String logicalResource ) + { + this.logicalResource = logicalResource; + } } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/IndexWriter.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/IndexWriter.java index 8c28a3547..d1a995ea6 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/IndexWriter.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/IndexWriter.java @@ -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;iCollection: /" + logicalResource + "" ); //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(); diff --git a/archiva-modules/plugins/metadata-store-cassandra/pom.xml b/archiva-modules/plugins/metadata-store-cassandra/pom.xml index 4106996b8..69a268cbd 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/pom.xml +++ b/archiva-modules/plugins/metadata-store-cassandra/pom.xml @@ -37,7 +37,7 @@ 2.x has 1.7 required 2.0.2 --> - 1.56.44 + 1.56.48 diff --git a/pom.xml b/pom.xml index a648a2a3f..a4d64387e 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ 0.1-incubating - 2.6.10 + 2.6.13 10.10.1.1 4.3.1 4.3 @@ -1865,7 +1865,7 @@ .repository/** *.patch **/target/** - .java-version + **/.java-version patch.diff @@ -1944,5 +1944,4 @@ -