public class ContextPool extends Object
| Constructor and Description |
|---|
ContextPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearAll(String password)
Clear the context instance.
|
static String |
computeHash(Class<? extends Context> contextInterface)
Compute emuStudio-specific hash of the context interface.
|
<T extends CompilerContext> |
getCompilerContext(long pluginID,
Class<T> contextInterface)
Get registered compiler context.
|
<T extends CompilerContext> |
getCompilerContext(long pluginID,
Class<T> contextInterface,
int index)
Get registered compiler context (extended version).
|
<T extends Context> |
getContext(long pluginID,
Class<T> contextInterface,
int index)
Get plug-in context.
|
<T extends CPUContext> |
getCPUContext(long pluginID,
Class<T> contextInterface)
Get registered CPU context.
|
<T extends CPUContext> |
getCPUContext(long pluginID,
Class<T> contextInterface,
int index)
Get registered CPU context (extended version).
|
<T extends DeviceContext> |
getDeviceContext(long pluginID,
Class<T> contextInterface)
Get registered device context.
|
<T extends DeviceContext> |
getDeviceContext(long pluginID,
Class<T> contextInterface,
int index)
Get registered device context (extended version).
|
<T extends MemoryContext> |
getMemoryContext(long pluginID,
Class<T> contextInterface)
Get registered memory context.
|
<T extends MemoryContext> |
getMemoryContext(long pluginID,
Class<T> contextInterface,
int index)
Get registered memory context (extended version).
|
void |
register(long pluginID,
Context context,
Class<? extends Context> contextInterface)
This method registers plug-in's context interface.
|
boolean |
setComputer(String password,
PluginConnections computer)
Set a computer, represented as plug-in connections, loaded by emuStudio.
|
static String |
SHA1(String text)
Compute SHA-1 hash string.
|
boolean |
unregister(long pluginID,
Class<? extends Context> contextInterface)
Unregisters all contexts of given context interface.
|
public void register(long pluginID,
Context context,
Class<? extends Context> contextInterface)
throws AlreadyRegisteredException,
InvalidContextException
pluginID - owner plugin ID of the context contextsByOwnercontext - The context object that the plug-in want to registercontextInterface - The interface that the context has to implementAlreadyRegisteredException - Raised when a plug-in tries to register context that is already registered.InvalidContextException - Raised when a class does not implement given interface, or it is not
annotated, or if the context interface does not fulfill context requirements.public boolean unregister(long pluginID,
Class<? extends Context> contextInterface)
throws InvalidContextException
pluginID - plugin ID of the context ownercontextInterface - the context interfaceInvalidContextException - Raised when context interface is not annotated, or if the context interface does
not fulfill context requirements.public boolean setComputer(String password, PluginConnections computer) throws InvalidPasswordException
password - emuStudio passwordcomputer - virtual computer, loaded by emuStudioInvalidPasswordException - if the password was incorrectpublic void clearAll(String password) throws InvalidPasswordException
password - emuStudio passwordInvalidPasswordException - if the password was incorrectpublic <T extends Context> T getContext(long pluginID, Class<T> contextInterface, int index) throws InvalidContextException, ContextNotFoundException
T - Specific context typepluginID - ID of requesting plug-incontextInterface - wanted context interface (implemented by the plug-in)index - the index if more than one context are found. If -1 is
provided, any matched context is usedInvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends CPUContext> T getCPUContext(long pluginID, Class<T> contextInterface) throws InvalidContextException, ContextNotFoundException
getCPUContext(pluginID, contextInterface, -1);T - Specific CPU contextpluginID - plug-in requesting the CPU contextcontextInterface - Interface of the contextInvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends CPUContext> T getCPUContext(long pluginID, Class<T> contextInterface, int index) throws InvalidContextException, ContextNotFoundException
T - Specific CPU ContextpluginID - plug-in requesting the CPU contextcontextInterface - Interface of the contextindex - 0-based the order of the context if they are more than one. Does nothing if the index is out of
the bounds. If index is -1, it uses any found context.InvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends CompilerContext> T getCompilerContext(long pluginID, Class<T> contextInterface) throws InvalidContextException, ContextNotFoundException
getCompilerContext(pluginID, contextInterface, -1);T - Specific compiler contextpluginID - plug-in requesting the compiler contextcontextInterface - Interface of the context, if requesting plugin has permission to acccess itInvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends CompilerContext> T getCompilerContext(long pluginID, Class<T> contextInterface, int index) throws InvalidContextException, ContextNotFoundException
T - Specific compiler contextpluginID - plug-in requesting the Compiler contextcontextInterface - Interface of the contextindex - the order of the context if they are more than one. Does nothing if the index is out of bounds.
If the index is -1, it uses any found context.InvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends MemoryContext> T getMemoryContext(long pluginID, Class<T> contextInterface) throws InvalidContextException, ContextNotFoundException
getMemoryContext(pluginID, contextInterface, -1);T - Specific memory contextpluginID - plug-in requesting the memory contextcontextInterface - Interface of the contextInvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends MemoryContext> T getMemoryContext(long pluginID, Class<T> contextInterface, int index) throws InvalidContextException, ContextNotFoundException
T - Specific memory contextpluginID - plug-in requesting the memory contextcontextInterface - Interface of the contextindex - the index of the context if they are more than one. Does nothing if the index is out of bounds.
If the index is -1, it uses any found context.InvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends DeviceContext> T getDeviceContext(long pluginID, Class<T> contextInterface) throws InvalidContextException, ContextNotFoundException
getDeviceContext(pluginID, contextInterface, -1);T - Specific device contextpluginID - plug-in requesting the device contextcontextInterface - Interface of the contextInvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic <T extends DeviceContext> T getDeviceContext(long pluginID, Class<T> contextInterface, int index) throws InvalidContextException, ContextNotFoundException
T - Specific device contextpluginID - plug-in requesting the device contextcontextInterface - Interface of the contextindex - index of the context implementation. Does nothing if the index is out of bounds.
If the index is -1, it uses any found context.InvalidContextException - if the context interface does not fulfil context requirementsContextNotFoundException - if the context does not exist or the plug-in is not allowed to get itpublic static String computeHash(Class<? extends Context> contextInterface)
contextInterface - interface to compute hash ofpublic static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
text - Data to make hash fromNoSuchAlgorithmException - self-descriptiveUnsupportedEncodingException - self-descriptiveCopyright © 2017. All rights reserved.