mondrian.xmla
Class XmlaServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by mondrian.xmla.XmlaServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig, XmlaConstants
Direct Known Subclasses:
DefaultXmlaServlet

public abstract class XmlaServlet
extends HttpServlet
implements XmlaConstants

Base XML/A servlet.

Since:
December, 2005
Author:
Gang Chen
See Also:
Serialized Form
 

Nested Class Summary
static class XmlaServlet.Phase
           
 
Field Summary
protected  CatalogLocator catalogLocator
           
protected  String charEncoding
           
protected  DataSourcesConfig.DataSources dataSources
           
static String DEFAULT_DATASOURCE_FILE
           
static String PARAM_CALLBACKS
           
static String PARAM_CHAR_ENCODING
           
static String PARAM_DATASOURCES_CONFIG
           
static String PARAM_OPTIONAL_DATASOURCE_CONFIG
           
protected  XmlaHandler xmlaHandler
           
 
Fields inherited from interface mondrian.xmla.XmlaConstants
CHH_AUTHORIZATION_CODE, CHH_AUTHORIZATION_FAULT_FS, CHH_CODE, CHH_FAULT_FS, CLIENT_FAULT_FC, CONTENT_DEFAULT, CONTEXT_ROLE, CONTEXT_ROLE_NAME, CONTEXT_XMLA_SESSION_ID, CONTEXT_XMLA_SESSION_STATE, CONTEXT_XMLA_SESSION_STATE_BEGIN, CONTEXT_XMLA_SESSION_STATE_END, CONTEXT_XMLA_SESSION_STATE_WITHIN, CPOSTA_CODE, CPOSTA_FAULT_FS, CPREA_CODE, CPREA_FAULT_FS, FAULT_ACTOR, FAULT_FC_PREFIX, FAULT_FS_PREFIX, FAULT_NS_PREFIX, HSB_ACCESS_DENIED_CODE, HSB_ACCESS_DENIED_FAULT_FS, HSB_BAD_COMMAND_CODE, HSB_BAD_COMMAND_FAULT_FS, HSB_BAD_METHOD_CODE, HSB_BAD_METHOD_FAULT_FS, HSB_BAD_METHOD_NS_CODE, HSB_BAD_METHOD_NS_FAULT_FS, HSB_BAD_NON_NULLABLE_COLUMN_CODE, HSB_BAD_NON_NULLABLE_COLUMN_FAULT_FS, HSB_BAD_PROPERTIES_CODE, HSB_BAD_PROPERTIES_FAULT_FS, HSB_BAD_PROPERTIES_LIST_CODE, HSB_BAD_PROPERTIES_LIST_FAULT_FS, HSB_BAD_REQUEST_TYPE_CODE, HSB_BAD_REQUEST_TYPE_FAULT_FS, HSB_BAD_RESTRICTION_LIST_CODE, HSB_BAD_RESTRICTION_LIST_FAULT_FS, HSB_BAD_RESTRICTION_TYPE_CODE, HSB_BAD_RESTRICTION_TYPE_FAULT_FS, HSB_BAD_RESTRICTION_VALUE_CODE, HSB_BAD_RESTRICTION_VALUE_FAULT_FS, HSB_BAD_RESTRICTIONS_CODE, HSB_BAD_RESTRICTIONS_FAULT_FS, HSB_BAD_SOAP_BODY_CODE, HSB_BAD_SOAP_BODY_FAULT_FS, HSB_BAD_STATEMENT_CODE, HSB_BAD_STATEMENT_FAULT_FS, HSB_CONNECTION_DATA_SOURCE_CODE, HSB_CONNECTION_DATA_SOURCE_FAULT_FS, HSB_DISCOVER_FORMAT_CODE, HSB_DISCOVER_FORMAT_FAULT_FS, HSB_DISCOVER_UNPARSE_CODE, HSB_DISCOVER_UNPARSE_FAULT_FS, HSB_DRILL_THROUGH_FORMAT_CODE, HSB_DRILL_THROUGH_FORMAT_FAULT_FS, HSB_DRILL_THROUGH_NOT_ALLOWED_CODE, HSB_DRILL_THROUGH_NOT_ALLOWED_FAULT_FS, HSB_DRILL_THROUGH_SQL_CODE, HSB_DRILL_THROUGH_SQL_FAULT_FS, HSB_DRILLDOWN_BAD_FIRST_ROWSET_CODE, HSB_DRILLDOWN_BAD_FIRST_ROWSET_FAULT_FS, HSB_DRILLDOWN_BAD_MAXROWS_CODE, HSB_DRILLDOWN_BAD_MAXROWS_FAULT_FS, HSB_DRILLDOWN_ERROR_CODE, HSB_DRILLDOWN_ERROR_FAULT_FS, HSB_EXECUTE_QUERY_CODE, HSB_EXECUTE_QUERY_FAULT_FS, HSB_EXECUTE_UNPARSE_CODE, HSB_EXECUTE_UNPARSE_FAULT_FS, HSB_PARSE_QUERY_CODE, HSB_PARSE_QUERY_FAULT_FS, HSB_PROCESS_CODE, HSB_PROCESS_FAULT_FS, HSB_UNKNOWN_CODE, HSB_UNKNOWN_FAULT_FS, HSB_UNSUPPORTED_OPERATION_CODE, HSB_UNSUPPORTED_OPERATION_FAULT_FS, HSH_BAD_SESSION_ID_CODE, HSH_BAD_SESSION_ID_FAULT_FS, HSH_MUST_UNDERSTAND_CODE, HSH_MUST_UNDERSTAND_FAULT_FS, HSH_UNKNOWN_CODE, HSH_UNKNOWN_FAULT_FS, METHOD_DISCOVER, METHOD_EXECUTE, MONDRIAN_NAMESPACE, MSM_UNKNOWN_CODE, MSM_UNKNOWN_FAULT_FS, MUST_UNDERSTAND_FAULT_FC, NS_SOAP_ENC_1_1, NS_SOAP_ENC_1_2, NS_SOAP_ENV_1_1, NS_SOAP_ENV_1_2, NS_SQL, NS_XMLA, NS_XMLA_EMPTY, NS_XMLA_EX, NS_XMLA_MDDATASET, NS_XMLA_ROWSET, NS_XSD, NS_XSI, SERVER_FAULT_FC, SOAP_MUST_UNDERSTAND_ATTR, SOAP_PREFIX, UNKNOWN_ERROR_CODE, UNKNOWN_ERROR_FAULT_FS, USM_DOM_FACTORY_CODE, USM_DOM_FACTORY_FAULT_FS, USM_DOM_PARSE_CODE, USM_DOM_PARSE_FAULT_FS, USM_DOM_PARSE_IO_CODE, USM_DOM_PARSE_IO_FAULT_FS, USM_REQUEST_INPUT_CODE, USM_REQUEST_INPUT_FAULT_FS, USM_REQUEST_STATE_CODE, USM_REQUEST_STATE_FAULT_FS, USM_UNKNOWN_CODE, USM_UNKNOWN_FAULT_FS, VERSION_MISSMATCH_FAULT_FC, XMLA_BEGIN_SESSION, XMLA_END_SESSION, XMLA_SESSION, XMLA_SESSION_ID
 
