Stellent
HowToComponents
JavaDoc

intradoc.data
Class DataBinder

java.lang.Object
  |
  +--intradoc.data.DataBinder
All Implemented Interfaces:
DataDecode, Parameters

public class DataBinder
extends java.lang.Object
implements Parameters, DataDecode


Field Summary
static int CONTENT_ERROR
           
static java.lang.String[] DATA_TYPES
          List of allowable section keyword tags of the form @keyword tag.
static int DOWNLOAD_FORMAT
           
static int HDA_FORMAT
           
 java.util.Stack m_activeResultSets
           
 IdcDateFormat m_blDateFormat
           
 java.util.Properties m_blFieldTypes
           
 java.lang.String m_boundary
           
 byte[] m_boundaryBytes
           
 java.io.BufferedReader m_bufReader
           
 boolean m_checkLocalLocalization
           
 boolean m_checkResultSetLocalization
           
 java.lang.String m_clientEncoding
          Indicates client encoding.
 java.lang.String m_contentType
           
 boolean m_convertDatabaseDateFormats
           
 ResultSet m_currentResultSet
           
 java.lang.String m_currentSetName
           
 boolean m_determinedDataDateFormat
           
 boolean m_determinedEncoding
          Indicates if encoding has been determined.
 java.util.Properties m_environment
           
