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

org.ow2.util.archive.api.IArchive Maven / Gradle / Ivy

The newest version!
/**
 * Copyright 2007-2012 Bull S.A.S.
 *
 * 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.
 */

package org.ow2.util.archive.api;

import java.net.URL;
import java.util.Iterator;

/**
* Abstraction layer around processed archive (Jar, Directories, Bundles, ...).
* @author Guillaume Sauthier
*/
public interface IArchive {

    /**
     * @return a description of this archive. This name could be used in logger info.
     */
    String getName();

   /**
    * Returns an URL that can be used to access the resource described by this IArchive.
    * This URL MUST be canonicalized (at least when this is a file) because it is often
    * used as a key.
    * @return Returns the resource URL.
    * @throws ArchiveException if method fails.
    */
   URL getURL() throws ArchiveException;

   /**
    * @param resourceName The resource name to be looked up.
    * @return Returns the resource URL if the resource
    *         has been found. null otherwise.
    * @throws ArchiveException if method fails.
    */
   URL getResource(String resourceName) throws ArchiveException;

   /**
    * @return Returns an Iterator of Resource's URL.
    * @throws ArchiveException if method fails.
    */
   Iterator getResources() throws ArchiveException;

   /**
    * @param resourceName The resource name to be looked up.
    * @return Returns an Iterator of matching resources.
    * @throws ArchiveException if method fails.
    */
   Iterator getResources(String resourceName) throws ArchiveException;

   /**
    * @return Returns all resources name in the archive.
    * @throws ArchiveException if method fails.
    */
   Iterator getEntries() throws ArchiveException;

   /**
    * Close the underlying Resource.
    * @return Returns true if the close was
    *         succesful, false otherwise.
    */
   boolean close();

   /**
    * @return the Metadata associated to this archive.
    */
   IArchiveMetadata getMetadata();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy