|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGenericXQDataSource
net.xqj.basex.BaseXXQDataSource
public class BaseXXQDataSource
BaseX XQDataSource Implementation
This implementation internally creates Socket connections with a BaseX Server. Socket connections are persistent and stateful.
By default, BaseX listens for incoming connections on port "1984".
Constructor Summary | |
---|---|
BaseXXQDataSource()
Creates a new instance of a BaseXXQDataSource. |
Method Summary | |
---|---|
XQConnection |
getConnection()
Creates an XQConnection / XQConnection2 instance. |
XQConnection |
getConnection(Connection con)
Deprecated. |
XQConnection |
getConnection(String username,
String passwd)
Creates a XQConnection / / XQConnection2 instance manually specifying user credentials. |
String |
getDatabaseName()
Get the name of the target Database. |
String |
getPassword()
Gets the password value of this BaseXXQDataSource |
int |
getPort()
Get the target port of the BaseX Server. |
String |
getProperty(String name)
Returns the current value of the named property if set, else null . |
String |
getServerName()
Gets the BaseX 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 BaseXXQDataSource |
void |
setDatabaseName(String databaseName)
Set the BaseX Server's target Database. |
void |
setPassword(String password)
Sets the password value of this BaseXXQDataSource |
void |
setPort(int port)
Sets the target port of the BaseX Server. |
void |
setPort(String port)
Sets the target port of the BaseX Server. |
void |
setProperty(String name,
String value)
Sets the named property to the specified value. |
void |
setServerName(String serverName)
Sets the BaseX Server's name |
void |
setUser(String user)
Sets the user value of this BaseXXQDataSource |
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 |
Constructor Detail |
---|
public BaseXXQDataSource()
Creates a new instance of a BaseXXQDataSource.
Some default properties are given to the XQDataSource
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
)BaseXXQDataSourceInstance.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
/ / XQConnection2
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
)BaseXXQDataSourceInstance.getConnection("user","password");
getConnection
in interface XQDataSource
username
- the username which will be used when communicating with the BaseX Server.passwd
- the password which will be used when communicating with the BaseX Server.
XQConnection
/ XQConnection2
.
XQException
- if a datasource access error occursXQConnection2
public void setServerName(String serverName)
serverName
- the BaseX 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 setUser(String user)
user
- a username which will be sent to an Basex server.public String getUser()
public void setPassword(String password)
password
- a password which will be sent to an BaseX server.public String getPassword()
public void setPort(int port)
port
- the BaseX Server portpublic void setPort(String port) throws XQException
port
- the BaseX Server port
XQException
- if the supplied port is not a valid port.public int getPort()
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 |