[MRM-1745] path of merged index for group configurable

implement backend part

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1470295 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-04-21 13:22:26 +00:00
parent f470e5f2fa
commit e0c2f0af78
2 changed files with 17 additions and 6 deletions

View File

@ -840,6 +840,14 @@
<required>true</required> <required>true</required>
<description>The id of the repository group.</description> <description>The id of the repository group.</description>
</field> </field>
<field>
<name>mergedIndexPath</name>
<version>1.2.0+</version>
<type>String</type>
<required>false</required>
<defaultValue>/.indexer</defaultValue>
<description>The path of the merged index.</description>
</field>
<field> <field>
<name>repositories</name> <name>repositories</name>
<version>1.2.0+</version> <version>1.2.0+</version>

View File

@ -262,8 +262,8 @@ public class ArchivaDavResourceFactory
// handle browse requests for virtual repos // handle browse requests for virtual repos
if ( RepositoryPathUtil.getLogicalResource( archivaLocator.getOrigResourcePath() ).endsWith( "/" ) ) if ( RepositoryPathUtil.getLogicalResource( archivaLocator.getOrigResourcePath() ).endsWith( "/" ) )
{ {
return getResource( request, repoGroupConfig.getRepositories(), archivaLocator, return getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator,
archivaLocator.getRepositoryId() ); repoGroupConfig );
} }
else else
{ {
@ -904,8 +904,9 @@ public class ArchivaDavResourceFactory
} }
} }
private DavResource getResource( DavServletRequest request, List<String> repositories, private DavResource getResourceFromGroup( DavServletRequest request, List<String> repositories,
ArchivaDavResourceLocator locator, String groupId ) ArchivaDavResourceLocator locator,
RepositoryGroupConfiguration repositoryGroupConfiguration )
throws DavException throws DavException
{ {
List<File> mergedRepositoryContents = new ArrayList<File>(); List<File> mergedRepositoryContents = new ArrayList<File>();
@ -930,9 +931,11 @@ public class ArchivaDavResourceFactory
// remove last / // remove last /
String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" ); String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" );
if ( StringUtils.endsWith( pathInfo, "/.indexer" ) ) if ( StringUtils.endsWith( pathInfo, "/" + repositoryGroupConfiguration.getMergedIndexPath() )
|| StringUtils.endsWith( pathInfo, "/" + repositoryGroupConfiguration.getMergedIndexPath() + "/" ) )
{ {
File mergedRepoDir = buildMergedIndexDirectory( repositories, activePrincipal, request, groupId ); File mergedRepoDir = buildMergedIndexDirectory( repositories, activePrincipal, request,
repositoryGroupConfiguration.getId() );
mergedRepositoryContents.add( mergedRepoDir ); mergedRepositoryContents.add( mergedRepoDir );
} }
else else