jp.go.aist.rtm.RTC
Class Manager

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

public class Manager
extends java.lang.Object

This is a manager class that manages various information such as components.


Nested Class Summary
(package private)  class Manager.cleanupComponentsClass
           Listener Class for deletion of RT component
(package private)  class Manager.ECFactoryPredicate
           Helper class to find ECFactory
protected  class Manager.FactoryPredicate
           Helper class to find Factory
protected  class Manager.Finalized
           Class
protected  class Manager.InstanceName
           Helper class to find Object
protected  class Manager.OrbRunner
           ORB exrcution helper class
(package private)  class Manager.shutdownOnNoRtcsClass
           Listener Class for deletion of Manager
protected  class Manager.Terminator
           ORB termination helper class.
 
Field Summary
(package private)  Manager.cleanupComponentsClass m_cleanupComponents
           Listener for timer processing
protected  ObjectManager<java.lang.String,RTObject_impl> m_compManager
           Component Manager
protected  Properties m_config
           Managaer's configuration Properties
protected  ObjectManager<java.lang.String,java.lang.Object> m_ecfactory
           ExecutionContext Factory
protected  java.util.Vector<ExecutionContextBase> m_ecs
           ExecutionContext
protected  ObjectManager<java.lang.String,FactoryBase> m_factory
           Component Factory Manager
(package private)  Manager.Finalized m_finalized
           List for component deletion
protected  ModuleInitProc m_initProc
           User component initialization procedure object
(package private)  ManagerServant m_mgrservant
           The object to the ManagerServant
protected  ModuleManager m_module
           Module Manager
protected  NamingManager m_namingManager
           Naming Manager
protected  CorbaObjectManager m_objManager
           CORBA Object Manager
protected  org.omg.CORBA.ORB m_pORB
           ORB
protected  org.omg.PortableServer.POA m_pPOA
           POA
protected  org.omg.PortableServer.POAManager m_pPOAManager
           POAManager
protected  Manager.OrbRunner m_runner
           ORB Runner
(package private)  Manager.shutdownOnNoRtcsClass m_shutdownOnNoRtcs
           Listener for timer processing
protected  int m_terminate_waiting
           Counter for Terminator
protected  Manager.Terminator m_terminator
           Terminator
protected  Timer m_timer
           Timer Object
protected static Manager manager
           This field is the only Manager instance.
protected static java.lang.String manager_mutex
           This field is a mutex variable for Manager.
protected  Logbuf rtcout
           Logger stream
 
Constructor Summary
protected Manager()
           Constructor
  Manager(Manager rhs)
           Copy Constructor
 
Method Summary
 boolean activateManager()
           Activate the Manager
protected  boolean bindManagerServant()
           Binds ManagerServant.
 void cleanupComponent(RTObject_impl comp)
           Unregister RT-Components
 void clearModules()
           Clears the RT component manager.
 void clearModulesFactories()
           Clears the factory for RT component.
protected  void configureComponent(RTObject_impl comp, Properties prop)
           Configure RT-Component
 RTObject_impl createComponent(java.lang.String comp_args)
           Create RT-Components
 ExecutionContextBase createContext(java.lang.String ec_args)
           Create Context
protected  void createORBEndpointOption(java.lang.String opt, java.util.Vector<java.lang.String> endpoints)
           Create a command optional line of Endpoint of ORB.
protected  void createORBEndpoints(java.util.Vector<java.lang.String> endpoints)
           Create Endpoints
protected  java.lang.String createORBOptions()
           Create ORB command options
protected  java.util.Properties createORBProperties()
           Creates ORB Properties.
 void deleteComponent(RTObject_impl comp)
           Unregister RT-Components that have been registered to Manager
 void deleteComponent(java.lang.String instanceName)
           Unregister RT-Components that have been registered to Manager
