Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

Connection Class Reference

Manages client-side connections to an MPS server. More...

List of all members.

Private Methods

public Connection (String name) throws MPSException
public String toString ()
private void parseResolvedName () throws MPSException
public void open () throws MPSException
public void close () throws MPSException
public java io InputStream getInputStream () throws MPSException
public java io OutputStream getOutputStream () throws MPSException
public String getResolvedName ()
int getOid ()

Private Attributes

private String resolvedName
private Socket connection
private String method
private String hostname
private int portnumber
private int oid


Detailed Description

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.

Author(s):
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
See also:
org.hebe.mps.Proxy , org.hebe.mps.InputStream , org.hebe.mps.OutputStream

Definition at line 53 of file Connection.java.


Constructor & Destructor Documentation

public Connection::Connection ( String name ) [inline, private]
 

Creates a fresh Connection given the resolved name of a remote object to connect to.

Parameters:
name   the resolved name of the MPS server to connect to
Exceptions:
MPSException   if the resolved name is ill-formed or unsupported

Definition at line 76 of file Connection.java.


Member Function Documentation

public void Connection::close ( ) [inline, private]
 

Closes the connection to the remote server.

Exceptions:
MPSException   if there was a problem closing the socket.

Definition at line 139 of file Connection.java.

Referenced by Proxy::_disconnect_proxy().

public java io InputStream Connection::getInputStream ( ) [inline, private]
 

Allows clients access to the input (server-to-client) facilities of the socket connected to the remote server.

Returns:
a Java input stream for reading bytes from the server
Exceptions:
MPSException   from open() if the connection was closed and wouldn't open
MPSException   if the socket failed to create an InputStream for us

Definition at line 157 of file Connection.java.

Referenced by InputStream::open().

int Connection::getOid ( ) [inline, private]
 

Returns the OID of the remote object.

For use by {Input,Output}Stream's constructors.

Definition at line 195 of file Connection.java.

Referenced by Proxy::getInputStream(), and Proxy::getOutputStream().

public java io OutputStream Connection::getOutputStream ( ) [inline, private]
 

Allows clients access to the output (client-to-server) facilities of the socket connected to the remote server.

Returns:
a Java output stream for reading bytes from the server
Exceptions:
MPSException   from open() if the connection was closed and wouldn't open
MPSException   if the socket failed to create an OutputStream for us

Definition at line 174 of file Connection.java.

Referenced by OutputStream::open().

public String Connection::getResolvedName ( ) [inline, private]
 

Allows clients to inspect the canonical name for the server we are connected to.

Definition at line 187 of file Connection.java.

Referenced by Proxy::getReference().

public void Connection::open ( ) [inline, private]
 

Opens the connection to the remote server.

Only called on demand.

Exceptions:
MPSException   if the resolvedName of this object is ill-formed or unsupported
MPSException   if the server is refusing connections

Definition at line 121 of file Connection.java.

Referenced by getInputStream(), and getOutputStream().

private void Connection::parseResolvedName ( ) [inline, private]
 

Splits up the resolvedName of this object into its components.

Exceptions:
MPSException   if the resolvedName of this object is ill-formed or unsupported

Definition at line 97 of file Connection.java.

Referenced by Connection(), and open().

public String Connection::toString ( ) [inline, private]
 

Obtains a (simple) human-readable representation of this connection object.

Returns:
the printable string

Definition at line 88 of file Connection.java.

Referenced by close(), getInputStream(), getOutputStream(), open(), and parseResolvedName().


Member Data Documentation

private Socket Connection::connection [private]
 

Socket that connects us to the remote server.

Definition at line 58 of file Connection.java.

private String Connection::hostname [private]
 

Hostname of the remote server - taken from resolvedName.

Definition at line 63 of file Connection.java.

private String Connection::method [private]
 

Transport name - always "inet", for the Java implementation, currently.

Definition at line 61 of file Connection.java.

private int Connection::oid [private]
 

OID (Object ID) of the remote server - taken from resolvedName.

Definition at line 67 of file Connection.java.

private int Connection::portnumber [private]
 

Port number of the remote server - taken from resolvedName.

Definition at line 65 of file Connection.java.

private String Connection::resolvedName [private]
 

mps:inet:<host>:<port>:<oid> - server's canonical (bound) name.

Definition at line 55 of file Connection.java.


The documentation for this class was generated from the following file:
Generated at Wed Aug 15 01:05:34 2001 for mps-java by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001