|
||||||||||
| 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 FS |
cmdFS
. |
private FS |
confFS
. |
private List<File> |
dirs
. |
private ExecutorService |
executor
The shared executor. |
private ClassLoader |
loader
. |
private static org.slf4j.Logger |
log
. |
(package private) PluginManager |
manager
. |
private static Pattern |
p
. |
private Map<PropertyDescriptor<?>,Property<?>> |
properties
. |
private ScheduledExecutorService |
scanner
. |
private boolean |
started
. |
private String |
version
. |
| Constructor Summary | |
|---|---|
PluginContext(PluginDiscovery discovery,
Map<String,Object> attributes,
FS cmdFS,
FS confFS,
ClassLoader loader)
Create a new plugin context. |
|
| 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. |
|
|
getProperty(String propertyName,
Class<T> type)
Returns a context property or null if it cannot be found. |
|
String |
getVersion()
|
|
List<String> |
listResourceId(ResourceKind kind)
List the resources id for a specific resource kind. |
|
Resource |
loadResource(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 Pattern p
private static final org.slf4j.Logger log
final PluginManager manager
private final ClassLoader loader
private final String version
private ScheduledExecutorService scanner
private volatile List<File> dirs
private final Map<PropertyDescriptor<?>,Property<?>> properties
private final FS cmdFS
private final Map<String,Object> attributes
private final FS confFS
private boolean started
private ExecutorService executor
| Constructor Detail |
|---|
public PluginContext(PluginDiscovery discovery,
Map<String,Object> attributes,
FS cmdFS,
FS confFS,
ClassLoader loader)
throws NullPointerException
discovery - the plugin discoverycmdFS - the command file systemattributes - the attributesconfFS - the conf file systemloader - the loader
NullPointerException - if any parameter argument is null| Method Detail |
|---|
public String getVersion()
public Map<String,Object> getAttributes()
public ExecutorService getExecutor()
public <T> T getProperty(PropertyDescriptor<T> desc)
throws NullPointerException
T - the property parameter typedesc - the property descriptor
NullPointerException - if the descriptor argument is null
public <T> T getProperty(String propertyName,
Class<T> type)
throws NullPointerException
T - the property parameter typepropertyName - the name of the propertytype - the property type
NullPointerException - if the descriptor argument is null
public <T> void setProperty(PropertyDescriptor<T> desc,
T value)
throws NullPointerException
T - the property parameter typedesc - the property descriptorvalue - the property value
NullPointerException - if the descriptor argument is null
public <T> void setProperty(PropertyDescriptor<T> desc,
String value)
throws NullPointerException,
IllegalArgumentException
T - the property parameter typedesc - the property descriptorvalue - the property value
NullPointerException - if the descriptor argument is null
IllegalArgumentException - if the string value cannot be converted to the property type
public Resource loadResource(String resourceId,
ResourceKind resourceKind)
resourceId - the resource idresourceKind - the resource kind
public List<String> listResourceId(ResourceKind kind)
kind - the resource kind
public ClassLoader getLoader()
public Iterable<CRaSHPlugin<?>> getPlugins()
public <T> Iterable<T> getPlugins(Class<T> pluginType)
T - the plugin generic typepluginType - the plugin type
public <T> T getPlugin(Class<T> pluginType)
T - the plugin generic typepluginType - the plugin type
public void refresh()
void start()
void stop()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||