001package org.intellimate.izou.system; 002 003import org.apache.logging.log4j.spi.ExtendedLogger; 004import org.intellimate.izou.addon.AddOnModel; 005import org.intellimate.izou.security.storage.SecureStorage; 006import org.intellimate.izou.system.context.*; 007import org.intellimate.izou.system.context.System; 008 009/** 010 * The Izou context is a means for all addOns to get general information they might need. Every addOn its own context 011 * and can use it to reach certain Izou components. It controls what an addOn has access to and what it does not have 012 * access to. 013 * <br> 014 * For instance, the addOn should have access to a logger (created in Izou for the addOn), but it should not have 015 * access to classes like the AddOnManager, which loads all addOns at the start. Hence the logger is included in the 016 * context, but the addOn manager is not. Anything that is not included in the context, and addOn does not have access to. 017 * So in short, the context exists to give addOns access to higher Izou components while still denying access to other 018 * components. 019 */ 020public interface Context { 021 /** 022 * returns the API used for interaction with Events 023 * @return Events 024 */ 025 Events getEvents(); 026 027 /** 028 * returns the API used for interaction with Resource 029 * @return Resource 030 */ 031 Resources getResources(); 032 033 /** 034 * returns the API used for interaction with Files 035 * @return Files 036 */ 037 Files getFiles(); 038 039 /** 040 * returns the API used to log 041 * @return Logger 042 */ 043 ExtendedLogger getLogger(); 044 045 /** 046 * returns the API used to manage the ThreadPool 047 * @return ThreadPool 048 */ 049 ThreadPool getThreadPool(); 050 051 /** 052 * returns the API to manage the Activators 053 * @return Activator 054 */ 055 Activators getActivators(); 056 057 /** 058 * returns the API used to manage the OutputPlugins and OutputExtensions 059 * @return Output 060 */ 061 Output getOutput(); 062 063 /** 064 * retruns the API used to interact with Izou. 065 * @return System. 066 */ 067 System getSystem(); 068 069 /** 070 * gets addOn 071 * 072 * @return the addOn 073 */ 074 AddOnModel getAddOn(); 075 076 /** 077 * Gets the Secure Storage object of Izou. {@link SecureStorage} allows addOns to safely store data so that other 078 * addOns cannot access it. However while the data is encrypted, there is no guarantee that the end user cannot 079 * decrypt the data and access it. So be careful to not store any sensitive information here 080 * 081 * @return the Secure Storage object of Izou 082 */ 083 default SecureStorage getSecureStorage() { 084 return SecureStorage.getInstance(); 085 } 086}