Constructor Summary
XmlaServlet()
           
 
Method Summary
protected  void addCallback(XmlaRequestCallback callback)
          Registers a callback.
protected  void addToDataSources(DataSourcesConfig.DataSources dataSources)
           
protected  void doPost(HttpServletRequest request, HttpServletResponse response)
          Main entry for HTTP post method
static boolean getBooleanInitParameter(ServletConfig servletConfig, String paramName)
          If paramName's value is not null and 'true', then return true.
protected  List<XmlaRequestCallback> getCallbacks()
          Returns the list of callbacks.
static boolean getParameter(HttpServletRequest req, String paramName)
           
protected  XmlaHandler getXmlaHandler()
          Gets (creating if needed) the XmlaHandler.
protected abstract  void handleFault(HttpServletResponse response, byte[][] responseSoapParts, XmlaServlet.Phase phase, Throwable t)
          Implement to application specified handler of SOAP fualt.
protected abstract  void handleSoapBody(HttpServletResponse response, Element[] requestSoapParts, byte[][] responseSoapParts, Map<String,Object> context)
          Implement to handle XML/A request.
protected abstract  void handleSoapHeader(HttpServletResponse response, Element[] requestSoapParts, byte[][] responseSoapParts, Map<String,Object> context)
          Implement to handle application specified SOAP header.
 void init(ServletConfig servletConfig)
          Initializes servlet and XML/A handler.
protected  void initCallbacks(ServletConfig servletConfig)
          Registers callbacks configured in web.xml.
protected  void initCharEncodingHandler(ServletConfig servletConfig)
          Initialize character encoding
protected  CatalogLocator makeCatalogLocator(ServletConfig servletConfig)
          Make catalog locator.
protected  DataSourcesConfig.DataSources makeDataSources(ServletConfig servletConfig)
          Make DataSourcesConfig.DataSources instance.
protected abstract  void marshallSoapMessage(HttpServletResponse response, byte[][] responseSoapParts)
          Implement to privode application specified SOAP marshalling algorithm.
protected  DataSourcesConfig.DataSources parseDataSources(String dataSourcesConfigString)
           
protected  DataSourcesConfig.DataSources parseDataSourcesUrl(URL dataSourcesConfigUrl)
           
protected  String readDataSourcesContent(URL dataSourcesConfigUrl)
           
protected abstract  void unmarshallSoapMessage(HttpServletRequest request, Element[] requestSoapParts)
          Implement to provide application specified SOAP unmarshalling algorithm.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_DATASOURCES_CONFIG