static long m_fileCounter
           
 boolean m_hasAttachedFiles
          This flag is set to true internally during a file upload or externally to true if this binder is to be used for a multipart upload.
 java.io.BufferedInputStream m_inStream
           
 boolean m_ioLocalOnly
          Set to true if result sets should not be serialized along with the local data.
 boolean m_isCgi
          Set to true to indicate that the stream being parsed should be assumed to have come from a Intradoc HTML page post using the CGI encoding of characters.
 boolean m_isExternalRequest
          Used to indicate whether this object was parsed from an external source (such as an HTTP request through a web server.
 boolean m_isGet
          Set to true if the DataBinder was parsed from a client request that emulated a browser request put did not have any post data, i.e.
 boolean m_isJava
          Used to indicate whether this object should be sent back to the browser as an HTML page or a raw data to an applet.
 boolean m_isNonStandardResponse
          Indicates we are using a non-standard response.
 boolean m_isSkipFile
          By default, this is set to true and is used only during a multipart upload, i.e.
 boolean m_isSuspended
          If true, indicates that the input stream has been suspended.
 java.lang.String m_javaEncoding
          Indicates what java encoding to use.
 java.util.Properties m_localData
           
 IdcDateFormat m_localeDateFormat
           
 java.util.Properties m_localizedFields
           
 java.util.Hashtable m_localizedResultSets
           
 java.util.Hashtable m_optionLists
           
 java.util.Vector m_optListSuggestedOrder
           
 java.lang.String m_overrideTempDir
           
 byte[] m_postDataBuf
           
 ReportProgress m_progress
           
 java.util.Vector m_rawData
           
 byte[] m_rawPostData
           
 long m_remainingLength
          Indicates the content length still to be read from a multipart input stream.
 java.util.Hashtable m_resultSets
           
 java.util.Vector m_rsetSuggestedOrder
           
 java.lang.String m_suspendedFileKey
          Indicates the file at which the multipart post was suspended.
 byte[] m_tempByteBuf
           
static java.lang.String m_tempDir
           
 java.util.Vector m_tempFiles
           
 char[] m_tmpCharArray
           
 java.util.Vector m_unstructuredData
           
static int MULTIPART_CONTENT
           
static int UNKNOWN_FORMAT
           
static int UPLOAD_FORMAT
           
static int URLENCODED_CONTENT
           
 
Constructor Summary
DataBinder()
          Default constructor.
DataBinder(boolean isJava)
           
DataBinder(java.util.Properties env)
          Constructor with the environment data being assigned as a parameter.
 
Method Summary
 void addLocaleFields(ResultSet rset)
          Retrieves information about columns in a result set and uses them to enhance the 'type' information for local data.
 void addOptionList(java.lang.String name, java.util.Vector options)
          Adds a Vector array of strings to be used as an option list.
 ResultSet addResultSet(java.lang.String name, ResultSet rset)
          Adds a result set to this object.
 void addTempFile(java.lang.String name)
          Adds a name to the list of temp files
 boolean attemptRawSynchronizeLocale(ResultSet rset)
          Attempts to see if the result set is either already has a matching locale information or whether it can easilty be coerced.
 void cleanUpTempFiles()
          Delete all the temporary files.
 void clearResultSets()
          Wipes out all current result sets cached in the DataBinder.
 java.lang.String convertToSystem(java.lang.String key, java.lang.String value)
          Takes a value in standard format (ex: standard date format) and converts it to a system format (ex: date format becomes JDBC format).
 void copyLocalDataStateShallow(DataBinder binder)
           
 void copyResultSetStateShallow(DataBinder binder)
           
 DataBinder createShallowCopy()
          Creates a shallow copy of the DataBinder so that the DataBinder will share pointers to all the data objects (such as the name value pairs and result sets) but not the other attributes (such the encoding/decoding rules for serialization or the current active Reader or Writer objects).
 DataBinder createShallowCopyCloneResultSets()
          Does shallow copy but makes clone copy of hashtable containing result sets.
 java.lang.String decode(java.lang.String in)
          Implements the DataDecode interface.
 void determineLocaleChecks()
          Determines what type of fixup this DataBinder will require.
 java.lang.String displayProperties(java.util.Properties props)
          Turns a Properties object into an HTML displayable format.
 java.lang.String displayResultSet(java.lang.String name, ResultSet rset)
          Creates an HTML displayable format of a result set.
 java.lang.String encode(java.lang.String in)
          Encodes a string using hda style encoding for a value.
 java.lang.String get(java.lang.String key)
          This calls getEx(key, false, true, true, true).
 java.lang.String get(java.lang.String key, boolean isActive)
          This calls getEx(key, isActive, true, !isActive, true).
 java.lang.String getActiveAllowMissing(java.lang.String key)
          This calls getEx(key, true, true, false, false).
 ResultSet getActiveSet(java.lang.String name)
          Searches through the stack of active result sets and tries to find the one with the particular key.
 java.lang.String getActiveValue(java.lang.String key)
          This calls getEx(key, true, true, false, true).
 java.lang.String getActiveValueSearchAll(java.lang.String key)
          This calls getEx(key, true, true, true, true).
 java.lang.String getAllowMissing(java.lang.String key)
          This calls getEx(key, true, true, true, false).
 java.lang.String getContentType()
          Gets the current HTTP header strings for describing the content of the file or page being returned.
 ResultSet getCurrentActiveResultSet()
          Returns the result set that is considered to be the most recently made active.
 java.util.Properties getEnvironment()
          Returns the Properties object that holds the environment values for this object.
 java.lang.String getEnvironmentValue(java.lang.String key)
          Gets an environment value.
 java.lang.String getEx(java.lang.String key, boolean fromActiveSets, boolean fromLocal, boolean fromAllSets, boolean mustExist)
          Searches through all the data in this object.
 java.lang.String getFromSets(java.lang.String key)
          This calls getEx(key, true, false, true, true).
 java.lang.String getLocal(java.lang.String key)
          Gets a value from local data.
 java.util.Properties getLocalData()
          Returns the Properties object that holds the local data.
static long getNextFileCounter()
           
 java.util.Vector getOptionList(java.lang.String name)
          Gets a Vector array of strings.
 java.util.Enumeration getOptionLists()
          Returns an Enumeration of all the lookup keys for the option lists.
 ResultSet getResultSet(java.lang.String name)
          Gets the result set using the lookup key.
 java.util.Enumeration getResultSetList()
          Gets an enumeration list of lookup keys for all the result sets in this object.
 java.lang.String getResultSetValue(ResultSet rset, java.lang.String key)
          Gets a value out of a result set.
protected  java.lang.String getResultSetValueWithFieldInfo(ResultSet rset, FieldInfo info)
           
 java.lang.String getSearchAllAllowMissing(java.lang.String key)
          This calls getEx(key, false, true, true, false).
 java.lang.String getSystem(java.lang.String key)
          This method is equivalent to get(key) except that dates are put into the ODBC format for direct use in SQL queries.
 java.util.Vector getTempFiles()
           
static java.lang.String getTemporaryDirectory()
          Get the directory for temporary files created on upload.
static java.lang.String header()
          A suggested HTTP response header string.
static java.lang.String htmlBottom()
          Standard HTML page end.
static java.lang.String htmlTop(java.lang.String title)
          Standard HTML page start.
 java.lang.String localizeLocal(java.lang.String key, java.lang.String value)
          Localizes value from internal DataBinder locale values to destination locale values (except for message strings).
 void merge(DataBinder newData)
          Merges data from one DataBinder into another DataBinder.
static void mergeHashTables(java.util.Hashtable current, java.util.Hashtable newData)
          Merges the contents of one Hashtable into another.
 void mergeHashTablesInternal(java.util.Hashtable current, java.util.Hashtable newData, DataBinder binder, boolean isResultSets)
          Merges the contents of one Hashtable into another.
 void mergeResultSetRowIntoLocalData(ResultSet rset)
          Merges data from a result set into local data properties of a DataBinder.
static void mergeVectors(java.util.Vector current, java.util.Vector newData)
          Merges the contents of one Vector into another.
 java.lang.String myBaseURL()
          If this object was filled from a browser based GET or POST, this method returns the base URL for the web server that is handling the GET or POST.
 boolean nextRow(java.lang.String setName)
          Advances the named result set to the next row.
 java.util.Date parseDate(java.lang.String key, java.lang.String date)
           
 void parseLocalParameters(java.lang.String params, java.lang.String delimiter)
          Deprecated. Use DataSerializeUtils.parseLocalParameters()
 ResultSet popActiveResultSet()
          Removes the currently active result set from the stack of active result sets.
 void pushActiveResultSet(java.lang.String name, ResultSet aSet)
          Pushes a result set onto the stack of active result sets.
 java.lang.String putLocal(java.lang.String key, java.lang.String value)
          Puts a value into local data.
 java.lang.String putLocalDate(java.lang.String key, java.util.Date value)
           
 void receive(java.io.BufferedReader reader)
          Calls receiveEx with the isHeaderOnly parameter set to false.
 void receiveEx(java.io.BufferedReader reader, boolean isHeaderOnly)
          Parses a stream and loads it into attributes of this object.
 void removeLocal(java.lang.String key)
          Removes a value from local data.
 ResultSet removeResultSet(java.lang.String name)
          Removes the result set from this object.
 void reportProgress(java.lang.String filename, long amtDone)
           
 void send(java.io.Writer writer)
          Writes out the header, local data, and result sets in hda format (see documentation on basic component architecture for a description of this format).
 byte[] sendBytes(java.lang.String javaEncoding, ExecutionContext cxt)
          Similar to sendEx, except it uses a byte array to write the data binder values.
 void sendEx(java.io.Writer writer, boolean sendHeader)
          Writes out the local data and result sets in hda format (see documentation on basic component architecture for a description of this format).
 void sendWithEncoding(java.io.Writer writer, java.lang.String javaEncoding)
          Writes out data binder in a chosen encoding.
 void setContentType(java.lang.String type)
          Sets a HTTP header style content type string.
 void setEncodeFlags(boolean cgiFlag, boolean javaFlag)
          Sets the encoding flags for parsing data that is received from a stream.
 void setEnvironment(java.util.Properties env)
          Sets the Properties object that holds the environment values for this object.
 void setEnvironmentValue(java.lang.String key, java.lang.String value)
          Sets an enviroment value.
 void setFieldType(java.lang.String name, java.lang.String type)
          Explicitly sets a variable to be of a particular field type.
static void setFileCounterStart()
           
 void setLocalData(java.util.Properties localData)
          Sets the Properties object that holds the local data.
 void setOverrideTemporaryDirectory(java.lang.String dir)
           
 void setReportProgress(ReportProgress rp)
           
static void setTemporaryDirectory(java.lang.String dir)
          Set the directory for temporary files created on upload.
 java.lang.String toString()
          Debug dump of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_environment

public java.util.Properties m_environment

m_localData

public java.util.Properties m_localData

m_optionLists

public java.util.Hashtable m_optionLists

m_rawData

public java.util.Vector m_rawData

m_rawPostData

public byte[] m_rawPostData

m_postDataBuf

public byte[] m_postDataBuf

m_resultSets

public java.util.Hashtable m_resultSets

m_activeResultSets

public java.util.Stack m_activeResultSets

m_currentResultSet

public ResultSet m_currentResultSet

m_currentSetName

public java.lang.String m_currentSetName

m_unstructuredData

public java.util.Vector m_unstructuredData

m_checkLocalLocalization

public boolean m_checkLocalLocalization

m_checkResultSetLocalization

public boolean m_checkResultSetLocalization

m_determinedDataDateFormat

public boolean m_determinedDataDateFormat

m_convertDatabaseDateFormats

public boolean m_convertDatabaseDateFormats

m_blDateFormat

public IdcDateFormat m_blDateFormat

m_blFieldTypes

public java.util.Properties m_blFieldTypes

m_localeDateFormat

public IdcDateFormat m_localeDateFormat

m_localizedFields

public java.util.Properties m_localizedFields

m_localizedResultSets

public java.util.Hashtable m_localizedResultSets

m_rsetSuggestedOrder

public java.util.Vector m_rsetSuggestedOrder

m_optListSuggestedOrder

public java.util.Vector m_optListSuggestedOrder

m_tempFiles

public java.util.Vector m_tempFiles

m_tempDir

public static java.lang.String m_tempDir

m_overrideTempDir

public java.lang.String m_overrideTempDir

m_inStream

public java.io.BufferedInputStream m_inStream

m_tempByteBuf

public byte[] m_tempByteBuf

m_tmpCharArray

public char[] m_tmpCharArray

m_bufReader

public java.io.BufferedReader m_bufReader

m_fileCounter

public static long m_fileCounter

CONTENT_ERROR

public static final int CONTENT_ERROR
See Also:
Constant Field Values

URLENCODED_CONTENT

public static final int URLENCODED_CONTENT
See Also:
Constant Field Values

MULTIPART_CONTENT

public static final int MULTIPART_CONTENT
See Also:
Constant Field Values

m_contentType

public java.lang.String m_contentType

UNKNOWN_FORMAT

public static final int UNKNOWN_FORMAT
See Also:
Constant Field Values

HDA_FORMAT

public static final int HDA_FORMAT
See Also:
Constant Field Values

UPLOAD_FORMAT

public static final int UPLOAD_FORMAT
See Also:
Constant Field Values

DOWNLOAD_FORMAT

public static final int DOWNLOAD_FORMAT
See Also:
Constant Field Values

m_isExternalRequest

public boolean m_isExternalRequest
Used to indicate whether this object was parsed from an external source (such as an HTTP request through a web server.


m_isJava

public boolean m_isJava
Used to indicate whether this object should be sent back to the browser as an HTML page or a raw data to an applet. If set to true then the data will be sent to an applet. If set to false then the data is to be used for creating an HTML reponse page. Note: this flag is not used internally in this object, it is purely a placeholder for the code that handles requests from browsers. If this object is being used purely to read and write from files then the value of this attribute is irrelevant. The default value is true.


m_isCgi

public boolean m_isCgi
Set to true to indicate that the stream being parsed should be assumed to have come from a Intradoc HTML page post using the CGI encoding of characters. If false then the stream is parsed using hda style encoding. The default is false.

See Also:
decode(java.lang.String), receive(java.io.BufferedReader), #parseRequest, send(java.io.Writer)

m_isGet

public boolean m_isGet
Set to true if the DataBinder was parsed from a client request that emulated a browser request put did not have any post data, i.e. a get.


m_ioLocalOnly

public boolean m_ioLocalOnly
Set to true if result sets should not be serialized along with the local data.

See Also:
#parseRequest

DATA_TYPES

public static final java.lang.String[] DATA_TYPES
List of allowable section keyword tags of the form @keyword tag. Current list is Properties, OptionList, ResultSet, and end. Used during serialization of DataBinder.

See Also:
receive(java.io.BufferedReader), decode(java.lang.String), #parseRequest, send(java.io.Writer)

m_remainingLength

public long m_remainingLength
Indicates the content length still to be read from a multipart input stream.


m_hasAttachedFiles

public boolean m_hasAttachedFiles
This flag is set to true internally during a file upload or externally to true if this binder is to be used for a multipart upload.


m_isSuspended

public boolean m_isSuspended
If true, indicates that the input stream has been suspended. This can only happen at a file read and if m_isSkipFile has been set to true. When a file read is encountered the m_suspendedFileKey is set to the name. By default, this parameter is false.

See Also:
#parseRequest

m_isSkipFile

public boolean m_isSkipFile
By default, this is set to true and is used only during a multipart upload, i.e. file upload. When set to true, parseRequest will suspend the read of a file.

See Also:
#parseRequest

m_suspendedFileKey

public java.lang.String m_suspendedFileKey
Indicates the file at which the multipart post was suspended.


m_boundary

public java.lang.String m_boundary

m_boundaryBytes

public byte[] m_boundaryBytes

m_progress

public ReportProgress m_progress

m_javaEncoding

public java.lang.String m_javaEncoding
Indicates what java encoding to use. If java encoding is not specified, then it will use the system encoding.


m_clientEncoding

public java.lang.String m_clientEncoding
Indicates client encoding.


m_determinedEncoding

public boolean m_determinedEncoding
Indicates if encoding has been determined.


m_isNonStandardResponse

public boolean m_isNonStandardResponse
Indicates we are using a non-standard response.

Constructor Detail

DataBinder

public DataBinder()
Default constructor.


DataBinder

public DataBinder(boolean isJava)

DataBinder

public DataBinder(java.util.Properties env)
Constructor with the environment data being assigned as a parameter.

Parameters:
env - Environment data to be used by this object.
See Also:
setEnvironment(java.util.Properties)
Method Detail

clearResultSets

public void clearResultSets()
Wipes out all current result sets cached in the DataBinder. On a commit of a transaction when performing a service script, all the result sets are wiped out from the current DataBinder object.


createShallowCopy

public DataBinder createShallowCopy()
Creates a shallow copy of the DataBinder so that the DataBinder will share pointers to all the data objects (such as the name value pairs and result sets) but not the other attributes (such the encoding/decoding rules for serialization or the current active Reader or Writer objects). Note the shallow copy is initialized with m_isJava set to true and m_isCgi set to false.

Returns:
A shallow copy of this object.
See Also:
m_isJava, m_isCgi

createShallowCopyCloneResultSets

public DataBinder createShallowCopyCloneResultSets()
Does shallow copy but makes clone copy of hashtable containing result sets. Use this method if result sets are an issue when making a secondary pointer reference to the same DataBinder.


copyResultSetStateShallow

public void copyResultSetStateShallow(DataBinder binder)

copyLocalDataStateShallow

public void copyLocalDataStateShallow(DataBinder binder)

merge

public void merge(DataBinder newData)
Merges data from one DataBinder into another DataBinder. If a matching result set then the resultset is replaced. If a matching name for a name value pair, then the value is replaced. Otherwise the result sets and name value pairs are added to the current DataBinder object.

Parameters:
newData - Source DataBinder object.

mergeResultSetRowIntoLocalData

public void mergeResultSetRowIntoLocalData(ResultSet rset)
Merges data from a result set into local data properties of a DataBinder.


mergeHashTablesInternal

public void mergeHashTablesInternal(java.util.Hashtable current,
                                    java.util.Hashtable newData,
                                    DataBinder binder,
                                    boolean isResultSets)
Merges the contents of one Hashtable into another. Unlike the static method, this method is careful to maintain i18n characteristics. In particular, Date fields will be parsed and reformatted for the locale of the new DataBinder.

See Also:
mergeHashTables(java.util.Hashtable, java.util.Hashtable)

mergeHashTables

public static void mergeHashTables(java.util.Hashtable current,
                                   java.util.Hashtable newData)
Merges the contents of one Hashtable into another. Used by the 'merge(...)' method to merge the local data and environment data.

Parameters:
current - Target hashtable.
newData - Source hastable.
See Also:
merge(intradoc.data.DataBinder)

mergeVectors

public static void mergeVectors(java.util.Vector current,
                                java.util.Vector newData)
Merges the contents of one Vector into another.

Parameters:
current - Target vector.
newData - Source vector.
See Also:
merge(intradoc.data.DataBinder)

parseDate

public java.util.Date parseDate(java.lang.String key,
                                java.lang.String date)
                         throws DataException
DataException

getActiveValue

public java.lang.String getActiveValue(java.lang.String key)
                                throws DataException
This calls getEx(key, true, true, false, true). This method searches in the active result set, local data, and environment data.

Parameters:
key - Look up key.
Throws:
DataException - If the key is not found.
See Also:
getEx

getActiveValueSearchAll

public java.lang.String getActiveValueSearchAll(java.lang.String key)
                                         throws DataException
This calls getEx(key, true, true, true, true). This method searches in the active sets, the local data, all the sets and the environment values.

Parameters:
key - Look up key.
Returns:
Value found.
Throws:
DataException - If the key is not found.
See Also:
getEx

get

public java.lang.String get(java.lang.String key)
                     throws DataException
This calls getEx(key, false, true, true, true). In other words, first the local data, then all the result sets and finally the environment data is searched. Note: this is the method that implements the Parameters interface so it is used when executing queries. Note: this method should be called getAll, but for historical reasons has been shortened to 'get'.

Specified by:
get in interface Parameters
Parameters:
key - Look up key.
Returns:
Value found.
Throws:
DataException - if the key is not found
See Also:
getEx

getSystem

public java.lang.String getSystem(java.lang.String key)
                           throws DataException
This method is equivalent to get(key) except that dates are put into the ODBC format for direct use in SQL queries. This method is also part of the Parameters interface and used by the database API.

Specified by:
getSystem in interface Parameters
Parameters:
key - Look up key.
Returns:
Value found.
Throws:
DataException - if the key is not found
See Also:
get

get

public java.lang.String get(java.lang.String key,
                            boolean isActive)
                     throws DataException
This calls getEx(key, isActive, true, !isActive, true). In other words, in the case where isActive is true, it searches the active result sets, then the local data and environment data. It will not search in all the result sets. If the key is not found, it will throw a DataException. If isActive is false, it will first search in the local data and then in all the result sets and finally in the environment data throwing a DataException if the key is not found.

Parameters:
key - Look up key.
isActive - Whether or not to search active result.
Returns:
Value found.
Throws:
DataException - if the key is not found
See Also:
getEx

getSearchAllAllowMissing

public java.lang.String getSearchAllAllowMissing(java.lang.String key)
This calls getEx(key, false, true, true, false). This method is the same as get(String), but if the key is not found, no exception is thrown. In particular, this method does not search the active result sets.

Parameters:
key - Look up key.
Returns:
Value found.
See Also:
getEx

getAllowMissing

public java.lang.String getAllowMissing(java.lang.String key)
This calls getEx(key, true, true, true, false). This method is the same as getActiveValueSearchAll(String), but if the key is not found, no exception is thrown. Note: this method uses a different searching algorithm then get(String). It can cause subtle logic issues if there are active result sets and get(String) and getAllowMissing(String) are used interchangeably.

Parameters:
key - Look up key.
Returns:
Value found.
See Also:
getEx

getActiveAllowMissing

public java.lang.String getActiveAllowMissing(java.lang.String key)
This calls getEx(key, true, true, false, false). This method is the same as getActiveValue(String), but it does not throw an exception if the key is not found. It is also the same as getAllowMissing(String) except that it does not search the full list of result sets after the local data.

Parameters:
key - Look up key.
Returns:
Value found.
See Also:
getEx

getFromSets

public java.lang.String getFromSets(java.lang.String key)
                             throws DataException
This calls getEx(key, true, false, true, true). This method searches the active sets, then in all the sets, and finally in the environment. It does not look in the local data.

Parameters:
key - Look up key.
Throws:
DataException - If the key is not found.
See Also:
getEx

getEx

public java.lang.String getEx(java.lang.String key,
                              boolean fromActiveSets,
                              boolean fromLocal,
                              boolean fromAllSets,
                              boolean mustExist)
                       throws DataException
Searches through all the data in this object. The boolean parameters control how the search is to be conducted. This method is generally not used directly. It is called through the other methods,which set the appropriate Booleans for the search. In other words, all other getXXX(...) methods go through getEx. The order in which getEx searches for the key is: the active result sets, the local data, all result sets, and finally the environment values. As soon as the key is found, the function returns. Note: the enviroment data is always searched. Use 'getLocal(...)' and 'getEnvironmentValue(...)' for more targeted searches.

Parameters:
key - Look up key.
fromActiveSets - Whether or not to search result sets that are currently being looped on. The active results sets are searched before any other result sets are searched.
fromLocal - Whether or not to search local data (the name value pairs that are available for this calling thread only).
fromAllSets - Whether or not to search all result sets regardless of whether they are active or not.
mustExist - Whether or not to throw a DataException if 'key' is not found.
Returns:
Value found.
Throws:
DataException - If the key is not found and mustExist is true, getEx will throw a DataException, otherwise it will return null.
See Also:
getLocal(java.lang.String), getEnvironmentValue(java.lang.String)

getResultSetValue

public java.lang.String getResultSetValue(ResultSet rset,
                                          java.lang.String key)
Gets a value out of a result set. Makes sure that it is localized.


getResultSetValueWithFieldInfo

protected java.lang.String getResultSetValueWithFieldInfo(ResultSet rset,
                                                          FieldInfo info)

putLocal

public java.lang.String putLocal(java.lang.String key,
                                 java.lang.String value)
Puts a value into local data.

Parameters:
key - Lookup key.
value - Value to be assigned to key. Cannot be null.

putLocalDate

public java.lang.String putLocalDate(java.lang.String key,
                                     java.util.Date value)

getLocal

public java.lang.String getLocal(java.lang.String key)
Gets a value from local data. Returns null if value not found.

Parameters:
key - Lookup key.
Returns:
Value assigned to key.

convertToSystem

public java.lang.String convertToSystem(java.lang.String key,
                                        java.lang.String value)
Takes a value in standard format (ex: standard date format) and converts it to a system format (ex: date format becomes JDBC format).


localizeLocal

public java.lang.String localizeLocal(java.lang.String key,
                                      java.lang.String value)
Localizes value from internal DataBinder locale values to destination locale values (except for message strings).

Parameters:
key - Lookup key.
value - Current value directory from local properties object.
Returns:
Value after locale transformation.

removeLocal

public void removeLocal(java.lang.String key)
Removes a value from local data.

Parameters:
key - Lookup key.

getLocalData

public java.util.Properties getLocalData()
Returns the Properties object that holds the local data.

Returns:
The object holding local data.
See Also:
Properties

setLocalData

public void setLocalData(java.util.Properties localData)
Sets the Properties object that holds the local data. If a properties object was created through some other mechanism, this is a good way to get the DataBinder to use that data as its local data.

Parameters:
localData - The object that will now hold local data for this object.

getEnvironment

public java.util.Properties getEnvironment()
Returns the Properties object that holds the environment values for this object. This Properties object usually contains CGI headers and/or configuration name value pairs. Environment information is not serialized.

Returns:
The object holding environment information.
See Also:
getLocalData()

setEnvironment

public void setEnvironment(java.util.Properties env)
Sets the Properties object that holds the environment values for this object.

Parameters:
env - Environment data to be searched by the 'getXXX(...)' functions. The environment data is searched as a last resort for finding name value pairs. Generally the environment data contains global variables and/or variables (such as REMOTE_USER) set by the web browser on a CGI call. Data in the environment variables is always trusted and nevers needs an authenticated user to authorize the usage of the data. The environment data is not serialized to or from files nor is it received by or sent to browser applets.
See Also:
getEnvironment(), setLocalData(java.util.Properties)

getEnvironmentValue

public java.lang.String getEnvironmentValue(java.lang.String key)
Gets an environment value.

Parameters:
key - A lookup key.
Returns:
An environment value.
See Also:
getLocal(java.lang.String)

setEnvironmentValue

public void setEnvironmentValue(java.lang.String key,
                                java.lang.String value)
Sets an enviroment value. This method is rarely used.

Parameters:
key - A lookup key.
value - A environment value assigned to the key.

getCurrentActiveResultSet

public ResultSet getCurrentActiveResultSet()
Returns the result set that is considered to be the most recently made active. When looping on result sets during a template page merge, the inner most loop is looping on the "current" result set.

Returns:
The current active result set.

addOptionList

public void addOptionList(java.lang.String name,
                          java.util.Vector options)
Adds a Vector array of strings to be used as an option list.

Parameters:
name - The lookup key to use for this option list.
options - A Vector of strings holding the option list.

getOptionList

public java.util.Vector getOptionList(java.lang.String name)
Gets a Vector array of strings.

Parameters:
name - The lookup key for the option list.
Returns:
Returns the option list assigned to the key.
See Also:
addOptionList(java.lang.String, java.util.Vector)

getOptionLists

public java.util.Enumeration getOptionLists()
Returns an Enumeration of all the lookup keys for the option lists.

Returns:
An Enumeration of the Option List lookup keys.

nextRow

public boolean nextRow(java.lang.String setName)
                throws java.io.IOException
Advances the named result set to the next row. This method also manages the stack of active result sets using the following logic. If the result set being advanced is the top level active result set then if there is another row in the result set then the result set is advanced one row and the method returns true. If it is the top level result set but has no more rows then the result set is popped from the stack, the result set next up on the stack is promoted to being the top level active result set and the method returns false. If the result set being advanced is not the top level result set, then that result set is pushed onto the stack of active result sets, promoted to being the top level active result set, and advanced to the first row. This method implements the looping logic of result sets when merging with a template page.

Parameters:
setName - The name of result set being advanced.
Returns:
True if result set row was advanced (or if new active result set that was moved to first row) otherwise returns false. Note: returns false if result set is not in the list of result sets bound to this object.
Throws:
java.io.IOException - Thrown if error while advancing result set.

popActiveResultSet

public ResultSet popActiveResultSet()
Removes the currently active result set from the stack of active result sets. Do not call this method directly.

Returns:
The result set that was active (but no longer).
See Also:
nextRow(java.lang.String)

pushActiveResultSet

public void pushActiveResultSet(java.lang.String name,
                                ResultSet aSet)
Pushes a result set onto the stack of active result sets. This result set will now be designated as the current active result set. Do not call this method directly.

Parameters:
name - The lookup key for the result set.
aSet - The result set to push on the stack.
See Also:
popActiveResultSet(), nextRow(java.lang.String)

getActiveSet

public ResultSet getActiveSet(java.lang.String name)
Searches through the stack of active result sets and tries to find the one with the particular key.

Parameters:
name - The lookup key for the active result set.
Returns:
The result set associated with the key when it was pushed onto the stack. Returns null if the result set is not found.

getResultSetList

public java.util.Enumeration getResultSetList()
Gets an enumeration list of lookup keys for all the result sets in this object.

Returns:
An enumeration of strings.

getResultSet

public ResultSet getResultSet(java.lang.String name)
Gets the result set using the lookup key.

Parameters:
name - The lookup key for the result set.
Returns:
The result set associated with the lookup key. Returns null if no such result set exists.

addResultSet

public ResultSet addResultSet(java.lang.String name,
                              ResultSet rset)
Adds a result set to this object. If the result set with the same lookup key already exists, that result set is removed and replaced with the one provided in this method.

Parameters:
name - The lookup key to use for retrieving this result set.
rset - The result set being added to this object.
Returns:
The previous result set for this lookup key. Returns null if no previous result set was assigned to this lookup key.

removeResultSet

public ResultSet removeResultSet(java.lang.String name)
Removes the result set from this object.

Returns:
The result set at the lookup key.

setFieldType

public void setFieldType(java.lang.String name,
                         java.lang.String type)
Explicitly sets a variable to be of a particular field type. Currently types are focused on dates and encoded unlocalized messages. There is no going back once messages are localized.


addLocaleFields

public void addLocaleFields(ResultSet rset)
Retrieves information about columns in a result set and uses them to enhance the 'type' information for local data. This method assumes that a variable of a particular name can only be of one type.


attemptRawSynchronizeLocale

public boolean attemptRawSynchronizeLocale(ResultSet rset)
Attempts to see if the result set is either already has a matching locale information or whether it can easilty be coerced.


determineLocaleChecks

public void determineLocaleChecks()
Determines what type of fixup this DataBinder will require.


send

public void send(java.io.Writer writer)
          throws java.io.IOException
Writes out the header, local data, and result sets in hda format (see documentation on basic component architecture for a description of this format). If m_ioLocalOnly is true then the result sets are not written out.

java.io.IOException

sendWithEncoding

public void sendWithEncoding(java.io.Writer writer,
                             java.lang.String javaEncoding)
                      throws java.io.IOException
Writes out data binder in a chosen encoding. Since a "Writer" object typically has an built-in encoding, it can be useful to force the DataBinder to write in that particular encoding. Note: if javaEncoding is null, then the "system encoding" is used. In other words using null, is not the same as using the "send(...)" method since the send(...) method uses the current encoding values in the DataBinder.

java.io.IOException

sendEx

public void sendEx(java.io.Writer writer,
                   boolean sendHeader)
            throws java.io.IOException
Writes out the local data and result sets in hda format (see documentation on basic component architecture for a description of this format). If m_ioLocalOnly is true then the result sets are not written out. If sendHeader is true, hda header will be written before local data and result sets.

java.io.IOException

sendBytes

public byte[] sendBytes(java.lang.String javaEncoding,
                        ExecutionContext cxt)
                 throws java.io.IOException
Similar to sendEx, except it uses a byte array to write the data binder values. If m_isNonStandardResponse is false, it defaults to calling sendEx. If m_isNonStandardResponse is true, it allows custom processing the response at the byte level, rather than at the string level.

java.io.IOException

receive

public void receive(java.io.BufferedReader reader)
             throws java.io.IOException
Calls receiveEx with the isHeaderOnly parameter set to false.

Parameters:
reader - The stream being parsed.
Throws:
java.io.IOException - Thrown if there is an error reading from the stream.
DataException - Thrown if there is a data integrity error.
See Also:
receiveEx(java.io.BufferedReader, boolean), send(java.io.Writer)

receiveEx

public void receiveEx(java.io.BufferedReader reader,
                      boolean isHeaderOnly)
               throws java.io.IOException
Parses a stream and loads it into attributes of this object. Previously loaded data is kept although it may be replaced by new data from the stream.

Parameters:
reader - The stream being parsed. Note: this method assumes that 'reader' will provide a clean termination point for consumption. This method does not provide for partial reads based on expected response length or for issues such as persisting connections (i.e. keep alive logic). Such complex issues must be negotiated by the underlying input source (for example, the input stream from a response to an Http request using the java.net.HttpUrlConnection object has a built in termination point created from the Content-Length HTTP response header).
isHeaderOnly - If set to true, then only the local data and the field names of the first result set are read in. This allows sampling of a very large hda file.
Throws:
java.io.IOException - Thrown if there is an error reading from the stream.
DataException - Thrown if there is a data integrity error.
See Also:
m_isCgi, #parseRequest, receive(java.io.BufferedReader), send(java.io.Writer)

parseLocalParameters

public void parseLocalParameters(java.lang.String params,
                                 java.lang.String delimiter)
Deprecated. Use DataSerializeUtils.parseLocalParameters()


setEncodeFlags

public void setEncodeFlags(boolean cgiFlag,
                           boolean javaFlag)
Sets the encoding flags for parsing data that is received from a stream.

Parameters:
cgiFlag - New value of m_isCgi.
javaFlag - New value of m_isJava
See Also:
m_isCgi, m_isJava

decode

public java.lang.String decode(java.lang.String in)
Implements the DataDecode interface. Used to control how to decode data as its being parsed and stored into attributes.

Specified by:
decode in interface DataDecode
Parameters:
in - The string to decode.
Returns:
The decoded version of the string.
See Also:
DataDecode, encode(java.lang.String), m_isCgi

encode

public java.lang.String encode(java.lang.String in)
Encodes a string using hda style encoding for a value. That is, it uses the following translations:
\ -> \\
cr -> \r
lf -> \n
@ -> \@

Parameters:
in - The string to encode.
Returns:
The encoded string.
See Also:
decode(java.lang.String)

getTempFiles

public java.util.Vector getTempFiles()

addTempFile

public void addTempFile(java.lang.String name)
Adds a name to the list of temp files

Parameters:
name - The name of the file, including local path

cleanUpTempFiles

public void cleanUpTempFiles()
Delete all the temporary files.


setTemporaryDirectory

public static void setTemporaryDirectory(java.lang.String dir)
Set the directory for temporary files created on upload.


getTemporaryDirectory

public static java.lang.String getTemporaryDirectory()
Get the directory for temporary files created on upload.


setFileCounterStart

public static void setFileCounterStart()

getNextFileCounter

public static long getNextFileCounter()

setOverrideTemporaryDirectory

public void setOverrideTemporaryDirectory(java.lang.String dir)

setReportProgress

public void setReportProgress(ReportProgress rp)

reportProgress

public void reportProgress(java.lang.String filename,
                           long amtDone)

header

public static java.lang.String header()
A suggested HTTP response header string. Used to aid browser based debugging of the content of this object.

Returns:
A HTTP 200 OK style header string.
See Also:
toString

setContentType

public void setContentType(java.lang.String type)
Sets a HTTP header style content type string. Used to help build an HTTP header when responding to a CGI request. Note: this method is set by Intradoc after a page merge has been performed or the size of the file being returned is computed. Ex:
html/text
Content-Disposition: attachment;filename="myfile.htm"
Content-Length: 2036

Parameters:
type - HTTP header style string describing content being returned.
See Also:
getContentType()

getContentType

public java.lang.String getContentType()
Gets the current HTTP header strings for describing the content of the file or page being returned.

See Also:
setContentType(java.lang.String)

htmlTop

public static java.lang.String htmlTop(java.lang.String title)
Standard HTML page start. Used to help browser based debugging of the contents of this object.

Parameters:
title - The title of the HTML page.
Returns:
The HTML page start including the body tag.
See Also:
toString()

htmlBottom

public static java.lang.String htmlBottom()
Standard HTML page end.

Returns:
A closing of an HTML page. Used in combination with htmlTop.
See Also:
htmlTop(java.lang.String), toString()

myBaseURL

public java.lang.String myBaseURL()
If this object was filled from a browser based GET or POST, this method returns the base URL for the web server that is handling the GET or POST. This method can only be used for purposes of debugging the contents of this object.

Returns:
The base URL.
See Also:
toString()

displayProperties

public java.lang.String displayProperties(java.util.Properties props)
Turns a Properties object into an HTML displayable format.

Parameters:
props - Properties object to present.
Returns:
An HTML rendition of the name value pairs.
See Also:
toString()

displayResultSet

public java.lang.String displayResultSet(java.lang.String name,
                                         ResultSet rset)
Creates an HTML displayable format of a result set.

Parameters:
name - The lookup key for the result set.
rset - The result set.
Returns:
The HTML representation of a result set.
See Also:
toString()

toString

public java.lang.String toString()
Debug dump of this object. Combining the results of calls to header, htmlTop, toString, and htmlBottom will create a response that can be sent back to a browser.

Overrides:
toString in class java.lang.Object
Returns:
A HTML displayable version of the contents of this object that can be put into the body part of an HTML page.


(c) 1996-2005  All rights reserved.  Stellent, Inc.