|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
public interface ExtendedRequest
このインタフェースは、「RFC 2251」で定義されている LDAPv3 拡張操作の要求を表します。
ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
requestName [0] LDAPOID,
requestValue [1] OCTET STRING OPTIONAL }
この要求は、オブジェクト拡張子の文字列と任意の ASN.1 BER で符号化された値で構成されます。
このクラスのメソッドはサービスプロバイダで使用され、LDAP サーバーに送るビットを構築します。一般に、アプリケーションはこのインタフェースを実装するクラスだけを処理しており、特定の拡張操作の要求に応えて必要な情報をクラスに提供します。次に LDAPv3 拡張操作を実行するために、クラスは引数として、LdapContext.extendedOperation() メソッドにパスされます。
「時間取得」の拡張操作をサポートした LDAP サーバーを例にとります。LDAP サーバーは、GetTimeRequest および GetTimeResponse のクラスを次のように指定します。
public class GetTimeRequest implements ExtendedRequest {
public GetTimeRequest() {... };
public ExtendedResponse createExtendedResponse(String id,
byte[] berValue, int offset, int length)
throws NamingException {
return new GetTimeResponse(id, berValue, offset, length);
}
...
}
public class GetTimeResponse implements ExtendedResponse {
long time;
public GetTimeResponse(String id, byte[] berValue, int offset,
int length) throws NamingException {
time = ... // decode berValue to get time
}
public java.util.Date getDate() { return new java.util.Date(time) };
public long getTime() { return time };
...
}
プログラムはこれらのクラスを次のように使用します。
GetTimeResponse resp =
(GetTimeResponse) ectx.extendedOperation(new GetTimeRequest());
long time = resp.getTime();
ExtendedResponse,
LdapContext.extendedOperation(javax.naming.ldap.ExtendedRequest)| メソッドの概要 | |
|---|---|
ExtendedResponse |
createExtendedResponse(String id,
byte[] berValue,
int offset,
int length)
この要求に対応する応答オブジェクトを作成します。 |
byte[] |
getEncodedValue()
LDAP の拡張操作要求の ASN.1 BER で符号化された値を取得します。 |
String |
getID()
この要求のオブジェクトの識別子を検出します。 |
| メソッドの詳細 |
|---|
String getID()
byte[] getEncodedValue()
IllegalStateException - 要求が不十分または無効なデータおよび状態を含んでいるため、 符号化された値が検出されなかった場合
ExtendedResponse createExtendedResponse(String id,
byte[] berValue,
int offset,
int length)
throws NamingException
サービスプロバイダが拡張操作の要求を LDAP サーバーに送ったあと、このサーバーから応答を受け取ります。操作の要求が失敗すると、プロバイダは NamingException をスローします。操作が正常に終了すると、プロバイダはこのメソッドを応答に戻ったデータを使って呼び出します。拡張操作の要求に任意の ExtendedResponse インタフェースを実装するクラスを返すのが、このメソッドのジョブになります。
たとえば、Start TLS 拡張要求クラスは、Start TLS 拡張応答の処理方法を認識するために、ExtendedResponse を実装するクラスを作成します。
id - 応答コントロールの null の可能性があるオブジェクト識別子berValue - null の可能性のある応答コントロールの ASN.1 BER で符号化された値
これは、応答値のタグおよび長さを含むそのまま (raw) の BER バイトで表示されます。ただし、応答 OID は含まない。offset - 使用バイトの berValue の開始位置length - berValue の使用バイト数
NamingException - エラーのため拡張応答が 作成できない場合ExtendedResponse
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。