public static final String PARAM_DATASOURCES_CONFIG
See Also:
Constant Field Values

PARAM_OPTIONAL_DATASOURCE_CONFIG

public static final String PARAM_OPTIONAL_DATASOURCE_CONFIG
See Also:
Constant Field Values

PARAM_CHAR_ENCODING

public static final String PARAM_CHAR_ENCODING
See Also:
Constant Field Values

PARAM_CALLBACKS

public static final String PARAM_CALLBACKS
See Also:
Constant Field Values

DEFAULT_DATASOURCE_FILE

public static final String DEFAULT_DATASOURCE_FILE
See Also:
Constant Field Values

catalogLocator

protected CatalogLocator catalogLocator

dataSources

protected DataSourcesConfig.DataSources dataSources

xmlaHandler

protected XmlaHandler xmlaHandler

charEncoding

protected String charEncoding
Constructor Detail

XmlaServlet

public XmlaServlet()
Method Detail

getBooleanInitParameter

public static boolean getBooleanInitParameter(ServletConfig servletConfig,
                                              String paramName)
If paramName's value is not null and 'true', then return true.


getParameter

public static boolean getParameter(HttpServletRequest req,
                                   String paramName)

init

public void init(ServletConfig servletConfig)
          throws ServletException
Initializes servlet and XML/A handler.

Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet
Throws:
ServletException

getXmlaHandler

protected XmlaHandler getXmlaHandler()
Gets (creating if needed) the XmlaHandler.

Returns:
XMLA handler

addCallback

protected final void addCallback(XmlaRequestCallback callback)
Registers a callback.


getCallbacks

protected final List<XmlaRequestCallback> getCallbacks()
Returns the list of callbacks. The list is immutable.

Returns:
list of callbacks

doPost

protected void doPost(HttpServletRequest request,
                      HttpServletResponse response)
               throws ServletException,
                      IOException
Main entry for HTTP post method

Overrides:
doPost in class HttpServlet
Throws:
ServletException
IOException

unmarshallSoapMessage

protected abstract void unmarshallSoapMessage(HttpServletRequest request,
                                              Element[] requestSoapParts)
                                       throws XmlaException
Implement to provide application specified SOAP unmarshalling algorithm.

Throws:
XmlaException

handleSoapHeader

protected abstract void handleSoapHeader(HttpServletResponse response,
                                         Element[] requestSoapParts,
                                         byte[][] responseSoapParts,
                                         Map<String,Object> context)
                                  throws XmlaException
Implement to handle application specified SOAP header.

Throws:
XmlaException

handleSoapBody

protected abstract void handleSoapBody(HttpServletResponse response,
                                       Element[] requestSoapParts,
                                       byte[][] responseSoapParts,
                                       Map<String,Object> context)
                                throws XmlaException
Implement to handle XML/A request.

Throws:
XmlaException

marshallSoapMessage

protected abstract void marshallSoapMessage(HttpServletResponse response,
                                            byte[][] responseSoapParts)
                                     throws XmlaException
Implement to privode application specified SOAP marshalling algorithm.

Throws:
XmlaException

handleFault

protected abstract void handleFault(HttpServletResponse response,
                                    byte[][] responseSoapParts,
                                    XmlaServlet.Phase phase,
                                    Throwable t)
Implement to application specified handler of SOAP fualt.


makeCatalogLocator

protected CatalogLocator makeCatalogLocator(ServletConfig servletConfig)
Make catalog locator. Derived classes can roll their own


makeDataSources

protected DataSourcesConfig.DataSources makeDataSources(ServletConfig servletConfig)
Make DataSourcesConfig.DataSources instance. Derived classes can roll their own

If there is an initParameter called "DataSourcesConfig" get its value, replace any "${key}" content with "value" where "key/value" are System properties, and try to create a URL instance out of it. If that fails, then assume its a real filepath and if the file exists then create a URL from it (but only if the file exists). If there is no initParameter with that name, then attempt to find the file called "datasources.xml" under "WEB-INF/" and if it exists, use it.


addToDataSources

protected void addToDataSources(DataSourcesConfig.DataSources dataSources)

parseDataSourcesUrl

protected DataSourcesConfig.DataSources parseDataSourcesUrl(URL dataSourcesConfigUrl)

readDataSourcesContent

protected String readDataSourcesContent(URL dataSourcesConfigUrl)
                                 throws IOException
Throws:
IOException

parseDataSources

protected DataSourcesConfig.DataSources parseDataSources(String dataSourcesConfigString)

initCharEncodingHandler

protected void initCharEncodingHandler(ServletConfig servletConfig)
Initialize character encoding


initCallbacks

protected void initCallbacks(ServletConfig servletConfig)
Registers callbacks configured in web.xml.


SourceForge.net_Logo