XCC/J 4.0-9

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.
 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 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 Sessions 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

XCC/J 4.0-9

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

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