public final class ConnectionSettingsNegotiator extends SettingsNegotiator
SettingsNegotiator parent class,
ConnectionSettingsNegotiator instances provide all
methods necessary for text parameter negotiation and for creating Settings objects, which allow
access to the current parameters.
Each instance of this class belongs to one TargetConnection, for which it manages all
connection-specific parameters. A similar association exists between the connection's enclosing
TargetSession and the sessionSettingsNegotiator member variable.
A negotiation sequence consists of the following steps, performed in the given order:
beginNegotiation() until it returns true.negotiate(TargetServer, LoginStage, boolean, boolean, List, List). The method will return
false if there was a problem.checkConstraints() to check more complex requirements. The method will return
false if there was a problem.finishNegotiation(boolean) with the appropriate parameter. This step is mandatory.backUpEntries, entries| Constructor and Description |
|---|
ConnectionSettingsNegotiator(SessionSettingsNegotiator sessionSettingsNegotiator)
The
ConnectionSettingsNegotiator constructor. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
beginNegotiation()
This method must be called at the beginning of a parameter negotiation
sequence.
|
boolean |
checkConstraints()
Checks constraints that cannot be checked at the
Entry level,
e.g. |
void |
finishNegotiation(boolean commitChanges)
This method must be called at the end of a negotiation sequence.
|
Settings |
getSettings()
This method checks if any parameter changes have been committed since the
last call and, if so, creates a new
Settings object reflecting
the current parameters. |
protected void |
initializeEntries()
Adds a properly initialized
Entry object to SettingsNegotiator.entries for
every parameter managed by this SettingsNegotiator. |
boolean |
negotiate(TargetServer target,
LoginStage loginStage,
boolean leadingConnection,
boolean initialPdu,
List<String> requestKeyValuePairs,
List<String> responseKeyValuePairs)
Processes one or more key-value pairs sent by the initiator,
formulates response key-value pairs and changes the involved
Entry instances
accordingly. |
protected void |
updateSettingsBuilderComponent()
Updates
ConnectionSettingsBuilderComponent with the currently
valid parameters retrieved from the elements of SettingsNegotiator.entries. |
backUpEntries, commitOrRollBackChanges, copypublic ConnectionSettingsNegotiator(SessionSettingsNegotiator sessionSettingsNegotiator)
ConnectionSettingsNegotiator constructor.sessionSettingsNegotiator - the SessionSettingsNegotiator maintaining all Entry objects for session-wide
parameterspublic boolean beginNegotiation()
This method will block until no other ConnectionSettingsNegotiator is negotiating and will
return true if negotiations may proceed, or false, if the request for the
permission to negotiate was denied.
true if and only if the caller is allowed to
negotiate parametersfinishNegotiation(boolean)public void finishNegotiation(boolean commitChanges)
Entry objects must be discarded
by setting the
commitChanges parameter to false. If it is true, then the parameter
changes will be incorporated into
the updated settings.
Calling this method should be ensured by a try ... catch ...
finally block.
commitChanges - true if and only if the negotiated parameter
changes are to be committedpublic boolean negotiate(TargetServer target, LoginStage loginStage, boolean leadingConnection, boolean initialPdu, List<String> requestKeyValuePairs, List<String> responseKeyValuePairs)
Entry instances
accordingly.loginStage - specifies the current stage or phaseleadingConnection - true if and only if the connection is the first
connection of the enclosing sessioninitialPdu - true if and only if the key-value pairs
were sent in the first ProtocolDataUnit received on
this connectionrequestKeyValuePairs - contains the key-value pairs from the initiator;
processed elements will be removedresponseKeyValuePairs - will contain the key-value pairs from the jSCSI targettrue if everything went fine and false if there was an irreconcilable
problempublic boolean checkConstraints()
SettingsNegotiatorEntry level,
e.g. because they depend on the values of multiple parameters.checkConstraints in class SettingsNegotiatortrue if everything is fine, false if
that is not the casepublic Settings getSettings()
Settings object reflecting
the current parameters.protected void initializeEntries()
SettingsNegotiatorEntry object to SettingsNegotiator.entries for
every parameter managed by this SettingsNegotiator.initializeEntries in class SettingsNegotiatorprotected void updateSettingsBuilderComponent()
ConnectionSettingsBuilderComponent with the currently
valid parameters retrieved from the elements of SettingsNegotiator.entries.Copyright © 2012 University of Konstanz, Distributed Systems Group. All Rights Reserved.