public final class PluginContext
extends java.lang.Object
| Constructor and Description |
|---|
PluginContext(java.util.concurrent.ExecutorService executor,
java.util.concurrent.ScheduledExecutorService scanner,
PluginDiscovery discovery,
java.util.Map<java.lang.String,java.lang.Object> attributes,
FS cmdFS,
FS confFS,
java.lang.ClassLoader loader)
Create a new plugin context.
|
PluginContext(PluginDiscovery discovery,
java.util.Map<java.lang.String,java.lang.Object> attributes,
FS cmdFS,
FS confFS,
java.lang.ClassLoader loader)
Create a new plugin context with preconfigured executor and scanner, this is equivalent to invoking:
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes() |
java.util.concurrent.ExecutorService |
getExecutor() |
java.lang.ClassLoader |
getLoader()
Returns the classloader associated with this context.
|
<T> T |
getPlugin(java.lang.Class<T> pluginType)
Returns the first plugin associated with this context implementing the specified type.
|
java.lang.Iterable<CRaSHPlugin<?>> |
getPlugins() |
<T> java.lang.Iterable<T> |
getPlugins(java.lang.Class<T> pluginType)
Returns the plugins associated with this context.
|
<T> T |
getProperty(PropertyDescriptor<T> desc)
Returns a context property or null if it cannot be found.
|
<T> T |
getProperty(java.lang.String propertyName,
java.lang.Class<T> type)
Returns a context property or null if it cannot be found.
|
org.crsh.plugin.PropertyManager |
getPropertyManager() |
java.lang.String |
getVersion() |
java.lang.Iterable<java.lang.String> |
listResources(ResourceKind kind)
List the resources id for a specific resource kind.
|
Resource |
loadResource(java.lang.String resourceId,
ResourceKind resourceKind)
Load a resource from the context.
|
java.lang.Iterable<Resource> |
loadResources(java.lang.String resourceId,
ResourceKind resourceKind)
Load a resource from the context.
|
void |
refresh()
Refresh the fs system view.
|
<T> void |
setProperty(PropertyDescriptor<T> desc,
java.lang.String value)
Set a context property to a new value.
|
<T> void |
setProperty(PropertyDescriptor<T> desc,
T value)
Set a context property to a new value.
|
public PluginContext(PluginDiscovery discovery, java.util.Map<java.lang.String,java.lang.Object> attributes, FS cmdFS, FS confFS, java.lang.ClassLoader loader) throws java.lang.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 loaderjava.lang.NullPointerException - if any parameter argument is nullpublic PluginContext(java.util.concurrent.ExecutorService executor,
java.util.concurrent.ScheduledExecutorService scanner,
PluginDiscovery discovery,
java.util.Map<java.lang.String,java.lang.Object> attributes,
FS cmdFS,
FS confFS,
java.lang.ClassLoader loader)
throws java.lang.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 loaderjava.lang.NullPointerException - if any parameter argument is nullpublic java.lang.String getVersion()
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
public java.util.concurrent.ExecutorService getExecutor()
public org.crsh.plugin.PropertyManager getPropertyManager()
public <T> T getProperty(PropertyDescriptor<T> desc) throws java.lang.NullPointerException
T - the property parameter typedesc - the property descriptorjava.lang.NullPointerException - if the descriptor argument is nullpublic <T> T getProperty(java.lang.String propertyName,
java.lang.Class<T> type)
throws java.lang.NullPointerException
T - the property parameter typepropertyName - the name of the propertytype - the property typejava.lang.NullPointerException - if the descriptor argument is nullpublic <T> void setProperty(PropertyDescriptor<T> desc, T value) throws java.lang.NullPointerException
T - the property parameter typedesc - the property descriptorvalue - the property valuejava.lang.NullPointerException - if the descriptor argument is nullpublic <T> void setProperty(PropertyDescriptor<T> desc, java.lang.String value) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
T - the property parameter typedesc - the property descriptorvalue - the property valuejava.lang.NullPointerException - if the descriptor argument is nulljava.lang.IllegalArgumentException - if the string value cannot be converted to the property typepublic Resource loadResource(java.lang.String resourceId, ResourceKind resourceKind)
resourceId - the resource idresourceKind - the resource kindpublic java.lang.Iterable<Resource> loadResources(java.lang.String resourceId, ResourceKind resourceKind)
resourceId - the resource idresourceKind - the resource kindpublic java.lang.Iterable<java.lang.String> listResources(ResourceKind kind)
kind - the resource kindpublic java.lang.ClassLoader getLoader()
public java.lang.Iterable<CRaSHPlugin<?>> getPlugins()
public <T> java.lang.Iterable<T> getPlugins(java.lang.Class<T> pluginType)
T - the plugin generic typepluginType - the plugin typepublic <T> T getPlugin(java.lang.Class<T> pluginType)
T - the plugin generic typepluginType - the plugin typepublic void refresh()
Copyright © 2014 eXo Platform SAS. All Rights Reserved.