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

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

public abstract class PortBase
extends PortServicePOA

Port base class

This class is a base class of RTC::Port. RTC::Port inherits a concept of RT-Component, and can be regarded as almost the same as it. In the concept of RT-Component, Port is attached to the component, can mediate interaction between other components and usually is associated with some interfaces. Component can provide or require interface for outside via Port, and the Port plays a role to manage the connection. Concrete class of Port assumes to be usually created at the same time that RT-Component's instance is created, be registerd to RT-Component after provided and required interfaces are registerd, and function as accessible Port from outside. RTC::Port provides the following operations as CORBA interface:

This class provides implementations of these operations. In these operations, as for get_port_profile(), get_connector_profiles(), get_connector_profile(), connect(), disconnect() and disconnect_all(), since their behaviors especially need not to be change in subclass, overriding is not recommended. As for notify_connect() and notify_disconnect(), you may have to modify behavior according to the kind of interfaces that subclass provides and requires, however it is not recommended these are overriden directly. In the section of notify_connect() and notify_disconnect() as described below, it is recommended that you modify behavior by overriding the protected function related to these functions.


Nested Class Summary
protected  class PortBase.connect_func
          ポート接続のためのヘルパクラスです。
protected  class PortBase.disconnect_all_func
          ポート接続解除のためのヘルパクラスです。
protected  class PortBase.disconnect_func
          ポート接続解除のためのヘルパクラスです。
protected  class PortBase.find_conn_id
          指定された接続IDを持つ接続プロファイルを検索するためのヘルパクラスです。
protected  class PortBase.find_interface
          指定されたインスタンス名と属性を持つインタフェースを検索するためのヘルパクラスです。
protected  class PortBase.find_port_ref
          指定されたPortオブジェクトと同じCORBAオブジェクト参照を持つPortオブジェクトを 検索するためのヘルパクラスです。
 
Field Summary
protected  int m_connectionLimit
           The maximum number of connections
protected static java.lang.String m_connectorsMutex
           
protected  PortService m_objref
          当該ポートのCORBAオブジェクト参照です。
protected  ConnectionCallback m_onConnected
           
protected  ConnectionCallback m_onConnectionLost
           
protected  ConnectionCallback m_onDisconnected
           
protected  ConnectionCallback m_onPublishInterfaces
          Callback functor objects
protected  ConnectionCallback m_onSubscribeInterfaces
           
protected  ConnectionCallback m_onUnsubscribeInterfaces
           
protected  java.lang.String m_ownerInstanceName
           
protected  PortConnectListeners m_portconnListeners
           PortConnectListener holder
protected  PortProfile m_profile
          当該ポートに関連付けられているPortProfileオブジェクトです。
protected static java.lang.String m_profile_mutex
           
protected  Logbuf rtcout
           
 
Constructor Summary
PortBase()
           Default constructor
PortBase(java.lang.String name)
           Constructor
 
Method Summary
protected  ReturnCode_t _publishInterfaces()
           Publish interface information
 PortService _this()
           Gets CORBA object referense of this PortService
abstract  void activateInterfaces()
           Activate all Port interfaces
protected
<T> void
addProperty(java.lang.String key, T value, java.lang.Class<T> klass)
          当該ポートが持つPortProfile内のpropertiesメンバに、 指定されたキーと値を持つNameValueオブジェクトを追加します。
protected  boolean appendInterface(java.lang.String instance_name, java.lang.String type_name, PortInterfacePolarity polarity)
          当該ポートが持つPortProfile内に含まれるPortInterfaceProfileメンバに、 引数で指定された情報を追加します。この情報は、get_port_profile()メソッドによって 得られるPortProfileにうち、PortInterfaceProfileの値を変更するのみであり、 実際にインタフェースを提供したり要求したりする場合には、サブクラス側で publishInterface(), subscribeInterface()などのメソッドを適切にオーバライドし、 インタフェースの提供や要求処理を行う必要があります。
protected  void appendProperty(java.lang.String key, java.lang.String value)
           Add NameValue data to PortProfile's properties
protected  boolean checkPorts(PortService[] ports)
           
 ReturnCode_t connect(ConnectorProfileHolder connector_profile)
           [CORBA interface] Connect the Port
protected  ReturnCode_t connectNext(ConnectorProfileHolder connector_profile)
           Call notify_connect() of the next Port
