com.marklogic.xdbc
Class XDBCConnectionFactory

java.lang.Object
  extended bycom.marklogic.xdbc.XDBCConnectionFactory
Direct Known Subclasses:
XDMPConnectionFactoryImpl

public abstract class XDBCConnectionFactory
extends Object

A abstract factory class for creating XDBC Database Connection objects. To use this factory, first create a new instance of the factory using the static method newInstance(). Then call newXDBCConnection() to get a connection to an XML data source or data base.


Field Summary
protected  String host
           
protected  int port
           
 
Constructor Summary
protected XDBCConnectionFactory()
           
 
Method Summary
 String getHost()
          Gets the host name or ip address used to create connections with this factory instance.
 int getPort()
          Gets the port number used to create connections with this factory instance.
static XDBCConnectionFactory newInstance()
          Returns a new instance of an XDBCConnectionFactory which can be used to produce XDBCConnection objects.
abstract  XDBCConnection newXDBCConnection()
          Creates and returns a new XDBCConnection object, representing a connection to an XML data source.
abstract  XDBCConnection newXDBCConnection(String host, int port)
          Creates and returns a new XDBCConnection object, representing a connection to an XML data source.
abstract  XDBCConnection newXDBCConnection(String host, int port, String prompt)
          Creates and returns a new XDBCConnection object, representing a connection to an XML data source.
abstract  XDBCConnection newXDBCConnection(String host, int port, String user, String password)
          Creates and returns a new XDBCConnection object, representing a connection to an XML data source.
 void setHost(String host)
          Sets the host name or ip address used to create connections with this factory instance.
 void setPort(int port)
          Sets the port number used to create connections with this factory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

host

protected String host

port

protected int port
Constructor Detail

XDBCConnectionFactory

protected XDBCConnectionFactory()
Method Detail

newInstance

public static XDBCConnectionFactory newInstance()
                                         throws XDBCException
Returns a new instance of an XDBCConnectionFactory which can be used to produce XDBCConnection objects. XDBCConnections represent connections to an XML data source.

Returns:
the XDBCConnectionFactory object
Throws:
XDBCException - if a factory configuration error occurs.

newXDBCConnection

public abstract XDBCConnection newXDBCConnection()
                                          throws XDBCException
Creates and returns a new XDBCConnection object, representing a connection to an XML data source. This connection is established to the default host and port used to by the XDBCConnectionFactory implementation.

Returns:
the XDBCConnection object
Throws:
XDBCException - if an error occurs while establishing the connection.

newXDBCConnection

public abstract XDBCConnection newXDBCConnection(String host,
                                                 int port)
                                          throws XDBCException
Creates and returns a new XDBCConnection object, representing a connection to an XML data source. This connection is established to the host and port specified as parameters.

Parameters:
host - the String name or ip address of the data source host.
port - the integer port number of the data source host.
Returns:
the XDBCConnection object
Throws:
XDBCException - if an error occurs while establishing the connection.

newXDBCConnection

public abstract XDBCConnection newXDBCConnection(String host,
                                                 int port,
                                                 String prompt)
                                          throws XDBCException
Creates and returns a new XDBCConnection object, representing a connection to an XML data source. This connection is established to the host and port specified as parameters, with credentials provided by the Authenticator for this host, port, and prompt.

Parameters:
host - the String name or ip address of the data source host.
port - the integer port number of the data source host.
prompt - the String prompt distinguishing the data source.
Returns:
the XDBCConnection object
Throws:
XDBCException - if an error occurs while establishing the connection.

newXDBCConnection

public abstract XDBCConnection newXDBCConnection(String host,
                                                 int port,
                                                 String user,
                                                 String password)
                                          throws XDBCException
Creates and returns a new XDBCConnection object, representing a connection to an XML data source. This connection is established to the host and port specified as parameters, with the credentials given.

Parameters:
host - the String name or ip address of the data source host.
port - the integer port number of the data source host.
user - the user to use to connect.
password - the password to use to connect.
Returns:
the XDBCConnection object
Throws:
XDBCException - if an error occurs while establishing the connection.

getHost

public String getHost()
               throws XDBCException
Gets the host name or ip address used to create connections with this factory instance.

Returns:
the String host name.
Throws:
XDBCException - if an error occurs while getting the host.

getPort

public int getPort()
            throws XDBCException
Gets the port number used to create connections with this factory instance.

Returns:
the integer port number.
Throws:
XDBCException - if an error occurs while getting the port.

setHost

public void setHost(String host)
             throws XDBCException
Sets the host name or ip address used to create connections with this factory instance. Subsequent calls to newXDBCConnection() will return a connection to this host.

Parameters:
host - the String host name.
Throws:
XDBCException - if an error occurs while setting the host.

setPort

public void setPort(int port)
             throws XDBCException
Sets the port number used to create connections with this factory instance. Subsequent calls to newXDBCConnection() will return a connection to this port number on the host specified with setHost().

Parameters:
port - the integer port number
Throws:
XDBCException - if an error occurs while setting the port.