|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crsh.plugin.PluginContext
public final class PluginContext
Field Summary | |
---|---|
private Map<String,Object> |
attributes . |
private ExecutorService |
executor The shared executor. |
private ClassLoader |
loader . |
private static Logger |
log . |
(package private) PluginManager |
manager . |
private PropertyManager |
propertyManager . |
private ResourceManager |
resourceManager . |
private ScheduledExecutorService |
scanner . |
private ScheduledFuture |
scannerFuture . |
private boolean |
started . |
private String |
version . |
Constructor Summary | |
---|---|
PluginContext(ExecutorService executor, ScheduledExecutorService scanner, PluginDiscovery discovery, Map<String,Object> attributes, FS cmdFS, FS confFS, ClassLoader loader) Create a new plugin context. |
|
PluginContext(PluginDiscovery discovery, Map<String,Object> attributes, FS cmdFS, FS confFS, ClassLoader loader) Create a new plugin context with preconfigured executor and scanner, this is equivalent to invoking:
|
Method Summary | ||
---|---|---|
Map<String,Object> |
getAttributes() |
|
ExecutorService |
getExecutor() |
|
ClassLoader |
getLoader() Returns the classloader associated with this context. |
|
|
getPlugin(Class<T> pluginType) Returns the first plugin associated with this context implementing the specified type. |
|
Iterable<CRaSHPlugin<?>> |
getPlugins() |
|
|
getPlugins(Class<T> pluginType) Returns the plugins associated with this context. |
|
|
getProperty(PropertyDescriptor<T> desc) Returns a context property or null if it cannot be found. |
|
PropertyManager |
getPropertyManager() |
|
String |
getVersion() |
|
Iterable<String> |
listResources(ResourceKind kind) List the resources id for a specific resource kind. |
|
Resource |
loadResource(String resourceId, ResourceKind resourceKind) Load a resource from the context. |
|
Iterable<Resource> |
loadResources(String resourceId, ResourceKind resourceKind) Load a resource from the context. |
|
void |
refresh() Refresh the fs system view. |
|
|
setProperty(PropertyDescriptor<T> desc, String value) Set a context property to a new value. |
|
|
setProperty(PropertyDescriptor<T> desc, T value) Set a context property to a new value. |
|
(package private) void |
start() |
|
(package private) void |
stop() |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
final PluginManager manager
private final ClassLoader loader
private final String version
private final ScheduledExecutorService scanner
private final Map<String,Object> attributes
private final ExecutorService executor
private boolean started
private ScheduledFuture scannerFuture
private final ResourceManager resourceManager
private final PropertyManager propertyManager
Constructor Detail |
---|
public PluginContext(PluginDiscovery discovery, Map<String,Object> attributes, FS cmdFS, FS confFS, ClassLoader loader) throws NullPointerException
new PluginContext(
Executors.newFixedThreadPool(20),
new ScheduledThreadPoolExecutor(1),
discovery,
attributes,
cmdFS,
confFS,
loader);
discovery
- the plugin discoverycmdFS
- the command file systemattributes
- the attributesconfFS
- the conf file systemloader
- the loaderNullPointerException
- if any parameter argument is nullpublic PluginContext(ExecutorService executor, ScheduledExecutorService scanner, PluginDiscovery discovery, Map<String,Object> attributes, FS cmdFS, FS confFS, ClassLoader loader) throws NullPointerException
executor
- the executor for executing asynchronous jobsscanner
- the background scanner for scanning commandsdiscovery
- the plugin discoverycmdFS
- the command file systemattributes
- the attributesconfFS
- the conf file systemloader
- the loaderNullPointerException
- if any parameter argument is nullMethod Detail |
---|
public String getVersion()
public Map<String,Object> getAttributes()
public ExecutorService getExecutor()
public PropertyManager getPropertyManager()
public <T> T getProperty(PropertyDescriptor<T> desc) throws NullPointerException
T
- the property parameter typedesc
- the property descriptorNullPointerException
- if the descriptor argument is nullpublic <T> void setProperty(PropertyDescriptor<T> desc, T value) throws NullPointerException
T
- the property parameter typedesc
- the property descriptorvalue
- the property valueNullPointerException
- if the descriptor argument is nullpublic <T> void setProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException
T
- the property parameter typedesc
- the property descriptorvalue
- the property valueNullPointerException
- if the descriptor argument is nullIllegalArgumentException
- if the string value cannot be converted to the property typepublic Resource loadResource(String resourceId, ResourceKind resourceKind)
resourceId
- the resource idresourceKind
- the resource kindpublic Iterable<Resource> loadResources(String resourceId, ResourceKind resourceKind)
resourceId
- the resource idresourceKind
- the resource kindpublic Iterable<String> listResources(ResourceKind kind)
kind
- the resource kindpublic ClassLoader getLoader()
public Iterable<CRaSHPlugin<?>> getPlugins()
public <T> Iterable<T> getPlugins(Class<T> pluginType)
T
- the plugin generic typepluginType
- the plugin typepublic <T> T getPlugin(Class<T> pluginType)
T
- the plugin generic typepluginType
- the plugin typepublic void refresh()
void start()
void stop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |