UDDI ノードの構成プロパティーの管理
UDDI レジストリー管理インターフェースを使用して、構成プロパティーを設定することにより、UDDI ノードのランタイムの振る舞いを管理することができます。
UDDI ノードのランタイムの振る舞いは、
いくつかの構成プロパティーの設定で決まります。UddiNode MBean では、構成プロパティーを検査して更新するための以下の操作を提供します。
- getProperties
- getProperty
- updateProperty
- updateProperties
上記操作の実例については、WebSphere® Application Server のサンプル集で、UDDI レジストリー・サンプルの ManagePropertiesSample クラスを参照してください。
- getProperties
- すべての構成プロパティーの集合を、
ConfigurationProperty オブジェクトとして戻します。
- getProperties 操作を呼び出します。
List properties = uddiNode.getProperties();
- 各集合のメンバーを ConfigurationProperty オブジェクトにキャストします。
if (properties != null) { for (Iterator iter = properties.iterator(); iter.hasNext();) { ConfigurationProperty property = (ConfigurationProperty) iter.next(); System.out.println(property); } }
ConfigurationProperty オブジェクトが戻された場合は、ID、値、型などの属性を検査することができます。さらに、プロパティーが読み取り専用かどうか、あるいは初期化が必要かどうかを判断し、名前や説明のメッセージ・キーを取得できます。例えば、toString メソッドを呼び出した場合は、以下の例のような結果が戻されます。ConfigurationProperty id: operatorNodeIDValue nameKey: property.name.operatorNodeIDValue descriptionKey: property.desc.operatorNodeIDValue type: java.lang.String value: uddi:capnscarlet:capnscarlet:server1:default unitsKey: readOnly: true required: true usingMessageKeys: false validValues: none
nameKey 値 および descriptionKey 値を使用すると、サンプル・パッケージ内の messages.properties リソースから、 指定するロケール用に変換された名前と説明を検索することが できます。
- getProperties 操作を呼び出します。
- getProperty
- 指定した ID の ConfigurationProperty オブジェクトを戻します。
有効なプロパティー ID が、それに対応するプロパティーの目的の説明とともに、
PropertyConstants で指定されます。
- getProperty 操作を呼び出します。
ConfigurationProperty property = uddiNode.getProperty(PropertyConstants.DATABASE_MAX_RESULT_COUNT);
- プロパティーの値を取得する際に、オブジェクトを戻す getValue メソッドを使用できますが、この場合は、プロパティーが整数型であるため、getIntegerValue という便利なメソッドを使用して値を取得する方が簡単です。
int maxResults = property.getIntegerValue();
- getProperty 操作を呼び出します。
- updateProperty
- 指定した ID の ConfigurationProperty オブジェクトの値を更新します。
有効なプロパティー ID が、それに対応するプロパティーの目的の説明とともに、
PropertyConstants で指定されます。ConfigurationProperty オブジェクトで setter メソッドを呼び出すことはできますが、
UDDI ノードでは、この値だけが更新されます。プロパティーを更新するには、通常、以下のステップを使用します。
- ConfigurationProperty オブジェクトを作成し、その ID を設定します。
ConfigurationProperty defaultLanguage = new ConfigurationProperty(); defaultLanguage.setId(PropertyConstants.DEFAULT_LANGUAGE);
- 値を設定します。
defaultLanguage.setStringValue("ja");
- updateProperty 操作を呼び出します。
uddiNode.updateProperty(defaultLanguage);
- ConfigurationProperty オブジェクトを作成し、その ID を設定します。
- updateProperties
- 一度の要求で複数の ConfigurationProperty オブジェクトを更新します。
updateProperty 操作の場合と同様に、ConfigurationProperty オブジェクトをセットアップします。
- 更新済みのプロパティーをリストに追加します。
List updatedProperties = new ArrayList(); updatedProperties.add(updatedProperty1); updatedProperties.add(updatedProperty2);
- updateProperties 操作を呼び出します。
uddiNode.updateProperties(updatedProperties);
- 更新済みのプロパティーをリストに追加します。