Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

## oracle.xml.xsql
Class XSQLActionHandlerImpl

`java.lang.Object
oracle.xml.xsql.XSQLActionHandlerImpl`

All Implemented Interfaces:
  XSQLActionHandler

      public abstract class XSQLActionHandlerImpl

extends java.lang.Object
implements XSQLActionHandler

Base Implementation of XSQLActionHandler that can be extended to create your own custom handlers.

Includes a set of useful helper methods.

NOTE: If you extend this class and override the init() method, make sure to call:

    super.init(env,e);

Constructor Summary
`XSQLActionHandlerImpl()`

Method Summary
`protected void` `addResultElement(Node rootNode, java.lang.String elementName, java.lang.String content)` Convenience method to add a single element with text content as the result of your action handler.
`protected void` `appendCopyOfSecondaryDocument(Node rootNode, Document d)` Convenience method to append a copy of the entire content of one XML document to another.
`protected void` `appendSecondaryDocument(Node rootNode, Document d)` Convenience method to append the entire content of one XML document to another.
`protected java.lang.String` `firstColumnOfFirstRow(Node rootNode, java.lang.String statement)` Convenience method to return the first column value of the first row of a SQL statement as a String.
`protected java.lang.String[]` `firstNColumnsOfFirstRow(Node rootNode, java.lang.String statement, int n)` Convenience method to return the first column value of the first row of a SQL statement as a String.
`protected Element` `getActionElement()` Return the DOM Element representing the current XSQL action element in the XSQL page being processed.
`protected java.lang.String` `getActionElementContent()` Convenience method to return the first (normalized) text content of the action element, with all parameter values subsituted automatically.
`protected java.lang.String` `getAttribute(java.lang.String attrname, Element e)` Convenience method to get the value of an attribute by name the actionElement or some sub-element.
`protected java.lang.String` `getAttributeAllowingParam(java.lang.String attrname, Element e)` Convenience method to get the value of an attribute by name the actionElement or some sub-element.
`protected int` `getBindVariableCount()`
`protected int` `getDefaultFetchSize()` Convenience method to return default row prefetch size
`protected java.lang.String` `getDefaultOWAFetchStyle()`
`protected XSQLPageRequest` `getPageRequest()` Get XSQL Page Request object for the request being processed
`protected void` `handleBindVariables(java.sql.PreparedStatement stmt)`
`protected void` `handleBindVariables(java.sql.PreparedStatement stmt, int slotsUsed)`
`void` `init(XSQLPageRequest env, Element e)` Initialize the Action Handler
`protected void` `reportError(Node rootNode, java.lang.String message)` Convenience method to report an error in the action handler as a standard <xsql-error> element.
`protected void` `reportErrorIncludingStatement(Node rootNode, java.lang.String statement, int ErrorCode, java.lang.String message)` Convenience method to report an error in the action handler (including the offending SQL statement and error code) as a standard * <xsql-error> element.
`protected void` `reportErrorIncludingStatement(Node rootNode, java.lang.String statement, java.lang.String message)` Convenience method to report an error in the action handler (including the offending SQL statement) as a standard <xsql-error> element.
`protected void` `reportFatalError(java.lang.String message)` Report a fatal error message using the standard XSQL Page Processor error reporting mechanism.
`protected void` `reportMissingAttribute(Node rootNode, java.lang.String attrname)` Convenience method to report an error for a missing attribute in the action handler as a standard <xsql-error> element.
`protected void` `reportStatus(Node rootNode, java.lang.String statusAttr, java.lang.String message)` Convenience method to report a status in the action handler as a standard <xsql-status> element.
`protected boolean` `requiredConnectionProvided(Node rootNode)` Convenience method to check whether the current page has specified a (database) connection.
`protected void` `setErrorStatusParamIfPresent()`
`protected java.lang.String` `valueOfXPathInPostedXML(java.lang.String xpath)` Convenience method to return the value of any XPath expression against the posted XML document.
`protected java.lang.String` `variableValue(java.lang.String varName, Element e)` Convenience method to return the value of a parameter variable.
`protected java.lang.String[]` `variableValues(java.lang.String varName, Element e)` Convenience method to return the value of a parameter variable that might have multiple values.

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

Methods inherited from interface oracle.xml.xsql.XSQLActionHandler
`handleAction`

Constructor Detail

### XSQLActionHandlerImpl

    public XSQLActionHandlerImpl()

Method Detail

### getPageRequest

    protected XSQLPageRequest getPageRequest()

  Get XSQL Page Request object for the request being processed

### getActionElement

    protected Element getActionElement()

  Return the DOM Element representing the current XSQL action element in the XSQL page being processed. Use this to gain access to supporting attributes or element content specified in the XSQL page on which the action handler may depend.

### init

    public void init(XSQLPageRequest env,
                     Element e)

  Description copied from interface: `XSQLActionHandler`
  Initialize the Action Handler
  Specified by:
    `init` in interface `XSQLActionHandler`
  Parameters:
    `env` - XSQLPageRequest object
    `e` - DOM element representing the Action Element being handled

### reportFatalError

    protected void reportFatalError(java.lang.String message)
                             throws java.sql.SQLException

  Report a fatal error message using the standard XSQL Page Processor error reporting mechanism. Only report a fatal error if something drastic happens inside the handler.

  To report a fatal error in your action handler, call this method then throw a java.sql.SQLException with an appropriate error message.

  Reporting a fatal error stops page processing and reports the error to the requestor.

  Parameters:
    `message` - Fatal error message string
  Throws:
    `java.sql.SQLException`

