com.infoengine.jsp
Class InfoEngine

java.lang.Object
  extended bycom.infoengine.SAK.IeService
      extended bycom.infoengine.jsp.InfoEngine
All Implemented Interfaces:
Cloneable, Serializable

public class InfoEngine
extends IeService

This class extends the Info*Engine Server Access Kit. It provides additional functionality that facilitates interaction between JSP pages and Info*Engine. For example, this class makes it convenient to execute Info*Engine templates and tasks, access the results, and render them in various ways.

See Also:
Serialized Form

Field Summary
private  javax.servlet.http.HttpServletRequest request
           
 
Fields inherited from class com.infoengine.SAK.IeService
 
Constructor Summary
InfoEngine()
          Create an instance that is not associated with any particular Info*Engine server or servlet request.
InfoEngine(javax.servlet.http.HttpServletRequest request)
          Create an instance that is associated with a specified servlet request but no particular Info*Engine server.
InfoEngine(javax.servlet.http.HttpServletRequest request, String serverUri)
          Create an instance that is associated with a specified servlet request and Info*Engine server.
 
Method Summary
 String applyXSL(Reader xslReader, String styleBaseUri)
          Internally render the default group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result.
 String applyXSL(String groupName, Reader xslReader, String styleBaseUri)
          Internally render a group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result.
 String applyXSL(String stylesheet, String styleBaseUri)
          Internally render the default group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result.
 String applyXSL(String groupName, String stylesheet, String styleBaseUri)
          Internally render a group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result.
 void beginRequestWithParameters(String templatePath)
          Initiate a request to the Info*Engine server, and send all variables supplied in the query string and/or HTML form of the servlet request as parameters of the template or task.
 void executeTask(String uri)
          Execute an Info*Engine task and update the internal collection of groups from the result.
 void executeTaskWithParameters(String uri)
          Execute an Info*Engine task and update the internal collection of groups from the result.
 String formatAttributeNames(String prefix, String suffix, String separator)
          Obtain the names of the attributes contained within each element of the default Info*Engine group, and format the names as a String that can be rendered for display.
 String formatAttributeNames(String groupName, String prefix, String suffix, String separator)
          Obtain the names of the attributes contained within each element of an Info*Engine group, and format the names as a String that can be rendered for display.
 String formatColumn(String attrName, String prefix, String suffix, String separator)
          Obtain all of the values contained within all attributes of a specified name of all elements of the default group, and format them as a String that can be rendered for display.
 String formatColumn(String groupName, String attrName, String prefix, String suffix, String separator)
          Obtain all of the values contained within all attributes of a specified name of all elements of a specified group, and format them as a String that can be rendered for display.
 String formatGroup(String elementPrefix, String elementSuffix, String elementSeparator, String attributePrefix, String attributeSuffix, String attributeSeparator, String valuePrefix, String valueSuffix, String valueSeparator)
          Traverse the entire set of elements contained within the default Info*Engine group, and format all of their attribute values as a String that can be rendered for display.
 String formatGroup(String groupName, String elementPrefix, String elementSuffix, String elementSeparator, String attributePrefix, String attributeSuffix, String attributeSeparator, String valuePrefix, String valueSuffix, String valueSeparator)
          Traverse the entire set of elements contained within an Info*Engine group, and format all of their attribute values as a String that can be rendered for display.
 String formatRow(int index, String prefix, String suffix, String separator)
          Obtain all of the attribute values contained within an element of the default group, and format them as a String that can be rendered for display.
 String formatRow(String groupName, int index, String prefix, String suffix, String separator)
          Obtain all of the attribute values contained within an element of a group, and format them as a String that can be rendered for display.
 Vector getColumn(String attrName)
          Return all of the values of a named attribute of all elements of the default group.
 int getElementCount()
          Return the number of elements in the default group.
 String getMessage()
          Return the message string associated with the default group.
 Vector getRow(int index)
          Return all of the values of an element of the default group.
 int getStatus()
          Return the status value associated with the default group.
 String invokeRequest(String templatePath)
          Execute an Info*Engine template or task and return the result as a String.
 String invokeRequestWithParameters(String templatePath)
          Execute an Info*Engine template or task, and send all variables supplied in the query string and/or HTML form of the servlet request as parameters of the template or task.
private  void setAuthorization()
           
 void setServletRequest(javax.servlet.http.HttpServletRequest request)
          Set the servlet request object associated with this object instance.
 
