本文整理了Java中org.apache.archiva.common.utils.FileUtils.deleteDirectory()
方法的一些代码示例,展示了FileUtils.deleteDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.deleteDirectory()
方法的具体详情如下:
包路径:org.apache.archiva.common.utils.FileUtils
类名称:FileUtils
方法名:deleteDirectory
暂无
代码示例来源:origin: apache/archiva
private void deleteDirectoryQuiet( Path f )
{
try
{
org.apache.archiva.common.utils.FileUtils.deleteDirectory( f );
}
catch ( IOException e )
{
log.warn( "skip error delete {} : {}", f, e.getMessage() );
}
}
代码示例来源:origin: apache/archiva
protected void revertMkDirs()
throws IOException
{
if ( createdDirs != null )
{
Collections.reverse( createdDirs );
while ( !createdDirs.isEmpty() )
{
Path dir = createdDirs.remove( 0 );
if ( Files.isDirectory(dir))
{
try(Stream<Path> str = Files.list(dir)) {
if (str.count()==0) {
org.apache.archiva.common.utils.FileUtils.deleteDirectory(dir);
}
}
}
else
{
//cannot rollback created directory if it still contains files
break;
}
}
}
}
代码示例来源:origin: apache/archiva
@Override
public void removeMetadataFacet( String repoId, String facetId, String name )
throws MetadataRepositoryException
{
try
{
Path dir = getMetadataDirectory( repoId, facetId ).resolve( name );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( dir );
}
catch ( IOException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
代码示例来源:origin: apache/archiva
@Override
public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
throws MetadataRepositoryException
{
try
{
Path directory = getDirectory( repoId ).resolve( namespace + "/" + projectId + "/" + projectVersion );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory );
}
catch ( IOException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
代码示例来源:origin: apache/archiva
@Override
public void removeProject( String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException
{
try
{
Path directory = getDirectory( repositoryId ).resolve( namespace + "/" + projectId );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory );
}
catch ( IOException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
代码示例来源:origin: apache/archiva
@Override
public void deleteGroupId( String groupId )
throws ContentNotFoundException
{
String path = StringUtils.replaceChars( groupId, '.', '/' );
Path directory = Paths.get( getRepoRoot(), path );
if ( Files.exists(directory) )
{
try
{
org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory );
}
catch ( IOException e )
{
log.warn( "skip error deleting directory {}:", directory, e );
}
}
}
代码示例来源:origin: apache/archiva
@Override
public void removeMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException
{
try
{
Path dir = getMetadataDirectory( repositoryId, facetId );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( dir );
}
catch ( IOException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
代码示例来源:origin: apache/archiva
@Override
public void removeRepository( String repoId )
throws MetadataRepositoryException
{
try
{
Path dir = getDirectory( repoId );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( dir );
}
catch ( IOException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
代码示例来源:origin: apache/archiva
@Override
public void removeNamespace( String repositoryId, String project )
throws MetadataRepositoryException
{
try
{
Path namespaceDirectory = getDirectory( repositoryId ).resolve( project );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( namespaceDirectory );
//Properties properties = new Properties();
//properties.setProperty( "namespace", namespace );
//writeProperties( properties, namespaceDirectory, NAMESPACE_METADATA_KEY );
}
catch ( IOException e )
{
throw new MetadataRepositoryException( e.getMessage(), e );
}
}
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory );
代码示例来源:origin: apache/archiva
@Async
@Override
public void cleanTemporaryGroupIndex( TemporaryGroupIndex temporaryGroupIndex )
{
if ( temporaryGroupIndex == null )
{
return;
}
try
{
Optional<IndexingContext> ctxOpt = temporaryContextes.stream( ).filter( ctx -> ctx.getId( ).equals( temporaryGroupIndex.getIndexId( ) ) ).findFirst( );
if (ctxOpt.isPresent()) {
IndexingContext ctx = ctxOpt.get();
indexer.closeIndexingContext( ctx, true );
temporaryGroupIndexes.remove( temporaryGroupIndex );
temporaryContextes.remove( ctx );
Path directory = temporaryGroupIndex.getDirectory();
if ( directory != null && Files.exists(directory) )
{
FileUtils.deleteDirectory( directory );
}
}
}
catch ( IOException e )
{
log.warn( "fail to delete temporary group index {}", temporaryGroupIndex.getIndexId(), e );
}
}
代码示例来源:origin: apache/archiva
@After
public void cleanup()
throws Exception
{
super.tearDown();
Path tmpIndexDir = Paths.get( System.getProperty( "java.io.tmpdir" ), "tmpIndex" );
if ( Files.exists(tmpIndexDir) )
{
org.apache.archiva.common.utils.FileUtils.deleteDirectory( tmpIndexDir );
}
}
代码示例来源:origin: apache/archiva
protected String prepareTestRepos()
throws Exception
{
Path testDir = Paths.get( AbstractRepositoryPurgeTest.fixPath( getTestRepoRoot().toAbsolutePath().toString() ) );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( testDir );
Path sourceDir = Paths.get( Paths.get( "target/test-classes/" + TEST_REPO_ID ).toAbsolutePath().toString() );
FileUtils.copyDirectory( sourceDir.toFile(), testDir.toFile() );
Path releasesTestDir = Paths.get( AbstractRepositoryPurgeTest.fixPath(
Paths.get( "target/test-" + getName() + "/" + RELEASES_TEST_REPO_ID ).toAbsolutePath().toString() ) );
org.apache.archiva.common.utils.FileUtils.deleteDirectory( releasesTestDir );
Path sourceReleasesDir =
Paths.get( Paths.get( "target/test-classes/" + RELEASES_TEST_REPO_ID ).toAbsolutePath().toString() );
FileUtils.copyDirectory( sourceReleasesDir.toFile(), releasesTestDir.toFile() );
return AbstractRepositoryPurgeTest.fixPath( testDir.toAbsolutePath().toString() );
}
代码示例来源:origin: apache/archiva
@Override
@Before
public void startServer()
throws Exception
{
Path appServerBase = Paths.get( System.getProperty( "appserver.base" ) );
Path jcrDirectory = appServerBase.resolve( "jcr" );
if ( Files.exists(jcrDirectory) )
{
org.apache.archiva.common.utils.FileUtils.deleteDirectory( jcrDirectory );
}
super.startServer();
}
代码示例来源:origin: apache/archiva
@After
public void cleanup()
throws Exception
{
super.tearDown();
Path tmpIndexDir = Paths.get( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex" );
if ( Files.exists(tmpIndexDir) )
{
org.apache.archiva.common.utils.FileUtils.deleteDirectory( tmpIndexDir );
}
}
代码示例来源:origin: apache/archiva
@Override
public void deleteProject( String namespace, String projectId )
throws RepositoryException
{
ArtifactReference artifactReference = new ArtifactReference();
artifactReference.setGroupId( namespace );
artifactReference.setArtifactId( projectId );
String path = toPath( artifactReference );
Path directory = Paths.get( getRepoRoot(), path );
if ( !Files.exists(directory) )
{
throw new ContentNotFoundException( "cannot found project " + namespace + ":" + projectId );
}
if ( Files.isDirectory(directory) )
{
try
{
org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory );
}
catch ( IOException e )
{
throw new RepositoryException( e.getMessage(), e );
}
}
else
{
log.warn( "project {}:{} is not a directory", namespace, projectId );
}
}
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteDirectory( resource );
triggerAuditEvent( member, AuditEvent.REMOVE_DIR );
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteDirectory( newLocation );
FileUtils.copyDirectory( Paths.get(repoConfig.getLocation() ).toFile(), newLocation.toFile() );
repoConfig.setLocation( newLocation.toAbsolutePath().toUri() );
代码示例来源:origin: apache/archiva
@Override
public ArchivaIndexingContext reset(ArchivaIndexingContext context) throws IndexUpdateFailedException {
ArchivaIndexingContext ctx;
executeUpdateFunction(context, indexingContext -> {
try {
indexingContext.close(true);
} catch (IOException e) {
log.warn("Index close failed");
}
try {
FileUtils.deleteDirectory(Paths.get(context.getPath()));
} catch (IOException e) {
throw new IndexUpdateFailedException("Could not delete index files");
}
});
try {
Repository repo = context.getRepository();
ctx = createContext(context.getRepository());
if (repo instanceof EditableRepository) {
((EditableRepository)repo).setIndexingContext(ctx);
}
} catch (IndexCreationFailedException e) {
throw new IndexUpdateFailedException("Could not create index");
}
return ctx;
}
代码示例来源:origin: apache/archiva
org.apache.archiva.common.utils.FileUtils.deleteDirectory( indexDirectory );
return getIndexingContext( remoteRepository, contextKey, repoDir, indexDirectory, remoteIndexUrl );
内容来源于网络,如有侵权,请联系作者删除!