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 /** 28 * 29 */ 30 public interface StreamingWagon 31 extends Wagon 32 { 33 /** 34 * Downloads specified resource from the repository to given output stream. 35 * 36 * @param resourceName 37 * @param stream 38 * @throws TransferFailedException 39 * @throws ResourceDoesNotExistException 40 * @throws AuthorizationException 41 * @throws AuthorizationException 42 */ 43 void getToStream( String resourceName, OutputStream stream ) 44 throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException; 45 46 /** 47 * Downloads specified resource from the repository if it was modified since specified date. The date is measured in 48 * milliseconds, between the current time and midnight, January 1, 1970 UTC and aligned to GMT timezone. 49 * 50 * @param resourceName 51 * @param stream 52 * @param timestamp 53 * @return <code>true</code> if newer resource has been downloaded, <code>false</code> if resource in the 54 * repository is older or has the same age. 55 * @throws TransferFailedException 56 * @throws ResourceDoesNotExistException 57 * @throws AuthorizationException 58 * @throws AuthorizationException 59 */ 60 boolean getIfNewerToStream( String resourceName, OutputStream stream, long timestamp ) 61 throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException; 62 63 /** 64 * @deprecated due to unknown contentLength various http(s) implementation will use a chuncked transfer encoding 65 * mode you must take care you http target server supports that (ngnix don't !). 66 * <b>So in case of http(s) transport layer avoid using this. Will be remove in 3.0</b> 67 * Copy from a local input stream to remote. 68 * 69 * @param stream the local stream 70 * @param destination the remote destination 71 * @throws TransferFailedException 72 * @throws ResourceDoesNotExistException 73 * @throws AuthorizationException 74 */ 75 void putFromStream( InputStream stream, String destination ) 76 throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException; 77 78 /** 79 * Copy from a local input stream to remote. 80 * 81 * @param stream the local stream 82 * @param destination the remote destination 83 * @throws TransferFailedException 84 * @throws ResourceDoesNotExistException 85 * @throws AuthorizationException 86 */ 87 void putFromStream( InputStream stream, String destination, long contentLength, long lastModified ) 88 throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException; 89 }