Methods inherited from class com.infoengine.SAK.IeService
addAttributeValue, addGroup, beginRequest, clone, getAttribute, getAttribute, getAttributeNames, getAttributeValue, getAttributeValue, getAttributeValues, getAttributeValues, getCollection, getColumn, getContentType, getElementCount, getElements, getEnableExceptions, getGroup, getGroup, getGroupNames, getGroupXML, getInputStream, getLocale, getMessage, getNextContent, getRow, getStatus, removeAllGroups, removeGroup, sendCollection, sendContent, sendGroup, sendParameter, setAttributeValue, setCollection, setCredentials, setEnableExceptions, setLanguagePreferences, setLocale, setServerUri, toString, updateCollection, updateCollection, updateCollection, writeNextContent, writeNextContent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

request

private javax.servlet.http.HttpServletRequest request
Constructor Detail

InfoEngine

public InfoEngine()
Create an instance that is not associated with any particular Info*Engine server or servlet request.


InfoEngine

public InfoEngine(javax.servlet.http.HttpServletRequest request)
           throws javax.servlet.ServletException
Create an instance that is associated with a specified servlet request but no particular Info*Engine server.

Parameters:
request - the servlet request object
Throws:
javax.servlet.ServletException - if authentication information provided in the servlet request can not be validated

InfoEngine

public InfoEngine(javax.servlet.http.HttpServletRequest request,
                  String serverUri)
           throws javax.servlet.ServletException
Create an instance that is associated with a specified servlet request and Info*Engine server.

Parameters:
request - the servlet request object
serverUri - the base URI of the Info*Engine server
Throws:
javax.servlet.ServletException - if authentication information provided in the servlet request can not be validated
Method Detail

setServletRequest

public void setServletRequest(javax.servlet.http.HttpServletRequest request)
                       throws javax.servlet.ServletException
Set the servlet request object associated with this object instance.

Parameters:
request - the servlet request object
Throws:
javax.servlet.ServletException - if authentication information provided in the servlet request can not be validated

beginRequestWithParameters

public void beginRequestWithParameters(String templatePath)
                                throws IeServiceException
Initiate a request to the Info*Engine server, and send all variables supplied in the query string and/or HTML form of the servlet request as parameters of the template or task. The templatePath parameter is appended to the server URI (specified in the constructor or by calling setServerUri) to produce the full URI of the template or task to be executed. If a server URI has not been supplied via the constructor or setServerUri, the templatePath parameter is assumed to be a fully qualified template/task URI.

Parameters:
templatePath - the pathname of a template or task.
Throws:
IeServiceException - if the request was not initiated successfully

invokeRequest

public String invokeRequest(String templatePath)
                     throws IeServiceException
Execute an Info*Engine template or task and return the result as a String. The templatePath parameter is appended to the server URI (specified in the constructor or by calling setServerUri) to produce the full URI of the template or task to be executed. If a server URI has not been supplied via the constructor or setServerUri, the templatePath parameter is assumed to be a fully qualified template/task URI. If the template or task requires parameters, use sendParameters to send the parameters after executing this method and before obtaining the output stream or attempting to update the collection via updateCollection (or consider using invokeRequestWithParameters instead).

Parameters:
templatePath - the pathname of a template or task.
Returns:
A String containing the result of the template or task
Throws:
IeServiceException - if the request was not initiated successfully

invokeRequestWithParameters

public String invokeRequestWithParameters(String templatePath)
                                   throws IeServiceException
Execute an Info*Engine template or task, and send all variables supplied in the query string and/or HTML form of the servlet request as parameters of the template or task. Return a String containing the result produced by the template or task. The templatePath parameter is appended to the server URI (specified in the constructor or by calling setServerUri) to produce the full URI of the template or task to be executed. If a server URI has not been supplied via the constructor or setServerUri, the templatePath parameter is assumed to be a fully qualified template/task URI.

Parameters:
templatePath - the pathname of a template or task.
Returns:
A String containing the result of the template or task
Throws:
IeServiceException - if the request was not initiated successfully

executeTask

public void executeTask(String uri)
                 throws IeServiceException
Execute an Info*Engine task and update the internal collection of groups from the result. The templatePath parameter is appended to the server URI (specified in the constructor or by calling setServerUri) to produce the full URI of the task to be executed. If a server URI has not been supplied via the constructor or setServerUri, the templatePath parameter is assumed to be a fully qualified task URI. If the task requires parameters, they must be specified in a query string component of the templatePath parameter (or consider using executeTaskWithParameters instead).

Throws:
IeServiceException - if the request was not executed successfully

executeTaskWithParameters

public void executeTaskWithParameters(String uri)
                               throws IeServiceException
Execute an Info*Engine task and update the internal collection of groups from the result. Send all variables supplied in the query string and/or HTML form of the servlet request as parameters of the task. The templatePath parameter is appended to the server URI (specified in the constructor or by calling setServerUri) to produce the full URI of the task to be executed. If a server URI has not been supplied via the constructor or setServerUri, the templatePath parameter is assumed to be a fully qualified task URI.