abstract  void deactivateInterfaces()
           Deactivate all Port interfaces
protected  boolean deleteInterface(java.lang.String instance_name, PortInterfacePolarity polarity)
          指定されたインスタンス名と属性を持つインタフェースを、当該ポートが持つPortProfile内の PortInterfaceProfileから削除します。
 ReturnCode_t disconnect_all()
           [CORBA interface] Disconnect the All Ports
 ReturnCode_t disconnect(java.lang.String connector_id)
           [CORBA interface] Disconnect the Port
protected  ReturnCode_t disconnectNext(ConnectorProfile connector_profile)
          当該ポートの次のポートに対して接続解除通知を行います。
protected  boolean eraseConnectorProfile(java.lang.String connector_id)
          指定された接続IDに対応する接続プロファイルを、当該ポートのPortProfileから削除します。
protected  ConnectorProfile findConnProfile(java.lang.String id)
          指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトが取得されます。
protected  int findConnProfileIndex(java.lang.String id)
          指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトのシーケンス内でのインデクスが取得されます。
 ConnectorProfile get_connector_profile(java.lang.String connector_id)
           [CORBA interface] Get the ConnectorProfile
 ConnectorProfile[] get_connector_profiles()
           [CORBA interface] Get the ConnectorProfileList of the Port
 PortProfile get_port_profile()
           [CORBA interface] Get the PortProfile of the Port
 java.lang.String getName()
           Get the name of this Port
 PortProfile getPortProfile()
           Get the PortProfile of the Port
 PortService getPortRef()
           Get the object reference of this Port
 PortProfile getProfile()
           Get the PortProfile of the Port
protected  java.lang.String getUUID()
          UUIDを生成します。
protected  boolean isEmptyId(ConnectorProfile connector_profile)
          指定されたConnectorProfileオブジェクト内のconnector_idメンバが空かどうか判定します。
protected  boolean isExistingConnId(java.lang.String id)
          指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを判定します。
 ReturnCode_t notify_connect(ConnectorProfileHolder connector_profile)
           [CORBA interface] Notify the Ports connection
 ReturnCode_t notify_disconnect(java.lang.String connector_id)
           [CORBA interface] Notify the Ports disconnection
