/** * Test if the provided ManagedRepositoryContent has any proxies configured for it. */ @Override public boolean hasProxies( ManagedRepositoryContent repository ) { synchronized ( this.proxyConnectorMap ) { return this.proxyConnectorMap.containsKey( repository.getId() ); } }
Path artifactFile = Paths.get( repository.getRepoRoot( ), path ); ArtifactReference artifact = repository.toArtifactReference( path ); reference.setVersion( artifact.getVersion( ) ); List<String> versions = new ArrayList<>( repository.getVersions( reference ) ); ArtifactReference newArtifactReference = repository.toArtifactReference( artifactFile.toAbsolutePath( ).toString() ); newArtifactReference.setVersion( version ); Path newArtifactFile = repository.toFile( newArtifactReference ); artifactsToDelete.addAll( repository.getRelatedArtifacts( newArtifactReference ) ); artifactsToDelete.addAll( repository.getRelatedArtifacts( newArtifactReference ) );
private void deleteSilently( Path path ) { try { Files.deleteIfExists( path ); triggerAuditEvent( repository.getRepository( ).getId( ), path.toString( ), AuditEvent.PURGE_FILE ); } catch ( IOException e ) { log.error( "Error occured during file deletion {}: {} ", path, e.getMessage( ), e ); } }
Path repoDir = Paths.get( managedRepository.getRepoRoot(), path ); PathUtil.getRelative( managedRepository.getRepoRoot(), path1 ) ).filter( filetypes::matchesArtifactPattern ).findFirst().orElse( null ); if (result!=null) { return managedRepository.toArtifactReference( result );
Path file = Paths.get( managedRepository.getRepoRoot(), logicalResource ); if ( Files.exists(file) ) Set<String> proxyIds = proxies.get( managedRepository.getId() ); if ( proxyIds != null )
throws LayoutException, IOException, ContentNotFoundException Set<String> foundVersions = managedRepository.getVersions( reference ); Set<String> proxiedRepoIds = this.proxies.get( managedRepository.getId() );
Path artifactFile = Paths.get( repository.getRepoRoot( ), path ); ArtifactReference artifactRef = repository.toArtifactReference( path ); for ( String version : repoContent.getVersions( reference ) ) repository.deleteVersion( versionRef ); listener.deleteArtifact( metadataRepository, repository.getId( ), artifactRef.getGroupId( ), artifactRef.getArtifactId( ), artifactRef.getVersion( ), artifactFile.getFileName().toString() ); metadataRepository.removeProjectVersion( repository.getId( ), artifactRef.getGroupId( ), artifactRef.getArtifactId( ), artifactRef.getVersion( ) );
if ( isAuthorized( request, managedRepositoryContent.getId() ) ) Path resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), path ); resource = new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), path, managedRepositoryContent.getRepository(), request.getRemoteAddr(), activePrincipal, request.getDavSession(), archivaLocator, this, mimeTypes, auditListeners, scheduler, fileLockManager ); resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), localResourcePath ); resource = new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), logicalResource.getPath(), managedRepositoryContent.getRepository(), request.getRemoteAddr(), activePrincipal, request.getDavSession(), archivaLocator, this, mimeTypes, resourceFile.getFileName(), managedRepositoryContent.getId(), activePrincipal ); if ( managedRepositoryContent.getRepository().getActiveReleaseSchemes().contains( ReleaseScheme.RELEASE ) && !repositoryRequest.isMetadata( resourcePath ) && !repositoryRequest.isSupportFile( resourcePath ) ) artifact = managedRepositoryContent.toArtifactReference( resourcePath ); if ( managedRepositoryContent.hasContent( artifact ) && managedRepositoryContent.getRepository().blocksRedeployments()) managedRepositoryContent.getId() ); throw new DavException( HttpServletResponse.SC_CONFLICT, "Overwriting released artifacts is not allowed." );
metaResolved.put( metaBaseId, metadataRepository.getArtifacts( repository.getId( ), reference.getGroupId( ), reference.getArtifactId( ), baseVersion ) ); Path artifactFile = repository.toFile( reference ); listener.deleteArtifact( metadataRepository, repository.getId( ), reference.getGroupId( ), reference.getArtifactId( ), reference.getVersion( ), artifactFile.getFileName( ).toString( ) ); repository.deleteArtifact( reference ); triggerAuditEvent( repository.getRepository( ).getId( ), ArtifactReference.toKey( reference ), AuditEvent.PURGE_ARTIFACT ); purgeSupportFiles( artifactFile );
private Path toLocalRepoFile( ManagedRepositoryContent repository, RemoteRepositoryContent targetRepository, String targetPath ) { String repoPath = metadataTools.getRepositorySpecificName( targetRepository, targetPath ); return Paths.get( repository.getRepoRoot(), repoPath ); }
File file = managedRepositoryContent.toFile( ref ); artifact.setType( type ); artifact.setFileExtension( extension ); artifact.setPath( managedRepositoryContent.toPath( ref ) ); artifact.setContext( managedRepositoryContent.getId() ); DecimalFormat df = new DecimalFormat( "#,###.##", new DecimalFormatSymbols( Locale.US ) ); artifact.setSize( df.format( s ) + " " + symbol );
String path = repository.toMetadataPath( ref ); repository.deleteArtifact( artifactReference ); repository.deleteVersion( ref ); Set<ArtifactReference> related = repository.getRelatedArtifacts( artifactReference ); log.debug( "related: {}", related ); for ( ArtifactReference artifactRef : related ) repository.deleteArtifact( artifactRef ); listener.deleteArtifact( metadataRepository, repository.getId(), artifactMetadata.getNamespace(), artifactMetadata.getProject(), artifactMetadata.getVersion(), artifactMetadata.getId() );
return getFilePath( requestPath, managedRepositoryContent.getRepository() ); String filePath = getFilePath( requestPath, managedRepositoryContent.getRepository() ); Path metadataDir = Paths.get( managedRepositoryContent.getRepoRoot(), filePath ).getParent(); if ( !Files.exists(metadataDir) ) + "-" + buildNumber ); throw new RelocationException( "/repository/" + managedRepositoryContent.getRepository().getId() + ( StringUtils.startsWith( filePath, "/" ) ? "" : "/" ) + filePath, RelocationException.RelocationType.TEMPORARY );
throws LayoutException, RepositoryMetadataException, IOException, ContentNotFoundException Path metadataFile = Paths.get( managedRepository.getRepoRoot(), toPath( reference ) ); Set<String> allVersions = managedRepository.getVersions( reference ); Set<String> proxiedRepoIds = this.proxies.get( managedRepository.getId() );
File artifactFile = new File( repository.getRepoRoot(), path ); ArtifactReference artifact = repository.toArtifactReference( path ); reference.setVersion( artifact.getVersion() ); List<String> versions = new ArrayList<>( repository.getVersions( reference ) );
private Path toLocalFile( ManagedRepositoryContent repository, ArtifactReference artifact ) { return repository.toFile( artifact ); }
String repositoryLayout = managedRepository.getRepository().getLayout(); resource.setPath( managedRepository.toPath( artifact ) );
String adjustedPath = repository.toPath( ref ); return adjustedPath + supportfile;