|
Wildfire 3.2.4 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.wildfire.nio.NIOConnection
public class NIOConnection
Implementation of Connection
inteface specific for NIO connections when using
the MINA framework.
MINA project can be found at here.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jivesoftware.wildfire.Connection |
---|
Connection.CompressionPolicy, Connection.TLSPolicy |
Field Summary | |
---|---|
static String |
CHARSET
The utf-8 charset for decoding and encoding XMPP packet streams. |
Constructor Summary | |
---|---|
NIOConnection(org.apache.mina.common.IoSession session,
PacketDeliverer packetDeliverer)
|
Method Summary | |
---|---|
void |
close()
Close this session including associated socket connection. |
void |
deliver(Packet packet)
Delivers the packet to this connection without checking the recipient. |
void |
deliverRawText(String text)
Delivers raw text to this connection. |
Connection.CompressionPolicy |
getCompressionPolicy()
Returns whether compression is optional or is disabled. |
InetAddress |
getInetAddress()
Returns the InetAddress describing the connection. |
String |
getLanguage()
Returns the language code that should be used for this connection (e.g. |
int |
getMajorXMPPVersion()
Returns the major version of XMPP being used by this connection (major_version.minor_version. |
int |
getMinorXMPPVersion()
Returns the minor version of XMPP being used by this connection (major_version.minor_version. |
PacketDeliverer |
getPacketDeliverer()
Returns the packet deliverer to use when delivering a packet over the socket fails. |
Connection.TLSPolicy |
getTlsPolicy()
Returns whether TLS is mandatory, optional or is disabled. |
void |
init(Session owner)
Initializes the connection with it's owning session. |
boolean |
isClosed()
Returns true if the connection/session is closed. |
boolean |
isCompressed()
Returns true if the connection is using compression. |
boolean |
isFlashClient()
Returns true if the connected client is a flash client. |
boolean |
isSecure()
Returns true if this connection is secure. |
void |
registerCloseListener(ConnectionCloseListener listener,
Object ignore)
Registers a listener for close event notification. |
void |
removeCloseListener(ConnectionCloseListener listener)
Removes a registered close event listener. |
void |
setCompressionPolicy(Connection.CompressionPolicy compressionPolicy)
Sets whether compression is enabled or is disabled. |
void |
setFlashClient(boolean flashClient)
Sets whether the connected client is a flash client. |
void |
setLanaguage(String language)
Sets the language code that should be used for this connection (e.g. |
void |
setTlsPolicy(Connection.TLSPolicy tlsPolicy)
Sets whether TLS is mandatory, optional or is disabled. |
void |
setXMPPVersion(int majorVersion,
int minorVersion)
Sets the XMPP version information. |
void |
startCompression()
Start using compression for this connection. |
void |
startTLS(boolean clientMode,
String remoteServer)
Secures the plain connection by negotiating TLS with the client. |
void |
systemShutdown()
Notification message indicating that the server is being shutdown. |
String |
toString()
|
boolean |
validate()
Verifies that the connection is still live. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CHARSET
Constructor Detail |
---|
public NIOConnection(org.apache.mina.common.IoSession session, PacketDeliverer packetDeliverer)
Method Detail |
---|
public boolean validate()
Connection
validate
in interface Connection
public void registerCloseListener(ConnectionCloseListener listener, Object ignore)
Connection
registerCloseListener
in interface Connection
listener
- the listener to register for events.ignore
- the object to send in the event notification.public void removeCloseListener(ConnectionCloseListener listener)
Connection
removeCloseListener
in interface Connection
listener
- the listener to deregister for close events.public InetAddress getInetAddress() throws UnknownHostException
Connection
getInetAddress
in interface Connection
UnknownHostException
- if IP address of host could not be determined.public PacketDeliverer getPacketDeliverer()
Connection
getPacketDeliverer
in interface Connection
public void close()
Connection
close
in interface Connection
public void systemShutdown()
Connection
systemShutdown
in interface Connection
public void init(Session owner)
Connection
init
in interface Connection
owner
- the session that owns this connectionpublic boolean isClosed()
Connection
isClosed
in interface Connection
public boolean isSecure()
Connection
isSecure
in interface Connection
public void deliver(Packet packet) throws UnauthorizedException
Connection
socket.send(packet.getWriteBuffer())
.
deliver
in interface Connection
packet
- the packet to deliver.
UnauthorizedException
- if a permission error was detected.public void deliverRawText(String text)
Connection
Connection.deliver(org.xmpp.packet.Packet)
.This method avoids having to get the writer of this connection and mess directly with the writer. Therefore, this method ensures a correct delivery of the stanza even if other threads were sending data concurrently.
deliverRawText
in interface Connection
text
- the XML stanzas represented kept in a String.public void startTLS(boolean clientMode, String remoteServer) throws Exception
Connection
true
and
remoteServer is the server name of the remote server. Otherwise clientMode
will be false
and remoteServer null.
startTLS
in interface Connection
clientMode
- boolean indicating if this entity is a client or a server.remoteServer
- server name of the remote server we are connecting to or null
when not in client mode.
Exception
- if an error occured while securing the connection.public void startCompression()
Connection
startCompression
in interface Connection
public boolean isFlashClient()
Connection
isFlashClient
in interface Connection
public void setFlashClient(boolean flashClient)
Connection
setFlashClient
in interface Connection
flashClient
- true if the if the connection is a flash client.public int getMajorXMPPVersion()
Connection
getMajorXMPPVersion
in interface Connection
public int getMinorXMPPVersion()
Connection
getMinorXMPPVersion
in interface Connection
public void setXMPPVersion(int majorVersion, int minorVersion)
Connection
setXMPPVersion
in interface Connection
majorVersion
- the major version.minorVersion
- the minor version.public String getLanguage()
Connection
getLanguage
in interface Connection
public void setLanaguage(String language)
Connection
setLanaguage
in interface Connection
language
- the language code.public boolean isCompressed()
Connection
isCompressed
in interface Connection
public Connection.CompressionPolicy getCompressionPolicy()
Connection
getCompressionPolicy
in interface Connection
public void setCompressionPolicy(Connection.CompressionPolicy compressionPolicy)
Connection
setCompressionPolicy
in interface Connection
compressionPolicy
- whether Compression is enabled or is disabled.public Connection.TLSPolicy getTlsPolicy()
Connection
getTlsPolicy
in interface Connection
public void setTlsPolicy(Connection.TLSPolicy tlsPolicy)
Connection
setTlsPolicy
in interface Connection
tlsPolicy
- whether TLS is mandatory, optional or is disabled.public String toString()
toString
in class Object
|
Wildfire 3.2.4 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |