Version: 1.1.1

ca.ucalgary.services.util
Class PBERecorder

java.lang.Object
  extended by ca.ucalgary.services.util.PBERecorder
All Implemented Interfaces:
DataRecorder

public class PBERecorder
extends Object
implements DataRecorder

This class controls the interaction between the web browser and Seahawk via the pasting actions. The tracking of Moby data in a demonstration usage of a web service or html form is used to generalize the invocation details into a Moby wrapper for the legacy service.


Field Summary
static String AUTOCOMPLETE_PARAM
           
static String CONTEXT_XPTR_PARAM
           
static String CUSTOM_INPUT_PART_OPTION
           
static String CUSTOM_INPUT_PART_VALUES_SUFFIX
           
static String CUSTOM_VALUE_XPATH_OPTION
           
static String DATE_INPUT_PART_OPTION
           
static String FLOAT_INPUT_PART_OPTION
           
static String INT_INPUT_PART_OPTION
           
static String LIST_CHOICE_PARAM
           
static String OUTPUT_RULE_URI_PARAM
           
static String RAW_XPATH_PARAM
           
static String RESOURCE_FILE_PARAM
           
static String RESOURCE_PREFIX
           
static String RETURN_XPATH_PARAM
           
static String SCALAR_INPUT_PART_MAX_SUFFIX
           
static String SCALAR_INPUT_PART_MIN_SUFFIX
           
static String VALUE_XPATH_PARAM
           
static String XPATH_DEFAULT_NS_PREFIX
           
 
Fields inherited from interface ca.ucalgary.services.util.DataRecorder
PASSTHROUGH_ACTION
 
Constructor Summary
PBERecorder()
           
 
Method Summary
 String autocomplete(javax.servlet.http.HttpServletRequest request, String seed)
          Called via AJAX when the user is filling something on the form that's supposed to be the Moby ontology The returned value is the list of possible ontology matches, with relevant description excerpts.
 void dataCopied(MobyDataInstance source, String copiedValue, String transformRuleURI)
          Called by source of data going into the browser, i.e.
 void dataPasted(javax.servlet.http.HttpServletRequest request)
           
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called when data in a field is being updated via a paste event.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called when data a form is being submitted, or when submitting the PBE form
 String getBody(javax.servlet.http.HttpServletRequest request)
          Gives the data recorder an opportunity to insert extra HTML elements into the body (at the start) of the WrappingServlet generates for the user-facing CGI form.
 Element[] getBodyAsDOM(javax.servlet.http.HttpServletRequest request, Document owner)
           
 String getBodyAttrs(javax.servlet.http.HttpServletRequest request)
          Gives the data recorder an opportunity to insert extra HTML element attributes into the body element the WrappingServlet generates for the Web Service's CGI form.
 Attr[] getBodyAttrsAsDOM(javax.servlet.http.HttpServletRequest request, Document owner)
           
 int getChoice(String statusMsg, String[] choices)
          Show the user a set of choices in the browser window, and waits until they pick one before returning.
 String getHead(javax.servlet.http.HttpServletRequest request)
          Gives the data recorder an opportunity to insert extra HTML into the head element of the HTML the WrappingServlet generates for the Web Service's CGI form.
 Element[] getHeadAsDOM(javax.servlet.http.HttpServletRequest request, Document owner)
          Gives the data recorder an opportunity to insert extra HTML into the head element of the HTML the WrappingServlet generates for the Web Service's CGI form.
 Attr getOnEventAsDOM(Document owner)
           
 String getOnEventText()
          Gives the data recorder an opportunity to insert a javascript event handler into every form input element the WrappingServlet generates for the Web Service's CGI form.
 Attr getOnSubmitAsDOM(Document owner)
           
 String getOnSubmitText()
          Gives the data recorder an opportunity to insert a javascript event handler into the form submission tags the WrappingServlet generates for the Web Service's CGI form.
static String getProxyBaseUrl()
           
 void getRawXml(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void getResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void getStatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void interceptRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 byte[] markupResponse(byte[] responseBody, String contentType, String charSet, javax.servlet.http.HttpServletRequest request)
          Gives the data recorder an opportunity to record or modify the CGI response before WrappingServlet returns it to the HTTP client.
 String markupResponse(Source resultSource, javax.servlet.http.HttpServletRequest request)
          Manipulates the Web Service response data so that it includes a bunch of links that can be used to create Moby services.
 void setGUIMap(Map<String,MobyContentGUI> map)
           
 void setInputParams(javax.servlet.http.HttpServletRequest submissionRequest, Map<String,byte[]> httpParams, List<String> hiddenParams)
          This method is to be called just before submission of data to the CGI, so that the PBE system can record the input for data type analysis later in the wrapping process.
 void setInputSource(javax.servlet.http.HttpServletRequest request, SourceMap sourceMap)
          This method is to be called just before submission of data to the Web Service, so that the PBE system can record the input for data type analysis later in the wrapping process.
 void setParameter(javax.servlet.http.HttpSession session, String paramName, String paramValue)
          Allows a WrappingServlet to set the equivalent of HTTP request parameters (which are normally immutable).
 void setStatus(String statusMsg)
           
 void setTransformer(Transformer t)
          Specify a XML transformation to be applied to the service results.
 boolean shouldIntercept(javax.servlet.http.HttpServletRequest request)
          Lets the WrappingServlet know if the HTTP GET request should be handles by interceptRequest or not.
 void startRecording(javax.servlet.http.HttpServletRequest request)
          Tells the data recorder that a new Web Service proxying has been requested.
 String writeWrapperForm(javax.servlet.http.HttpServletRequest request)
          Uses the retained copy of the WSDL service response, matching it up with the xPath given by the user, to create an interface confirming the definition of a new Moby service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_PREFIX

public static final String RESOURCE_PREFIX
See Also:
Constant Field Values

RESOURCE_FILE_PARAM

public static final String RESOURCE_FILE_PARAM
See Also:
Constant Field Values

AUTOCOMPLETE_PARAM

public static final String AUTOCOMPLETE_PARAM
See Also:
Constant Field Values

LIST_CHOICE_PARAM

public static final String LIST_CHOICE_PARAM
See Also:
Constant Field Values

RETURN_XPATH_PARAM

public static final String RETURN_XPATH_PARAM
See Also:
Constant Field Values

VALUE_XPATH_PARAM

public static final String VALUE_XPATH_PARAM
See Also:
Constant Field Values

CONTEXT_XPTR_PARAM

public static final String CONTEXT_XPTR_PARAM
See Also:
Constant Field Values

OUTPUT_RULE_URI_PARAM

public static final String OUTPUT_RULE_URI_PARAM
See Also:
Constant Field Values

RAW_XPATH_PARAM

public static final String RAW_XPATH_PARAM
See Also:
Constant Field Values

XPATH_DEFAULT_NS_PREFIX

public static final String XPATH_DEFAULT_NS_PREFIX
See Also:
Constant Field Values

CUSTOM_VALUE_XPATH_OPTION

public static final String CUSTOM_VALUE_XPATH_OPTION
See Also:
Constant Field Values

CUSTOM_INPUT_PART_OPTION

public static final String CUSTOM_INPUT_PART_OPTION
See Also:
Constant Field Values

INT_INPUT_PART_OPTION

public static final String INT_INPUT_PART_OPTION
See Also:
Constant Field Values

FLOAT_INPUT_PART_OPTION

public static final String FLOAT_INPUT_PART_OPTION
See Also:
Constant Field Values

DATE_INPUT_PART_OPTION

public static final String DATE_INPUT_PART_OPTION
See Also:
Constant Field Values

CUSTOM_INPUT_PART_VALUES_SUFFIX

public static final String CUSTOM_INPUT_PART_VALUES_SUFFIX
See Also:
Constant Field Values

SCALAR_INPUT_PART_MIN_SUFFIX

public static final String SCALAR_INPUT_PART_MIN_SUFFIX
See Also:
Constant Field Values

SCALAR_INPUT_PART_MAX_SUFFIX

public static final String SCALAR_INPUT_PART_MAX_SUFFIX
See Also:
Constant Field Values
Constructor Detail

PBERecorder

public PBERecorder()
Method Detail

setGUIMap

public void setGUIMap(Map<String,MobyContentGUI> map)

startRecording

public void startRecording(javax.servlet.http.HttpServletRequest request)
Description copied from interface: DataRecorder
Tells the data recorder that a new Web Service proxying has been requested. The data recorder might want to set a cookie or something of the sort to track further callbacks.

Specified by:
startRecording in interface DataRecorder
Parameters:
request - the GET request that specifies the WSDL to be proxied

setTransformer

public void setTransformer(Transformer t)
Description copied from interface: DataRecorder
Specify a XML transformation to be applied to the service results. For example, SoapServlet tries to indent the results nicely.

Specified by:
setTransformer in interface DataRecorder

shouldIntercept

public boolean shouldIntercept(javax.servlet.http.HttpServletRequest request)
Description copied from interface: DataRecorder
Lets the WrappingServlet know if the HTTP GET request should be handles by interceptRequest or not. This will generally be determined by special request parameters the data recorder inserted into the request form.

Specified by:
shouldIntercept in interface DataRecorder

interceptRequest

public void interceptRequest(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
Specified by:
interceptRequest in interface DataRecorder

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
Called when data in a field is being updated via a paste event.

Specified by:
doGet in interface DataRecorder

getStatus

public void getStatus(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)

getChoice

public int getChoice(String statusMsg,
                     String[] choices)
Show the user a set of choices in the browser window, and waits until they pick one before returning. Return -1 if canceled.


setStatus

public void setStatus(String statusMsg)

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
Called when data a form is being submitted, or when submitting the PBE form


getOnEventText

public String getOnEventText()
Description copied from interface: DataRecorder
Gives the data recorder an opportunity to insert a javascript event handler into every form input element the WrappingServlet generates for the Web Service's CGI form.

Specified by:
getOnEventText in interface DataRecorder
Returns:
recorder-specific CGI form attributes for input elements

getOnEventAsDOM

public Attr getOnEventAsDOM(Document owner)
Specified by:
getOnEventAsDOM in interface DataRecorder

getOnSubmitText

public String getOnSubmitText()
Description copied from interface: DataRecorder
Gives the data recorder an opportunity to insert a javascript event handler into the form submission tags the WrappingServlet generates for the Web Service's CGI form.

Specified by:
getOnSubmitText in interface DataRecorder
Returns:
recorder-specific CGI form attributes for form submission tags

getOnSubmitAsDOM

public Attr getOnSubmitAsDOM(Document owner)
Specified by:
getOnSubmitAsDOM in interface DataRecorder

getHead

public String getHead(javax.servlet.http.HttpServletRequest request)
Description copied from interface: DataRecorder
Gives the data recorder an opportunity to insert extra HTML into the head element of the HTML the WrappingServlet generates for the Web Service's CGI form.

Specified by:
getHead in interface DataRecorder
Returns:
recorder-specific HTML code for the CGI form header

getHeadAsDOM

public Element[] getHeadAsDOM(javax.servlet.http.HttpServletRequest request,
                              Document owner)
Description copied from interface: DataRecorder
Gives the data recorder an opportunity to insert extra HTML into the head element of the HTML the WrappingServlet generates for the Web Service's CGI form.

Specified by:
getHeadAsDOM in interface DataRecorder
owner - the Document that should be used to create the DOM elements returned
Returns:
recorder-specific HTML code for the CGI form header

getBodyAttrs

public String getBodyAttrs(javax.servlet.http.HttpServletRequest request)
Description copied from interface: DataRecorder
Gives the data recorder an opportunity to insert extra HTML element attributes into the body element the WrappingServlet generates for the Web Service's CGI form.

Specified by:
getBodyAttrs in interface DataRecorder
Returns:
recorder-specific HTML body-tag attributes for the CGI form header

getBodyAttrsAsDOM

public Attr[] getBodyAttrsAsDOM(javax.servlet.http.HttpServletRequest request,
                                Document owner)
Specified by:
getBodyAttrsAsDOM in interface DataRecorder

getBody

public String getBody(javax.servlet.http.HttpServletRequest request)
Description copied from interface: DataRecorder
Gives the data recorder an opportunity to insert extra HTML elements into the body (at the start) of the WrappingServlet generates for the user-facing CGI form.

Specified by:
getBody in interface DataRecorder
Returns:
recorder-specific HTML body-tag attributes for the CGI form header

getBodyAsDOM

public Element[] getBodyAsDOM(javax.servlet.http.HttpServletRequest request,
                              Document owner)
Specified by:
getBodyAsDOM in interface DataRecorder

markupResponse

public byte[] markupResponse(byte[] responseBody,
                             String contentType,
                             String charSet,
                             javax.servlet.http.HttpServletRequest request)
                      throws Exception
Description copied from interface: DataRecorder
Gives the data recorder an opportunity to record or modify the CGI response before WrappingServlet returns it to the HTTP client.

Specified by:
markupResponse in interface DataRecorder
Returns:
responseBody, potentially modified
Throws:
Exception

markupResponse

public String markupResponse(Source resultSource,
                             javax.servlet.http.HttpServletRequest request)
                      throws Exception
Manipulates the Web Service response data so that it includes a bunch of links that can be used to create Moby services. Also notes the WSDL location for future reference.

Specified by:
markupResponse in interface DataRecorder
Returns:
the XML serialization of the resultSource, potentially modified
Throws:
Exception

autocomplete

public String autocomplete(javax.servlet.http.HttpServletRequest request,
                           String seed)
Called via AJAX when the user is filling something on the form that's supposed to be the Moby ontology The returned value is the list of possible ontology matches, with relevant description excerpts.

Parameters:
seed - a string of the form datatype:xxx or namespace:xxx or servicetype:xxx or just xxx to search all

getRawXml

public void getRawXml(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)

getResource

public void getResource(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)

writeWrapperForm

public String writeWrapperForm(javax.servlet.http.HttpServletRequest request)
Uses the retained copy of the WSDL service response, matching it up with the xPath given by the user, to create an interface confirming the definition of a new Moby service.

Specified by:
writeWrapperForm in interface DataRecorder

getProxyBaseUrl

public static String getProxyBaseUrl()

setInputSource

public void setInputSource(javax.servlet.http.HttpServletRequest request,
                           SourceMap sourceMap)
This method is to be called just before submission of data to the Web Service, so that the PBE system can record the input for data type analysis later in the wrapping process.

Specified by:
setInputSource in interface DataRecorder

setInputParams

public void setInputParams(javax.servlet.http.HttpServletRequest submissionRequest,
                           Map<String,byte[]> httpParams,
                           List<String> hiddenParams)
This method is to be called just before submission of data to the CGI, so that the PBE system can record the input for data type analysis later in the wrapping process.

Specified by:
setInputParams in interface DataRecorder

setParameter

public void setParameter(javax.servlet.http.HttpSession session,
                         String paramName,
                         String paramValue)
Description copied from interface: DataRecorder
Allows a WrappingServlet to set the equivalent of HTTP request parameters (which are normally immutable). Useful in case salient parameters such as WrappingServlet.SERVICE_SPEC_PARAM or WrappingServlet.SRC_PARAM are passed around by aletrnate means (e.g. multipart encoded form like in CGIServlet)

Specified by:
setParameter in interface DataRecorder

dataCopied

public void dataCopied(MobyDataInstance source,
                       String copiedValue,
                       String transformRuleURI)
Called by source of data going into the browser, i.e. Seahawk


dataPasted

public void dataPasted(javax.servlet.http.HttpServletRequest request)

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010