package org.apache.maven.deploy.deployers;

/* ====================================================================
 *   Copyright 2001-2004 The Apache Software Foundation.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * ====================================================================
 */

import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.RepositoryInfo;
import org.apache.maven.deploy.exceptions.AuthenticationException;
import org.apache.maven.deploy.exceptions.TransferFailedException;

/**
 *
 * Common interface for classes capable of uploading a file to remote host

 *
 * @author <a href="mailto:michl.maczka@dimatics.com">Michal Maczka</a>
 * @version $Id: Deployer.java,v 1.6 2004/03/02 14:59:31 evenisse Exp $
 */
public interface Deployer
{
    /**
     * Set the information about host to which we will deploy.
     * In this method deployer can allocate the resources which will
     * be needed to perform an upload. E.g.  connection to remote host
     * can be opened,
     * Resources allocated in this metod should
     * be release when deloyer is not needed any more
     * @see #release()
     *
     * @param repoInfo
     * @throws AuthenticationException when connection to remote host cannot be established
     */
    public void init( RepositoryInfo repoInfo )
        throws AuthenticationException;

    /**
     * Release all resources which were allocated
     * by this deployer (e.g. a connection to remote host)
     *
     */
    public void release(  );

    /**
     * Perform an upload of single file to remote host
     * @param request <code>DeployRequest</code> which should contatin all parameters
     * which are necessery to upload a file
     * to remote host.
     */
    public void deploy( DeployRequest request )
        throws TransferFailedException;

    /**
     * 
     */
    public void flush() throws TransferFailedException;
}