Throws:
IeServiceException - if the request was not executed successfully

formatAttributeNames

public String formatAttributeNames(String groupName,
                                   String prefix,
                                   String suffix,
                                   String separator)
Obtain the names of the attributes contained within each element of an Info*Engine group, and format the names as a String that can be rendered for display.

Parameters:
groupName - the name of the group from which attribute names will be obtained. The group must exist within the internal collection.
prefix - the string to insert immediately before each attribute name
suffix - the string to insert immediatly after each attribute name
separator - the string to insert between attribute names
Returns:
A String containing the formatted attribute names

formatAttributeNames

public String formatAttributeNames(String prefix,
                                   String suffix,
                                   String separator)
Obtain the names of the attributes contained within each element of the default Info*Engine group, and format the names as a String that can be rendered for display. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
prefix - the string to insert immediately before each attribute name
suffix - the string to insert immediatly after each attribute name
separator - the string to insert between attribute names
Returns:
A String containing the formatted attribute names

formatGroup

public String formatGroup(String groupName,
                          String elementPrefix,
                          String elementSuffix,
                          String elementSeparator,
                          String attributePrefix,
                          String attributeSuffix,
                          String attributeSeparator,
                          String valuePrefix,
                          String valueSuffix,
                          String valueSeparator)
Traverse the entire set of elements contained within an Info*Engine group, and format all of their attribute values as a String that can be rendered for display.

Parameters:
groupName - the name of the group to be formatted. The group must exist within the internal collection.
elementPrefix - the string to insert immediately before each element of the group. An element can be envisioned as a row of a table.
elementSuffix - the string to insert immediatly after each element (row) of the group.
elementSeparator - the string to insert between elements (rows) of the group.
attributePrefix - the string to insert immediately before each attribute of an element. An attribute can be envisioned as a column of a table.
attributeSuffix - the string to insert immediatly after each attribute (column) of an element.
attributeSeparator - the string to insert between attributes (columns) of an element.
valuePrefix - the string to insert immediately before each value of an attribute. Attributes can have more than one value. In case an attribute is multi-valued, this parameter specifies a prefix to insert immediately before each one.
valueSuffix - the string to insert immediatly after each value of an attribute.
valueSeparator - the string to insert between values of a multi-valued attribute.
Returns:
A String containing the formatted group

formatGroup

public String formatGroup(String elementPrefix,
                          String elementSuffix,
                          String elementSeparator,
                          String attributePrefix,
                          String attributeSuffix,
                          String attributeSeparator,
                          String valuePrefix,
                          String valueSuffix,
                          String valueSeparator)
Traverse the entire set of elements contained within the default Info*Engine group, and format all of their attribute values as a String that can be rendered for display. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
elementPrefix - the string to insert immediately before each element of the group. An element can be envisioned as a row of a table.
elementSuffix - the string to insert immediatly after each element (row) of the group.
elementSeparator - the string to insert between elements (rows) of the group.
attributePrefix - the string to insert immediately before each attribute of an element. An attribute can be envisioned as a column of a table.
attributeSuffix - the string to insert immediatly after each attribute (column) of an element.
attributeSeparator - the string to insert between attributes (columns) of an element.
valuePrefix - the string to insert immediately before each value of an attribute. Attributes can have more than one value. In case an attribute is multi-valued, this parameter specifies a prefix to insert immediately before each one.
valueSuffix - the string to insert immediatly after each value of an attribute.
valueSeparator - the string to insert between values of a multi-valued attribute.
Returns:
A String containing the formatted group

formatRow

public String formatRow(String groupName,
                        int index,
                        String prefix,
                        String suffix,
                        String separator)
Obtain all of the attribute values contained within an element of a group, and format them as a String that can be rendered for display.

Parameters:
groupName - the name of the group from which the element will be obtained. The group must exist within the internal collection.
index - the index of the element within the group. Use getElementCount to determine how many elements are contained within the group. Valid indexes range from 0 to the element count - 1.
prefix - the string to insert immediately before each attribute value
suffix - the string to insert immediatly after each attribute value
separator - the string to insert between attribute values
Returns:
A String containing the formatted attribute values

formatRow

public String formatRow(int index,
                        String prefix,
                        String suffix,
                        String separator)
Obtain all of the attribute values contained within an element of the default group, and format them as a String that can be rendered for display. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
index - the index of the element within the group. Use getElementCount to determine how many elements are contained within the group. Valid indexes range from 0 to the element count - 1.
prefix - the string to insert immediately before each attribute value
suffix - the string to insert immediatly after each attribute value
separator - the string to insert between attribute values
Returns:
A String containing the formatted attribute values

