org.exolab.jms.net.connector
Class AbstractConnectionFactory

java.lang.Object
  |
  +--org.exolab.jms.net.connector.AbstractConnectionFactory
All Implemented Interfaces:
ConnectionFactory
Direct Known Subclasses:
AbstractHTTPConnectionFactory, SocketConnectionFactory

public abstract class AbstractConnectionFactory
extends java.lang.Object
implements ConnectionFactory

Abstract implementation of the ConnectionFactory interface.

Version:
$Revision: 1.5 $ $Date: 2005/05/03 13:45:58 $
Author:
Tim Anderson

Field Summary
static java.lang.String PROPERTY_PREFIX
          Connection property prefix.
 
Constructor Summary
AbstractConnectionFactory(java.lang.String scheme, ManagedConnectionFactory factory, ConnectionManager manager)
          Construct a new AbstractConnectionFactory.
AbstractConnectionFactory(java.lang.String connectScheme, java.lang.String acceptScheme, ManagedConnectionFactory factory, ConnectionManager manager)
          Construct a new AbstractConnectionFactory.
 
Method Summary
 void accept(URI uri)
          Listen for new connections on the specified URI, using the default connection acceptor properties.
 void accept(URI uri, java.util.Map properties)
          Listen for new connections on the specified URI, using the specified acceptor properties.
 boolean canAccept(URI uri)
          Determines if this factory supports listening for new connections on the specified URI.
 boolean canConnect(URI uri)
          Determines if this factory supports connections to the specified URI.
protected  ConnectionRequestInfo getAcceptorRequestInfo(URI uri, java.util.Map properties)
          Returns connection request info for the specified URI and connection acceptor properties.
 Connection getConnection(java.security.Principal principal, URI uri)
          Returns a connection to the specified URI, using the default connection properties.
 Connection getConnection(java.security.Principal principal, URI uri, java.util.Map properties)
          Returns a connection to the specified URI, using the specified connection properties.
protected  ConnectionManager getConnectionManager()
          Returns the connection manager.
protected abstract  ConnectionRequestInfo getConnectionRequestInfo(URI uri, java.util.Map properties)
          Returns connection request info for the specified URI and connection properties.
protected  ManagedConnectionFactory getManagedConnectionFactory()
          Returns the managed connection factory.
protected  Properties getProperties(java.util.Map properties)
          Helper to return a Properties instance for the supplied map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PREFIX

public static final java.lang.String PROPERTY_PREFIX
Connection property prefix. Connection properties are prefixed with this, followed by the connection scheme.
Constructor Detail

AbstractConnectionFactory

public AbstractConnectionFactory(java.lang.String scheme,
                                 ManagedConnectionFactory factory,
                                 ConnectionManager manager)
Construct a new AbstractConnectionFactory.
Parameters:
scheme - the scheme that this factory supports, for both connect and accept
factory - the managed connection factory
manager - the connection manager

AbstractConnectionFactory

public AbstractConnectionFactory(java.lang.String connectScheme,
                                 java.lang.String acceptScheme,
                                 ManagedConnectionFactory factory,
                                 ConnectionManager manager)
Construct a new AbstractConnectionFactory.
Parameters:
connectScheme - the connect scheme that this factory supports
acceptScheme - the accept scheme that this factory supports
factory - the managed connection factory
manager - the connection manager
Method Detail

canConnect

public boolean canConnect(URI uri)
Determines if this factory supports connections to the specified URI.
Specified by:
canConnect in interface ConnectionFactory
Parameters:
uri - the connection address
Returns:
true if this factory supports the URI; false otherwise

getConnection

public Connection getConnection(java.security.Principal principal,
                                URI uri)
                         throws ResourceException
Returns a connection to the specified URI, using the default connection properties.
Specified by:
getConnection in interface ConnectionFactory
Parameters:
principal - the security principal. May be null
uri - the connection address
Returns:
a connection to uri
Throws:
ResourceException - if a connection cannot be established

getConnection

public Connection getConnection(java.security.Principal principal,
                                URI uri,
                                java.util.Map properties)
                         throws ResourceException
Returns a connection to the specified URI, using the specified connection properties.
Specified by:
getConnection in interface ConnectionFactory
Parameters:
principal - the security principal. May be null
uri - the connection address
properties - connection properties. If null, use the default connection properties
Returns:
a connection to uri
Throws:
ResourceException - if a connection cannot be established

canAccept

public boolean canAccept(URI uri)
Determines if this factory supports listening for new connections on the specified URI.
Specified by:
canAccept in interface ConnectionFactory
Parameters:
uri - the connection address
Returns:
true if this factory supports the URI; false otherwise

accept

public void accept(URI uri)
            throws ResourceException
Listen for new connections on the specified URI, using the default connection acceptor properties.
Specified by:
accept in interface ConnectionFactory
Parameters:
uri - the connection address
Throws:
ResourceException - if connections can't be accepted on the specified URI

accept

public void accept(URI uri,
                   java.util.Map properties)
            throws ResourceException
Listen for new connections on the specified URI, using the specified acceptor properties.
Specified by:
accept in interface ConnectionFactory
Parameters:
uri - the connection address
properties - acceptor properties. May be null
Throws:
ResourceException - if connections can't be accepted on the specified URI

getConnectionRequestInfo

protected abstract ConnectionRequestInfo getConnectionRequestInfo(URI uri,
                                                                  java.util.Map properties)
                                                           throws ResourceException
Returns connection request info for the specified URI and connection properties.
Parameters:
uri - the connection address
properties - connection properties. If null, use the default connection properties
Returns:
connection request info corresponding to uri and properties
Throws:
ResourceException - for any error

getAcceptorRequestInfo

protected ConnectionRequestInfo getAcceptorRequestInfo(URI uri,
                                                       java.util.Map properties)
                                                throws ResourceException
Returns connection request info for the specified URI and connection acceptor properties.

This implementation returns getConnectionRequestInfo(URI, Map).

Parameters:
uri - the connection address
properties - acceptor properties. May be null
Returns:
connection request info corresponding to uri and properties
Throws:
ResourceException - for any error

getManagedConnectionFactory

protected ManagedConnectionFactory getManagedConnectionFactory()
Returns the managed connection factory.
Returns:
the managed connection factory

getConnectionManager

protected ConnectionManager getConnectionManager()
Returns the connection manager.
Returns:
the connection manager

getProperties

protected Properties getProperties(java.util.Map properties)
Helper to return a Properties instance for the supplied map.

All searches will be performed with properties prefixed by "org.exolab.jms.net.<scheme>." .



Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.