|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttigase.net.IOService<RefObject>
RefObject - is a reference object stored by this service. This is e
reference to higher level data object keeping more information about the
connection.public abstract class IOService<RefObject>
IOService offers thread safe
call() method execution, however you must be prepared that other
methods can be called simultaneously like
stop(),
getProtocol() or
isConnected().
It is recommended that developers extend
AbsractServerService rather then implement
ServerService interface directly.
If you directly implement
ServerService interface you must take care about
SocketChannel I/O, queuing tasks, processing results and thread
safe execution of
call() method. If you however extend
IOService class all this basic operation are implemented and you
have only to take care about parsing data received from network socket.
Parsing data is expected to be implemented in
parseData(char[] data) method.
Created: Tue Sep 28 23:00:34 2004
| Field Summary | |
|---|---|
protected CharBuffer |
cb
Field description |
static String |
CERT_CHECK_RESULT
Field description |
protected CharsetDecoder |
decoder
Field description |
protected CharsetEncoder |
encoder
Field description |
static String |
HOSTNAME_KEY
Field description |
protected byte[] |
partialCharacterBytes
The saved partial bytes for multi-byte UTF-8 characters between reads |
static String |
PORT_TYPE_PROP_KEY
Field description |
static String |
SESSION_ID_KEY
This is key used to store session ID in temporary session data storage. |
static String |
SSL_PROTOCOLS_KEY
Field description |
| Constructor Summary | |
|---|---|
IOService()
|
|
| Method Summary | |
|---|---|
void |
accept(SocketChannel socketChannel)
Method accept is used to perform |
protected ByteOrder |
byteOrder()
Method description |
IOService<?> |
call()
Method run is used to perform |
ConnectionType |
connectionType()
Method description |
protected boolean |
debug(char[] msg)
Describe debug method here. |
protected boolean |
debug(String msg,
String prefix)
Describe debug method here. |
void |
forceStop()
Method description |
long |
getBuffOverflow(boolean reset)
Method description |
long |
getBytesReceived(boolean reset)
Method description |
long |
getBytesSent(boolean reset)
Method description |
tigase.xmpp.JID |
getConnectionId()
|
tigase.xmpp.JID |
getDataReceiver()
Method description |
long |
getLastTransferTime()
This method returns the time of last transfer in any direction through this service. |
String |
getLocalAddress()
Method description |
List<String> |
getPeersJIDsFromCert()
Method description |
long[] |
getReadCounters()
Method description |
RefObject |
getRefObject()
Method description |
String |
getRemoteAddress()
Returns a remote IP address for the TCP/IP connection. |
ConcurrentMap<String,Object> |
getSessionData()
Method description |
SocketChannel |
getSocketChannel()
Method getSocketChannel is used to perform |
void |
getStatistics(StatisticsList list,
boolean reset)
Method description |
long |
getTotalBuffOverflow()
Method description |
long |
getTotalBytesReceived()
Method description |
long |
getTotalBytesSent()
Method description |
String |
getUniqueId()
Method description |
long[] |
getWriteCounters()
Method description |
TrustManager[] |
getX509TrustManagers()
Method description |
void |
handshakeCompleted(TLSWrapper wrapper)
Method description |
boolean |
isConnected()
Describe isConnected method here. |
protected boolean |
isInputBufferEmpty()
Method description |
protected abstract void |
processSocketData()
Method description |
abstract void |
processWaitingPackets()
Method description |
protected ByteBuffer |
readBytes()
Method description |
protected void |
readCompleted()
Method description |
protected char[] |
readData()
Describe readData method here. |
protected abstract int |
receivedPackets()
Method description |
void |
setConnectionId(tigase.xmpp.JID connectionId)
|
void |
setDataReceiver(tigase.xmpp.JID address)
Method description |
void |
setIOServiceListener(IOServiceListener<IOService<RefObject>> sl)
Method description |
void |
setRefObject(RefObject refObject)
Method description |
void |
setSessionData(Map<String,Object> props)
Method description |
void |
setX509TrustManagers(TrustManager[] trustManager)
Method description |
void |
startSSL(boolean clientMode,
boolean wantClientAuth)
Method description |
void |
startTLS(boolean clientMode,
boolean wantClientAuth)
Method description |
void |
startZLib(int level)
Method description |
void |
stop()
Describe stop method here. |
String |
toString()
Method description |
boolean |
waitingToRead()
Method description |
boolean |
waitingToSend()
Method description |
int |
waitingToSendSize()
Method description |
protected void |
writeBytes(ByteBuffer data)
Method description |
protected void |
writeData(String data)
Describe writeData method here. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String CERT_CHECK_RESULT
public static final String HOSTNAME_KEY
public static final String PORT_TYPE_PROP_KEY
public static final String SESSION_ID_KEY
public static final String SSL_PROTOCOLS_KEY
protected byte[] partialCharacterBytes
protected CharsetEncoder encoder
protected CharsetDecoder decoder
protected CharBuffer cb
| Constructor Detail |
|---|
public IOService()
| Method Detail |
|---|
public void accept(SocketChannel socketChannel)
throws IOException
accept is used to perform
socketChannel - a
SocketChannel value
IOException
public IOService<?> call()
throws IOException
run is used to perform
call in interface Callable<IOService<?>>IOExceptionpublic ConnectionType connectionType()
public void forceStop()
public void handshakeCompleted(TLSWrapper wrapper)
handshakeCompleted in interface TLSEventHandlerwrapper -
public abstract void processWaitingPackets()
throws IOException
IOException
public void startSSL(boolean clientMode,
boolean wantClientAuth)
throws IOException
clientMode -
IOException
public void startTLS(boolean clientMode,
boolean wantClientAuth)
throws IOException
clientMode -
IOExceptionpublic void startZLib(int level)
level - public void stop()
stop method here.
public String toString()
toString in class Objectpublic boolean waitingToRead()
public boolean waitingToSend()
public int waitingToSendSize()
public long getBuffOverflow(boolean reset)
reset -
public long getBytesReceived(boolean reset)
reset -
public long getBytesSent(boolean reset)
reset -
public tigase.xmpp.JID getConnectionId()
public tigase.xmpp.JID getDataReceiver()
public long getLastTransferTime()
public String getLocalAddress()
public List<String> getPeersJIDsFromCert()
public long[] getReadCounters()
public RefObject getRefObject()
public String getRemoteAddress()
public ConcurrentMap<String,Object> getSessionData()
public SocketChannel getSocketChannel()
getSocketChannel is used to perform
SocketChannel value
public void getStatistics(StatisticsList list,
boolean reset)
list - reset - public long getTotalBuffOverflow()
public long getTotalBytesReceived()
public long getTotalBytesSent()
public String getUniqueId()
public long[] getWriteCounters()
public TrustManager[] getX509TrustManagers()
public boolean isConnected()
isConnected method here.
boolean valuepublic void setConnectionId(tigase.xmpp.JID connectionId)
connectionId - the connectionId to setpublic void setDataReceiver(tigase.xmpp.JID address)
address - public void setIOServiceListener(IOServiceListener<IOService<RefObject>> sl)
sl - public void setRefObject(RefObject refObject)
refObject - public void setSessionData(Map<String,Object> props)
props - public void setX509TrustManagers(TrustManager[] trustManager)
trustManager - protected ByteOrder byteOrder()
protected boolean debug(char[] msg)
debug method here.
msg - a
char[] value
boolean value
protected boolean debug(String msg,
String prefix)
debug method here.
msg - a
String valueprefix -
boolean value
protected abstract void processSocketData()
throws IOException
IOException
protected ByteBuffer readBytes()
throws IOException
IOExceptionprotected void readCompleted()
protected char[] readData()
throws IOException
readData method here.
char[] value
IOException - if an error occursprotected abstract int receivedPackets()
protected void writeBytes(ByteBuffer data)
data - protected void writeData(String data)
writeData method here.
data - a
String valueprotected boolean isInputBufferEmpty()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||