ElegantJ Data Tables Java API Specification v1.1

com.elegantj.data.dataprovider.text
Class TextDataProvider

java.lang.Object
  extended bycom.elegantj.data.dataprovider.AbstractDataProvider
      extended bycom.elegantj.data.dataprovider.text.TextDataProvider
All Implemented Interfaces:
DataProvider, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
FTPTextDataProvider, HTTPTextDataProvider, XMLDataProvider

public class TextDataProvider
extends AbstractDataProvider

This class encapsulates functionality of a text data provider.
It provides data in a format in which the row separator, column separator, text qualifier, column's fixed width are user-specified text.
Text data may contains the column names as first row.
And may be delimited by string or may be fixed width.
This bean provides powerful designing aspects by providing following user friendly property.
DataProvider the data provider
File the path of the source file
URL the URL of the source file
URLConnectionEnabled indicates whether the connection can be established through the URL or not
RowSeparator the row separator string
ColumnSeparator the column separator string
TextQualifier the text qualifier string
FirstRowAsColumnNames indicates whether the first row of the retrieved data is column names or not
ColumnsDelimited indicates whether the columns are delimited or fixed width
SkippedColumns the comma separated indexes of the columns to be skipped
ColumnsWidth the comma separated width of the columns
SortCriteria the criteria for sorting the data
FilterCriteria the criteria for filtering the data
FilterState indicates whether the filter criteria is applied or not
SaveOnlyFilteredData indicates to save only filtered rows or all rows
FetchSize the maximum number of rows which can be retrieved
AppendDataOnFetchNext indicates whether the next fetched data is appended or replaced to existing data
SkippedRows the total number of rows to be skipped

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_COLUMN_SEPARATOR
          Specifies the comma as a default column separator
static java.lang.String DEFAULT_ROW_SEPARATOR
          Specifies the newline character as a default row separator
static java.lang.String DEFAULT_TEXT_QUALIFIER
          Specifies the empty string as default text qualifier
protected  boolean forInput
          Specifies the text file operation as input or output
protected  java.io.InputStream in
          Specifies the input stream of the text file
protected  java.io.OutputStream out
          Specifies the output stream of the text file
 
Fields inherited from class com.elegantj.data.dataprovider.AbstractDataProvider
c1, changes, clientTable, columnNames, currentIndex, dataTable
 
Constructor Summary
TextDataProvider()
           
 
Method Summary
 boolean close()
          Closes input / output stream of the text file
 java.lang.String getFile()
          Gets the path of the text file.
 java.lang.String getSkippedColumns()
          Gets the column indexes to be skipped
 java.lang.String getURL()
          Gets the URL of the text file.
 boolean isFetchNext()
          Determines whether fetching the next rows or not
 boolean isURLConnectionEnabled()
          Gets the enability to connect through URL
 boolean nextData()
          If more data can be fetched, it fetches and return true, otherwise return false
 boolean open(boolean input)
          Opens input stream or output stream of the text file
 void readExternal(java.io.ObjectInput in)
           
 void retrieve()
          Retrives the data
 boolean retrieveData(java.io.InputStream is)
          Retrieves the data from given input stream.
 void save()
          Saves the transaction
 boolean saveData(java.io.OutputStream os)
          Saves the data to given output stream.
 void setFile(java.lang.String path)
          Sets the path of the text file.
 void setSkippedColumns(java.lang.String skipColumns)
          Sets the column indexes to be skipped
 void setURL(java.lang.String url)
          Sets the URL of the text file.
 void setURLConnectionEnabled(boolean b)
          Sets the enability to connect through URL
 void writeExternal(java.io.ObjectOutput out)
          Externalizable interface implementation to save and retrieve the state of this bean
 