### reportErrorIncludingStatement

    protected void reportErrorIncludingStatement(Node rootNode,
                                                 java.lang.String statement,
                                                 java.lang.String message)

  Convenience method to report an error in the action handler (including the offending SQL statement) as a standard <xsql-error> element.
  Parameters:
    `rootNode` - Root node of generated document fragment
    `statement` - SQL Statement in error
    `message` - Error message string

### reportErrorIncludingStatement

    protected void reportErrorIncludingStatement(Node rootNode,
                                                 java.lang.String statement,
                                                 int ErrorCode,
                                                 java.lang.String message)

  Convenience method to report an error in the action handler (including the offending SQL statement and error code) as a standard * <xsql-error> element.
  Parameters:
    `rootNode` - Root node of generated document fragment
    `statement` - SQL Statement in error
    `errorCode` - Integer error code
    `message` - Error message string

### addResultElement

    protected void addResultElement(Node rootNode,
                                    java.lang.String elementName,
                                    java.lang.String content)

  Convenience method to add a single element with text content as the result of your action handler.
  Parameters:
    `rootNode` - Root node of generated document fragment
    `elementName` - Name of the result element to add
    `content` - String to be used as text content of the element

### requiredConnectionProvided

    protected boolean requiredConnectionProvided(Node rootNode)

  Convenience method to check whether the current page has specified a (database) connection. Returns true if a connection has been specified, and false otherwise.
  Parameters:
    `rootNode` - Root node of generated document fragment

### getDefaultFetchSize

    protected int getDefaultFetchSize()

  Convenience method to return default row prefetch size

### reportError

    protected void reportError(Node rootNode,
                               java.lang.String message)

  Convenience method to report an error in the action handler as a standard <xsql-error> element.
  Parameters:
    `rootNode` - Root node of generated document fragment
    `message` - Error message string

### reportMissingAttribute

    protected void reportMissingAttribute(Node rootNode,
                                          java.lang.String attrname)

  Convenience method to report an error for a missing attribute in the action handler as a standard <xsql-error> element.
  Parameters:
    `rootNode` - Root node of generated document fragment
    `attrname` - Missing attribute name

### reportStatus

    protected void reportStatus(Node rootNode,
                                java.lang.String statusAttr,
                                java.lang.String message)

  Convenience method to report a status in the action handler as a standard <xsql-status> element.
  Parameters:
    `rootNode` - Root node of generated document fragment
    `statusAttr` - Name of status attribute to appear on xsql-status element
    `message` - Error message string

### getAttributeAllowingParam

    protected java.lang.String getAttributeAllowingParam(java.lang.String attrname,
                                                         Element e)

  Convenience method to get the value of an attribute by name the actionElement or some sub-element.

  Allows the parameter value to include a reference to another parameter in its value.

  Parameters:
    `attrName` - Name of attribute whose value you want to retrieve
    `e` - DOM Element containing the attribute

### getAttribute

    protected java.lang.String getAttribute(java.lang.String attrname,
                                            Element e)

  Convenience method to get the value of an attribute by name the actionElement or some sub-element.

  Treats the attribute value literally, without evaluating parameter references.

  Parameters:
    `attrName` - Name of attribute whose value you want to retrieve
    `e` - DOM Element containing the attribute

### appendCopyOfSecondaryDocument

    protected void appendCopyOfSecondaryDocument(Node rootNode,
                                                 Document d)

  Convenience method to append a copy of the entire content of one XML document to another.
  Parameters:
    `rootNode` - Node to which XML document is to be appended
    `d` - Secondary DOM Document to copy and append

### appendSecondaryDocument

    protected void appendSecondaryDocument(Node rootNode,
                                           Document d)

  Convenience method to append the entire content of one XML document to another.
  Parameters:
    `rootNode` - Node to which XML document is to be appended
    `d` - Secondary DOM Document to be appended

### variableValue

    protected java.lang.String variableValue(java.lang.String varName,
                                             Element e)

  Convenience method to return the value of a parameter variable.
  Parameters:
    `varName` - Name of parameter variable
    `e` - DOM Element to use to provide default parameter values

### variableValues

    protected java.lang.String[] variableValues(java.lang.String varName,
                                                Element e)

  Convenience method to return the value of a parameter variable that might have multiple values. Returns null if there are no values for the parameter.
  Parameters:
    `varName` - Name of parameter variable
    `e` - DOM Element to use to provide default parameter values

### getActionElementContent

    protected java.lang.String getActionElementContent()

  Convenience method to return the first (normalized) text content of the action element, with all parameter values subsituted automatically.

### firstColumnOfFirstRow

    protected java.lang.String firstColumnOfFirstRow(Node rootNode,
                                                     java.lang.String statement)

  Convenience method to return the first column value of the first row of a SQL statement as a String.

### firstNColumnsOfFirstRow

    protected java.lang.String[] firstNColumnsOfFirstRow(Node rootNode,
                                                         java.lang.String statement,
                                                         int n)

  Convenience method to return the first column value of the first row of a SQL statement as a String.

### getDefaultOWAFetchStyle

    protected java.lang.String getDefaultOWAFetchStyle()

### handleBindVariables

    protected void handleBindVariables(java.sql.PreparedStatement stmt)
                                throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### handleBindVariables

    protected void handleBindVariables(java.sql.PreparedStatement stmt,
                                       int slotsUsed)
                                throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getBindVariableCount

    protected int getBindVariableCount()
                                throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### valueOfXPathInPostedXML

    protected java.lang.String valueOfXPathInPostedXML(java.lang.String xpath)
                                                throws XSLException

  Convenience method to return the value of any XPath expression against the posted XML document.
  Throws:
    `XSLException`

### setErrorStatusParamIfPresent

    protected void setErrorStatusParamIfPresent()

Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.