|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.unboundid.ldap.sdk.Control
com.unboundid.ldap.sdk.unboundidds.controls.RouteToServerRequestControl
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class RouteToServerRequestControl
NOTE: This class is part of the Commercial Edition of the UnboundID LDAP SDK for Java. It is not available for use in applications that include only the Standard Edition of the LDAP SDK, and is not supported for use in conjunction with non-UnboundID products.This class provides a request control which may be used to request that the associated request be routed to a specific server. It is primarily intended for use when the request will pass through a Directory Proxy Server to indicate that which backend server should be used to process the request. The server ID for the server to use may be obtained using the
GetServerIDRequestControl
.
GetServerIDResponseControl
with the server ID of the server that was
used to process the request. It may or may not be the same as the server ID
included in the request control, depending on whether an alternate server was
determined to be better suited to handle the request.
true
or false
.
It must have a value with the following encoding:
RouteToServerRequest ::= SEQUENCE { serverID [0] OCTET STRING, allowAlternateServer [1] BOOLEAN, preferLocalServer [2] BOOLEAN DEFAULT TRUE, preferNonDegradedServer [3] BOOLEAN DEFAULT TRUE, ... }
// Perform a search to find an entry, and use the get server ID request // control to figure out which server actually processed the request. SearchRequest searchRequest = new SearchRequest("dc=example,dc=com", SearchScope.BASE, Filter.createPresenceFilter("objectClass"), "description"); searchRequest.addControl(new GetServerIDRequestControl()); SearchResultEntry entry = connection.searchForEntry(searchRequest); GetServerIDResponseControl serverIDControl = GetServerIDResponseControl.get(entry); String serverID = serverIDControl.getServerID(); // Send a modify request to update the target entry, and include the route // to server request control to request that the change be processed on the // same server that processed the request. ModifyRequest modifyRequest = new ModifyRequest("dc=example,dc=com", new Modification(ModificationType.REPLACE, "description", "new description value")); modifyRequest.addControl(new RouteToServerRequestControl(false, serverID, true, true, true)); LDAPResult modifyResult = connection.modify(modifyRequest);
Field Summary | |
---|---|
static java.lang.String |
ROUTE_TO_SERVER_REQUEST_OID
The OID (1.3.6.1.4.1.30221.2.5.16) for the route to server request control. |
Constructor Summary | |
---|---|
RouteToServerRequestControl(boolean isCritical,
java.lang.String serverID,
boolean allowAlternateServer,
boolean preferLocalServer,
boolean preferNonDegradedServer)
Creates a new route to server request control with the provided information. |
|
RouteToServerRequestControl(Control control)
Creates a new route to server request control which is decoded from the provided generic control. |
Method Summary | |
---|---|
boolean |
allowAlternateServer()
Indicates whether the request may be routed to an alternate server if the target server is unknown, unavailable, or otherwise unsuited for use. |
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available. |
java.lang.String |
getServerID()
Retrieves the server ID for the server to which the request should be sent. |
boolean |
preferLocalServer()
Indicates whether the request may be routed to an alternate server if the target server is nonlocal and a suitable server is available locally. |
boolean |
preferNonDegradedServer()
Indicates whether the request may be routed to an alternate server if the target server is in a degraded state and a suitable non-degraded server is available. |
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided buffer. |
Methods inherited from class com.unboundid.ldap.sdk.Control |
---|
decode, decode, decodeControls, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, toString, writeTo |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ROUTE_TO_SERVER_REQUEST_OID
Constructor Detail |
---|
public RouteToServerRequestControl(boolean isCritical, java.lang.String serverID, boolean allowAlternateServer, boolean preferLocalServer, boolean preferNonDegradedServer)
isCritical
- Indicates whether this control should be
considered critical.serverID
- The server ID for the server to which the
request should be sent. It must not be
null
.allowAlternateServer
- Indicates whether the request may be
routed to an alternate server in the
event that the target server is not known,
is not available, or is otherwise unsuited
for use. If this has a value of
false
and the target server is
unknown or unavailable, then the
associated operation will be rejected. If
this has a value of true
, then an
intermediate Directory Proxy Server may be
allowed to route the request to a
different server if deemed desirable or
necessary.preferLocalServer
- Indicates whether the associated request
may be routed to an alternate server if
the target server is in a remote location
and a suitable alternate server is
available locally. This will only be used
if allowAlternateServer
is
true
.preferNonDegradedServer
- Indicates whether the associated request
may be routed to an alternate server if
the target server is in a degraded state
and an alternate server is not in a
degraded state. This will only be used if
allowAlternateServer
is
true
.public RouteToServerRequestControl(Control control) throws LDAPException
control
- The generic control to be decoded as a route to server
request control.
LDAPException
- If the provided control cannot be decoded as a
route to server request control.Method Detail |
---|
public java.lang.String getServerID()
public boolean allowAlternateServer()
true
if the request may be routed to an alternate server
if the target server is not suitable for use, or false
if
the operation should be rejected if it cannot be routed to the
target server.public boolean preferLocalServer()
true
if allowAlternateServer
also returns
true
.
true
if the request may be routed to a suitable local
server if the target server is nonlocal, or false
if the
nonlocal target server should still be used.public boolean preferNonDegradedServer()
true
if
allowAlternateServer
also returns true
.
true
if the request may be routed to a suitable
non-degraded server if the target server is degraded, or
false
if the degraded target server should still be used.public java.lang.String getControlName()
getControlName
in class Control
public void toString(java.lang.StringBuilder buffer)
toString
in class Control
buffer
- The buffer to which to append the string representation of
this buffer.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |