Merge branch 'trunk' into 2.0.0-RC

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/2.0.0-RC@1568624 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2014-02-15 12:00:36 +00:00
parent 48f1e243a6
commit 86f5f926e3
7 changed files with 76 additions and 34 deletions

View 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 );

View 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>

View 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 );

View File

@ -343,4 +343,13 @@ public class ArchivaVirtualDavResource
propsInitialized = true;
}
public String getLogicalResource()
{
return logicalResource;
}
public void setLogicalResource( String logicalResource )
{
this.logicalResource = logicalResource;
}
}

View 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();

View 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>

View File

@ -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>
@ -1865,7 +1865,7 @@
<exclude>.repository/**</exclude>
<exclude>*.patch</exclude>
<exclude>**/target/**</exclude>
<exclude>.java-version</exclude>
<exclude>**/.java-version</exclude>
<exclude>patch.diff</exclude>
</excludes>
</configuration>
@ -1944,5 +1944,4 @@
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>