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.
getDefaultLogger()
,
ContentSourceFactory
,
Session
Modifier and Type | Method and Description |
---|---|
ConnectionProvider |
getConnectionProvider() |
java.util.logging.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(java.lang.String contentbaseId)
Attempts to establish a
Session with the specified contentbase on the server
represented by this ContentSource. |
Session |
newSession(java.lang.String userName,
java.lang.String password)
Attempts to establish a
Session with the default contentbase for this ContentSource
using the provided login credentials. |
Session |
newSession(java.lang.String userName,
java.lang.String password,
java.lang.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(java.util.logging.Logger logger)
Set the default java.util.Logger instance which will be inherited by new
Session
instances. |
Session newSession()
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.Session
instance.java.lang.IllegalStateException
- If this ContentSource was created without specifying user/password credentials.Session newSession(java.lang.String contentbaseId)
Session
with the specified contentbase on the server
represented by this ContentSource.contentbaseId
- A contentbase name or numeric ID.Session
instance.java.lang.IllegalStateException
- If this ContentSource was created without specifying default user credentials.Session newSession(java.lang.String userName, java.lang.String password)
Session
with the default contentbase for this ContentSource
using the provided login credentials.userName
- The user name to connect as.password
- The password associated with the user name.Session
instance.Session newSession(java.lang.String userName, java.lang.String password, java.lang.String contentbaseId)
Session
with the specified contentbase on the server
represented by this ContentSource, using the provided user credentials.userName
- The user name to connect as.password
- The password associated with the user name.contentbaseId
- A contentbase name or numeric ID.Session
instance.java.util.logging.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.
void setDefaultLogger(java.util.logging.Logger logger)
Set the default java.util.Logger instance which will be inherited by new Session
instances.
logger
- An instance of java.util.logging.Loggerboolean isAuthenticationPreemptive()
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.
value
- true if basic authentication should be attempted preemptively, false otherwise.ConnectionProvider getConnectionProvider()
Copyright © 2017 MarkLogic Corporation. All Rights Reserved.
Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com