jp.go.aist.rtm.RTC
Class ModuleManager

java.lang.Object
  extended by jp.go.aist.rtm.RTC.ModuleManager

public class ModuleManager
extends java.lang.Object

ModuleManager class

This is a class to manage for loading and unloading modules.


Field Summary
protected  boolean m_absoluteAllowed
           Flag of absolute path when specify module for the load.
protected  java.util.Vector<java.lang.String> m_configPath
           Configuration path list
protected  boolean m_downloadAllowed
           Flag of URL when specify module for the load.
protected  java.lang.String m_initFuncPrefix
           Initial execution function prefix
protected  java.lang.String m_initFuncSuffix
           Initial execution function suffix
protected  java.util.Vector<java.lang.String> m_loadPath
           Module load path list
protected  java.util.Map<java.lang.String,jp.go.aist.rtm.RTC.ModuleManager.DLLEntity> m_modules
           Module list that has already loaded
protected  Properties m_properties
           Module Manager properties
 
Constructor Summary
ModuleManager(Properties properties)
           Constructor
 
Method Summary
 void addLoadPath(java.util.Vector<java.lang.String> loadPath)
           Add the module load path
 void allowAbsolutePath()
           Allow absolute path when specify module path
 void allowModuleDownload()
           Allow URL when specify module path
 void destruct()
           destructer
 void disallowAbsolutePath()
           Disallow absolute path when specify module path
 void disallowModuleDownload()
           Disallow URL when specify module path
protected  void finalize()
           finalize
 java.lang.String getInitFuncName(java.lang.String class_path)
           Create initialization function symbol
 java.util.Vector<Properties> getLoadableModules()
           Get the loadable module list
 java.util.Vector<Properties> getLoadedModules()
           Get the module list that has been loaded
 java.util.Vector<java.lang.String> getLoadPath()
           Get the module load path
 java.lang.String load(java.lang.String moduleName)
           Load the module
 java.lang.String load(java.lang.String moduleName, java.lang.String methodName)
           Load and intialize the module
 void setLoadpath(java.util.Vector<java.lang.String> loadPath)
           Set the module load path
 java.lang.reflect.Method symbol(java.lang.String class_name, java.lang.String method_name)
           Refer to the symbol of the method
 void unload(java.lang.String moduleName)
           Unload the module
 void unloadAll()
           Unload all modules
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_properties

protected Properties m_properties
Module Manager properties


m_modules

protected java.util.Map<java.lang.String,jp.go.aist.rtm.RTC.ModuleManager.DLLEntity> m_modules
Module list that has already loaded


m_loadPath

protected java.util.Vector<java.lang.String> m_loadPath
Module load path list


m_configPath

protected java.util.Vector<java.lang.String> m_configPath
Configuration path list


m_downloadAllowed

protected boolean m_downloadAllowed
Flag of URL when specify module for the load.


m_absoluteAllowed

protected boolean m_absoluteAllowed
Flag of absolute path when specify module for the load.


m_initFuncSuffix

protected java.lang.String m_initFuncSuffix
Initial execution function suffix


m_initFuncPrefix

protected java.lang.String m_initFuncPrefix
Initial execution function prefix

Constructor Detail

ModuleManager

public ModuleManager(Properties properties)
Constructor

Initialize based on information in the set Property object.

Parameters:
properties - Properties for initialization
Method Detail

destruct

public void destruct()
destructer


finalize

protected void finalize()
                 throws java.lang.Throwable
finalize

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

load

public java.lang.String load(java.lang.String moduleName)
                      throws java.lang.Exception
Load the module

Load file_name as DLL or a shared liblary. The file_name is specified by the relative path to default load path (manager.modules.load_path). If Property manager.modules.abs_path_allowed is yes, the load module can be specified by the absolute path.
If Property manager.modules.download_allowed is yes, the load module can be specified with URL. The file_name can be specified by the absolute path. If manager.modules.allowAbsolutePath is no, module of file_name will be searched from the default module load path and loaded.

Parameters:
moduleName - The target module name for the loading
Returns:
Name of module for the specified load
Throws:
java.lang.Exception

load

public java.lang.String load(java.lang.String moduleName,
                             java.lang.String methodName)
                      throws java.lang.Exception
Load and intialize the module

Load the specified file as DLL or a shared library, and execute operation for specified initialization.

Parameters:
moduleName - A module name
methodName - a initial method name
Returns:
The module name specified by the argument is returned.
Throws:
java.lang.IllegalArgumentException - When the argument is not correctly specified, it is thrown out.
java.lang.Exception

unload

public void unload(java.lang.String moduleName)
            throws java.lang.Exception
Unload the module

Close and unload the specified module that has been loaded.

Parameters:
moduleName - Name of module for the unloading
Throws:
java.lang.Exception

unloadAll

public void unloadAll()
Unload all modules

Unload all modules that have been loaded.


symbol

public java.lang.reflect.Method symbol(java.lang.String class_name,
                                       java.lang.String method_name)
                                throws java.lang.Exception
Refer to the symbol of the method

Parameters:
class_name - Name of class
method_name - Name of method
Returns:
method
Throws:
java.lang.Exception

getInitFuncName

public java.lang.String getInitFuncName(java.lang.String class_path)
Create initialization function symbol

Assemble names of the initialization functions.

Parameters:
class_path - Name of module for initialization
Returns:
Assembly result of initialization function name

setLoadpath

public void setLoadpath(java.util.Vector<java.lang.String> loadPath)
Set the module load path

Specify searching path to find the target module when loading module.

Parameters:
loadPath - List of module search path

getLoadPath

public java.util.Vector<java.lang.String> getLoadPath()
Get the module load path

Get the search path of the set module.

Returns:
List of module search path

addLoadPath

public void addLoadPath(java.util.Vector<java.lang.String> loadPath)
Add the module load path

Add specified path list to search path list.

Parameters:
loadPath - List of additional module search path

getLoadedModules

public java.util.Vector<Properties> getLoadedModules()
Get the module list that has been loaded

Get the module list that has been loaded.

Returns:
List of module that has been loaded

getLoadableModules

public java.util.Vector<Properties> getLoadableModules()
Get the loadable module list

Get the loadable module list (not implemented).

Returns:
Loadable module list

allowAbsolutePath

public void allowAbsolutePath()
Allow absolute path when specify module path

Set to allow the absolute path when specify the module for the load.


disallowAbsolutePath

public void disallowAbsolutePath()
Disallow absolute path when specify module path

Set to disallow the absolute path when specify the module for the load.


allowModuleDownload

public void allowModuleDownload()
Allow URL when specify module path

Allow URL when specify module for the load. When this setup is allowed, downloading and loading the module will be allowed.


disallowModuleDownload

public void disallowModuleDownload()
Disallow URL when specify module path

Disallow URL when specify module for the load.