org.exolab.core.messenger
Class Messenger

java.lang.Object
  extended byorg.exolab.core.messenger.Messenger

public class Messenger
extends java.lang.Object

Version:
$Revision: 1.5 $ $Date: 2003/06/09 06:28:40 $
Author:
Tim Anderson

Constructor Summary
protected Messenger()
          Construct a new Messenger
 
Method Summary
 void accept(java.lang.String uri, ConnectionHandler handler)
          Accept connections for the specified URI, passing new connections to the handler.
 void accept(java.lang.String uri, ConnectionHandler handler, ConnectionProperties properties)
          Accept connections for the specified URI, passing new connections to the handler.
 void close(java.lang.String uri)
          Stop accepting connections for the specified URI
static Messenger getInstance()
          Returns the singleton instance of the Messenger
 Connection open(java.lang.String uri)
          Establish a connection to the specified URI.
 Connection open(java.lang.String uri, ConnectionProperties properties)
          Establish a connection to the specified URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Messenger

protected Messenger()
Construct a new Messenger

Method Detail

getInstance

public static Messenger getInstance()
Returns the singleton instance of the Messenger

Returns:
the singleton instance

open

public Connection open(java.lang.String uri)
                throws java.net.MalformedURLException,
                       java.rmi.RemoteException
Establish a connection to the specified URI.

If a connection to the URI already exists, it will be returned.

Parameters:
uri - the URI to connect to
Returns:
the new Connection
Throws:
java.net.MalformedURLException - if uri is an invalid URI
java.rmi.RemoteException - if the connection cannot be opened
java.lang.IllegalArgumentException - if uri is null

open

public Connection open(java.lang.String uri,
                       ConnectionProperties properties)
                throws java.net.MalformedURLException,
                       java.rmi.RemoteException
Establish a connection to the specified URI.

If a connection to the URI already exists, it will be returned.

Parameters:
uri - the URI to connect to
properties - connection properties (may be null)
Returns:
the new Connection
Throws:
java.net.MalformedURLException - if uri is an invalid URI
java.rmi.RemoteException - if the connection cannot be opened
java.lang.IllegalArgumentException - if uri is null

accept

public void accept(java.lang.String uri,
                   ConnectionHandler handler)
            throws java.net.MalformedURLException,
                   java.rmi.RemoteException
Accept connections for the specified URI, passing new connections to the handler. This method returns immediately.

Parameters:
uri - the URI to listen on
handler - the handler to pass new connections to
Throws:
java.net.MalformedURLException - if uri is an invalid URI
java.rmi.RemoteException - if an error occurs accepting connections
java.lang.IllegalArgumentException - if uri or handler are null

accept

public void accept(java.lang.String uri,
                   ConnectionHandler handler,
                   ConnectionProperties properties)
            throws java.net.MalformedURLException,
                   java.rmi.RemoteException
Accept connections for the specified URI, passing new connections to the handler. This method returns immediately.

Parameters:
uri - the URI to listen on
handler - the handler to pass new connections to
properties - connection properties (may be null)
Throws:
AcceptorAlreadyRegisteredException - if an ConnectionAcceptor is already listing on uri
java.net.MalformedURLException - if uri is an invalid URI
java.rmi.RemoteException - if an error occurs accepting connections
java.lang.IllegalArgumentException - if uri or handler are null

close

public void close(java.lang.String uri)
           throws java.net.MalformedURLException,
                  java.rmi.RemoteException
Stop accepting connections for the specified URI

Parameters:
uri - the URI to close
Throws:
java.net.MalformedURLException - if uri is an invalid URI
java.rmi.RemoteException - if an error occurs closing the connection
java.lang.IllegalArgumentException - if uri is null


Copyright © 1999-2005 The Exolab Group. All Rights Reserved.