1 package org.apache.maven.wagon; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import java.io.InputStream; 23 import java.io.OutputStream; 24 25 import org.apache.maven.wagon.authorization.AuthorizationException; 26 27 public interface StreamingWagon 28 extends Wagon 29 { 30 /** 31 * Downloads specified resource from the repository to given output stream. 32 * 33 * @param resourceName 34 * @param stream 35 * @throws TransferFailedException 36 * @throws ResourceDoesNotExistException 37 * @throws AuthorizationException 38 * @throws AuthorizationException 39 */ 40 void getToStream( String resourceName, OutputStream stream ) 41 throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException; 42 43 /** 44 * Downloads specified resource from the repository if it was modified since specified date. The date is measured in 45 * milliseconds, between the current time and midnight, January 1, 1970 UTC and aligned to GMT timezone. 46 * 47 * @param resourceName 48 * @param stream 49 * @param timestamp 50 * @return <code>true</code> if newer resource has been downloaded, <code>false</code> if resource in the 51 * repository is older or has the same age. 52 * @throws TransferFailedException 53 * @throws ResourceDoesNotExistException 54 * @throws AuthorizationException 55 * @throws AuthorizationException 56 */ 57 boolean getIfNewerToStream( String resourceName, OutputStream stream, long timestamp ) 58 throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException; 59 60 /** 61 * @deprecated due to unknown contentLength various http(s) implementation will use a chuncked transfer encoding mode 62 * you must take care you http target server supports that (ngnix don't !). 63 * <b>So in case of http(s) transport layer avoid using this. Will be remove in 3.0</b> 64 * Copy from a local input stream to remote. 65 * 66 * @param stream the local stream 67 * @param destination the remote destination 68 * @throws TransferFailedException 69 * @throws ResourceDoesNotExistException 70 * @throws AuthorizationException 71 */ 72 void putFromStream( InputStream stream, String destination ) 73 throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException; 74 75 /** 76 * Copy from a local input stream to remote. 77 * 78 * @param stream the local stream 79 * @param destination the remote destination 80 * @throws TransferFailedException 81 * @throws ResourceDoesNotExistException 82 * @throws AuthorizationException 83 */ 84 void putFromStream( InputStream stream, String destination, long contentLength, long lastModified ) 85 throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException; 86 }