protected  void onConnected(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onConnectNextport(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onDisconnected(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onDisconnectNextport(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onNotifyConnect(java.lang.String portname, ConnectorProfile profile)
           
protected  void onNotifyDisconnect(java.lang.String portname, ConnectorProfile profile)
           
protected  void onPublishInterfaces(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onSubscribeInterfaces(java.lang.String portname, ConnectorProfile profile, ReturnCode_t ret)
           
protected  void onUnsubscribeInterfaces(java.lang.String portname, ConnectorProfile profile)
           
protected abstract  ReturnCode_t publishInterfaces(ConnectorProfileHolder connector_profile)
          Interface情報を公開します。 このメソッドは、notify_connect()処理シーケンスの始めに呼び出されるテンプレートメソッドです。
protected  void setConnectionLimit(int limit_value)
           Set the maximum number of connections
 void setName(java.lang.String name)
           Set the name of this Port
 void setOnConnected(ConnectionCallback on_connected)
           Setting callback called on connection established
 void setOnConnectionLost(ConnectionCallback on_connection_lost)
           
 void setOnDisconnected(ConnectionCallback on_disconnected)
           Setting callback called on disconnected
 void setOnPublishInterfaces(ConnectionCallback on_publish)
           Setting callback called on publish interfaces
 void setOnSubscribeInterfaces(ConnectionCallback on_subscribe)
           Setting callback called on publish interfaces
 void setOnUnsubscribeInterfaces(ConnectionCallback on_unsubscribe)
           Setting callback called on unsubscribe interfaces
 void setOwner(RTObject owner)
           Set the owner RTObject of the Port
 void setPortConnectListenerHolder(PortConnectListeners portconnListeners)
           Setting PortConnectListener holder
 void setPortRef(PortService port_ref)
           Set the object reference of this Port
protected  void setUUID(ConnectorProfileHolder connector_profile)
          UUIDを生成し、指定されたConnectorProfileオブジェクトのconnector_idメンバに設定します。
protected abstract  ReturnCode_t subscribeInterfaces(ConnectorProfileHolder connector_profile)
          Interface 情報を公開します。
protected abstract  void unsubscribeInterfaces(ConnectorProfile connector_profile)
          Interfaceの接続を解除します。
protected  void updateConnectorProfile(ConnectorProfile connector_profile)
          指定された接続プロファイルを、当該ポートのPortProfileに追加します。 同一の接続IDを持つ接続プロファイルがすでにある場合は、その内容を上書きします。
protected  void 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_profile

protected PortProfile m_profile

当該ポートに関連付けられているPortProfileオブジェクトです。


m_profile_mutex

protected static java.lang.String m_profile_mutex

m_connectorsMutex

protected static java.lang.String m_connectorsMutex

m_objref

protected PortService m_objref

当該ポートのCORBAオブジェクト参照です。


rtcout

protected Logbuf rtcout

m_onPublishInterfaces

protected ConnectionCallback m_onPublishInterfaces

Callback functor objects


m_onSubscribeInterfaces

protected ConnectionCallback m_onSubscribeInterfaces

m_onConnected

protected ConnectionCallback m_onConnected

m_onUnsubscribeInterfaces

protected ConnectionCallback m_onUnsubscribeInterfaces

m_onDisconnected

protected ConnectionCallback m_onDisconnected

m_onConnectionLost

protected ConnectionCallback m_onConnectionLost

m_portconnListeners

protected PortConnectListeners m_portconnListeners
PortConnectListener holder

Holders of PortConnectListeners


m_connectionLimit

protected int m_connectionLimit

The maximum number of connections


m_ownerInstanceName

protected java.lang.String m_ownerInstanceName
Constructor Detail

PortBase

public PortBase(java.lang.String name)
Constructor

The constructor of the ProtBase class is given the name of this Portand initialized. At the same time, the PortBase activates itself as CORBA object and stores its object reference to the PortProfile's * port_ref member.

Parameters:
name - The name of Port (The default value:"")

PortBase

public PortBase()
Default constructor

Empty string is assigned port name.

Method Detail

_this

public PortService _this()
Gets CORBA object referense of this PortService

Overrides:
_this in class PortServicePOA
Returns:
CORBA object referense of this OpenRTM.OutPortCdr

get_port_profile

public PortProfile get_port_profile()
[CORBA interface] Get the PortProfile of the Port

This operation returns the PortProfile of the Port. Since this function is CORBA operation, callers have responsibility to destruction of the returned PortProfile object according to the CORBA memory management rules. PortProfile struct has the following members:

post:This function never changes the state of the object.

Returns:
PortProfile of the Port

getPortProfile

public final PortProfile getPortProfile()
Get the PortProfile of the Port

This function is a const function that returns a const reference of the PortProfile stored in this Port. post:This function never changes the state of the object.

Returns:
PortProfile

get_connector_profiles

public ConnectorProfile[] get_connector_profiles()
[CORBA interface] Get the ConnectorProfileList of the Port

This operation returns a list of the ConnectorProfiles of the Port. Since this function is CORBA operation, callers have responsibility to destruction of the returned ConnectorProfileList object according to the CORBA memory management rules. ConnectorProfile includes the connection information that describes relation between (among) Ports, and Ports exchange the ConnectionProfile on connection process and hold the same information in every Port. ConnectionProfile has the following members:

post:This function never changes the state of the object.

Returns:
ConnectorProfileList of the Port

get_connector_profile

public ConnectorProfile get_connector_profile(java.lang.String connector_id)
[CORBA interface] Get the ConnectorProfile

This operation returns the ConnectorProfiles specified connector_id. Since this function is CORBA operation, callers have responsibility to destruction of the returned ConnectorProfile object according to the CORBA memory management rules. If ConnectorProfile with specified connector_id is not included, empty ConnectorProfile is returned. post:This function never changes the state of the object.

Parameters:
connector_id - ID of the ConnectorProfile
Returns:
the ConnectorProfile identified by the connector_id

connect

public ReturnCode_t connect(ConnectorProfileHolder connector_profile)
[CORBA interface] 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. Preconditioin:


notify_connect

public ReturnCode_t notify_connect(ConnectorProfileHolder connector_profile)
[CORBA interface] Notify the Ports connection

This operation is usually called from other ports' connect() or notify_connect() operations when connection between ports is established. This function is not premised on calling from other functions or application programs. According to the template method pattern, the notify_connect() calls "publishInterfaces()" and "subsctiveInterfaces()" functions, which are premised on implementing in the subclasses. The processing sequence is as follows. - publishInterfaces(): Publishing interface information - connectNext(): Calling notify_connect() of the next port - subscribeInterfaces(): Subscribing interface information - Storing connection profile According to the order of port's references stored in the ConnectorProfile::ports, publishing interface information to all the ports and subscription interface information from all the ports is performed by "notify_connect()"s. This cascaded call never aborts in the halfway operations, and calling sequence shall be completed for all the ports.

Precondition:
notify_connect() calls notify_connect() for the port's reference that is stored in next of this port's reference in the sequence of the ConnectorProfile::ports. Therefore the reference of this port shall be stored in the ConnectorProfile::ports. If this port's reference is not stored in the sequence, BAD_PARAMETER error will be returned, except the return code is overwritten by other operations. UUID shall be set to ConnectorProfile::connector_id as a unique identifier when this operation is called. Usually, connector_id is given by a connect() function and, the behavior is undefined in the case of a null character.

Postcondition:
ConnectorProfile::name, ConnectorProfile::connector_id, ConnectorProfile::ports are invariant, and they are never rewritten by notify_connect() operations. In order to transfer interface information to other ports, interface property information is stored into the ConnectorProfile::properties. At the end of notify_connect() operation for the first port stored in the ConnectorProfile::ports sequence, the related ports' notify_connect() invocations complete. Even if errors are raised at the halfway of publishInterfaces(), connectNext(), subscribeInterfaces() and storing process of ConnectorProfile, error codes are saved and the first error is returned.

Parameters:
connector_profile - ConnectorProfileHolder
Returns:
ReturnCode_t The return code of ReturnCode_t type.

disconnect

public ReturnCode_t disconnect(java.lang.String connector_id)
[CORBA interface] Disconnect the Port

This operation destroys connection between this port and the peer port according to given connector_id. Usually connector_id should be a UUID string that is unique in the system. And the connection, which is established by connect()/notify_connect() functions, is identified by the ConnectorProfile::connector_id. Precondition

Parameters:
connector_id - The ID of the ConnectorProfile.
Returns:
ReturnCode_t The return code of ReturnCode_t type.

notify_disconnect

public ReturnCode_t notify_disconnect(java.lang.String connector_id)
[CORBA interface] Notify the Ports disconnection

This operation is invoked between Ports internally when the connection is destroied. Generally it is not premised on calling from application programs or RTC objects except Port object. According to the template method pattern, the notify_disconnect() calls unsubsctiveInterfaces() function, which are premised on implementing in the subclasses. The processing sequence is as follows. - Searching ConnectorProfile - Calling notify_disconnect() for the next port - Unsubscribing interfaces - Deleting ConnectorProfile notify_disconnect() notifies disconnection to all the ports by cascaded call to the stored ports in the ConnectorProfile::ports in order.

Precondition:
The port shall store the ConnectorProfile having same id with connector_id.

Postcondition:
If ConnectorProfile of same ID with connector_id does not exist, it returns BAD_PARAMETER error. For the cascaded call, this operation calls noify_disconnect() for the port that is stored in the next of this port in the ConnectorProfile::ports. If the operation call raises exception for some failure, it tries to call notify_disconnect() and skips until the operation succeeded. If none of operation call succeeded, it returns RTC_ERROR. At the end of notify_disconnect() operation for the first port stored in the ConnectorProfile::ports sequence, the related ports' notify_disconnect() invocations complete.

Parameters:
connector_id - The ID of the ConnectorProfile.
Returns:
The return code of ReturnCode_t type.

disconnect_all

public ReturnCode_t disconnect_all()
[CORBA interface] Disconnect the All Ports

This operation destroys all connections associated with this Port.

Returns:
ReturnCode_t The return code of ReturnCode_t type.

activateInterfaces

public abstract void activateInterfaces()
Activate all Port interfaces

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


deactivateInterfaces

public abstract void deactivateInterfaces()
Deactivate all Port interfaces

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


setName

public void setName(java.lang.String name)
Set the name of this Port

This operation sets the name of this Port. The given Port's name is applied to Port's PortProfile.name.

Parameters:
name - The name of this Port.

getName

public final java.lang.String getName()
Get the name of this Port

This operation returns the name of this Port.

Returns:
The name of this Port.

getProfile

public final PortProfile getProfile()
Get the PortProfile of the Port

This operation returns const reference of the PortProfile.

Returns:
PortProfile of the Port

setPortRef

public void setPortRef(PortService port_ref)
Set the object reference of this Port

This operation sets the object reference itself to the Port's PortProfile.

Parameters:
port_ref - port_ref The object reference of this Port.

getPortRef

public PortService getPortRef()
Get the object reference of this Port

This operation returns the object reference that is stored in the Port's PortProfile.

Returns:
{`.en The object reference of this Port.}

setOwner

public void setOwner(RTObject owner)
Set the owner RTObject of the Port

This operation sets the owner RTObject of this Port.

Parameters:
owner - The owner RTObject's reference of this Port

setOnPublishInterfaces

public void setOnPublishInterfaces(ConnectionCallback on_publish)

Setting callback called on publish interfaces

This operation sets a functor that is called after publishing interfaces process when connecting between ports.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called after calling publishInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of publishInterfaces() function. Although by using this functor, you can modify the ConnectorProfile published by publishInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.

Parameters:
on_publish - ConnectionCallback's subclasses

setOnSubscribeInterfaces

public void setOnSubscribeInterfaces(ConnectionCallback on_subscribe)

Setting callback called on publish interfaces

This operation sets a functor that is called before subscribing interfaces process when connecting between ports.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called before calling subscribeInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of subscribeInterfaces() function. Although by using this functor, you can modify ConnectorProfile argument for subscribeInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.

Parameters:
on_subscribe - ConnectionCallback's subclasses

setOnConnected

public void setOnConnected(ConnectionCallback on_connected)

Setting callback called on connection established

This operation sets a functor that is called when connection between ports established.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called only when notify_connect() function successfully returns. In case of error, the functor will not be called.

Since this functor is called with ConnectorProfile argument that is same as out-parameter of notify_connect() function, you can get all the information of published interfaces of related ports in the connection. Although by using this functor, you can modify ConnectorProfile argument for out-paramter of notify_connect(), the modification should be done carefully for fear of causing connection inconsistency.

Parameters:
on_connected - ConnectionCallback's subclasses

setOnUnsubscribeInterfaces

public void setOnUnsubscribeInterfaces(ConnectionCallback on_unsubscribe)

Setting callback called on unsubscribe interfaces

This operation sets a functor that is called before unsubscribing interfaces process when disconnecting between ports.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called before calling unsubscribeInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of unsubscribeInterfaces() function. Although by using this functor, you can modify ConnectorProfile argument for unsubscribeInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.

Parameters:
on_unsubscribe - ConnectionCallback's subclasses

setOnDisconnected

public void setOnDisconnected(ConnectionCallback on_disconnected)

Setting callback called on disconnected

This operation sets a functor that is called when connection between ports is destructed.

Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.

The callback functor is called just before notify_disconnect() that is disconnection execution function returns.

This functor is called with argument of corresponding ConnectorProfile. Since this ConnectorProfile will be destructed after calling this functor, modifications never affect others.

Parameters:
on_disconnected - ConnectionCallback's subclasses

setOnConnectionLost

public void setOnConnectionLost(ConnectionCallback on_connection_lost)

setPortConnectListenerHolder

public void setPortConnectListenerHolder(PortConnectListeners portconnListeners)
Setting PortConnectListener holder

This operation sets a functor that is called when connection of this port does lost.

Parameters:
portconnListeners - a pointer to ConnectionCallback's subclasses

publishInterfaces

protected abstract ReturnCode_t publishInterfaces(ConnectorProfileHolder connector_profile)

Interface情報を公開します。 このメソッドは、notify_connect()処理シーケンスの始めに呼び出されるテンプレートメソッドです。

notify_connect()内では、以下の順にテンプレートメソッドが呼び出されて接続処理が行われます。

  1. publishInterfaces()
  2. connectNext()
  3. subscribeInterfaces()
  4. updateConnectorProfile()

具象Portクラスでは、このメソッドをオーバーライドし、引数として与えられた ConnectorProfileに従って処理を行い、パラメータが不適切であれば、ReturnCode_t型の エラーコードを返します。

通常、publishInterafaces()内においては、このポートに属するインターフェースに関する情報を ConnectorProfileに対して適切に設定し、他のポートに通知しなければなりません。 また、このメソッドが呼び出される段階では、他のポートのInterfaceに関する情報は すべては含まれていないので、他のポートのInterfaceを取得する処理はsubscribeInterfaces()内で 行われるべきです。

このメソッドは、新規のコネクタIDに対しては接続の生成が、既存のコネクタIDに対しては更新が 適切に行われる必要があります。

Parameters:
connector_profile - 接続プロファイル
Returns:
ReturnCode_t型の戻り値

connectNext

protected ReturnCode_t connectNext(ConnectorProfileHolder connector_profile)
Call notify_connect() of the next Port

This operation calls the notify_connect() of the next Port's that stored in ConnectorProfile's port_ref sequence.

Parameters:
connector_profile - The connection profile information
Returns:
The return code of ReturnCode_t type.

disconnectNext

protected ReturnCode_t disconnectNext(ConnectorProfile connector_profile)

当該ポートの次のポートに対して接続解除通知を行います。

ConnectorProfile内に設定されているPortのシーケンスを調べて、 当該Portの次のPortを特定し、そのPortに対してnotify_disconnect()を呼び出します。

Parameters:
connector_profile - 接続プロファイル

subscribeInterfaces

protected abstract ReturnCode_t subscribeInterfaces(ConnectorProfileHolder connector_profile)

Interface 情報を公開します。

このメソッドは、notify_connect()処理シーケンスの中間に呼び出されるテンプレートメソッドです。 notify_connect()では、

  1. publishInterfaces()
  2. connectNext()
  3. subscribeInterfaces()
  4. updateConnectorProfile()
の順にprotectedメソッドが呼び出されて接続処理が行われます。

このメソッドの処理は、新規のconnector_idに対しては接続の生成が適切に行われる必要があります。
また、既存のconnector_idに対しては更新が適切に行われる必要があります。

Parameters:
connector_profile - 接続プロファイル情報
Returns:
ReturnCode_t 戻り値

unsubscribeInterfaces

protected abstract void unsubscribeInterfaces(ConnectorProfile connector_profile)

Interfaceの接続を解除します。

このメソッドは、notify_disconnect()処理シーケンスの終わりに呼び出されるテンプレートメソッドです。 notify_disconnect()では、

  1. disconnectNext()
  2. unsubscribeInterfaces()
  3. eraseConnectorProfile()
の順にprotectedメソッドが呼び出されて接続解除処理が行われます。

具象クラスでは、このメソッドをオーバーライドし、引数として 与えられた ConnectorProfile に従い接続解除処理を行います。

Parameters:
connector_profile - 接続プロファイル情報

isEmptyId

protected boolean isEmptyId(ConnectorProfile connector_profile)

指定されたConnectorProfileオブジェクト内のconnector_idメンバが空かどうか判定します。

Returns:
空であればtrueを、さもなくばfalseを返します。

getUUID

protected java.lang.String getUUID()

UUIDを生成します。

Returns:
生成されたUUID

setUUID

protected void setUUID(ConnectorProfileHolder connector_profile)

UUIDを生成し、指定されたConnectorProfileオブジェクトのconnector_idメンバに設定します。

Parameters:
connector_profile - 設定先となるConnectorProfileオブジェクト

isExistingConnId

protected boolean isExistingConnId(java.lang.String id)

指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを判定します。

Returns:
存在すればtrueを、さもなくばfalseを返します。

findConnProfile

protected ConnectorProfile findConnProfile(java.lang.String id)

指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトが取得されます。

Parameters:
id - 接続ID
Returns:
指定した接続IDを持つConnectorProfileオブジェクトが見つかった場合は、 そのオブジェクトを返します。
見つからない場合は、空のConnectorProfileオブジェクトを返します。

findConnProfileIndex

protected int findConnProfileIndex(java.lang.String id)

指定された接続IDを持つ接続プロファイルが、当該ポートのPortProfileに設定されている ConnectorProfileオブジェクトシーケンス内に存在するかどうかを調べ、存在する場合は そのConnectorProfileオブジェクトのシーケンス内でのインデクスが取得されます。

Returns:
指定した接続IDを持つConnectorProfileオブジェクトが見つかった場合は、 そのオブジェクトのシーケンス内インデクスを返します。
見つからない場合は、-1を返します。

updateConnectorProfile

protected void updateConnectorProfile(ConnectorProfile connector_profile)

指定された接続プロファイルを、当該ポートのPortProfileに追加します。 同一の接続IDを持つ接続プロファイルがすでにある場合は、その内容を上書きします。

Parameters:
connector_profile - 追加もしくは更新する接続プロファイル

eraseConnectorProfile

protected boolean eraseConnectorProfile(java.lang.String connector_id)

指定された接続IDに対応する接続プロファイルを、当該ポートのPortProfileから削除します。

Parameters:
connector_id - 削除対象となる接続プロファイルの接続ID
Returns:
削除された場合はtrueを返します。
また、指定された接続IDの接続プロファイルが見つからない場合はfalseを返します。

appendInterface

protected boolean appendInterface(java.lang.String instance_name,
                                  java.lang.String type_name,
                                  PortInterfacePolarity polarity)

当該ポートが持つPortProfile内に含まれるPortInterfaceProfileメンバに、 引数で指定された情報を追加します。この情報は、get_port_profile()メソッドによって 得られるPortProfileにうち、PortInterfaceProfileの値を変更するのみであり、 実際にインタフェースを提供したり要求したりする場合には、サブクラス側で publishInterface(), subscribeInterface()などのメソッドを適切にオーバライドし、 インタフェースの提供や要求処理を行う必要があります。

なお、インタフェース(のインスタンス)名は、ポート内で一意でなければなりません。

Parameters:
instance_name - インタフェースのインスタンス名
type_name - インタフェースの型名称
polarity - インタフェースの属性(提供インタフェースまたは要求インタフェース)
Returns:
正常に登録できた場合はtrueを返します。 また、同名のインタフェースがすでに登録済みの場合はfalseを返します。

deleteInterface

protected boolean deleteInterface(java.lang.String instance_name,
                                  PortInterfacePolarity polarity)

指定されたインスタンス名と属性を持つインタフェースを、当該ポートが持つPortProfile内の PortInterfaceProfileから削除します。

Parameters:
instance_name - 削除対象インタフェースのインスタンス名
polarity - 削除対象インタフェースの属性
Returns:
正常に削除できた場合はtrueを返します。 また、該当するインタフェースが見つからない場合はfalseを返します。

addProperty

protected <T> void addProperty(java.lang.String key,
                               T value,
                               java.lang.Class<T> klass)

当該ポートが持つPortProfile内のpropertiesメンバに、 指定されたキーと値を持つNameValueオブジェクトを追加します。

Parameters:
key - キー
value - 値

appendProperty

protected void appendProperty(java.lang.String key,
                              java.lang.String value)

Add NameValue data to PortProfile's properties

Add NameValue data to PortProfile's properties. Type of additional data is specified by ValueType.

Parameters:
key - The name of properties
value - The value of properties

updateConnectors

protected void updateConnectors()

checkPorts

protected boolean checkPorts(PortService[] ports)

onNotifyConnect

protected void onNotifyConnect(java.lang.String portname,
                               ConnectorProfile profile)

onNotifyDisconnect

protected void onNotifyDisconnect(java.lang.String portname,
                                  ConnectorProfile profile)

onUnsubscribeInterfaces

protected void onUnsubscribeInterfaces(java.lang.String portname,
                                       ConnectorProfile profile)

onPublishInterfaces

protected void onPublishInterfaces(java.lang.String portname,
                                   ConnectorProfile profile,
                                   ReturnCode_t ret)

onConnectNextport

protected void onConnectNextport(java.lang.String portname,
                                 ConnectorProfile profile,
                                 ReturnCode_t ret)

onSubscribeInterfaces

protected void onSubscribeInterfaces(java.lang.String portname,
                                     ConnectorProfile profile,
                                     ReturnCode_t ret)

onConnected

protected void onConnected(java.lang.String portname,
                           ConnectorProfile profile,
                           ReturnCode_t ret)

onDisconnectNextport

protected void onDisconnectNextport(java.lang.String portname,
                                    ConnectorProfile profile,
                                    ReturnCode_t ret)

onDisconnected

protected void onDisconnected(java.lang.String portname,
                              ConnectorProfile profile,
                              ReturnCode_t ret)

_publishInterfaces

protected ReturnCode_t _publishInterfaces()

Publish interface information

Publish interface information.

Returns:
The return code of ReturnCode_t type

setConnectionLimit

protected void setConnectionLimit(int limit_value)

Set the maximum number of connections

Parameters:
limit_value - The maximum number of connections