Methods inherited from class com.elegantj.data.dataprovider.AbstractDataProvider
addDataListener, addPropertyChangeListener, addRow, appendData, dataChanged, dataChanged, deleteRow, equals, exportToSQL, exportToSQL, exportToSQL, exportToSQL, exportToText, exportToText, exportToText, exportToText, exportToXML, exportToXML, filterData, find, find, findNext, fireDataChanged, firePropertyChange, firstRecord, getColumnCount, getColumnIndex, getColumnNames, getColumnsArray, getColumnSeparator, getColumnsWidth, getColumnTag, getColumnType, getComputable, getCurrentIndex, getCurrentRecord, getData, getDataAt, getDataAt, getDataCount, getDataProvider, getDeletedCount, getFetchSize, getFilterCriteria, getFilteredCount, getLicenseKey, getModifiedCount, getRootTag, getRowSeparator, getRowTag, getSkippedRows, getSortColumns, getSortCriteria, getTextQualifier, insertDataAt, isAppendDataOnFetchNext, isColumnsDelimited, isFilterState, isFirstRowAsColumnNames, isSaveOnlyFilteredData, lastRecord, modifyDataAt, nextRecord, parseInt, previousRecord, refreshData, removeAll, removeAt, removeDataListener, removePropertyChangeListener, removeRange, rollbackModifications, saveModifications, scrollToRow, setAppendDataOnFetchNext, setColumnsDelimited, setColumnSeparator, setColumnsWidth, setColumnTag, setData, setDataArray, setDataProvider, setFetchSize, setFilterCriteria, setFilterState, setFirstRowAsColumnNames, setLicenseKey, setRootTag, setRowSeparator, setRowTag, setSaveOnlyFilteredData, setSkippedRows, setSortCriteria, setTextQualifier, sortData, sortData, sortData, sortData, sortData, sortData, sortData, sortData, sortData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ROW_SEPARATOR

public static java.lang.String DEFAULT_ROW_SEPARATOR
Specifies the newline character as a default row separator


DEFAULT_COLUMN_SEPARATOR

public static java.lang.String DEFAULT_COLUMN_SEPARATOR
Specifies the comma as a default column separator


DEFAULT_TEXT_QUALIFIER

public static java.lang.String DEFAULT_TEXT_QUALIFIER
Specifies the empty string as default text qualifier


forInput

protected transient boolean forInput
Specifies the text file operation as input or output


in

protected transient java.io.InputStream in
Specifies the input stream of the text file


out

protected transient java.io.OutputStream out
Specifies the output stream of the text file

Constructor Detail

TextDataProvider

public TextDataProvider()
Method Detail

setURLConnectionEnabled

public void setURLConnectionEnabled(boolean b)
Sets the enability to connect through URL

Parameters:
b - true to enable the URL connection

isURLConnectionEnabled

public boolean isURLConnectionEnabled()
Gets the enability to connect through URL

Returns:
true if URL connection can be opened, otherwise false

setFile

public void setFile(java.lang.String path)
Sets the path of the text file. It is applicable, if the url connection is disabled

Parameters:
path - the path of the text file

getFile

public java.lang.String getFile()
Gets the path of the text file.

Returns:
the path of the text file

setURL

public void setURL(java.lang.String url)
Sets the URL of the text file. It is applicable, if the url connection is enabled

Parameters:
url - the URL of the text file

getURL

public java.lang.String getURL()
Gets the URL of the text file.

Returns:
the URL of the text file

open

public boolean open(boolean input)
Opens input stream or output stream of the text file

Parameters:
input - true to open the input stream, false to open the output stream
Returns:
true if the connection is successfully opened, otherwise false

close

public boolean close()
Closes input / output stream of the text file

Returns:
true if the connection is successfully closed, otherwise false

setSkippedColumns

public void setSkippedColumns(java.lang.String skipColumns)
Sets the column indexes to be skipped

Parameters:
skipColumns - the string contains comma separated column indexes

getSkippedColumns

public java.lang.String getSkippedColumns()
Gets the column indexes to be skipped

Returns:
the string contains comma separated column indexes

retrieveData

public boolean retrieveData(java.io.InputStream is)
Retrieves the data from given input stream.

Parameters:
is - the input stream from which to retrieve the data.

saveData

public boolean saveData(java.io.OutputStream os)
Saves the data to given output stream.

Parameters:
os - the output stream to save the data to.

retrieve

public void retrieve()
Retrives the data


save

public void save()
Saves the transaction


nextData

public boolean nextData()
If more data can be fetched, it fetches and return true, otherwise return false

Returns:
true, if the data has been fetched, otherwise false

isFetchNext

public boolean isFetchNext()
Determines whether fetching the next rows or not

Returns:
true if fetching the next rows

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Externalizable interface implementation to save and retrieve the state of this bean

Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class AbstractDataProvider
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class AbstractDataProvider
Throws:
java.io.IOException
java.lang.ClassNotFoundException

ElegantJ Data Tables Java API Specification v1.1

Submit a bug or feature

Copyright(c)
Elegant Microweb Technologies Pvt. Ltd.
www.elegantmicroweb.com
www.elegantjbeans.com
All Rights Reserved.