protected  java.lang.String formatString(java.lang.String namingFormat, Properties properties)
           Construct registration information when registering to Naming server
 RTObject_impl getComponent(java.lang.String instanceName)
           Get RT-Component's pointer
 java.util.Vector<RTObject_impl> getComponents()
           Get all RT-Components registered in the Manager
 Properties getConfig()
           Get the manager configuration
 java.util.Vector<Properties> getFactoryProfiles()
           Get profiles of factories.
 java.util.Vector<Properties> getLoadableModules()
           Get a list of loadable modules
 java.util.Vector<Properties> getLoadedModules()
           Get a list of loaded modules
 java.util.Vector<java.lang.String> getModulesFactories()
           Get the list of all Factories
 org.omg.CORBA.ORB getORB()
           Get the pointer to ORB
 org.omg.PortableServer.POA getPOA()
           Get a pointer to RootPOA held by Manager
 org.omg.PortableServer.POAManager getPOAManager()
           Get POAManager that Manager has
static Manager init(java.lang.String[] argv)
           Initialize manager
protected  boolean initComposite()
           PeriodicECSharedComposite initialization
protected  boolean initExecContext()
           ExecutionContextManager initialization
protected  boolean initFactories()
           Factories initialization
protected  boolean initLogger()
           System logger initialization
protected  void initManager(java.lang.String[] argv)
           Manager internal initialization
protected  boolean initManagerServant()
           ManagerServant initialization
protected  boolean initNaming()
           NamingManager initialization
protected  boolean initORB()
           CORBA ORB initialization
protected  boolean initTimer()
           Timer initialization
static Manager instance()
           Get instance of the manager
 void join()
           Wait for Manager's termination
 java.lang.String load(java.lang.String moduleFileName, java.lang.String initFunc)
           [CORBA interface] Load module
