本文整理了Java中org.commonjava.maven.galley.model.Transfer.delete()
方法的一些代码示例,展示了Transfer.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transfer.delete()
方法的具体详情如下:
包路径:org.commonjava.maven.galley.model.Transfer
类名称:Transfer
方法名:delete
[英]Goes up through the path to the root of the resource location until it finds an existing element and removes it in case if it is a file. Starts from the resource path, so also the target file is removed if it pre-exists.
[中]沿路径向上移动到资源位置的根目录,直到找到现有元素,如果是文件,则将其删除。从资源路径开始,因此如果目标文件预先存在,也会将其删除。
代码示例来源:origin: org.commonjava.maven.galley/galley-api
public boolean delete( final boolean fireEvents )
throws IOException
{
return delete( fireEvents, new EventMetadata() );
}
代码示例来源:origin: org.commonjava.maven.galley/galley-api
public boolean delete()
throws IOException
{
return delete( true, new EventMetadata() );
}
代码示例来源:origin: org.commonjava.aprox/aprox-core
public final void deleteChecksumsAndMergeInfo( final Group group, final String path )
throws IOException
{
final Transfer targetSha = downloadManager.getStorageReference( group, path + SHA_SUFFIX );
final Transfer targetMd5 = downloadManager.getStorageReference( group, path + MD5_SUFFIX );
final Transfer targetInfo = downloadManager.getStorageReference( group, path + MERGEINFO_SUFFIX );
if ( targetSha != null )
{
logger.debug( "Deleting: {}", targetSha );
targetSha.delete();
}
if ( targetMd5 != null )
{
logger.debug( "Deleting: {}", targetMd5 );
targetMd5.delete();
}
if ( targetInfo != null )
{
logger.debug( "Deleting: {}", targetInfo );
targetInfo.delete();
}
}
代码示例来源:origin: org.commonjava.indy/indy-core
targetSha.delete();
targetMd5.delete();
targetInfo.delete();
代码示例来源:origin: org.commonjava.indy/indy-core
private void delete( Transfer t )
{
Logger logger = LoggerFactory.getLogger( getClass() );
if ( t != null && t.exists() )
{
try
{
logger.debug( "Deleting: {}", t );
t.delete( true );
if ( t.exists() )
{
logger.error( "{} WAS NOT DELETED!", t );
}
}
catch ( IOException e )
{
logger.error( String.format( "Failed to delete: %s. Reason: %s", t, e.getMessage() ), e );
}
}
}
代码示例来源:origin: org.commonjava.indy/indy-core
@Override
public void handleContentDeletion( final ArtifactStore store, final String path, final EventMetadata eventMetadata )
throws IndyWorkflowException
{
final Transfer meta = downloads.getStorageReference( store, path + HttpExchangeMetadata.FILE_EXTENSION );
if ( meta.exists() )
{
try
{
meta.delete( false );
}
catch ( final IOException e )
{
logger.debug( "Failed to delete HTTP exchange metadata: " + meta, e );
}
}
}
代码示例来源:origin: org.commonjava.aprox/aprox-core
@Override
public void handleContentStorage( final ArtifactStore store, final String path, final Transfer result,
final EventMetadata eventMetadata )
throws AproxWorkflowException
{
final Transfer meta = result.getSiblingMeta( HttpExchangeMetadata.FILE_EXTENSION );
if ( meta.exists() )
{
try
{
meta.delete( false );
}
catch ( final IOException e )
{
logger.debug( "Failed to delete HTTP exchange metadata: " + meta, e );
}
}
}
代码示例来源:origin: org.commonjava.maven.galley/galley-core
public final void delete()
throws IOException
{
if ( checksumTransfer.exists() )
{
checksumTransfer.delete();
checksumTransfer.unlock();
}
}
代码示例来源:origin: org.commonjava.aprox/aprox-core
@Override
public void handleContentDeletion( final ArtifactStore store, final String path, final EventMetadata eventMetadata )
throws AproxWorkflowException
{
final Transfer meta = downloads.getStorageReference( store, path + HttpExchangeMetadata.FILE_EXTENSION );
if ( meta.exists() )
{
try
{
meta.delete( false );
}
catch ( final IOException e )
{
logger.debug( "Failed to delete HTTP exchange metadata: " + meta, e );
}
}
}
代码示例来源:origin: org.commonjava.maven.galley/galley-core
@Override
public void close() throws IOException
{
try
{
logger.trace( "START CLOSE: {}", transfer );
super.close();
logger.trace( "Delete: {} and its siblings in: {}.", transfer.getPath(), transfer.getLocation() );
transfer.delete( false );
Transfer meta = transfer.getSibling( HTTP_METADATA_EXT );
if ( meta != null && meta.exists() )
{
meta.delete( false );
}
}
finally
{
logger.trace( "END CLOSE: {}", transfer );
}
}
}
代码示例来源:origin: org.commonjava.aprox/aprox-core
protected void clearMergedFile( final Group group, final String path )
throws AproxWorkflowException
{
// delete so it'll be recomputed.
final Transfer target = fileManager.getStorageReference( group, path );
try
{
logger.debug( "Deleting merged file: {}", target );
target.delete();
helper.deleteChecksumsAndMergeInfo( group, path );
}
catch ( final IOException e )
{
throw new AproxWorkflowException(
"Failed to delete generated file (to allow re-generation on demand: {}. Error: {}", e,
target.getFullPath(), e.getMessage() );
}
}
代码示例来源:origin: org.commonjava.aprox/aprox-core
public void onStoreDeletion( @Observes final AbstractStoreDeleteEvent event )
{
for ( final Map.Entry<ArtifactStore, Transfer> storeRoot : event.getStoreRoots()
.entrySet() )
{
final StoreKey key = storeRoot.getKey()
.getKey();
final Transfer dir = storeRoot.getValue();
if ( dir.exists() && dir.isDirectory() )
{
try
{
logger.info( "[STORE REMOVED; DELETE] {}", dir.getFullPath() );
dir.delete();
scheduleManager.cancelAll( new StoreKeyMatcher( key, ScheduleManager.CONTENT_JOB_TYPE ) );
}
catch ( final IOException e )
{
logger.error( String.format( "Failed to delete storage for deleted artifact store: %s (dir: %s). Error: %s",
key, dir, e.getMessage() ), e );
}
catch ( final AproxSchedulerException e )
{
logger.error( String.format( "Failed to cancel file expirations for deleted artifact store: {} (dir: {}). Error: {}",
key, dir, e.getMessage() ), e );
}
}
}
}
代码示例来源:origin: org.commonjava.maven.galley/galley-transport-httpclient
target.delete();
代码示例来源:origin: org.commonjava.aprox/aprox-core
private void recurseAndDelete( final Transfer txfr )
{
try
{
final String[] list = txfr.list();
if ( list == null )
{
return;
}
for ( final String fname : list )
{
final Transfer child = txfr.getChild( fname );
if ( child.isDirectory() )
{
recurseAndDelete( child );
}
else
{
child.delete( true );
}
}
}
catch ( final IOException e )
{
logger.error( String.format( "Failed to list files for deletion under: %s. Reason: %s", txfr,
e.getMessage() ), e );
}
}
代码示例来源:origin: org.commonjava.aprox/aprox-core
private void reMerge( final Group group, final String path )
throws IOException
{
logger.debug( "Updating merged metadata file: {} in group: {}", path, group.getKey() );
final Transfer[] toDelete =
{ fileManager.getStorageReference( group, path ),
fileManager.getStorageReference( group, path + GroupMergeHelper.MERGEINFO_SUFFIX ),
fileManager.getStorageReference( group, path + GroupMergeHelper.SHA_SUFFIX ),
fileManager.getStorageReference( group, path + GroupMergeHelper.MD5_SUFFIX ) };
for ( final Transfer item : toDelete )
{
logger.debug( "Attempting to delete: {}", item );
if ( item.exists() )
{
final boolean result = item.delete();
logger.debug( "Deleted: {} (success? {})", item, result );
if ( fileEvent != null )
{
logger.debug( "Firing deletion event for: {}", item );
fileEvent.fire( new FileDeletionEvent( item, new EventMetadata() ) );
}
}
}
}
代码示例来源:origin: org.commonjava.indy/indy-core
try
httpMeta.delete();
代码示例来源:origin: org.commonjava.indy/indy-core
target.delete( false );
if ( target.exists() )
代码示例来源:origin: org.commonjava.indy/indy-dot-maven-common
@Override
public void removeObject( final ITransaction transaction, final String uri )
throws WebdavException
{
final StoreURIMatcher matcher = new StoreURIMatcher( uri );
if ( !matcher.hasStorePath() )
{
throw new WebdavException( "No store-level path specified: '" + uri
+ "'. This URI references either a list of stores, a root store directory, or something else equally read-only." );
}
final StorageAdvice advice = getStorageAdviceFor( matcher );
final String path = matcher.getStorePath();
final Transfer item = fileManager.getStorageReference( advice.getHostedStore(), path );
try
{
if ( item.exists() )
{
item.delete();
}
}
catch ( final IOException e )
{
logger.error( "Failed to delete file: {} in store: {}. Reason: {}", e, path, advice.getStore()
.getKey(), e.getMessage() );
throw new WebdavException( "Failed to delete file: " + uri );
}
}
代码示例来源:origin: org.commonjava.maven.galley/galley-core
if ( !item.delete( true, eventMetadata ) )
代码示例来源:origin: org.commonjava.aprox/aprox-dot-maven-common
@Override
public void removeObject( final ITransaction transaction, final String uri )
throws WebdavException
{
final StoreURIMatcher matcher = new StoreURIMatcher( uri );
if ( !matcher.hasStorePath() )
{
throw new WebdavException( "No store-level path specified: '" + uri
+ "'. This URI references either a list of stores, a root store directory, or something else equally read-only." );
}
final StorageAdvice advice = getStorageAdviceFor( matcher );
final String path = matcher.getStorePath();
final Transfer item = fileManager.getStorageReference( advice.getHostedStore(), path );
try
{
if ( item.exists() )
{
item.delete();
}
}
catch ( final IOException e )
{
logger.error( "Failed to delete file: {} in store: {}. Reason: {}", e, path, advice.getStore()
.getKey(), e.getMessage() );
throw new WebdavException( "Failed to delete file: " + uri );
}
}
内容来源于网络,如有侵权,请联系作者删除!