formatColumn

public String formatColumn(String groupName,
                           String attrName,
                           String prefix,
                           String suffix,
                           String separator)
Obtain all of the values contained within all attributes of a specified name of all elements of a specified group, and format them as a String that can be rendered for display. This has the effect of formatting a column of a table.

Parameters:
groupName - the name of the group from which the attributes will be obtained. The group must exist within the internal collection.
attrName - the name of the attribute from which values will be obtained. This attribute will be extracted from each element of the group.
prefix - the string to insert immediately before each attribute value
suffix - the string to insert immediatly after each attribute value
separator - the string to insert between attribute values
Returns:
A String containing the formatted attribute values

formatColumn

public String formatColumn(String attrName,
                           String prefix,
                           String suffix,
                           String separator)
Obtain all of the values contained within all attributes of a specified name of all elements of the default group, and format them as a String that can be rendered for display. This has the effect of formatting a column of a table. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
attrName - the name of the attribute from which values will be obtained. This attribute will be extracted from each element of the group.
prefix - the string to insert immediately before each attribute value
suffix - the string to insert immediatly after each attribute value
separator - the string to insert between attribute values
Returns:
A String containing the formatted attribute values

applyXSL

public String applyXSL(String groupName,
                       Reader xslReader,
                       String styleBaseUri)
                throws IeServiceException
Internally render a group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result.

Parameters:
groupName - the name of the group to which the stylesheet will be applied. The group must exist within the internal collection.
xslReader - the Reader from which the XSL stylesheet can be read
styleBaseUri - a URI specifying where to find additional stylesheets that might be referenced by the main stylesheet read from xslReader
Returns:
A String containing the result produced by the XSL stylesheet
Throws:
IeServiceException - if the XSL stylesheet was not applied successfully, possible due to a syntax error in the stylesheet, or a failure in trying to read the stylesheet

applyXSL

public String applyXSL(Reader xslReader,
                       String styleBaseUri)
                throws IeServiceException
Internally render the default group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
xslReader - the Reader from which the XSL stylesheet can be read
styleBaseUri - a URI specifying where to find additional stylesheets that might be referenced by the main stylesheet read from xslReader
Returns:
A String containing the result produced by the XSL stylesheet
Throws:
IeServiceException - if the XSL stylesheet was not applied successfully, possible due to a syntax error in the stylesheet, or a failure in trying to read the stylesheet

applyXSL

public String applyXSL(String groupName,
                       String stylesheet,
                       String styleBaseUri)
                throws IeServiceException
Internally render a group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result.

Parameters:
groupName - the name of the group to which the stylesheet will be applied. The group must exist within the internal collection.
stylesheet - a String containing the XSL stylesheet to apply
styleBaseUri - a URI specifying where to find additional stylesheets that might be referenced by the main stylesheet specified by the stylesheet parameter
Returns:
A String containing the result produced by the XSL stylesheet
Throws:
IeServiceException - if the XSL stylesheet was not applied successfully, possible due to a syntax error in the stylesheet, or a failure in trying to read the stylesheet

applyXSL

public String applyXSL(String stylesheet,
                       String styleBaseUri)
                throws IeServiceException
Internally render the default group as an XML string, then apply a specified XSL stylesheet to produce a string that is returned as a result. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
stylesheet - a String containing the XSL stylesheet to apply
styleBaseUri - a URI specifying where to find additional stylesheets that might be referenced by the main stylesheet specified by the stylesheet parameter
Returns:
A String containing the result produced by the XSL stylesheet
Throws:
IeServiceException - if the XSL stylesheet was not applied successfully, possible due to a syntax error in the stylesheet, or a failure in trying to read the stylesheet

getElementCount

public int getElementCount()
Return the number of elements in the default group. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Returns:
The number of elements contained in the default group

getColumn

public Vector getColumn(String attrName)
Return all of the values of a named attribute of all elements of the default group. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
attrName - The name of the attribute.
Returns:
The attribute values, or null the collection is empty.

getRow

public Vector getRow(int index)
Return all of the values of an element of the default group. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Parameters:
index - The index of the element.
Returns:
The attribute values, or null if the collection is empty.

getStatus

public int getStatus()
Return the status value associated with the default group. A value of 0 indicates success. Any other value indicates failure. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Returns:
The status value

getMessage

public String getMessage()
Return the message string associated with the default group. The default group is usually the last group added to the internal collection. This is often the one group produced as the output of a task.

Returns:
The message string, or null if the default group does not have a message string

setAuthorization

private void setAuthorization()
                       throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException