001package org.intellimate.izou.resource;
002
003import java.util.List;
004
005/**
006 * This interface is used to provide resources
007 */
008public interface ResourceProvider {
009
010    /**
011     * checks whether it can provide the resource
012     * beware that the implementation may vary. It can time out etc.
013     * @param resource the resource to provide
014     * @return true if the container can provide the resource
015     */
016    abstract boolean providesResource(ResourceModel resource);
017
018    /**
019     * checks whether there are any resources registered from the source
020     * beware that the implementation may vary. It can time out etc.
021     * @param sourceID the ID of the source
022     * @return true if the container has resources from the source
023     */
024    abstract boolean containsResourcesFromSource(String sourceID);
025
026    /**
027     * checks whether the ResourceContainer can provide at least ONE resource
028     * beware that the implementation may vary. It can time out etc.
029     * @param resourcesID a list containing sources
030     * @return true if the ResourceContainer can provide at least one resource
031     */
032    abstract boolean providesResource(List<String> resourcesID);
033
034    /**
035     * returns all EXISTING resources for the ID.
036     * If there are no resources for the ID the ID will get skipped
037     * beware that the implementation may vary. It can time out etc.
038     * @param resourceIDs an Array containing the resources
039     * @return a list of resources found
040     */
041    abstract List<ResourceModel> provideResource(String[] resourceIDs);
042
043    /**
044     * returns the resource (if existing)
045     * beware that the implementation may vary. It can time out etc.
046     * @param resourceID the ID of the resource
047     * @return a list of resources found
048     */
049    abstract List<ResourceModel> provideResource(String resourceID);
050
051    /**
052     * returns the resource (if existing) from the source
053     *
054     * @param sourceID the ID of the source
055     * @return a list containing all the found resources
056     */
057    public List<ResourceModel> provideResourceFromSource(String sourceID);
058}