XCC/J 3.2-9

com.marklogic.xcc
Class ContentSourceFactory

java.lang.Object
  extended bycom.marklogic.xcc.ContentSourceFactory

public class ContentSourceFactory
extends Object

Static helper class with factory methods to create instances of ContentSource using explicit connection parameters.

See Also:
ContentSource

Method Summary
static ContentSource newContentSource(ConnectionProvider connectionProvider, String user, String password, String contentbaseName)
           Return a ContentSource object that will use the provided ConnectionProvider instance to obtain server connections, with the given default login credentials and contentbase values.
static ContentSource newContentSource(String host, int port)
          Return a ContentSource object that will serve as the source of connections to the server on the given host and port, with no default login credentials.
static ContentSource newContentSource(String host, int port, String user, String password)
          Equivalent to newContentSource (host, port, user, password, null)
static ContentSource newContentSource(String host, int port, String user, String password, String contentbaseName)
          Return a ContentSource object that will serve as the source of connections to the server on the given host and port, with login credentials of the given user and password.
static ContentSource newContentSource(URI uri)
          Return a ContentSource object that will serve as the source of connections to the server specified by the given URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newContentSource

public static ContentSource newContentSource(ConnectionProvider connectionProvider,
                                             String user,
                                             String password,
                                             String contentbaseName)

Return a ContentSource object that will use the provided ConnectionProvider instance to obtain server connections, with the given default login credentials and contentbase values. Custom connection management policies may be implemented by the ConnectionProvider object.

NOTE: This factory method should only be used by advanced users. A misbehaving ConnectionProvider implementation can result in connection failures and potentially even data loss. Be sure you know what you're doing.

Parameters:
connectionProvider - An instance of ConnectionProvider that will be used to obtain sockets to connect to the ContentSource when needed. The client is responsible for properly initializing this object with the information it needs to make the appropriate connections.
user - The default User Name to use for authentication.
password - The default Password to use for authentication.
contentbaseName - The contentbase (database) on the ContentSource to run queries against. Pass null to use the default configured on the server.
Returns:
A ContentSource instance representing the ContentSource.
See Also:
ContentSource

newContentSource

public static ContentSource newContentSource(URI uri)
                                      throws XccConfigException

Return a ContentSource object that will serve as the source of connections to the server specified by the given URI. The format of the URI is:

xcc://user:password@host:port/contentbase

For example: xcc://joe:hush@myserver:8003

For example: xcc://joe:hush@myserver:8003/production

The contentbase id is optional. If not specified the default database for the XDBC server configuration will be used.

The only supported connection scheme is currently "xcc" ("xdbc" is an alias), but others may be added in the future.

Parameters:
uri - A URI instance which encodes the connection scheme, host, port and optional user and password.
Returns:
A ContentSource instance representing the ContentSource.
Throws:
XccConfigException - If there is a configuration problem or the configured ContentSource implementation class cannot be instantiated.
See Also:
ContentSource

newContentSource

public static ContentSource newContentSource(String host,
                                             int port,
                                             String user,
                                             String password,
                                             String contentbaseName)
Return a ContentSource object that will serve as the source of connections to the server on the given host and port, with login credentials of the given user and password. No connections are made at this time. Note that the ContentSource instance returned may be shared with other callers or threads. The implementation may choose to pool and re-use ContentSource objects for a particular host/port/user combination.

Parameters:
host - The name or dotted-quad IP address of the server host.
port - The port on the host to connect to.
user - The default User Name to use for authentication.
password - The default Password to use for authentication.
contentbaseName - The ContentBase (database) on the ContentSource run queries against. Pass null to use the default configured on the server.
Returns:
A ContentSource instance representing the ContentSource.
See Also:
ContentSource

newContentSource

public static ContentSource newContentSource(String host,
                                             int port,
                                             String user,
                                             String password)
Equivalent to newContentSource (host, port, user, password, null)

Parameters:
host - The name or dotted-quad IP address of the server host.
port - The port on the host to connect to.
user - The default User Name to use for authentication.
password - The default Password to use for authentication.
Returns:
A ContentSource instance representing the ContentSource. the configured ContentSource implementation class cannot be instantiated.
See Also:
ContentSource

newContentSource

public static ContentSource newContentSource(String host,
                                             int port)
Return a ContentSource object that will serve as the source of connections to the server on the given host and port, with no default login credentials. Invoking newSession() on the returned ContentSource object, without providing a user name/password, will throw an IllegalStateException.

Parameters:
host - The name or dotted-quad IP address of the server host.
port - The port on the host to connect to.
Returns:
A ContentSource instance representing the ContentSource.
See Also:
ContentSource

XCC/J 3.2-9

Copyright © 2003-2008 Mark Logic Corporation, All Rights Reserved.

Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com