本文整理了Java中org.commonjava.maven.galley.model.Transfer
类的一些代码示例,展示了Transfer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transfer
类的具体详情如下:
包路径:org.commonjava.maven.galley.model.Transfer
类名称:Transfer
暂无
代码示例来源: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-promote-common
@Override
public InputStream openInputStream( boolean fireEvents )
throws IOException
{
return delegate.openInputStream( fireEvents );
}
代码示例来源: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.maven.galley/galley-transport-filearc
protected AbstractZipOperation( final Transfer transfer )
{
this( transfer.getLocation(), transfer.getPath() );
this.transfer = transfer;
}
代码示例来源:origin: org.commonjava.maven.galley/galley-core
private boolean isEmptyFolder( Transfer childRef ) throws IOException
{
if ( childRef.isDirectory() )
{
String[] list = childRef.list();
if ( list == null || list.length == 0 )
{
return true;
}
}
return false;
}
代码示例来源:origin: org.commonjava.maven.galley/galley-core
public final void delete()
throws IOException
{
if ( checksumTransfer.exists() )
{
checksumTransfer.delete();
checksumTransfer.unlock();
}
}
代码示例来源:origin: org.commonjava.maven.galley/galley-core
if ( cachedListing.exists() )
stream = cachedListing.openInputStream();
filenames.addAll( IOUtils.readLines( stream, "UTF-8" ) );
if ( cached.exists() )
if ( cached.isFile() )
String[] fnames = cached.list();
if ( fnames != null && fnames.length > 0 )
if ( childRef.isFile() )
logger.info( "Delete empty folder, {}", childRef.getFullPath() );
childRef.delete(); // if the directory is there but it's empty, we should just delete it
if ( remoteListing != null && remoteListing.length > 0 )
final TransferDecorator decorator = cachedListing.getDecorator();
if ( decorator != null )
remoteListing = decorator.decorateListing( cachedListing.getParent(), remoteListing, metadata );
logger.debug( "Writing listing:\n\n{}\n\nto: {}", remoteListing, cachedListing );
stream = cachedListing.openOutputStream( TransferOperation.DOWNLOAD );
stream.write( join( remoteListing, "\n" ).getBytes( "UTF-8" ) );
代码示例来源:origin: org.commonjava.maven.galley/galley-core
private Boolean doDelete( final Transfer item, final EventMetadata eventMetadata )
throws TransferException
if ( !item.exists() )
contentLogger.info( "BEGIN: Delete {} ({})", item.getResource(), eventMetadata );
if ( item.isDirectory() )
listing = item.list();
if ( !doDelete( item.getChild( sub ), eventMetadata ) )
contentLogger.info( "FAIL: Delete: {}", item.getResource() );
return false;
if ( !item.delete( true, eventMetadata ) )
contentLogger.info( "FINISH: Delete: {}", item.getResource() );
代码示例来源:origin: org.commonjava.indy/indy-core
root = directContentAccess.getTransfer( key, ROOT );
root.lockWrite();
try
Stream.of(next.list()).forEach( filename->{
Transfer t = next.getChild( filename );
if ( t.isDirectory() )
logger.debug( "Adding directory path for processing: {}", t.getPath() );
toProcess.add( t );
logger.trace( "Testing file path: {}", t.getPath() );
if( pathFilter.test( t.getPath() ) )
logger.trace( "Adding file path to results: {}", t.getPath() );
paths.add( t.getPath() );
logger.trace( "Skipping file path: {}", t.getPath() );
root.unlock();
代码示例来源:origin: org.commonjava.aprox/aprox-core
private HttpExchangeMetadata readExchangeMetadata( final Transfer meta )
throws AproxWorkflowException
{
if ( meta != null && meta.exists() )
{
InputStream stream = null;
try
{
stream = meta.openInputStream( false );
return mapper.readValue( stream, HttpExchangeMetadata.class );
}
catch ( final IOException e )
{
throw new AproxWorkflowException( "HTTP exchange metadata appears to be damaged: %s. Reason: %s", e,
meta, e.getMessage() );
}
finally
{
IOUtils.closeQuietly( stream );
}
}
return null;
}
代码示例来源: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.maven.galley/galley-transport-httpclient
out = target.openOutputStream( TransferOperation.DOWNLOAD, true, eventMetadata, deleteFilesOnPath );
doCopy( in, out );
logger.info( "Ensuring all HTTP data is consumed..." );
ConcreteResource resource = target.getResource();
try
target.getPath() );
target.delete();
代码示例来源:origin: org.commonjava.aprox/aprox-promote-common
private void listRecursively( ArtifactStore store, String path, Set<String> paths )
throws AproxWorkflowException
{
List<StoreResource> listing = tools.list( store, path );
if ( listing != null )
{
for ( StoreResource res : listing )
{
if ( res != null )
{
Transfer txfr = tools.getTransfer( res );
if ( txfr != null )
{
if ( txfr.isDirectory() )
{
listRecursively( store, txfr.getPath(), paths );
}
else if ( txfr.exists() )
{
paths.add( txfr.getPath() );
}
}
}
}
}
}
代码示例来源:origin: org.commonjava.indy/indy-pkg-npm-common
if ( !src.exists() )
stream = src.openInputStream();
String content = IOUtils.toString( stream );
logger.debug( "[NPM] Adding in metadata content from: {}\n\n{}\n\n", src, content );
src.getPath(), key, e.getMessage() ), e );
代码示例来源:origin: org.commonjava.maven.galley/galley-transport-httpclient
private void writeMetadata( final Transfer target, final ObjectMapper mapper, final Map<String, List<String>> requestHeaders )
Transfer metaTxfr = target.getSiblingMeta( HttpExchangeMetadata.FILE_EXTENSION );
if ( metaTxfr == null )
if ( target.isDirectory() )
metaTxfr = target.getChild( HttpExchangeMetadata.FILE_EXTENSION );
out = metaTxfr.openOutputStream( TransferOperation.GENERATE, false );
logger.trace( "Writing HTTP exchange metadata:\n\n{}\n\n", new Object()
代码示例来源: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.aprox/aprox-dot-maven-common
if ( !item.exists() )
if ( !item.isDirectory() )
noms.addAll( Arrays.asList( item.list() ) );
if ( !item.exists() || !item.isDirectory() )
names = item.list();
代码示例来源:origin: org.commonjava.maven.galley/galley-api
final Location loc = transfer.getLocation();
final boolean allowsSnapshots = loc.allowsSnapshots();
final boolean allowsReleases = loc.allowsReleases();
if ( !allowsSnapshots || !allowsReleases )
if ( !transfer.isDirectory() )
final String path = transfer.getPath();
代码示例来源: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-promote-common
@Override
public String getPath()
{
return delegate.getPath();
}
内容来源于网络,如有侵权,请联系作者删除!