|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGenericXQDataSource
net.xqj.marklogic.MarkLogicXQDataSource
public class MarkLogicXQDataSource
MarkLogic implementation of the XQJ XQDataSource interface. (JSR 225).
This class has a default public constructor, so it may be instantiated easily via the reflection API.
The two approaches to create an implementation of this class are as follows:
Direct initializationXQDataSource xqDataSource = new MarkLogicXQDataSource();Java Reflection
XQDataSource xqDataSource = Class.forName("net.xqj.marklogic.MarkLogicXQDataSource").newInstance();
Field Summary | |
---|---|
static String |
FORCE_XDBC4
Force XDBC4 protocol constant. |
static String |
MODE_CONFORMANCE
Conformance mode constant, allowing driver to pass 100% of XQJ TCK. |
static String |
MODE_XDBC
XDBC mode constant, allowing driver to pass 94%+ of XQJ TCK. |
Constructor Summary | |
---|---|
MarkLogicXQDataSource()
Creates a new instance of a MarkLogicXQDataSource. |
Method Summary | |
---|---|
XQConnection |
getConnection()
Creates an XQConnection / XQConnection2 instance. |
XQConnection |
getConnection(Connection con)
Deprecated. |
XQConnection |
getConnection(String username,
String passwd)
Creates a XQConnection instance manually specifying user credentials. |
String |
getDatabaseName()
Get the name of the target Database. |
String |
getMode()
Gets the mode setting of this MarkLogicXQDataSource |
String |
getPassword()
Gets the password value of this MarkLogicXQDataSource |
int |
getPort()
Get the target port of the XDBC Server. |
String |
getProperty(String name)
Returns the current value of the named property if set, else null . |
String |
getServerName()
Gets the MarkLogic Server's name, which will be a hostname or an IP address. |
String[] |
getSupportedPropertyNames()
Returns an array containing the property names supported by this XQDataSource . |
String |
getUser()
Gets the user value of this MarkLogicXQDataSource |
boolean |
isForceXDBC4()
Retrieves whether or not all new XQConnection instances are forced to use the XDBC4 protocol. |
void |
setDatabaseName(String databaseName)
Set the MarkLogic Server's target Database. |
void |
setForceXDBC4(boolean forceXDBC4)
Force all new XQConnection instances to use the XDBC4 protocol. |
void |
setForceXDBC4(String forceXDBC4)
Force all new XQConnection instances to use the XDBC4 protocol. |
void |
setMode(String mode)
Sets the mode of the XQDataSource, values can be either "xdbc" or "conformance". |
void |
setPassword(String password)
Sets the password value of this MarkLogicXQDataSource |
void |
setPort(int port)
Sets the target port of the XDBC Server. |
void |
setPort(String port)
Sets the target port of the XDBC Server. |
void |
setProperty(String name,
String value)
Sets the named property to the specified value. |
void |
setServerName(String serverName)
Sets the MarkLogic Server's name |
void |
setUser(String user)
Sets the user value of this MarkLogicXQDataSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.xml.xquery.XQDataSource |
---|
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter, setProperties |
Field Detail |
---|
public static final String MODE_CONFORMANCE
public static final String MODE_XDBC
public static final String FORCE_XDBC4
Constructor Detail |
---|
public MarkLogicXQDataSource()
Method Detail |
---|
public XQConnection getConnection() throws XQException
Creates an XQConnection
/ XQConnection2
instance. Credentials must have already been defined.
The XQConnection
instance returned from this method may be cast into a XQConnection2
.
Consider the following code:
XQConnection2
conn = (XQConnection2
)MarkLogicXQDataSourceInstance.getConnection();
getConnection
in interface XQDataSource
XQConnection
/ XQConnection2
.
XQException
- if a datasource access error occursXQConnection2
public XQConnection getConnection(String username, String passwd) throws XQException
Creates a XQConnection
instance manually specifying user credentials.
The XQConnection
instance returned from this method may be cast into a XQConnection2
.
Consider the following code:
XQConnection2
conn = (XQConnection2
)MarkLogicXQDataSourceInstance.getConnection("user","password");
getConnection
in interface XQDataSource
username
- the username which will be used when communicating with the XDBC Server.passwd
- the password which will be used when communicating with the XDBC Server.
XQConnection
/ XQConnection2
.
XQException
- if a datasource access error occursXQConnection2
public void setServerName(String serverName)
serverName
- the MarkLogic Server's name, this can be a hostname or an IP address.public String getServerName()
public void setDatabaseName(String databaseName)
databaseName
- the name of the Database which queries run against.public String getDatabaseName()
public void setMode(String mode) throws XQException
mode
- the mode of future XQConnection instances, value may be "xdbc" or "conformance".
XQException
- if the mode parameter is not recognised.public String getMode()
public void setUser(String user)
user
- a username which will be sent to an XDBC server.public String getUser()
public void setPassword(String password)
password
- a password which will be sent to an XDBC server.public String getPassword()
public void setPort(int port)
port
- the XDBC Server portpublic void setPort(String port) throws XQException
port
- the XDBC Server port
XQException
- if the supplied port is not a valid port.public int getPort()
public void setForceXDBC4(boolean forceXDBC4)
forceXDBC4
- true to use the XDBC4 protocol, false to use the XDBC5+ protocol.public void setForceXDBC4(String forceXDBC4) throws XQException
forceXDBC4
- "true" to use the XDBC4 protocol, "false" to use the XDBC5+ protocol.
XQException
- if the supplied value is not a valid String representation of a Boolean.public boolean isForceXDBC4()
public String[] getSupportedPropertyNames()
XQDataSource
XQDataSource
.
Implementations that support user name and password must recognize
the user name and password properties listed below.
user |
the user name to use for creating a connection |
password |
the password to use for creating a connection |
getSupportedPropertyNames
in interface XQDataSource
String[]
an array of property names
supported by this implementationpublic void setProperty(String name, String value) throws XQException
XQDataSource
If the implementation does not support the given property or if it can determine that the value given for this property is invalid, then an exception is thrown. If an exception is thrown, then no previous value is overwritten.
setProperty
in interface XQDataSource
name
- the name of the property to setvalue
- the value of the named property
XQException
- if (1) the given property is not recognized,
(2) the value for the given property is
determined to be invalid, or (3) the name
parameter is null
public String getProperty(String name) throws XQException
XQDataSource
null
. If the implementation does not support the
given property then an exception is raised.
getProperty
in interface XQDataSource
name
- the name of the property whose value is
needed
String
representing the value of
the required property if set, else
null
XQException
- if (1) a given property is not supported, or
(2) the name parameter is null
public XQConnection getConnection(Connection con) throws XQException
getConnection
in interface XQDataSource
con
- an existing JDBC connection
XQException
- calling this method will throw an XQException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |