|
||||||||||
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
The plugin context.
Field Summary | |
---|---|
private Map<String,?> |
attributes
. |
private FS |
cmdFS
. |
private FS |
confFS
. |
private List<File> |
dirs
. |
private ScheduledExecutorService |
executor
. |
private ClassLoader |
loader
. |
private static org.slf4j.Logger |
log
. |
(package private) PluginManager |
manager
. |
private static Pattern |
p
. |
private Map<PropertyDescriptor<?>,Property<?>> |
properties
. |
private boolean |
started
. |
private String |
version
. |
Constructor Summary | |
---|---|
PluginContext(PluginDiscovery discovery,
Map<String,?> attributes,
FS cmdFS,
FS confFS,
ClassLoader loader)
Create a new plugin context. |
Method Summary | ||
---|---|---|
Map<String,?> |
getAttributes()
|
|
ClassLoader |
getLoader()
Returns the classloader associated with this context. |
|
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 executor
private volatile List<File> dirs
private final Map<PropertyDescriptor<?>,Property<?>> properties
private final FS cmdFS
private final Map<String,?> attributes
private final FS confFS
private boolean started
Constructor Detail |
---|
public PluginContext(PluginDiscovery discovery, Map<String,?> 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 nullMethod Detail |
---|
public Iterable<CRaSHPlugin<?>> getPlugins()
public String getVersion()
public Map<String,?> getAttributes()
public <T> T getProperty(PropertyDescriptor<T> desc) throws NullPointerException
T
- the property parameter typedesc
- the property descriptor
NullPointerException
- if the descriptor argument is nullpublic <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 nullpublic <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 nullpublic <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 typepublic 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 <T> Iterable<T> getPlugins(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 |