Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.api.xqj
Class BXQDataSource

    java.lang.Object
      org.basex.api.xqj.BXQDataSource

All Implemented Interfaces:
  XQDataSource

    public final class BXQDataSource

extends java.lang.Object
implements XQDataSource

Java XQuery API - Data Source.

Author:
  Workgroup DBIS, University of Konstanz 2005-08, ISC License, Andreas Weiler

Constructor Summary
`BXQDataSource()` Constructor.

Method Summary
`BXQConnection` | `getConnection()` Attempts to create a connection to an XML datasource.
`XQConnection` | `getConnection(java.sql.Connection c)` Attempts to create a connection to an XML datasource using an existing JDBC connection.
`XQConnection` | `getConnection(java.lang.String name, java.lang.String pw)` Attempts to establish a connection to an XML datasource using the supplied username and password.
`int` | `getLoginTimeout()` Gets the maximum time in seconds that this datasource can wait while attempting to connect to a database.
`java.io.PrintWriter` | `getLogWriter()` Retrieves the log writer for this `XQDataSource` object.
`java.lang.String` | `getProperty(java.lang.String key)` Returns the current value of the named property if set, else `null`.
`java.lang.String[]` | `getSupportedPropertyNames()` Returns an array containing the property names supported by this `XQDataSource`.
`void` | `setLoginTimeout(int to)` Sets the maximum time in seconds that this datasource will wait while attempting to connect to a database.
`void` | `setLogWriter(java.io.PrintWriter out)` Sets the log writer for this `XQDataSource` object to the given `java.io.PrintWriter` object.
`void` | `setProperties(java.util.Properties prop)` Sets the data source properties from the specified `Properties` instance.
`void` | `setProperty(java.lang.String key, java.lang.String val)` Sets the named property to the specified value.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BXQDataSource

    public BXQDataSource()

  Constructor.

Method Detail

### getConnection

    public BXQConnection getConnection()

  Description copied from interface: `XQDataSource`
  Attempts to create a connection to an XML datasource.

  Specified by:
    `getConnection` in interface `XQDataSource`
  Returns:
    a connection to the XML datasource

### getConnection

    public XQConnection getConnection(java.sql.Connection c)
                               throws XQException

  Description copied from interface: `XQDataSource`
  Attempts to create a connection to an XML datasource using an existing JDBC connection. An XQJ implementation is not required to support this method. If it is not supported, then an exception (`XQException`) is thrown. The XQJ and JDBC connections will operate under the same transaction context.

  Specified by:
    `getConnection` in interface `XQDataSource`
  Parameters:
    `c` - an existing JDBC connection
  Returns:
    a connection to the XML datasource
  Throws:
    `XQException` - if (1) a datasource access error occurs, (2) the implementation does not support this method of getting an `XQConnection`, or (3) if the `con` parameter is `null`

### getConnection

    public XQConnection getConnection(java.lang.String name,
                                      java.lang.String pw)

  Description copied from interface: `XQDataSource`
  Attempts to establish a connection to an XML datasource using the supplied username and password.

  Specified by:
    `getConnection` in interface `XQDataSource`
  Parameters:
    `name` - the user on whose behalf the connection is being made
    `pw` - the user's password
  Returns:
    a connection to the XML datasource

### getLoginTimeout

    public int getLoginTimeout()

  Description copied from interface: `XQDataSource`
  Gets the maximum time in seconds that this datasource can wait while attempting to connect to a database. A value of zero means that the timeout is the default system timeout if there is one; otherwise, it means that there is no timeout. When a XQDataSource object is created, the login timeout is initially zero. It is implementation-defined whether the returned login timeout is actually used by the data source implementation.

  Specified by:
    `getLoginTimeout` in interface `XQDataSource`
  Returns:
    the datasource login time limit

### getLogWriter

    public java.io.PrintWriter getLogWriter()

  Description copied from interface: `XQDataSource`
  Retrieves the log writer for this `XQDataSource` object. The log writer is a character output stream to which all logging and tracing messages for this datasource will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. When a `XQDataSource` object is created, the log writer is initially `null`; in other words, the default is for logging to be disabled.

  Specified by:
    `getLogWriter` in interface `XQDataSource`
  Returns:
    the log writer for this datasource or `null` if logging is disabled

### getProperty

    public java.lang.String getProperty(java.lang.String key)
                                 throws XQException

  Description copied from interface: `XQDataSource`
  Returns the current value of the named property if set, else `null`. If the implementation does not support the given property then an exception is raised.

  Specified by:
    `getProperty` in interface `XQDataSource`
  Parameters:
    `key` - the name of the property whose value is needed
  Returns:
    `String` representing the value of the required property if set, else `null`
  Throws:
    `XQException` - if (1) a given property is not supported, or (2) the name parameter is `null`

### getSupportedPropertyNames

    public java.lang.String[] getSupportedPropertyNames()

  Description copied from interface: `XQDataSource`
  Returns an array containing the property names supported by this `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

  Any additional properties are implementation-defined.

  Specified by:
    `getSupportedPropertyNames` in interface `XQDataSource`
  Returns:
    `String[]` an array of property names supported by this implementation

### setLoginTimeout

    public void setLoginTimeout(int to)

  Description copied from interface: `XQDataSource`
  Sets the maximum time in seconds that this datasource will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout. When a `XQDataSource` object is created, the login timeout is initially zero. It is implementation-defined whether the specified login timeout is actually used by the data source implementation. If the connection is created over an existing JDBC connection, then the login timeout value from the underlying JDBC connection may be used.

  Specified by:
    `setLoginTimeout` in interface `XQDataSource`
  Parameters:
    `to` - the datasource login time limit

### setLogWriter

    public void setLogWriter(java.io.PrintWriter out)

  Description copied from interface: `XQDataSource`
  Sets the log writer for this `XQDataSource` object to the given `java.io.PrintWriter` object. The log writer is a character output stream to which all logging and tracing messages for this datasource will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. When a `XQDataSource` object is created the log writer is initially `null`; in other words, the default is for logging to be disabled.

  Specified by:
    `setLogWriter` in interface `XQDataSource`
  Parameters:
    `out` - the new log writer; to disable logging, set to `null`

### setProperties

    public void setProperties(java.util.Properties prop)
                       throws XQException

  Description copied from interface: `XQDataSource`
  Sets the data source properties from the specified `Properties` instance. Properties set before this call will still apply but those with the same name as any of these properties will be replaced. Properties set after this call also apply and may replace properties set during this call.

  If the implementation does not support one or more of the given property names, or if it can determine that the value given for a specific property is invalid, then an exception is thrown. If an exception is thrown, then no previous value is overwritten. is invalid, then an exception is raised.

  Specified by:
    `setProperties` in interface `XQDataSource`
  Parameters:
    `prop` - the list of properties to set
  Throws:
    `XQException` - if (1) a given property is not recognized, (2) the value for a given property is determined to be invalid, or (3) the `props` parameter is `null`

### setProperty

    public void setProperty(java.lang.String key,
                            java.lang.String val)
                     throws XQException

  Description copied from interface: `XQDataSource`
  Sets the named property to the specified value. If a property with the same name was already set, then this method will override the old value for that property with the new value.

  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.

  Specified by:
    `setProperty` in interface `XQDataSource`
  Parameters:
    `key` - the name of the property to set
    `val` - the value of the named property
  Throws:
    `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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD