|
GraphLab Project | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgraphlab.platform.plugin.Plugger
public class Plugger
GraphLab plugging functionality is provided here.
Class Plugger, is the heart of plugin structure. In order to gather all the plugins, you need to gather all the possible libraries(.jar) files to the project. The method plug() does this using Java Reflection API and Java Class Loader. After this, you need to read the manifest files. This is done via Java JarFile class. other properties of the plugin like its version , the dependencies and the answer to the question that this plugin should be loaded to GraphLab should be answered here. Method init(File) gets a jar file and checks all the mentioned actions using helper methods verify(), dfs(), load() and remove(). verify() reads a HashMap called depends. This Map is filled in the init() method using the property reader of JarFile class. It reads all the dependencies that are mentioned in the jar file. These are only related to version dependencies. dfs() tries a DFS algorithm to topologically sort the dependencies tree and then use the sorted trees to give priority to plugin loads.
Field Summary | |
---|---|
int |
activePlugins
|
java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> |
childs
|
java.net.URLClassLoader |
classLoader
|
java.util.HashMap<java.lang.String,java.lang.String> |
configxml
|
java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Object[]>> |
depends
|
java.util.HashMap<java.lang.String,java.io.File> |
files
|
java.lang.String |
handler_postfix
|
java.util.HashMap<java.lang.String,java.lang.String> |
initializer
|
java.util.HashMap<java.lang.String,java.lang.Integer> |
mark
|
static java.lang.String |
PLUGGER_INSTANCE
|
java.lang.String |
postfix
|
java.lang.String |
prefix
|
java.util.HashMap<java.lang.String,java.lang.Long> |
versions
|
Constructor Summary | |
---|---|
Plugger(BlackBoard blackboard)
|
Method Summary | |
---|---|
void |
dfs(java.lang.String name)
DFS to find a topological sort of plugins. |
static java.lang.String |
getExtension(java.io.File f)
Return the extension portion of the file's name . |
void |
init(java.io.File ff)
Read manifest of a jar file and make that plugin candidate to be loaded. |
void |
load(java.lang.String name)
Load and initialize a plugin. |
void |
plug()
Search plugins directory and add jar files to Graphlab. |
void |
remove(java.lang.String name)
Remove a "plugin candidate" because of lack of dependencies. |
void |
verify()
Check dependencies |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.lang.String prefix
public final java.lang.String postfix
public final java.lang.String handler_postfix
public static final java.lang.String PLUGGER_INSTANCE
public java.util.HashMap<java.lang.String,java.lang.Long> versions
public java.util.HashMap<java.lang.String,java.io.File> files
public java.util.HashMap<java.lang.String,java.lang.Integer> mark
public java.util.HashMap<java.lang.String,java.lang.String> initializer
public java.util.HashMap<java.lang.String,java.lang.String> configxml
public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.Object[]>> depends
public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> childs
public java.net.URLClassLoader classLoader
public int activePlugins
Constructor Detail |
---|
public Plugger(BlackBoard blackboard)
Method Detail |
---|
public void plug()
classLoader
public void init(java.io.File ff)
ff
- file objectpublic void remove(java.lang.String name)
name
- Name of pluginpublic void verify()
public void dfs(java.lang.String name)
name
- Name of pluginpublic void load(java.lang.String name)
PluginHandlerInterface
and
send path of config.xml to that handler.
name
- Name of pluginPluginInterface.init(graphlab.platform.core.BlackBoard)
,
PluginHandlerInterface.init(String,graphlab.platform.core.BlackBoard)
public static java.lang.String getExtension(java.io.File f)
getExtension(java.io.File)
,
FileFilter.accept(java.io.File)
|
GraphLab Project | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |