jp.go.aist.rtm.RTC.port
Class OutPortBase

java.lang.Object
  extended by org.omg.PortableServer.Servant
      extended by RTC.PortServicePOA
          extended by jp.go.aist.rtm.RTC.port.PortBase
              extended by jp.go.aist.rtm.RTC.port.OutPortBase
All Implemented Interfaces:
SDOServiceOperations, org.omg.CORBA.portable.InvokeHandler, PortServiceOperations
Direct Known Subclasses:
OutPort

public abstract class OutPortBase
extends PortBase

Base implementation class for OutPort

The implementation such as the registration of Pubilsher and notification to Publisher.


Nested Class Summary
protected  class OutPortBase.Publisher
          ポート名です。
 
Nested classes/interfaces inherited from class jp.go.aist.rtm.RTC.port.PortBase
PortBase.connect_func, PortBase.disconnect_all_func, PortBase.disconnect_func, PortBase.find_conn_id, PortBase.find_interface, PortBase.find_port_ref
 
Field Summary
protected  java.util.Vector<OutPortConnector> m_connectors
           
protected  java.util.Vector<java.lang.String> m_consumerTypes
           
protected  ConnectorListeners m_listeners
           
protected  Properties m_properties
           
protected  java.util.Vector<java.lang.String> m_providerTypes
           
protected  java.util.List<OutPortBase.Publisher> m_publishers
           
 
Fields inherited from class jp.go.aist.rtm.RTC.port.PortBase
m_connectionLimit, m_connectorsMutex, m_objref, m_onConnected, m_onConnectionLost, m_onDisconnected, m_onPublishInterfaces, m_onSubscribeInterfaces, m_onUnsubscribeInterfaces, m_ownerInstanceName, m_profile, m_profile_mutex, rtcout
 
Constructor Summary
OutPortBase(java.lang.String name, java.lang.String data_type)
           Constructor
 
Method Summary
 void activateInterfaces()
           Activate all Port interfaces
 void addConnectorDataListener(int type, ConnectorDataListenerT listener)
           Adds ConnectorDataListener type listener
 void addConnectorDataListener(int type, ConnectorDataListenerT listener, boolean autoclean)
           Adds ConnectorDataListener type listener
 void addConnectorListener(int type, ConnectorListener listener)
           Adds ConnectorListener type listener
 void addConnectorListener(int type, ConnectorListener listener, boolean autoclean)
           Adds ConnectorListener type listener
protected  void configure()
           Configureing outport
 ReturnCode_t connect(ConnectorProfileHolder connector_profile)
           Connect the Port
 java.util.Vector<OutPortConnector> connectors()
           Connector list
protected  OutPortConnector createConnector(ConnectorProfileHolder cprof, Properties prop, InPortConsumer consumer)
           OutPortPushConnector creation
protected  OutPortConnector createConnector(ConnectorProfileHolder cprof, Properties prop, OutPortProvider provider)
           OutPortPullConnector creation
protected  InPortConsumer createConsumer(ConnectorProfileHolder cprof, Properties prop)
           InPort consumer creation
protected  OutPortProvider createProvider(ConnectorProfileHolder cprof, Properties prop)
           OutPort provider creation
 void deactivateInterfaces()
           Deactivate all Port interfaces
 OutPortConnector getConnectorById(java.lang.String id)
           Getting ConnectorProfile by ID
(package private)  OutPortConnector getConnectorByName(java.lang.String name)
           Getting Connector by name
 java.util.Vector<java.lang.String> getConnectorIds()
           ConnectorId list
 java.util.Vector<java.lang.String> getConnectorNames()
           Connector name list
 boolean getConnectorProfileById(java.lang.String id, ConnectorBase.ConnectorInfoHolder profh)
           Getting ConnectorProfile by name
 boolean getConnectorProfileByName(java.lang.String name, ConnectorBase.ConnectorInfoHolder profh)
           Getting ConnectorProfile by name
 java.util.Vector<ConnectorBase.ConnectorInfo> getConnectorProfiles()
           ConnectorProfile list
 void init(Properties prop)
           Initializing properties
protected  void initConsumers()
           InPort consumer initialization
protected  void initProviders()
           OutPort provider initialization
 boolean isLittleEndian()
           Returns endian information
 void onConnect(java.lang.String id, PublisherBase publisher)
           onConnect
 void onDisconnect(java.lang.String id)
           onDisconenct
 Properties properties()
           Get properties
