|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.hebe.mps.Connection
Manages client-side connections to an MPS server. Contains the looked-up/resolved address of the remote server (ie. the canonical name of the server), and a Socket for communication with the server. This class is only used internally, and should never be exposed to client objects outside this package.
Proxy
,
InputStream
,
OutputStream
Field Summary | |
private java.net.Socket |
connection
Socket that connects us to the remote server |
private java.lang.String |
hostname
Hostname of the remote server - taken from resolvedName |
private java.lang.String |
method
Transport name - always "inet", for the Java implementation, currently |
private int |
oid
OID (Object ID) of the remote server - taken from resolvedName |
private int |
portnumber
Port number of the remote server - taken from resolvedName |
private java.lang.String |
resolvedName
mps:inet: |
Constructor Summary | |
Connection(java.lang.String name)
Creates a fresh Connection given the resolved name of a remote object to connect to. |
Method Summary | |
void |
close()
Closes the connection to the remote server. |
java.io.InputStream |
getInputStream()
Allows clients access to the input (server-to-client) facilities of the socket connected to the remote server. |
(package private) int |
getOid()
Returns the OID of the remote object. |
java.io.OutputStream |
getOutputStream()
Allows clients access to the output (client-to-server) facilities of the socket connected to the remote server. |
java.lang.String |
getResolvedName()
Allows clients to inspect the canonical name for the server we are connected to. |
void |
open()
Opens the connection to the remote server. |
private void |
parseResolvedName()
Splits up the resolvedName of this object into its components. |
java.lang.String |
toString()
Obtains a (simple) human-readable representation of this connection object. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.String resolvedName
private java.net.Socket connection
private java.lang.String method
private java.lang.String hostname
private int portnumber
private int oid
Constructor Detail |
public Connection(java.lang.String name) throws MPSException
name
- the resolved name of the MPS server to connect toMPSException
- if the resolved name is ill-formed or unsupportedMethod Detail |
public java.lang.String toString()
toString
in class java.lang.Object
private void parseResolvedName() throws MPSException
MPSException
- if the resolvedName of this object is ill-formed or unsupportedpublic void open() throws MPSException
MPSException
- if the resolvedName of this object is ill-formed or unsupportedMPSException
- if the server is refusing connectionspublic void close() throws MPSException
MPSException
- if there was a problem closing the socket.public java.io.InputStream getInputStream() throws MPSException
MPSException
- from open() if the connection was closed and wouldn't openMPSException
- if the socket failed to create an InputStream for uspublic java.io.OutputStream getOutputStream() throws MPSException
MPSException
- from open() if the connection was closed and wouldn't openMPSException
- if the socket failed to create an OutputStream for uspublic java.lang.String getResolvedName()
int getOid()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |