All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.util.plan.fetcher.api.IResourceFetcher Maven / Gradle / Ivy

The newest version!
/**
 * OW2 Util
 * Copyright (C) 2008
 * Contact: [email protected]
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 *
 * --------------------------------------------------------------------------
 * $Id: IResourceFetcher.java 4392 2008-12-15 14:05:41Z alitokmen $
 * --------------------------------------------------------------------------
 */

package org.ow2.util.plan.fetcher.api;

import java.io.File;

import org.ow2.util.plan.bindings.deploymentplan.DeploymentPlanFragment;
import org.ow2.util.plan.bindings.exceptions.InvalidDeploymentException;
import org.ow2.util.plan.bindings.repository.RepositoryKind;
import org.ow2.util.plan.fetcher.api.exceptions.FetcherException;
import org.ow2.util.plan.fetcher.api.exceptions.ResourceFetcherNotResolvedException;
import org.ow2.util.plan.fetcher.api.exceptions.ResourceNotFoundException;
import org.ow2.util.plan.repository.api.IRepositoryManager;

/**
 * Interface for the resource fetcher.
 * @author Mickaël LEDUQUE
 */
public interface IResourceFetcher {

    /**
     * Returns a local file for the resource.
     * It must return the same file if called twice, but will change if the update
     * method is called between two calls.
     * @return the file.
     * @throws ResourceNotFoundException if the resource could not be found.
     */
    public File getResource()
            throws ResourceFetcherNotResolvedException;

    /**
     * Searches the resource, and if it finds it, sets up the local copy.
     * @throws ResourceNotFoundException
     */
    public void resolve() throws FetcherException;

    /**
     * Returns true if the "distant" resource has changed since the last check.
     * @return true if the "distant" resource has changed since the last check.
     */
    public boolean hasChanged() throws FetcherException;

    /**
     * Updates the local copy of the resource.
     *
     */
    public void update() throws FetcherException;

    /**
     * Sets the deployment.
     * @param deployment the new deployment
     * @throws InvalidDeploymentException if the deployment is not valid.
     */
    public void setDeployment(DeploymentPlanFragment deployment) throws InvalidDeploymentException;

    /**
     * Returns the deployment plan.
     * @return the deployment plan.
     */
    public DeploymentPlanFragment getDeployment();

    /**
     * Sets the repository manager.
     * @param repositoryManager the new repository manager.
     */
    public void setRepositoryManager(IRepositoryManager repositoryManager);

    /**
     * Returns the repository manager.
     * @return the repository manager.
     */
    public IRepositoryManager getRepositoryManager();

    /**
     * Gives the type of repositories this resource fetcher can process.
     * @return the type of repositories.
     */
    public RepositoryKind getSupportedRepositoryType();

    /**
     * Sets the local repositories base directory, used to keep the local copy of
     * the resource.
     * @param localDirectory the new local directory.
     */
    public void setLocalRepositoriesBaseDir(File localDirectory);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy