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
Interface ContentSource

All Known Implementing Classes:
  ContentSourceBean

    public interface ContentSource

A ContentSource object describes a content source (MarkLogic Server instance) and serves as a factory that creates `Session` objects. Instances of ContentSource may be obtained from a JNDI lookup service or from one of the static factory methods on the `ContentSourceFactory` class.

See the `getDefaultLogger()` method for information about configuring logging behavior.

See Also:
  `getDefaultLogger()`, `ContentSourceFactory`, `Session`

Method Summary
`Logger` | `getDefaultLogger()` Returns the current Logger to which log messages will be sent.
`boolean` | `isAuthenticationPreemptive()`
`Session` | `newSession()` Attempts to establish a `Session` with the default contentbase for this ContentSource.
`Session` | `newSession(String contentbaseId)` Attempts to establish a `Session` with the specified contentbase on the server represented by this ContentSource.
`Session` | `newSession(String userName, String password)` Attempts to establish a `Session` with the default contentbase for this ContentSource using the provided login credentials.
`Session` | `newSession(String userName, String password, String contentbaseId)` Attempts to establish a `Session` with the specified contentbase on the server represented by this ContentSource, using the provided user credentials.
`void` | `setAuthenticationPreemptive(boolean value)` Sets whether basic authentication should be attempted preemptively, default is false.
`void` | `setDefaultLogger(Logger logger)` Set the default java.util.Logger instance which will be inherited by new `Session` instances.

Method Detail

### newSession

    Session newSession()

  Attempts to establish a `Session` with the default contentbase for this ContentSource. Login credentials are the defaults established when the instance was created or bound to the JNDI service.

  Returns:
    A `Session` instance.
  Throws:
    `IllegalStateException` - If this ContentSource was created without specifying user/password credentials.

### newSession

    Session newSession(String contentbaseId)

  Attempts to establish a `Session` with the specified contentbase on the server represented by this ContentSource.

  Parameters:
    `contentbaseId` - A contentbase name or numeric ID.
  Returns:
    A `Session` instance.
  Throws:
    `IllegalStateException` - If this ContentSource was created without specifying default user credentials.

### newSession

    Session newSession(String userName,
                       String password)

  Attempts to establish a `Session` with the default contentbase for this ContentSource using the provided login credentials.

  Parameters:
    `userName` - The user name to connect as.
    `password` - The password associated with the user name.
  Returns:
    A `Session` instance.

### newSession

    Session newSession(String userName,
                       String password,
                       String contentbaseId)

  Attempts to establish a `Session` with the specified contentbase on the server represented by this ContentSource, using the provided user credentials.

  Parameters:
    `userName` - The user name to connect as.
    `password` - The password associated with the user name.
    `contentbaseId` - A contentbase name or numeric ID.
  Returns:
    A `Session` instance.

### getDefaultLogger

    Logger getDefaultLogger()

  Returns the current Logger to which log messages will be sent. If not overridden with `setDefaultLogger(Logger)`, an implementation default logger is returned. This Logger will be inherited by `Session` instances created from this ContentSource. The `Logger` for individual `Session`s can be overridden with the `Session.setLogger(java.util.logging.Logger)` method.

  The name of the implementation default logger is `com.marklogic.xcc`. This is the name which should be used in a logging properties file (see `LogManager`) to customize the logger.

  XCC includes a bundled properties file that augments the default JVM logging properties. This file, xcc.logging.properties, is read from the classpath when the first ContentSource instance is created. The properties file in xcc.jar looks like this. If you wish to customize these logging properties, place a copy of this file in your classpath ahead of xcc.jar.

  Default logging properties file in xcc.jar.

  Returns:
    The currently set Logger instance, or a default created by the implementation.

### setDefaultLogger

    void setDefaultLogger(Logger logger)

  Set the default java.util.Logger instance which will be inherited by new `Session` instances.

  Parameters:
    `logger` - An instance of java.util.logging.Logger

### isAuthenticationPreemptive

    boolean isAuthenticationPreemptive()

  Returns:
    true if basic authentication will be attempted preemptively, false otherwise.

### setAuthenticationPreemptive

    void setAuthenticationPreemptive(boolean value)

  Sets whether basic authentication should be attempted preemptively, default is false.

  Preemptive authentication can reduce the overhead of making connections to servers that accept basic authentication by eliminating the challenge-response interaction otherwise required.

  Note that misuse of preemptive authentication entails potential security risks, and under most circumstances the credentials used to authenticate will be cached after the first connection. To avoid creating the illusion that credentials are protected, connections to a server requiring digest authentication will not be retried if this flag is set.

  Parameters:
    `value` - true if basic authentication should be attempted preemptively, false otherwise.

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