ecologylab.services.authentication.nio
Class NIOAuthClient
java.lang.Object
ecologylab.generic.Debug
ecologylab.services.distributed.impl.NIOCore
ecologylab.services.distributed.impl.NIONetworking
ecologylab.services.distributed.client.NIOClient
ecologylab.services.authentication.nio.NIOAuthClient
- All Implemented Interfaces:
- StartAndStoppable, AuthConstants, AuthMessages, AuthClientRegistryObjects, ClientConstants, NetworkingConstants, java.lang.Runnable
public class NIOAuthClient
- extends NIOClient
- implements AuthClientRegistryObjects, AuthConstants, AuthMessages
A client application that uses authentication and communicates using NIO.
- Author:
- Zachary O. Toups (toupsz@cs.tamu.edu)
| Fields inherited from class ecologylab.services.distributed.client.NIOClient |
headerMap, incomingMessageBuffer, isSending, outgoingChars, outgoingMessageBuffer, outgoingMessageHeaderBuffer, pRequestPool, reconnectAttempts, requestBuffer, requestsQueue, responsePool, selectInterval, serverAddress, startReadIndex, thisSocket, unfulfilledRequests, waitBetweenReconnectAttempts |
| Fields inherited from interface ecologylab.services.distributed.common.NetworkingConstants |
CHARACTER_ENCODING, CONTENT_LENGTH_STRING, CONTENT_LENGTH_STRING_LENGTH, DECODER, ENCODER, HTTP_HEADER_LINE_DELIMITER, HTTP_HEADER_TERMINATOR, MAX_HTTP_HEADER_LENGTH, MAX_PACKET_SIZE_BYTES, MAX_PACKET_SIZE_CHARACTERS, UNIQUE_IDENTIFIER_STRING |
|
Constructor Summary |
NIOAuthClient(java.lang.String server,
int port)
Creates a new AuthClient object using the given parameters. |
NIOAuthClient(java.lang.String server,
int port,
AuthenticationListEntry entry,
int interval,
RequestMessage messageToSend)
Creates a new AuthClient object using the given parameters. |
NIOAuthClient(java.lang.String server,
int port,
TranslationSpace messageSpace,
Scope objectRegistry,
AuthenticationListEntry entry)
|
NIOAuthClient(java.lang.String server,
int port,
TranslationSpace messageSpace,
Scope objectRegistry,
AuthenticationListEntry entry,
int interval,
RequestMessage messageToSend)
Main constructor; creates a new AuthClient using the parameters. |
NIOAuthClient(java.lang.String server,
int port,
TranslationSpace messageSpace,
Scope objectRegistry,
int interval,
RequestMessage messageToSend)
Creates a new AuthClient object using the given parameters. |
|
Method Summary |
java.lang.String |
getExplanation()
|
boolean |
isLoggedIn()
|
boolean |
isLoggingIn()
|
boolean |
isLoggingOut()
|
boolean |
login()
Attempts to connect to the server using the AuthenticationListEntry that is associated with the client's side of
the connection. |
boolean |
logout()
Attempts to log out of the server using the AuthenticationListEntry that is associated with the client's side of
the connection. |
protected ResponseMessage |
sendLoginMessage()
Sends a Login message to the server; may be overridden by subclasses that need to add addtional information to the
Login message. |
protected ResponseMessage |
sendLogoutMessage()
Sends a Logout message to the server; may be overridden by subclasses that need to add addtional information to
the Logout message. |
void |
setEntry(AuthenticationListEntry entry)
|
| Methods inherited from class ecologylab.services.distributed.client.NIOClient |
acceptFinished, acceptKey, acceptReady, addUnfulfilledRequest, checkAndDropIdleKeys, clearSessionId, connect, connected, connectReady, createConnection, dequeueRequest, disconnect, disconnect, enqueueRequestForSending, generateUid, getServer, getUidNoIncrement, invalidateKey, isServerRunning, nonBlockingSendMessage, nullOut, parseHeader, prepareAndEnqueueRequestForSending, processReadData, processResponse, readFinished, reconnect, removeBadConnections, requestsRemaining, sendMessage, sendMessage, setReconnectAttempts, setServer, setWaitBetweenReconnectAttempts, shutdownOK, start, stop, translateXMLStringToResponse, unableToRestorePreviousConnection, waitForConnect, writeKey |
| Methods inherited from class ecologylab.services.distributed.impl.NIOCore |
close, connectFinished, getPortNumber, invalidateKey, queueForAccept, queueForConnect, queueForRead, queueForWrite, run, setPendingInvalidate, writeFinished |
| Methods inherited from class ecologylab.generic.Debug |
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.lang.Runnable |
run |
entry
protected AuthenticationListEntry entry
- The username / password information supplied by the user.
NIOAuthClient
public NIOAuthClient(java.lang.String server,
int port)
throws java.io.IOException
- Creates a new AuthClient object using the given parameters.
- Parameters:
server - port -
- Throws:
java.io.IOException
NIOAuthClient
public NIOAuthClient(java.lang.String server,
int port,
TranslationSpace messageSpace,
Scope objectRegistry,
int interval,
RequestMessage messageToSend)
throws java.io.IOException
- Creates a new AuthClient object using the given parameters.
- Parameters:
server - port - messageSpace - objectRegistry -
- Throws:
java.io.IOException
NIOAuthClient
public NIOAuthClient(java.lang.String server,
int port,
AuthenticationListEntry entry,
int interval,
RequestMessage messageToSend)
throws java.io.IOException
- Creates a new AuthClient object using the given parameters.
- Parameters:
server - port - entry -
- Throws:
java.io.IOException
NIOAuthClient
public NIOAuthClient(java.lang.String server,
int port,
TranslationSpace messageSpace,
Scope objectRegistry,
AuthenticationListEntry entry)
throws java.io.IOException
- Throws:
java.io.IOException
NIOAuthClient
public NIOAuthClient(java.lang.String server,
int port,
TranslationSpace messageSpace,
Scope objectRegistry,
AuthenticationListEntry entry,
int interval,
RequestMessage messageToSend)
throws java.io.IOException
- Main constructor; creates a new AuthClient using the parameters.
- Parameters:
server - port - messageSpace - objectRegistry - entry -
- Throws:
java.io.IOException
setEntry
public void setEntry(AuthenticationListEntry entry)
- Parameters:
entry - The entry to set.
login
public boolean login()
throws java.io.IOException
- Attempts to connect to the server using the AuthenticationListEntry that is associated with the client's side of
the connection. Does not block for connection.
- Throws:
java.io.IOException
logout
public boolean logout()
throws java.io.IOException
- Attempts to log out of the server using the AuthenticationListEntry that is associated with the client's side of
the connection. Blocks until a response is received or until LOGIN_WAIT_TIME passes, whichever comes first.
- Throws:
java.io.IOException
sendLogoutMessage
protected ResponseMessage sendLogoutMessage()
throws java.io.IOException
- Sends a Logout message to the server; may be overridden by subclasses that need to add addtional information to
the Logout message.
- Throws:
java.io.IOException
sendLoginMessage
protected ResponseMessage sendLoginMessage()
throws java.io.IOException
- Sends a Login message to the server; may be overridden by subclasses that need to add addtional information to the
Login message.
- Throws:
java.io.IOException
isLoggingIn
public boolean isLoggingIn()
- Returns:
- Returns the loggingIn.
isLoggingOut
public boolean isLoggingOut()
- Returns:
- Returns the loggingOut.
getExplanation
public java.lang.String getExplanation()
- Returns:
- The response message from the server regarding the last attempt to log in; if login fails, will indicate
why.
isLoggedIn
public boolean isLoggedIn()
- Returns:
- Returns whether or not this client is logged in to a server.