001package org.intellimate.izou.resource;
002
003import org.intellimate.izou.events.EventModel;
004import org.intellimate.izou.identification.Identifiable;
005
006import java.util.List;
007import java.util.Optional;
008
009/**
010 * This interface is used to provide resources to other parts of the application.
011 */
012@SuppressWarnings("UnusedDeclaration")
013public interface ResourceBuilderModel extends Identifiable {
014    /**
015     * This method is called to register what resources the object provides.
016     * just pass a List of Resources without Data in it.
017     *
018     * @return a List containing the resources the object provides
019     */
020    abstract List<? extends ResourceModel> announceResources();
021    /**
022     * this method is called to register for what Events it wants to provide Resources.
023     * <p>
024     * The Event has to be in the following format: It should contain only one Descriptor and and one Resource with the
025     * ID "description", which contains an description of the Event.
026     * </p> 
027     * @return a List containing ID's for the Events
028     */
029    abstract List<? extends EventModel<?>> announceEvents();
030    /**
031     * This method is called when an object wants to get a Resource.
032     *
033     * <p>
034     * Don't use the Resources provided as arguments, they are just the requests.
035     * There is a timeout after 1 second.
036     * </p> 
037     * @param resources a list of resources without data
038     * @param event if an event caused the action, it gets passed. It can also be null.
039     * @return a list of resources with data
040     */
041    abstract List<ResourceModel> provideResource(List<? extends ResourceModel> resources, Optional<EventModel> event);
042}