protected  ReturnCode_t publishInterfaces(ConnectorProfileHolder cprof)
           Publish interface information
 void removeConnectorDataListener(int type, ConnectorDataListenerT listener)
           Removes ConnectorDataListener type listener
 void removeConnectorListener(int type, ConnectorListener listener)
           Removes BufferDataListener type listener
protected  ReturnCode_t subscribeInterfaces(ConnectorProfileHolder cprof)
           Subscribe to the interface
protected  void unsubscribeInterfaces(ConnectorProfile connector_profile)
           Disconnect the interface connection
abstract  boolean write()
           Write data
 
Methods inherited from class jp.go.aist.rtm.RTC.port.PortBase
_publishInterfaces, _this, addProperty, appendInterface, appendProperty, checkPorts, connectNext, deleteInterface, disconnect_all, disconnect, disconnectNext, eraseConnectorProfile, findConnProfile, findConnProfileIndex, get_connector_profile, get_connector_profiles, get_port_profile, getName, getPortProfile, getPortRef, getProfile, getUUID, isEmptyId, isExistingConnId, notify_connect, notify_disconnect, setConnectionLimit, setName, setOnConnected, setOnConnectionLost, setOnDisconnected, setOnPublishInterfaces, setOnSubscribeInterfaces, setOnUnsubscribeInterfaces, setOwner, setPortRef, setUUID, updateConnectorProfile, updateConnectors
 
Methods inherited from class RTC.PortServicePOA
_all_interfaces, _invoke, _this
 
Methods inherited from class org.omg.PortableServer.Servant
_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_publishers

protected java.util.List<OutPortBase.Publisher> m_publishers

m_properties

protected Properties m_properties

m_connectors

protected java.util.Vector<OutPortConnector> m_connectors

m_providerTypes

protected java.util.Vector<java.lang.String> m_providerTypes

m_consumerTypes

protected java.util.Vector<java.lang.String> m_consumerTypes

m_listeners

protected ConnectorListeners m_listeners
Constructor Detail

OutPortBase

public OutPortBase(java.lang.String name,
                   java.lang.String data_type)
Constructor

Parameters:
name - Port name
data_type - Specify the data type used in the InPort object.
Method Detail

init

public void init(Properties prop)
Initializing properties

This operation initializes outport's properties.

Parameters:
prop - Property for setting ports

write

public abstract boolean write()
Write data

Write data to the port. Write the value, which was set to the bound variable, to the port.

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

properties

public Properties properties()
Get properties

This method gets properties in the port.

Returns:
Properties Properties

connectors

public final java.util.Vector<OutPortConnector> connectors()
Connector list

This operation returns connector list

Returns:
connector list

getConnectorProfiles

public java.util.Vector<ConnectorBase.ConnectorInfo> getConnectorProfiles()
ConnectorProfile list

This operation returns ConnectorProfile list

Returns:
connector list

getConnectorIds

public java.util.Vector<java.lang.String> getConnectorIds()
ConnectorId list

This operation returns ConnectorId list

Returns:
connector list

getConnectorNames

public java.util.Vector<java.lang.String> getConnectorNames()
Connector name list

This operation returns Connector name list

Returns:
Connector名のリスト connector name list

getConnectorById

public OutPortConnector getConnectorById(java.lang.String id)
Getting ConnectorProfile by ID

This operation returns Connector specified by ID.

Parameters:
id - Connector ID
Returns:
InPortConnector connector

getConnectorByName

OutPortConnector getConnectorByName(java.lang.String name)
Getting Connector by name

This operation returns Connector specified by name.

Parameters:
name - Connector ID
Returns:
OutPortConnector connector

getConnectorProfileById

public boolean getConnectorProfileById(java.lang.String id,
                                       ConnectorBase.ConnectorInfoHolder profh)
Getting ConnectorProfile by name

This operation returns ConnectorProfile specified by name

Parameters:
id - Connector ID
profh - ConnectorInfoHolder
Returns:
false specified ID does not exist

getConnectorProfileByName

public boolean getConnectorProfileByName(java.lang.String name,
                                         ConnectorBase.ConnectorInfoHolder profh)
Getting ConnectorProfile by name

This operation returns ConnectorProfile specified by name

Parameters:
name - Connector ID
profh - ConnectorInfoHolder
Returns:
false specified name does not exist

onConnect

public void onConnect(java.lang.String id,
                      PublisherBase publisher)

onConnect


onDisconnect

public void onDisconnect(java.lang.String id)

onDisconenct


connect

public ReturnCode_t connect(ConnectorProfileHolder connector_profile)
Connect the Port

