org.crsh.plugin
Class PluginContext

java.lang.Object
  extended by org.crsh.plugin.PluginContext

public class PluginContext
extends Object

The plugin context.

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
PluginContext(FS fs, ClassLoader loader)
          Create a new plugin context.
 
Method Summary
 ClassLoader getLoader()
           
<T> T
getProperty(PropertyDescriptor<T> desc)
          Returns a context property or null if it cannot be found.
 String getVersion()
           
 List<String> listResourceId(ResourceKind kind)
           
 Resource loadResource(String resourceId, ResourceKind resourceKind)
           
 void refresh()
          Refresh the fs system view.
<T> void
setProperty(PropertyDescriptor<T> desc, 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.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginContext

public PluginContext(FS fs,
                     ClassLoader loader)
              throws NullPointerException
Create a new plugin context.

Parameters:
fs - the file system
loader - the loader
Throws:
NullPointerException - if any parameter argument is null
Method Detail

getVersion

public final String getVersion()

getProperty

public final <T> T getProperty(PropertyDescriptor<T> desc)
                    throws NullPointerException
Returns a context property or null if it cannot be found.

Type Parameters:
T - the property parameter type
Parameters:
desc - the property descriptor
Returns:
the property value
Throws:
NullPointerException - if the descriptor argument is null

setProperty

public final <T> void setProperty(PropertyDescriptor<T> desc,
                                  T value)
                       throws NullPointerException
Set a context property to a new value. If the provided value is null, then the property is removed.

Type Parameters:
T - the property parameter type
Parameters:
desc - the property descriptor
value - the property value
Throws:
NullPointerException - if the descriptor argument is null

setProperty

public final <T> void setProperty(PropertyDescriptor<T> desc,
                                  String value)
                       throws NullPointerException,
                              IllegalArgumentException
Set a context property to a new value. If the provided value is null, then the property is removed.

Type Parameters:
T - the property parameter type
Parameters:
desc - the property descriptor
value - the property value
Throws:
NullPointerException - if the descriptor argument is null
IllegalArgumentException - if the string value cannot be converted to the property type

loadResource

public final Resource loadResource(String resourceId,
                                   ResourceKind resourceKind)

listResourceId

public final List<String> listResourceId(ResourceKind kind)

getLoader

public final ClassLoader getLoader()

refresh

public final void refresh()
Refresh the fs system view. This is normally triggered by the periodic job but it can be manually invoked to trigger explicit refreshes.


start

public final void start()

stop

public final void stop()


Copyright © 2011 eXo Platform SAS. All Rights Reserved.