DataSourcePropertyStore (Apache Tomcat 11.0.22 API Documentation)
Description: declaration: package: org.apache.catalina.servlets, class: DataSourcePropertyStore

# Class DataSourcePropertyStore

java.lang.Object
org.apache.catalina.servlets.DataSourcePropertyStore

All Implemented Interfaces:
  `WebdavServlet.PropertyStore`

public class DataSourcePropertyStore extends Object implements WebdavServlet.PropertyStore
WebDAV dead properties storage using a DataSource.

A single properties table with four columns is used:

- path: the resource path
- namespace: the node namespace
- name: the local name in the namespace
- node: the full serialized XML node including the name

The table name used can be configured using the `tableName` property of the store.

Example table schema: `CREATE TABLE properties ( path VARCHAR(1024) NOT NULL, namespace VARCHAR(64) NOT NULL, name VARCHAR(64) NOT NULL, node VARCHAR(2048) NOT NULL, PRIMARY KEY (path, namespace, name) )`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected DataSource`
  `dataSource`
  DataSource instance being used.
  `protected static final StringManager`
  `sm`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DataSourcePropertyStore()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `copy(String source, String destination)`
  Copy resource.
  `void`
  `delete(String resource)`
  Delete specified resource.
  `void`
  `destroy()`
  Destroy the store.
  `String`
  `getDataSourceName()`
  `String`
  `getTableName()`
  `void`
  `init()`
  Initialize the store.
  `void`
  `periodicEvent()`
  Periodic event for maintenance tasks.
  `boolean`
  `propfind(String resource, Node property, boolean nameOnly, XMLWriter generatedXML)`
  Generate propfind XML fragments for dead properties.
  `void`
  `proppatch(String resource, ArrayList<WebdavServlet.ProppatchOperation> operations)`
  Apply proppatch to the specified resource.
  `void`
  `setDataSourceName(String dataSourceName)`
  `void`
  `setTableName(String tableName)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### sm

    protected static final StringManager sm

  - ### dataSource

    protected DataSource dataSource
    DataSource instance being used.

- ## Constructor Details

  - ### DataSourcePropertyStore

    public DataSourcePropertyStore()

- ## Method Details

  - ### getDataSourceName

    public String getDataSourceName()
    Returns:
      the DataSource JNDI name, will be prefixed with java:comp/env for the lookup.

  - ### setDataSourceName

    public void setDataSourceName(String dataSourceName)
    Parameters:
      `dataSourceName` - the DataSource JNDI name, will be prefixed with java:comp/env for the lookup.

  - ### getTableName

    public String getTableName()
    Returns:
      the table name that will be used in the database

  - ### setTableName

    public void setTableName(String tableName)
    Parameters:
      `tableName` - the table name to use in the database

  - ### init

    public void init()
    Description copied from interface: `WebdavServlet.PropertyStore`
    Initialize the store. This is tied to the Servlet lifecycle and is called by its init method.
    Specified by:
      `init` in interface `WebdavServlet.PropertyStore`

  - ### destroy

    public void destroy()
    Description copied from interface: `WebdavServlet.PropertyStore`
    Destroy the store. This is tied to the Servlet lifecycle and is called by its destroy method.
    Specified by:
      `destroy` in interface `WebdavServlet.PropertyStore`

  - ### periodicEvent

    public void periodicEvent()
    Description copied from interface: `WebdavServlet.PropertyStore`
    Periodic event for maintenance tasks.
    Specified by:
      `periodicEvent` in interface `WebdavServlet.PropertyStore`

  - ### copy

    public void copy(String source, String destination)
    Description copied from interface: `WebdavServlet.PropertyStore`
    Copy resource. Dead properties should be copied to the destination path.
    Specified by:
      `copy` in interface `WebdavServlet.PropertyStore`
    Parameters:
      `source` - the copy source path
      `destination` - the copy destination path

  - ### delete

    public void delete(String resource)
    Description copied from interface: `WebdavServlet.PropertyStore`
    Delete specified resource. Dead properties on a deleted resource should be deleted.
    Specified by:
      `delete` in interface `WebdavServlet.PropertyStore`
    Parameters:
      `resource` - the path of the resource to delete

  - ### propfind

    public boolean propfind(String resource, Node property, boolean nameOnly, XMLWriter generatedXML)
    Description copied from interface: `WebdavServlet.PropertyStore`
    Generate propfind XML fragments for dead properties.
    Specified by:
      `propfind` in interface `WebdavServlet.PropertyStore`
    Parameters:
      `resource` - the resource path
      `property` - the dead property, if null then all dead properties must be written
      `nameOnly` - true if only the property name element should be generated
      `generatedXML` - the current generated XML for the PROPFIND response
    Returns:
      true if a property was specified and a corresponding dead property was found on the resource, false otherwise

  - ### proppatch

    public void proppatch(String resource, ArrayList<WebdavServlet.ProppatchOperation> operations)
    Description copied from interface: `WebdavServlet.PropertyStore`
    Apply proppatch to the specified resource.
    Specified by:
      `proppatch` in interface `WebdavServlet.PropertyStore`
    Parameters:
      `resource` - the resource path on which to apply the proppatch
      `operations` - the set and remove to apply, the final status codes of the result should be set on each operation