This operation establishes connection according to the given ConnectionProfile inforamtion. This function is premised on calling from mainly application program or tools. To establish the connection among Ports of RT-Components, application programs must call this operation giving ConnectorProfile with valid values as an argument. Out of ConnectorProfile member variables, "name", "ports" and "properties" members shall be set valid data. "connector_id" shall be set as empty string value or valid string UUID value. ConnectorProfile::name that is connection identifier shall be any valid CORBA::string. ConnectorProfile::connector_id shall be set unique identifier (usually UUID is used) for all connections. Since UUID string value is usually set in the connect() function, caller should just set empty string. If the connect() is called with the same UUID as existing connection, this function returns PRECONDITION_NOT_MET error. However, in order to update the existing connection profile, the "connect()" operation with existing connector ID might be used as valid method by future extension ConnectorProfile::ports, which is sequence of RTC::PortService references, shall store usually two or more ports' references. As exceptions, the "connect()" operation might be called with only one reference in ConnectorProfile, in case of just getting interfaces information from the port, or connecting a special port (i.e. the peer port except RTC::PortService on CORBA). ConnectorProfile::properties might be used to give certain properties to the service interfaces associated with the port. The properties is a sequence variable with a pair of key string and Any type value. Although the A variable can store any type of values, it is not recommended except string. The following is the summary of the ConnectorProfile member to be set when this operation is called.

connect() operation will call the first port in the sequence of the ConnectorProfile. "noify_connect()"s perform cascaded call to the ports stored in the ConnectorProfile::ports by order. Even if errors are raised by intermediate notify_connect() operation, as long as ports' object references are valid, it is guaranteed that this cascaded call is completed in all the ports. If invalid or dead ports exist in the port's sequence, the ports are skipped and notify_connect() is called for the next valid port. connect() function returns RTC_OK if all the notify_connect() return RTC_OK. At this time the connection is completed. If notify_connect()s return except RTC_OK, connect() calls disconnect() operation with the connector_id to destruct the connection, and then it returns error code from notify_connect(). The ConnectorProfile argument of the connect() operation returns ConnectorProfile::connector_id and various information about service interfaces that is published by publishInterfaces() in the halfway ports. The connect() and halfway notify_connect() functions never change ConnectorProfile::(name, ports)

Specified by:
connect in interface PortServiceOperations
Overrides:
connect in class PortBase
Parameters:
connector_profile - The ConnectorProfile.
Returns:
The return code of ReturnCode_t type.

publishInterfaces

protected ReturnCode_t publishInterfaces(ConnectorProfileHolder cprof)
Publish interface information

This operation is pure virutal function that would be called at the beginning of the notify_connect() process sequence. In the notify_connect(), the following methods would be called in order.

This operation should create the new connection for the new connector_id, and should update the connection for the existing connection_id.

Specified by:
publishInterfaces in class PortBase
Parameters:
cprof - The connection profile information
Returns:
The return code of ReturnCode_t type.

subscribeInterfaces

protected ReturnCode_t subscribeInterfaces(ConnectorProfileHolder cprof)
Subscribe to the interface

This operation is pure virutal function that would be called at the middle of the notify_connect() process sequence. In the notify_connect(), the following methods would be called in order.

Specified by:
subscribeInterfaces in class PortBase
Parameters:
cprof - The connection profile information
Returns:
The return code of ReturnCode_t type.

unsubscribeInterfaces

protected void unsubscribeInterfaces(ConnectorProfile connector_profile)
Disconnect the interface connection

Disconnect the interface connection. Release all objects set in Consumer associated with given ConnectorProfile and unscribe the interface.

Specified by:
unsubscribeInterfaces in class PortBase
Parameters:
connector_profile - The connector profile

activateInterfaces

public void activateInterfaces()
Activate all Port interfaces

This operation activate all interfaces that is registered in the ports.

Specified by:
activateInterfaces in class PortBase

deactivateInterfaces

public void deactivateInterfaces()
Deactivate all Port interfaces

This operation deactivate all interfaces that is registered in the ports.

Specified by:
deactivateInterfaces in class PortBase

addConnectorDataListener

public void addConnectorDataListener(int type,
                                     ConnectorDataListenerT listener,
                                     boolean autoclean)
Adds ConnectorDataListener type listener

バッファ書き込みまたは読み出しイベントに関連する各種リスナを設定する。 設定できるリスナのタイプとコールバックイベントは以下の通り

リスナは ConnectorDataListener を継承し、以下のシグニチャを持つ operator() を実装している必要がある。

 ConnectorDataListener::
         operator()(const ConnectorProfile&, const cdrStream&)
 