protected  boolean mergeProperty(Properties properties, java.lang.String fileName)
           Merge property information
 void notifyFinalized(RTObject_impl comp)
           This method deletes RT-Components.
 boolean procComponentArgs(java.lang.String comp_arg, Properties comp_id, Properties comp_conf)
           Extracting component type/properties from the given string
 boolean procContextArgs(java.lang.String ec_args, java.lang.StringBuffer ec_id, Properties ec_conf)
           Extracting ExecutionContext's name/properties from the given string
 boolean registerComponent(RTObject_impl comp)
           Register RT-Component directly without Factory
 boolean registerECFactory(java.lang.String name)
           Register ExecutionContext Factory Register Factory to create ExecutionContext's instances.
 boolean registerFactory(Properties profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
           Register RT-Component Factory
 void runManager()
           Run the Manager
 void runManager(boolean noBlocking)
           Run the Manager
 void setModuleInitProc(ModuleInitProc initProc)
           Set initial procedure
 void shutdown()
           Shutdown Manager
protected  void shutdownComponents()
           NamingManager finalization
protected  void shutdownLogger()
           System Logger finalization
protected  void shutdownManager()
           Shutdown Manager
protected  void shutdownNaming()
           NamingManager finalization
protected  void shutdownORB()
           ORB finalization
 void terminate()
           Terminate manager
 void unload(java.lang.String moduleFileName)
           Unload module
 void unloadAll()
           Unload all modules
 boolean unregisterComponent(RTObject_impl comp)
           Unregister RT-Components
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_cleanupComponents

Manager.cleanupComponentsClass m_cleanupComponents
Listener for timer processing


m_shutdownOnNoRtcs

Manager.shutdownOnNoRtcsClass m_shutdownOnNoRtcs
Listener for timer processing


m_mgrservant

ManagerServant m_mgrservant
The object to the ManagerServant


manager

protected static Manager manager
This field is the only Manager instance.


manager_mutex

protected static java.lang.String manager_mutex
This field is a mutex variable for Manager.


m_pORB

protected org.omg.CORBA.ORB m_pORB
ORB


m_pPOA

protected org.omg.PortableServer.POA m_pPOA
POA


m_pPOAManager

protected org.omg.PortableServer.POAManager m_pPOAManager
POAManager


m_initProc

protected ModuleInitProc m_initProc
User component initialization procedure object


m_config

protected Properties m_config
Managaer's configuration Properties


m_module

protected ModuleManager m_module
Module Manager


m_namingManager

protected NamingManager m_namingManager
Naming Manager


m_objManager

protected CorbaObjectManager m_objManager
CORBA Object Manager


m_timer

protected Timer m_timer
Timer Object


rtcout

protected Logbuf rtcout
Logger stream


m_compManager

protected ObjectManager<java.lang.String,RTObject_impl> m_compManager
Component Manager


m_factory

protected ObjectManager<java.lang.String,FactoryBase> m_factory
Component Factory Manager


m_ecfactory

protected ObjectManager<java.lang.String,java.lang.Object> m_ecfactory
ExecutionContext Factory


m_ecs

protected java.util.Vector<ExecutionContextBase> m_ecs
ExecutionContext


m_runner

protected Manager.OrbRunner m_runner
ORB Runner


m_terminator

protected Manager.Terminator m_terminator
Terminator


m_terminate_waiting

protected int m_terminate_waiting
Counter for Terminator


m_finalized

Manager.Finalized m_finalized
List for component deletion

Constructor Detail

Manager

protected Manager()
Constructor

Protected Constructor


Manager

public Manager(Manager rhs)
Copy Constructor

Protected Copy Constructor

Parameters:
rhs - Manager object of copy source
Method Detail

init

public static Manager init(java.lang.String[] argv)
Initialize manager

This is the static member function to initialize the Manager. The Manager is initialized by given commandline arguments. To use the manager, this initialization member function init() must be called. The manager has two static functions to get the instance such as init() and instance(). Since initializing process is only performed by the init() function, the init() has to be called at the beginning of the lifecycle of the Manager. *Initialization of manager

Parameters:
argv - The array of the command line arguments.
Returns:
Reference of the unique instance of Manager

instance

public static Manager instance()
Get instance of the manager

This is the static member function to get the instance of the Manager. Before calling this function, ensure that the initialization function "init()" is called.

Returns:
The only instance reference of the manager

terminate

public void terminate()
Terminate manager

Terminate manager's processing


shutdown

public void shutdown()
Shutdown Manager

Terminate manager's processing. After terminating ORB, shutdown manager in sync.


join

public void join()
Wait for Manager's termination

Wait for Manager's termination to synchronize.


getConfig

public Properties getConfig()
Get the manager configuration

Get the manager configuration that has been set to manager.

Returns:
Manager's configuration

setModuleInitProc

public void setModuleInitProc(ModuleInitProc initProc)
Set initial procedure

This operation sets the initial procedure call to process module initialization, other user defined initialization and so on. The given procedure will be called at the proper timing after the manager initialization, activation and run.

Parameters:
initProc - Callback interface

activateManager

public boolean activateManager()
Activate the Manager

This operation do the following:

  • Activate CORBA POAManager
  • Activate Manager CORBA object
  • Bind object reference of the Manager to the nameserver This operation should be invoked after Manager:init(), and before runManager().

    Returns:
    Activation result (Successful:true, Failed:false)

  • runManager

    public void runManager()
    Run the Manager

    This operation processes the main event loop of the Manager. In this main loop, CORBA's ORB event loop or other processes are performed. This operation is going to blocking mode and never returns until Manager::destroy() is called.


    runManager

    public void runManager(boolean noBlocking)
    Run the Manager

    This operation processes the main event loop of the Manager. In this main loop, CORBA's ORB event loop or other processes are performed. As the default behavior, this operation is going to blocking mode and never returns until Manager::destroy() is called. When the given argument "no_block" is set to "true", this operation creates a thread to process the event loop internally, and it doesn't block and returns.

    Parameters:
    noBlocking - false: Blocking mode, true: non-blocking mode.

    load

    public java.lang.String load(java.lang.String moduleFileName,
                                 java.lang.String initFunc)
    [CORBA interface] Load module

    Load specified module (shared library, DLL etc..), and invoke initialize function.

    Parameters:
    moduleFileName - The module file name
    initFunc - The initialize function name

    unload

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

    Unload module.

    Parameters:
    moduleFileName - The module file name
    Throws:
    java.lang.Exception

    unloadAll

    public void unloadAll()
    Unload all modules

    Unload all modules.


    getLoadedModules

    public java.util.Vector<Properties> getLoadedModules()
    Get a list of loaded modules

    Get module list that is currently loaded into manager.

    Returns:
    Module list that has been loaded.

    getLoadableModules

    public java.util.Vector<Properties> getLoadableModules()
    Get a list of loadable modules

    Get loadable module list. (Currently, unimplemented on ModuleManager side)

    Returns:
    Loadable module list

    registerFactory

    public boolean registerFactory(Properties profile,
                                   RtcNewFunc new_func,
                                   RtcDeleteFunc delete_func)
    Register RT-Component Factory

    Register Factory to create RT-Component's instances.

    Parameters:
    profile - RT-Component profile
    new_func - RT-Component creation function
    delete_func - RT-Component destruction function
    Returns:
    Registration result (Successful:true, Failed:false)

    getFactoryProfiles

    public java.util.Vector<Properties> getFactoryProfiles()
    Get profiles of factories.

    Get profiles of factories.

    Returns:
    profiles of factories

    registerECFactory

    public boolean registerECFactory(java.lang.String name)
    Register ExecutionContext Factory Register Factory to create ExecutionContext's instances.

    Parameters:
    name - ExecutionContext name
    Returns:
    Registration result (Successful:true, Failed:false)

    getModulesFactories

    public java.util.Vector<java.lang.String> getModulesFactories()
    Get the list of all Factories

    Get the list of all factories that have been registered.

    Returns:
    Registered factory list

    clearModulesFactories

    public void clearModulesFactories()
    Clears the factory for RT component.


    clearModules

    public void clearModules()
    Clears the RT component manager.


    createComponent

    public RTObject_impl createComponent(java.lang.String comp_args)
    Create RT-Components

    Create specified RT-Component's instances via registered Factory. When its instances have been created successfully, the following processings are also executed.

  • Read and set configuration information that was set by external file.
  • Bind ExecutionContext and start operation.
  • Register to naming service.
  • Parameters:
    comp_args - Target RT-Component names for the creation.
    comp_args: [id]?[configuration]
    for examples,
    RTC:jp.go.aist:example:ConfigSample:1.0?conf.default.str_param0=munya RTC::example:ConfigSample:?conf.default.int_param0=100
    Returns:
    Created RT-Component's instances

    cleanupComponent

    public void cleanupComponent(RTObject_impl comp)
    Unregister RT-Components

    Unregister specified RT-Component's instances from naming service.

    Parameters:
    comp - Target RT-Components for the unregistration

    notifyFinalized

    public void notifyFinalized(RTObject_impl comp)
    This method deletes RT-Components.

    The deleted RT-Component is registered. The registered RT-Components are deleted by cleanupComponents().

    Parameters:
    comp - Deleted RT component

    procComponentArgs

    public boolean procComponentArgs(java.lang.String comp_arg,
                                     Properties comp_id,
                                     Properties comp_conf)
    Extracting component type/properties from the given string

    This operation extracts component type name and its properties from the figen character string. The given string formats is the following. [RTC type]?[key(0)]=[val(0)]&[key(1)]=[val(1)]...[key(n)]=[val(n)] Returned value "comp_id" has keys of "vendor", "category", "implementation_id", "version", and returned as Properties type object. "comp_conf" is returned as Properties type object includeing component properties to be given to component.

    Parameters:
    comp_arg - character string to be processed
    comp_id - extracted component type name
    comp_conf - extracted component's properties
    Returns:
    comp_arg false will returned if no component type in arg

    registerComponent

    public boolean registerComponent(RTObject_impl comp)
    Register RT-Component directly without Factory

    Register specified RT-Component's instances not via Factory to Manager directly.

    Parameters:
    comp - Target RT-Component's instances for the registration
    Returns:
    Registration result (Successful:true, Failed:false)

    unregisterComponent

    public boolean unregisterComponent(RTObject_impl comp)
    Unregister RT-Components

    Unregister specified RT-Components

    Parameters:
    comp - Target RT-Component's instances for the unregistration
    Returns:
    Unregistration result (Successful:true, Failed:false)

    createContext

    public ExecutionContextBase createContext(java.lang.String ec_args)
    Create Context

    Parameters:
    ec_args - Arguments
    Returns:
    @return Created Context's instances

    procContextArgs

    public boolean procContextArgs(java.lang.String ec_args,
                                   java.lang.StringBuffer ec_id,
                                   Properties ec_conf)
    Extracting ExecutionContext's name/properties from the given string

    This operation extracts ExecutionContext's name and its properties from the figen character string. The given string formats is the following. [ExecutionContext's name]?[key(0)] =[val(0)]&[key(1)]=[val(1)]...[key(n)]=[val(n)] "ec_conf" is returned as Properties type object includeing component properties to be given to component.

    Parameters:
    ec_args - character string to be processed
    ec_id - extracted ExecutionContext's name
    ec_conf - extracted ExecutionContext's properties
    Returns:
    ec_arg false will returned if no ExecutionContext's name in arg

    deleteComponent

    public void deleteComponent(RTObject_impl comp)
    Unregister RT-Components that have been registered to Manager

    Unregister RT-Components that have been registered to manager Remove specified RT-Component from naming service, terminate itself and release its instances.

    Parameters:
    comp - Target RT-Component's instances for the unregistration

    deleteComponent

    public void deleteComponent(java.lang.String instanceName)
    Unregister RT-Components that have been registered to Manager

    Unregister RT-Components that have been registered to manager Remove specified RT-Component from naming service, terminate itself and release its instances.

    Parameters:
    instanceName - Target RT-Component's instances for the unregistration

    getComponent

    public RTObject_impl getComponent(java.lang.String instanceName)
    Get RT-Component's pointer

    Search RT-Component that has been registered to Manager by its specified name, and get it that matches.

    Parameters:
    instanceName - Target RT-Component's name for searching
    Returns:
    Target RT-Component's instances that matches

    getComponents

    public java.util.Vector<RTObject_impl> getComponents()
    Get all RT-Components registered in the Manager

    Get all RT-Component's instances that have been registered to Manager.

    Returns:
    List of all RT-Component's instances

    getORB

    public org.omg.CORBA.ORB getORB()
    Get the pointer to ORB

    Get the pointer to ORB that has been set to Manager.

    Returns:
    ORB object

    getPOA

    public org.omg.PortableServer.POA getPOA()
    Get a pointer to RootPOA held by Manager

    Get the pointer to RootPOA that has been set to Manager.

    Returns:
    RootPOA object

    getPOAManager

    public org.omg.PortableServer.POAManager getPOAManager()
    Get POAManager that Manager has

    Get POAMAnager that has been set to Manager.

    Returns:
    POA manager

    initManager

    protected void initManager(java.lang.String[] argv)
                        throws java.lang.Exception
    Manager internal initialization

    Execute Manager's internal initialization processing.

    Parameters:
    argv - Commandline arguments
    Throws:
    java.lang.Exception

    shutdownManager

    protected void shutdownManager()
    Shutdown Manager

    Shutdown Manager


    initLogger

    protected boolean initLogger()
    System logger initialization

    Initialize System logger. Initialize logger and set it according to the set information in configuration file,

    Returns:
    Initialization result (Successful:true, Failed:false)

    shutdownLogger

    protected void shutdownLogger()
    System Logger finalization


    initORB

    protected boolean initORB()
    CORBA ORB initialization

    Initialize ORB based on the configuration given by arguments.

    Returns:
    ORB initialization result (Successful:true, Failed:false)

    createORBOptions

    protected java.lang.String createORBOptions()
    Create ORB command options

    Create ORB launch options from configuration information that has been set.

    Returns:
    ORB launch options

    createORBEndpoints

    protected void createORBEndpoints(java.util.Vector<java.lang.String> endpoints)
    Create Endpoints

    Create Endpoints from the configuration.

    Parameters:
    endpoints - endpoints Endpoints list

    createORBEndpointOption

    protected void createORBEndpointOption(java.lang.String opt,
                                           java.util.Vector<java.lang.String> endpoints)
    Create a command optional line of Endpoint of ORB.

    Parameters:
    opt - ORB options
    endpoints - Endpoints list

    createORBProperties

    protected java.util.Properties createORBProperties()
    Creates ORB Properties.

    Returns:
    java.util.Properties Property of ORB.init().

    shutdownORB

    protected void shutdownORB()
    ORB finalization

    Finalize ORB . When the waiting process exists, wait until it completes. In actual finalization, deactivate POA Manager and then shutdown of ORB.


    initNaming

    protected boolean initNaming()
    NamingManager initialization

    Initialize NamingManager . However, operate nothing, if it is set to property that NamingManager is not used. Register default NamingServer that is set to property information, when NamingManager is used. Also, launch a timer that updates information automatically at specified cycle and register the method for the update to the timer, when it is set to update it reguraly.

    Returns:
    Initialization result (Successful:true, Failed:false)

    shutdownNaming

    protected void shutdownNaming()
    NamingManager finalization

    Finalize NamingManager. Unbind all registered elements and shutdown them.


    shutdownComponents

    protected void shutdownComponents()
    NamingManager finalization

    Get a list of RT-Components that have been registered to NamingManager, and shutdown all components.


    configureComponent

    protected void configureComponent(RTObject_impl comp,
                                      Properties prop)
    Configure RT-Component

    Read property files described each RT-Component's type and instance, * and configure it to the component. Also, get each component's registered name when registering to NamingService and configure it.

    Parameters:
    comp - Target RT-Component for the configuration

    initExecContext

    protected boolean initExecContext()
    ExecutionContextManager initialization

    Initialize each ExecutionContext that is used, and register each ExecutionContext creation Factory to ExecutionContextManager.

    Returns:
    ExecutionContextManager initialization result (Successful:true, Failed:false)

    initComposite

    protected boolean initComposite()
    PeriodicECSharedComposite initialization

    Returns:
    (初期化成功:true、初期化失敗:false)} PeriodicECSharedComposite initialization result (Successful:true, Failed:false)

    initFactories

    protected boolean initFactories()
    Factories initialization

    Initialize buffer factories, thread factories, publisher factories, provider factories, and consumer factories.

    Returns:
    PeriodicECSharedComposite initialization result (Successful:true, Failed:false)

    initTimer

    protected boolean initTimer()
    Timer initialization

    Initialize each Timer that is used. (In current implementation, nothing is done.)

    Returns:
    Timer Initialization result (Successful:true, Failed:false)

    initManagerServant

    protected boolean initManagerServant()
    ManagerServant initialization

    Returns:
    Initialization result (Successful:true, Failed:false)

    bindManagerServant

    protected boolean bindManagerServant()
    Binds ManagerServant.

    Returns:
    Result (Successful:true, Failed:false)

    mergeProperty

    protected boolean mergeProperty(Properties properties,
                                    java.lang.String fileName)
    Merge property information

    Load property information that is configured in the specified file, and merge existing properties that has been configured.

    Parameters:
    properties - Target properties for the merge
    fileName - File name that property information is described
    Returns:
    Merge result (Successful:true, Failed:false)

    formatString

    protected java.lang.String formatString(java.lang.String namingFormat,
                                            Properties properties)
    Construct registration information when registering to Naming server

    Construct information when registering to NameServer based on specified format and property information. Each format specification character means as follows:

    Parameters:
    namingFormat - Format specification for NamingService registration
    properties - Property information that is used
    Returns:
    Specification format conversion result