private static Resource resourceFor( final String url ) { Resource res = new Resource(); res.setName( url ); return res; }
public static Resource getResource( String resourceName ) { String r = StringUtils.replace( resourceName, "\\", "/" ); return new Resource( r ); }
public void putFromStream( InputStream stream, String destination ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( destination ); firePutInitiated( resource, null ); putFromStream( stream, resource ); }
@Override public final List<String> getFileList(String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { try { return listDirectory(destinationDirectory); } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) { this.transferListenerSupport.fireTransferError(new Resource(destinationDirectory), TransferEvent.REQUEST_GET, e); throw e; } }
public void putFromStream( InputStream stream, String destination ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( destination ); firePutInitiated( resource, null ); putFromStream( stream, resource ); }
@Override public final boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException { try { return doesRemoteResourceExist(resourceName); } catch (AuthorizationException | TransferFailedException e) { this.transferListenerSupport.fireTransferError(new Resource(resourceName), TransferEvent.REQUEST_GET, e); throw e; } }
@Override public final List<String> getFileList(String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { try { return listDirectory(destinationDirectory); } catch (TransferFailedException | ResourceDoesNotExistException | AuthorizationException e) { this.transferListenerSupport.fireTransferError(new Resource(destinationDirectory), TransferEvent.REQUEST_GET, e); throw e; } }
@Override public final boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException { try { return doesRemoteResourceExist(resourceName); } catch (AuthorizationException | TransferFailedException e) { this.transferListenerSupport.fireTransferError(new Resource(resourceName), TransferEvent.REQUEST_GET, e); throw e; } }
public void put( File source, String resourceName ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( resourceName ); firePutInitiated( resource, source ); resource.setContentLength( source.length() ); resource.setLastModified( source.lastModified() ); put( null, resource, source ); }
@Override public void put(File file, String resourceName) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource(resourceName); firePutInitiated(resource, file); resource.setContentLength(file.length()); resource.setLastModified(file.lastModified()); RetryableSource source = new FileSource(resource, file); put(source, file, resource); }
public void put( File source, String resourceName ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( resourceName ); firePutInitiated( resource, source ); resource.setContentLength( source.length() ); resource.setLastModified( source.lastModified() ); OutputStream os = getOutputStream( resource ); checkOutputStream( resource, os ); putTransfer( resource, source, os, true ); }
public void put( File source, String resourceName ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( resourceName ); firePutInitiated( resource, source ); resource.setContentLength( source.length() ); resource.setLastModified( source.lastModified() ); OutputStream os = getOutputStream( resource ); checkOutputStream( resource, os ); putTransfer( resource, source, os, true ); }
public void putFromStream( InputStream stream, String destination, long contentLength, long lastModified ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( destination ); firePutInitiated( resource, null ); resource.setContentLength( contentLength ); resource.setLastModified( lastModified ); putFromStream( stream, resource ); }
public void putFromStream( final InputStream stream, String destination, long contentLength, long lastModified ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( destination ); firePutInitiated( resource, null ); resource.setContentLength( contentLength ); resource.setLastModified( lastModified ); put( stream, resource, null ); }
public void putFromStream( InputStream stream, String destination, long contentLength, long lastModified ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { Resource resource = new Resource( destination ); firePutInitiated( resource, null ); resource.setContentLength( contentLength ); resource.setLastModified( lastModified ); putFromStream( stream, resource ); }
public void testWagonGetIfNewerIsSame() throws Exception { if ( supportsGetIfNewer() ) { setupRepositories(); setupWagonTestingFixtures(); int expectedSize = putFile(); getIfNewer( getExpectedLastModifiedOnGet( testRepository, new Resource( resource ) ), false, expectedSize ); } }
public void testWagonGetIfNewerToStreamIsSame() throws Exception { if ( supportsGetIfNewer() ) { setupRepositories(); setupWagonTestingFixtures(); int expectedSize = putFile(); getIfNewerToStream( getExpectedLastModifiedOnGet( testRepository, new Resource( resource ) ), false, expectedSize ); } }
public void testWagonGetIfNewerIsSame() throws Exception { if ( supportsGetIfNewer() ) { setupRepositories(); setupWagonTestingFixtures(); int expectedSize = putFile(); getIfNewer( getExpectedLastModifiedOnGet( testRepository, new Resource( resource ) ), false, expectedSize ); } }
public void testWagonGetIfNewerToStreamIsSame() throws Exception { if ( supportsGetIfNewer() ) { setupRepositories(); setupWagonTestingFixtures(); int expectedSize = putFile(); getIfNewerToStream( getExpectedLastModifiedOnGet( testRepository, new Resource( resource ) ), false, expectedSize ); } }
protected PutFileContext getPutFileContext(File source, String destination) { Resource resource = new Resource(destination); PutFileContext context = new PutFileContext(); context.setResource(resource); context.setProgress(new TransferProgress(resource, TransferEvent.REQUEST_PUT, transferListeners)); context.setListeners(transferListeners); context.setDestination(destination); context.setSource(source); return context; }