001package org.intellimate.izou.system.context; 002 003import org.intellimate.izou.identification.Identification; 004import org.intellimate.izou.identification.IllegalIDException; 005import org.intellimate.izou.resource.ResourceModel; 006import org.intellimate.izou.resource.ResourceBuilderModel; 007 008import java.util.List; 009import java.util.Optional; 010import java.util.concurrent.CompletableFuture; 011import java.util.function.Consumer; 012 013/** 014 * @author Leander Kurscheidt 015 * @version 1.0 016 */ 017public interface Resources { 018 /** 019 * registers a ResourceBuilder. 020 * <p> 021 * this method registers all the events, resourcesID etc. 022 * </p> 023 * @param resourceBuilder an instance of the ResourceBuilder 024 * @throws IllegalIDException not yet implemented 025 */ 026 void registerResourceBuilder(ResourceBuilderModel resourceBuilder) throws IllegalIDException; 027 028 /** 029 * unregister a ResourceBuilder. 030 * <p> 031 * this method unregisters all the events, resourcesID etc. 032 * @param resourceBuilder an instance of the ResourceBuilder 033 */ 034 void unregisterResourceBuilder(ResourceBuilderModel resourceBuilder); 035 036 /** 037 * generates a resources 038 * <p> 039 * @param resource the resource to request 040 * @param consumer the callback when the ResourceBuilder finishes 041 * @throws IllegalIDException not yet implemented 042 */ 043 @Deprecated 044 void generateResource(ResourceModel resource, Consumer<List<ResourceModel>> consumer) throws IllegalIDException; 045 046 /** 047 * generates a resources 048 * <p> 049 * It will use the first matching resource! So if you really want to be sure, set the provider 050 * Identification 051 * </p> 052 * @param resource the resource to request 053 * @return an optional of an CompletableFuture 054 * @throws IllegalIDException not yet implemented 055 */ 056 Optional<CompletableFuture<List<ResourceModel>>> generateResource(ResourceModel resource) throws IllegalIDException; 057 058 /** 059 * returns the ID of the Manager 060 * @return an instance of Identification 061 */ 062 Identification getManagerIdentification(); 063}