| java.lang.Object org.continuent.sequoia.controller.requests.RequestFactory
All known Subclasses: org.continuent.sequoia.controller.requests.SequoiaRequestFactory,
RequestFactory | abstract public class RequestFactory (Code) | | This class defines a RequestFactory.
Given a SQL query, it creates a full request of the correct type. These
request types are defined by the implementing classes, as well as the regular
expressions to be used for the SQL query parsing
author: Emmanuel Cecchet author: Gilles Rayrat version: 2.0 |
Method Summary | |
protected AbstractRequest | decodeReadRequestFromString(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | protected AbstractRequest | decodeWriteRequestFromString(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected AlterRequest | getAlterRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected CreateRequest | getCreateRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected DeleteRequest | getDeleteRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected DropRequest | getDropRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected InsertRequest | getInsertRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected SelectRequest | getSelectRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected StoredProcedure | getStoredProcedure(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected UnknownReadRequest | getUnknownReadRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected UnknownWriteRequest | getUnknownWriteRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | abstract protected UpdateRequest | getUpdateRequest(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator) | public boolean | isAuthorizedRequest(String sql) Check whether the given sql is authorized to execute on the cluster or not. | public boolean | isBroadcastRequired(int transactionIsolationLevel) Determines whether or not a select statement should be broadcast
based on the setting of the transaction isolation level. | public AbstractRequest | requestFromString(String sqlQuery, boolean isProbablyAReadRequest, boolean escapeProcessing, int timeout, String lineSeparator) Given a sql statement string, creates the appropriate read or write
request, or null if no sql query could be identified.
Priority of the parsing and the parameters of the request to be created are
configurable tries to identify read or write first)
Parameters: sqlQuery - sql statement to parse Parameters: isProbablyAReadRequest - set to true if the given sql query isprobably a read statement. | public boolean | requestNeedsExecute(AbstractRequest request) |
RequestFactory | protected RequestFactory(RequestRegExp regexp)(Code) | | Sets the custom regular expressions
Parameters: regexp - regular expression to be used for request parsing |
decodeReadRequestFromString | protected AbstractRequest decodeReadRequestFromString(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator)(Code) | | Parses the given string:
- if a read query is identified, creates and returns the appropriate
read request
- else if a write query is identified, creates and returns an unknown
write request
- else returns null
Parameters: sqlQuery - sql statement to parse Parameters: escapeProcessing - query parameter to set Parameters: timeout - query parameter to set Parameters: lineSeparator - query parameter to set a SelectRequest , an UnknownReadRequest ,an UnknownWriteRequest or null |
decodeWriteRequestFromString | protected AbstractRequest decodeWriteRequestFromString(String sqlQuery, boolean escapeProcessing, int timeout, String lineSeparator)(Code) | | Parses the given string and creates/returns the appropriate write request,
stored procedure or null if no write query was identified
Parameters: sqlQuery - sql statement to parse Parameters: escapeProcessing - query parameter to set Parameters: timeout - query parameter to set Parameters: lineSeparator - query parameter to set an InsertRequest , an UpdateRequest ,a DeleteRequest , a CreateRequest , aDropRequest , an AlterRequest , aStoredProcedure or null |
isAuthorizedRequest | public boolean isAuthorizedRequest(String sql)(Code) | | Check whether the given sql is authorized to execute on the cluster or not.
Parameters: sql - the SQL statement to check false if the statement is not authorized and must be blocked, trueotherwise |
isBroadcastRequired | public boolean isBroadcastRequired(int transactionIsolationLevel)(Code) | | Determines whether or not a select statement should be broadcast
based on the setting of the transaction isolation level. By
default request at transaction isolation level serializable are
broadcast.
Parameters: transactionIsolationLevel - the transaction isolation levelfor the current request. true if the select should be broadcast. |
requestFromString | public AbstractRequest requestFromString(String sqlQuery, boolean isProbablyAReadRequest, boolean escapeProcessing, int timeout, String lineSeparator)(Code) | | Given a sql statement string, creates the appropriate read or write
request, or null if no sql query could be identified.
Priority of the parsing and the parameters of the request to be created are
configurable tries to identify read or write first)
Parameters: sqlQuery - sql statement to parse Parameters: isProbablyAReadRequest - set to true if the given sql query isprobably a read statement. This will give priority to the parsingof read requests Parameters: escapeProcessing - query parameter to set Parameters: timeout - query parameter to set Parameters: lineSeparator - query parameter to set an InsertRequest , an UpdateRequest ,a DeleteRequest , a CreateRequest , aDropRequest , an AlterRequest , aStoredProcedure , a SelectRequest ,an UnknownReadRequest , anUnknownWriteRequest or null |
requestNeedsExecute | public boolean requestNeedsExecute(AbstractRequest request)(Code) | | Returns true if the query has to be executed with statement.execute() or if
it contains an inline batch such as "SELECT xxx ; INSERT xxx ; DROP xxx ;
..."
Parameters: request - the request to check true if the request has to be executed with statement.execute() orcontains an inline batch |
|
|