001package org.apache.maven.wagon; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.io.InputStream; 023import java.io.OutputStream; 024 025import org.apache.maven.wagon.authorization.AuthorizationException; 026 027public interface StreamingWagon 028 extends Wagon 029{ 030 /** 031 * Downloads specified resource from the repository to given output stream. 032 * 033 * @param resourceName 034 * @param stream 035 * @throws TransferFailedException 036 * @throws ResourceDoesNotExistException 037 * @throws AuthorizationException 038 * @throws AuthorizationException 039 */ 040 void getToStream( String resourceName, OutputStream stream ) 041 throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException; 042 043 /** 044 * Downloads specified resource from the repository if it was modified since specified date. The date is measured in 045 * milliseconds, between the current time and midnight, January 1, 1970 UTC and aligned to GMT timezone. 046 * 047 * @param resourceName 048 * @param stream 049 * @param timestamp 050 * @return <code>true</code> if newer resource has been downloaded, <code>false</code> if resource in the 051 * repository is older or has the same age. 052 * @throws TransferFailedException 053 * @throws ResourceDoesNotExistException 054 * @throws AuthorizationException 055 * @throws AuthorizationException 056 */ 057 boolean getIfNewerToStream( String resourceName, OutputStream stream, long timestamp ) 058 throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException; 059 060 /** 061 * @deprecated due to unknown contentLength various http(s) implementation will use a chuncked transfer encoding mode 062 * you must take care you http target server supports that (ngnix don't !). 063 * <b>So in case of http(s) transport layer avoid using this. Will be remove in 3.0</b> 064 * Copy from a local input stream to remote. 065 * 066 * @param stream the local stream 067 * @param destination the remote destination 068 * @throws TransferFailedException 069 * @throws ResourceDoesNotExistException 070 * @throws AuthorizationException 071 */ 072 void putFromStream( InputStream stream, String destination ) 073 throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException; 074 075 /** 076 * Copy from a local input stream to remote. 077 * 078 * @param stream the local stream 079 * @param destination the remote destination 080 * @throws TransferFailedException 081 * @throws ResourceDoesNotExistException 082 * @throws AuthorizationException 083 */ 084 void putFromStream( InputStream stream, String destination, long contentLength, long lastModified ) 085 throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException; 086}