|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.exolab.jms.net.multiplexer.Multiplexer
This class multiplexes data over a physical connection.
| Field Summary | |
static byte |
AUTH_BASIC
Indicates that the client is supplying user/password authentication details. |
static byte |
AUTH_DENIED
Indicates that connection has been refused. |
static byte |
AUTH_NONE
Indicates that a client is supplying no authentication details. |
static byte |
AUTH_OK
Indicates that connection has been accepted. |
static byte |
CLOSE
Indicates that a packet is a request to close an existing channel. |
static byte |
DATA
Indicates the continuation of a stream of data packets. |
static byte |
FLOW_READ
Indicates the no. |
static int |
MAGIC
Magic no. |
static byte |
OPEN
Indicates that a packet is a request to open a new channel. |
static byte |
PING_REQUEST
Indicates that a packet is a ping request. |
static byte |
PING_RESPONSE
Indicates that a packet is a ping response. |
static byte |
REQUEST
Indicates the start of an invocation request. |
static byte |
RESPONSE
Indicates the start of an invocation return. |
static byte |
SHUTDOWN
Indicates to close the connection. |
static int |
VERSION
Indicates that the packet contains protocol version. |
| Constructor Summary | |
protected |
Multiplexer()
Construct a new Multiplexer. |
|
Multiplexer(MultiplexerListener listener,
Endpoint endpoint,
Authenticator authenticator)
Construct a new server-side Multiplexer. |
|
Multiplexer(MultiplexerListener listener,
Endpoint endpoint,
java.security.Principal principal)
Construct a new client-side Multiplexer. |
| Method Summary | |
protected void |
authenticate(Authenticator authenticator)
Performs authentication on initial connection. |
protected void |
authenticate(java.security.Principal principal)
Perform authentication on initial connection. |
void |
close()
Close the multiplexer, releasing any resources. |
void |
close(org.exolab.jms.net.multiplexer.Channel channel)
Close a channel. |
org.exolab.jms.net.multiplexer.Channel |
getChannel()
Returns a free channel from the pool, opening a new one if none are available. |
java.security.Principal |
getPrincipal()
Returns the principal that owns the connection. |
protected void |
handshake(java.io.DataOutputStream out,
java.io.DataInputStream in)
Perform handshaking on initial connection, to verify protocol. |
protected void |
initialise(MultiplexerListener listener,
Endpoint endpoint,
boolean client)
Initialise the multiplexer. |
boolean |
isClient()
Determines if this is a client-side instance. |
boolean |
isClosed()
Determines if the multiplexer is closed. |
protected org.exolab.jms.net.multiplexer.Channel |
open()
Opens a new channel. |
void |
ping(int token)
Ping the connection. |
void |
release(org.exolab.jms.net.multiplexer.Channel channel)
Releases a channel back to the pool. |
void |
run()
Start multiplexing. |
void |
send(byte type)
Send a message. |
void |
send(byte type,
int channelId)
Send a message. |
void |
send(byte type,
int channelId,
byte[] data,
int offset,
int length)
Send a message. |
void |
send(byte type,
int channelId,
int data)
Send a message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MAGIC
public static final int VERSION
public static final byte OPEN
public static final byte CLOSE
public static final byte REQUEST
public static final byte RESPONSE
public static final byte DATA
public static final byte AUTH_BASIC
public static final byte AUTH_NONE
public static final byte AUTH_OK
public static final byte AUTH_DENIED
public static final byte PING_REQUEST
public static final byte PING_RESPONSE
public static final byte FLOW_READ
public static final byte SHUTDOWN
| Constructor Detail |
public Multiplexer(MultiplexerListener listener,
Endpoint endpoint,
java.security.Principal principal)
throws java.io.IOException,
SecurityException
Multiplexer.listener - the multiplexer listenerendpoint - the endpoint to multiplex messages overprincipal - the security principaljava.io.IOException - if an I/O error occursSecurityException - if connection is refused by the server
public Multiplexer(MultiplexerListener listener,
Endpoint endpoint,
Authenticator authenticator)
throws java.io.IOException,
ResourceException
Multiplexer.listener - the multiplexer listenerendpoint - the endpoint to multiplex messages overauthenticator - the connection authenticatorjava.io.IOException - if an I/O error occursResourceException - if the authenticator cannot authenticateprotected Multiplexer()
Multiplexer.
This constructor is provided for subclasses that must perform setup
work prior to invoking initialise(org.exolab.jms.net.multiplexer.MultiplexerListener, org.exolab.jms.net.multiplexer.Endpoint, boolean)| Method Detail |
public void run()
run in interface java.lang.Runnable
public org.exolab.jms.net.multiplexer.Channel getChannel()
throws java.io.IOException
java.io.IOException - if an I/O error occurspublic void release(org.exolab.jms.net.multiplexer.Channel channel)
channel - the channel to release
public void close(org.exolab.jms.net.multiplexer.Channel channel)
throws java.io.IOException
channel - the channel to closejava.io.IOException - if an I/O error occurs
public void send(byte type)
throws java.io.IOException
type - the packet typejava.io.IOException - if an I/O error occurs
public void send(byte type,
int channelId)
throws java.io.IOException
type - the packet typechannelId - the identifier of the channel sending the messagejava.io.IOException - if an I/O error occurs
public void send(byte type,
int channelId,
int data)
throws java.io.IOException
type - the packet typechannelId - the identifier of the channel sending the messagedata - the data to sendjava.io.IOException - if an I/O error occurs
public void send(byte type,
int channelId,
byte[] data,
int offset,
int length)
throws java.io.IOException
type - the packet typechannelId - the identifier of the channel sending the messagedata - the data to sendoffset - the offset into the datalength - the length of datajava.io.IOException - if an I/O error occurs
public void ping(int token)
throws java.io.IOException
token - the token to be returned in the replyjava.io.IOException - if an I/O error occurspublic void close()
public boolean isClosed()
true if the multiplexer is closedpublic boolean isClient()
true if this is a client-side instance,
false if it is a server=side instancepublic java.security.Principal getPrincipal()
null
if this is an unauthenticated connection
protected void initialise(MultiplexerListener listener,
Endpoint endpoint,
boolean client)
throws java.io.IOException
listener - the multiplexer listenerendpoint - the endpoint to multiplex messages overclient - determines if this is a client-side or server-side
instancejava.io.IOException - if an I/O error occurs
protected void handshake(java.io.DataOutputStream out,
java.io.DataInputStream in)
throws java.io.IOException
out - the endpoint's output streamin - the endpoint's input streamjava.io.IOException - for any I/O error
protected void authenticate(java.security.Principal principal)
throws java.io.IOException,
SecurityException
principal - the security principal. May be nulljava.io.IOException - for any I/O errorjava.lang.SecurityException - if connection is refused by the server
protected void authenticate(Authenticator authenticator)
throws java.io.IOException,
ResourceException
authenticator - the authenticatorjava.io.IOException - for any I/O errorResourceException - if the authenticator cannot authenticate
protected org.exolab.jms.net.multiplexer.Channel open()
throws java.io.IOException
java.io.IOException - if a channel can't be opened
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||