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  PortProfile m_profile
          当該ポートに関連付けられているPortProfileオブジェクトです。
protected static java.lang.String m_profile_mutex
           
protected  Logbuf rtcout
           
 
Constructor Summary
PortBase()
          デフォルトコンストラクタです。ポート名には空文字列が割り当てられます。
PortBase(java.lang.String name)
           Constructor
 
Method Summary
protected  ReturnCode_t _publishInterfaces()
           Publish interface information
 PortService _this()
          当該PortのCORBAオブジェクト参照を取得します。
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)
          ポート間の接続を行います。指定された接続プロファイルにしたがってポート間の接続を確立します。
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()
          当該ポートに関連したすべての接続を解除します。
 ReturnCode_t disconnect(java.lang.String connector_id)
          ポートの接続を解除します。このメソッドは、接続確立時に接続に対して与えられるコネクタIDに 対応するピア・ポートとの接続を解除します。
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)
          指定されたコネクタIDに対応する接続プロファイルを取得します。
 ConnectorProfile[] get_connector_profiles()
          ConnectorProfileリストを取得します。 ConnectorProfileはポート間の接続プロファイル情報を保持するクラスであり、 接続時にポート間で情報交換を行い、関連するすべてのポートで同一の値が保持されます。
 PortProfile get_port_profile()
          PortProfileを取得します。なお、PortProfileは次のメンバを持っています。 name [String型] Port名 interfaces [PortInterfaceProfile配列型] Port が保持するPortInterfaceProfileのシーケンス port_ref [Port型] Port自身のCORBAオブジェクト参照 connector_profile [ConnectorProfile配列型] Portが現在保持するConnectorProfileのシーケンス owner [RTObject型] このPortを所有するRTObjectのCORBAオブジェクト参照 properties [NameValue配列型] その他のプロパティ
 java.lang.String getName()
           Get the name of this Port
 PortProfile getPortProfile()
          [Local interface] PortProfileを取得します。
 PortService getPortRef()
          当該ポートのPortProfileが保持している、当該ポート自身のCORBAオブジェクト参照を取得します。
 PortProfile getProfile()
          当該ポートが保持しているPortProfileオブジェクトを取得します。
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 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)
          ポート名を設定します。指定されたポート名は、PortProfileのnameメンバに設定されます。
 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 setPortRef(PortService port_ref)
          指定されたポートCORBAオブジェクト参照を設定します。
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_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()

デフォルトコンストラクタです。ポート名には空文字列が割り当てられます。

Method Detail

_this

public PortService _this()

当該PortのCORBAオブジェクト参照を取得します。

Overrides:
_this in class PortServicePOA
Returns:
当該PortのCORBAオブジェクト参照

get_port_profile

public PortProfile get_port_profile()

PortProfileを取得します。なお、PortProfileは次のメンバを持っています。

Returns:
本ポートに関するPortProfileオブジェクト

getPortProfile

public final PortProfile getPortProfile()

[Local interface] PortProfileを取得します。

Returns:
本ポートに関するPortProfile

get_connector_profiles

public ConnectorProfile[] get_connector_profiles()

ConnectorProfileリストを取得します。 ConnectorProfileはポート間の接続プロファイル情報を保持するクラスであり、 接続時にポート間で情報交換を行い、関連するすべてのポートで同一の値が保持されます。

ConnectorProfileは以下のメンバを保持しています。

Returns:
このポートに関連するConnectorProfileオブジェクトの配列

get_connector_profile

public ConnectorProfile get_connector_profile(java.lang.String connector_id)

指定されたコネクタIDに対応する接続プロファイルを取得します。

Parameters:
connector_id - コネクタID
Returns:
指定されたコネクタIDに対応する接続プロファイル

connect

public ReturnCode_t connect(ConnectorProfileHolder connector_profile)

ポート間の接続を行います。指定された接続プロファイルにしたがってポート間の接続を確立します。

アプリケーションプログラム側は、幾つかのコンポーネントが持つ複数のポート間を接続したい場合、 適切な値を設定した接続プロファイルを引数として渡すことにより、関連するポート間の接続を確立できます。

本メソッドの呼び出しにあたっては、ConnectorProfileオブジェクトのメンバのうち、 次のものについて値を設定しておかねばなりません。

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

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)

ポートの接続を解除します。このメソッドは、接続確立時に接続に対して与えられるコネクタIDに 対応するピア・ポートとの接続を解除します。

Parameters:
connector_id - コネクタID
Returns:
ReturnCode_t型の戻り値

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()

当該ポートに関連したすべての接続を解除します。

Returns:
ReturnCode_t型の戻り値

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)

ポート名を設定します。指定されたポート名は、PortProfileのnameメンバに設定されます。

Parameters:
name - ポート名

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()

当該ポートが保持しているPortProfileオブジェクトを取得します。

Returns:
当該ポートが保持しているPortProfileオブジェクト

setPortRef

public void setPortRef(PortService port_ref)

指定されたポートCORBAオブジェクト参照を設定します。

本メソッドは、当該ポート自身のCORBAオブジェクト参照を設定するために用います。 当該ポートのCORBAオブジェクト参照以外は設定しないでください。

Parameters:
port_ref - 当該ポートのCORBAオブジェクト参照

getPortRef

public PortService getPortRef()

当該ポートのPortProfileが保持している、当該ポート自身のCORBAオブジェクト参照を取得します。

Returns:
当該ポートのCORBAオブジェクト参照

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)

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)

_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