デフォルトでは、この関数に与えたリスナオブジェクトの所有権は OutPortに移り、OutPort解体時もしくは、 removeConnectorDataListener() により削除時に自動的に解体される。 リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引 数に false を指定し、自動的な解体を抑制することができる。} This operation adds certain listeners related to buffer writing and reading events. The following listener types are available. Listeners should have the following function operator().

 ConnectorDataListener::
         operator()(const ConnectorProfile&, const cdrStream&)
 
The ownership of the given listener object is transferred to this OutPort object in default. The given listener object will be destroied automatically in the OutPort's dtor or if the listener is deleted by removeConnectorDataListener() function. If you want to keep ownership of the listener object, give "false" value to 3rd argument to inhibit automatic destruction.

Parameters:
type - A listener type
listener - A pointer to a listener object
autoclean - A flag for automatic listener destruction

addConnectorDataListener

public void addConnectorDataListener(int type,
                                     ConnectorDataListenerT listener)
Adds ConnectorDataListener type listener

バッファ書き込みまたは読み出しイベントに関連する各種リスナを設定する。 設定できるリスナのタイプとコールバックイベントは以下の通り

リスナは ConnectorDataListener を継承し、以下のシグニチャを持つ operator() を実装している必要がある。

 ConnectorDataListener::
         operator()(const ConnectorProfile&, const cdrStream&)
 
デフォルトでは、この関数に与えたリスナオブジェクトの所有権は OutPortに移り、OutPort解体時もしくは、 removeConnectorDataListener() により削除時に自動的に解体される。} This operation adds certain listeners related to buffer writing and reading events. The following listener types are available. Listeners should have the following function operator().

 ConnectorDataListener::
         operator()(const ConnectorProfile&, const cdrStream&)
 
The ownership of the given listener object is transferred to this OutPort object in default. The given listener object will be destroied automatically in the OutPort's dtor or if the listener is deleted by removeConnectorDataListener() function.

Parameters:
type - A listener type
listener - A pointer to a listener object

removeConnectorDataListener

public void removeConnectorDataListener(int type,
                                        ConnectorDataListenerT listener)
Removes ConnectorDataListener type listener

This operation removes a specified listener.

Parameters:
type - A listener type
listener - A pointer to a listener object

addConnectorListener

public void addConnectorListener(int type,
                                 ConnectorListener listener,
                                 boolean autoclean)
Adds ConnectorListener type listener

This operation adds certain listeners related to buffer writing and reading events. The following listener types are available.

Listeners should have the following function operator(). ConnectorListener::operator()(const ConnectorProfile&) The ownership of the given listener object is transferred to this OutPort object in default. The given listener object will be destroied automatically in the OutPort's dtor or if the listener is deleted by removeConnectorListener() function. If you want to keep ownership of the listener object, give "false" value to 3rd argument to inhibit automatic destruction.

Parameters:
type - A listener type
listener - A pointer to a listener object
autoclean - A flag for automatic listener destruction

addConnectorListener

public void addConnectorListener(int type,
                                 ConnectorListener listener)
Adds ConnectorListener type listener

This operation adds certain listeners related to buffer writing and reading events. The following listener types are available.

Listeners should have the following function operator(). ConnectorListener::operator()(const ConnectorProfile&) The ownership of the given listener object is transferred to this OutPort object in default. The given listener object will be destroied automatically in the OutPort's dtor or if the listener is deleted by removeConnectorListener() function.

Parameters:
type - A listener type
listener - A pointer to a listener object

removeConnectorListener

public void removeConnectorListener(int type,
                                    ConnectorListener listener)
Removes BufferDataListener type listener

This operation removes a specified listener.

Parameters:
type - A listener type
listener - listener A pointer to a listener object

configure

protected void configure()
Configureing outport

This operation configures the outport based on the properties.


initProviders

protected void initProviders()
OutPort provider initialization


initConsumers

protected void initConsumers()
InPort consumer initialization


createProvider

protected OutPortProvider createProvider(ConnectorProfileHolder cprof,
                                         Properties prop)
OutPort provider creation


createConsumer

protected InPortConsumer createConsumer(ConnectorProfileHolder cprof,
                                        Properties prop)
InPort consumer creation


createConnector

protected OutPortConnector createConnector(ConnectorProfileHolder cprof,
                                           Properties prop,
                                           InPortConsumer consumer)
OutPortPushConnector creation


createConnector

protected OutPortConnector createConnector(ConnectorProfileHolder cprof,
                                           Properties prop,
                                           OutPortProvider provider)
OutPortPullConnector creation


isLittleEndian

public boolean isLittleEndian()
Returns endian information

Returns:
If endian information is "Little", it is "True."