Overview | Package | Class | Tree | Deprecated | Index | Help
| XCC/J 4.2-9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.marklogic.xcc
Class ContentSourceFactory

    java.lang.Object
      com.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)` Equivalent to `newContentSource (host, port, user, password, contentbaseName, null)`
`static ContentSource` | `newContentSource(String host, int port, String user, String password, String contentbaseName, SecurityOptions options)` 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)` Equivalent to `newContentSource(uri, null)`.
`static ContentSource` | `newContentSource(URI uri, SecurityOptions options)` 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. The contentbase numeric id may be supplied instead, if prepended by '#'. Pass null to use the default configured on the server.
  Returns:
    A `ContentSource` instance representing the ContentSource.
  See Also:
    `ContentSource`, `ContentbaseMetaData`

### newContentSource

    public static ContentSource newContentSource(URI uri,
                                                 SecurityOptions options)
                                          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 an SSL-enabled connection, the URI format is: `xccs://user:password@host:port/contentbase`

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

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

  The contentbase name is optional. If not specified the default database for the XDBC server configuration will be used. To reference a contentbase by numeric id (see `ContentbaseMetaData.getContentBaseId()`), prepend it with '#'.

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

  The supported connection schemes are currently "xcc" ("xdbc" is an alias) for a non-secure connection and "xccs" for a secure connection, 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.
    `options` - Security settings to be used for "xccs" secure connections.
  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`, `ContentbaseMetaData`

### newContentSource

    public static ContentSource newContentSource(URI uri)
                                          throws XccConfigException

  Equivalent to `newContentSource(uri, null)`.

  Parameters:
    `uri` - A URI instance which encodes the connection scheme, host, port and optional user and password. The format of the URI is: `xcc://user:password@host:port/contentbase`
  Returns:
    A `ContentSource` instance representing the ContentSource.
  Throws:
    `XccConfigException` - If there is a configuration problem or the configured `ContentSource` implementation class cannot be instantiated.

### newContentSource

    public static ContentSource newContentSource(String host,
                                                 int port,
                                                 String user,
                                                 String password,
                                                 String contentbaseName,
                                                 SecurityOptions options)

  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 to run queries against. The contentbase numeric id may be supplied instead, if prepended by '#'. Pass null to use the default configured on the server.
    `options` - Security settings to be used for secure connections.
  Returns:
    A `ContentSource` instance representing the ContentSource.
  See Also:
    `ContentSource`, `ContentbaseMetaData`

### newContentSource

    public static ContentSource newContentSource(String host,
                                                 int port,
                                                 String user,
                                                 String password,
                                                 String contentbaseName)

  Equivalent to `newContentSource (host, port, user, password, contentbaseName, 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.
    `contentbaseName` - The ContentBase (database) on the ContentSource to run
  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,
                                                 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`

Overview | Package | Class | Tree | Deprecated | Index | Help
| XCC/J 4.2-9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 MarkLogic Corporation, All Rights Reserved.

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