public DavResource createResource( final DavResourceLocator locator, final DavSession davSession )
throws DavException
{
ArchivaDavResourceLocator archivaLocator = checkLocatorIsInstanceOfRepositoryLocator( locator );
ManagedRepositoryContent managedRepository;
try
{
managedRepository = repositoryFactory.getManagedRepositoryContent( archivaLocator.getRepositoryId() );
}
catch ( RepositoryNotFoundException e )
{
throw new DavException( HttpServletResponse.SC_NOT_FOUND,
"Invalid repository: " + archivaLocator.getRepositoryId() );
}
catch ( RepositoryException e )
{
throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
}
String logicalResource = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() );
if ( logicalResource.startsWith( "/" ) )
{
logicalResource = logicalResource.substring( 1 );
}
File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource );
DavResource resource =
new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource, managedRepository.getRepository(),
davSession, archivaLocator, this, mimeTypes, auditListeners, scheduler );
resource.addLockManager( lockManager );
return resource;
}