本文整理了Java中org.commonjava.maven.galley.model.Transfer.exists()
方法的一些代码示例,展示了Transfer.exists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transfer.exists()
方法的具体详情如下:
包路径:org.commonjava.maven.galley.model.Transfer
类名称:Transfer
方法名:exists
暂无
代码示例来源:origin: org.commonjava.aprox/aprox-promote-common
@Override
public boolean exists()
{
return delegate.exists();
}
代码示例来源:origin: org.commonjava.indy/indy-content-index
private boolean exists( final Transfer transfer )
{
return transfer != null && transfer.exists();
}
代码示例来源:origin: org.commonjava.maven.galley/galley-api
public boolean exists()
{
return exists( new EventMetadata() );
}
代码示例来源: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.aprox/aprox-promote-common
private List<Transfer> getTransfersForPaths( final StoreKey source, final Set<String> paths )
throws AproxWorkflowException
{
final List<Transfer> contents = new ArrayList<Transfer>();
for ( final String path : paths )
{
final Transfer txfr = downloadManager.getStorageReference( source, path );
if ( !txfr.exists() )
{
logger.warn( "Cannot promotePaths path: '{}' from source: '{}'. It does not exist!", path, source );
// TODO: Fail??
continue;
}
contents.add( txfr );
}
return contents;
}
代码示例来源:origin: org.commonjava.indy/indy-core
@Override
public HttpExchangeMetadata getHttpMetadata( final StoreKey key, final String path )
throws IndyWorkflowException
{
Transfer transfer = getTransfer( key, path, TransferOperation.DOWNLOAD );
if ( transfer != null && transfer.exists() )
{
Transfer meta = transfer.getSiblingMeta( HttpExchangeMetadata.FILE_EXTENSION );
if ( meta != null && meta.exists() )
{
return readExchangeMetadata( meta );
}
}
return null;
}
代码示例来源:origin: org.commonjava.maven.galley/galley-core
public final void delete()
throws IOException
{
if ( checksumTransfer.exists() )
{
checksumTransfer.delete();
checksumTransfer.unlock();
}
}
代码示例来源: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.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.indy/indy-core
private HttpExchangeMetadata readExchangeMetadata( final Transfer meta )
throws IndyWorkflowException
{
logger.trace( "Reading HTTP exchange metadata from: {}", meta );
if ( meta != null && meta.exists() )
{
try(InputStream stream = meta.openInputStream( false ))
{
String raw = IOUtils.toString( stream );
logger.trace( "HTTP Metadata string is:\n\n{}\n\n", raw );
return mapper.readValue( raw, HttpExchangeMetadata.class );
}
catch ( final IOException e )
{
throw new IndyWorkflowException( "HTTP exchange metadata appears to be damaged: %s. Reason: %s", e,
meta, e.getMessage() );
}
}
else
{
logger.trace( "Cannot read HTTP exchange: {}. Transfer is missing!", meta );
}
return null;
}
代码示例来源: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.maven.galley/galley-core
private boolean exists( final ConcreteResource resource, final boolean suppressFailures )
throws TransferException
{
final Transfer cached = getCacheReference( resource );
return cached.exists() || exister.exists( resource, cached, getTimeoutSeconds( resource ),
getTransport( resource ), suppressFailures );
}
代码示例来源:origin: org.commonjava.indy/indy-core
private Transfer getStorageReferenceWithNFC( final ArtifactStore store, final String... path )
{
ConcreteResource resource = new ConcreteResource( LocationUtils.toLocation( store ), path );
if ( store.getType() != hosted && nfc.isMissing( resource ) )
{
logger.trace( "Resource {} is missing, return null", resource );
return null;
}
Transfer txfr = transfers.getCacheReference( resource );
if ( txfr == null || !txfr.exists() )
{
logger.trace( "Resource not found when retrieving cached reference; added to NFC: {}", resource );
nfc.addMissing( resource );
}
return txfr;
}
代码示例来源:origin: org.commonjava.indy/indy-core
private void recurseListing( final Transfer transfer, final List<Transfer> result )
throws IndyWorkflowException
{
if ( transfer.isDirectory() )
{
try
{
final String[] children = transfer.list();
for ( final String child : children )
{
final Transfer childTransfer = transfer.getChild( child );
recurseListing( childTransfer, result );
}
}
catch ( final IOException e )
{
throw new IndyWorkflowException( "Failed to list children of: %s. Reason: %s", e, transfer,
e.getMessage() );
}
}
else if ( transfer.exists() )
{
result.add( transfer );
}
}
代码示例来源:origin: org.commonjava.aprox/aprox-core
private void recurseListing( final Transfer transfer, final List<Transfer> result )
throws AproxWorkflowException
{
if ( transfer.isDirectory() )
{
try
{
final String[] children = transfer.list();
for ( final String child : children )
{
final Transfer childTransfer = transfer.getChild( child );
recurseListing( childTransfer, result );
}
}
catch ( final IOException e )
{
throw new AproxWorkflowException( "Failed to list children of: %s. Reason: %s", e, transfer,
e.getMessage() );
}
}
else if ( transfer.exists() )
{
result.add( transfer );
}
}
代码示例来源:origin: org.commonjava.indy/indy-core
private void doRescan( final Transfer item )
{
if ( !item.exists() )
{
return;
}
if ( item.isDirectory() )
{
try
{
final String[] listing = item.list();
for ( final String sub : listing )
{
doRescan( item.getChild( sub ) );
}
}
catch ( final IOException e )
{
logger.error( "Failed to list local contents: {}. Reason: {}", e, item, e.getMessage() );
}
}
fileEventManager.fire( new FileAccessEvent( item, eventMetadata ) );
}
代码示例来源:origin: org.commonjava.indy/indy-content-index
@Override
@Measure
public void indexTransferIn( Transfer transfer, StoreKey...topKeys )
{
if ( transfer != null && transfer.exists() )
{
StoreKey key = LocationUtils.getKey( transfer );
String path = getStrategyPath( key, transfer.getPath() );
indexPathInStores( path, key, topKeys );
}
}
代码示例来源: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-content-index
private Transfer getIndexedTransfer( ArtifactStore store, String path )
throws IndyWorkflowException
{
StoreKey indexedStoreKey =
indexManager.getIndexedStoreKey( store.getKey(), path );
if ( indexedStoreKey != null )
{
Transfer transfer = delegate.getTransfer( store, path );
if ( transfer == null || !transfer.exists() )
{
// something happened to the underlying Transfer...de-index it.
indexManager.deIndexStorePath( store.getKey(), path );
}
else
{
return transfer;
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!