Skip navigation links


com.essbase.eas.utils
Class RandomAccessFileTableModel

java.lang.Object
  extended by com.essbase.eas.utils.RandomAccessFileTableModel

All Implemented Interfaces:
javax.swing.table.TableModel
Direct Known Subclasses:
ScriptingResultListModel

public class RandomAccessFileTableModel
extends java.lang.Object
implements javax.swing.table.TableModel

Title: RandomAccessResultSetFile Description: Copyright: Copyright (c) 2003 Company: Hyperion Solutions, Inc.

Version:
1.0
Author:
Sree Menon

Field Summary
static short DATE
           
static short DOUBLE
           
static short FLOAT
           
static short INTEGER
           
static short LONG
           
static short SHORT
           
static short STRING
           
static short TIMESTAMP
           

 

Constructor Summary
RandomAccessFileTableModel()
          Empty constructor
RandomAccessFileTableModel(java.io.File file)
          Constructor with the source or output file

 

Method Summary
 void addTableModelListener(javax.swing.event.TableModelListener l)
           
 void buildColumns(java.sql.ResultSet rs)
          Builds column information from a SqlResultRest.
 void close()
           
 void createFile()
          creates the random access file
 void deleteFile()
           
 void dispose()
           
 java.lang.Class getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int columnIndex)
           
 java.io.File getFile()
           
 java.io.RandomAccessFile getRAFFile()
           
 int getRowCount()
           
 java.lang.Object[] getRowData(int rowIndex, java.lang.Object[] data)
           
 long getRowOffset(int row)
           
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 int getVersion()
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean readFromFile()
          Reads the file
 void removeTableModelListener(javax.swing.event.TableModelListener l)
           
 void setColumnCount(int count)
          Sets the column count
 void setColumnNames(java.lang.String[] names)
          Sets the columns names
 void setColumnTypes(int[] types)
          Sets the column types.
 void setDeleteOnExit(boolean delete)
           
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 void setVersion(int version)
           
 void startNewRow()
          Starts a new row for writing
 void writeColumns()
          Writes the column information
 void writeColumns(int cols, java.lang.String[] names, int[] types)
           
 void writeColumns(java.lang.String[] names)
           
 void writeColumns(java.lang.String[] names, int[] types)
           
 void writeData(java.sql.ResultSet rs)
          Writes row data from the result set
 void writeEmptyFile()
           
 void writeHeader()
          Writes the header information to the file
 void writeOffsets()
          Writes the row offsets to teh file
 void writeRow(java.lang.Object[] values)
          Writes a row information to the file
 void writeRowColumn(java.sql.Date value)
           
 void writeRowColumn(java.util.Date value)
           
 void writeRowColumn(double value)
           
 void writeRowColumn(float value)
           
 void writeRowColumn(int value)
           
 void writeRowColumn(int col, java.lang.Object value)
          Writes a row column
 void writeRowColumn(long value)
           
 void writeRowColumn(short value)
           
 void writeRowColumn(java.sql.Timestamp value)
           
 void writeRowCount()
          Writes the row count to the file
 boolean writeToFile(java.sql.ResultSet rs)
          Writes a result set to a file

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

SHORT

public static final short SHORT
See Also:
Constant Field Values

INTEGER

public static final short INTEGER
See Also:
Constant Field Values

LONG

public static final short LONG
See Also:
Constant Field Values

FLOAT

public static final short FLOAT
See Also:
Constant Field Values

DOUBLE

public static final short DOUBLE
See Also:
Constant Field Values

DATE

public static final short DATE
See Also:
Constant Field Values

TIMESTAMP

public static final short TIMESTAMP
See Also:
Constant Field Values

STRING

public static final short STRING
See Also:
Constant Field Values

Constructor Detail

RandomAccessFileTableModel

public RandomAccessFileTableModel()
Empty constructor

RandomAccessFileTableModel

public RandomAccessFileTableModel(java.io.File file)
Constructor with the source or output file
Parameters:
file - file

Method Detail

readFromFile

public boolean readFromFile()
                     throws java.io.IOException
Reads the file
Returns:
true if success
Throws:
java.io.IOException

writeEmptyFile

public void writeEmptyFile()
                    throws java.io.IOException
Throws:
java.io.IOException

createFile

public void createFile()
                throws java.io.IOException
creates the random access file
Throws:
java.io.IOException

writeHeader

public void writeHeader()
                 throws java.io.IOException
Writes the header information to the file
Throws:
java.io.IOException

writeColumns

public void writeColumns()
                  throws java.io.IOException
Writes the column information
Throws:
java.io.IOException

writeColumns

public void writeColumns(java.lang.String[] names)
                  throws java.io.IOException
Throws:
java.io.IOException

writeColumns

public void writeColumns(java.lang.String[] names,
                         int[] types)
                  throws java.io.IOException
Throws:
java.io.IOException

writeColumns

public void writeColumns(int cols,
                         java.lang.String[] names,
                         int[] types)
                  throws java.io.IOException
Throws:
java.io.IOException

setColumnCount

public void setColumnCount(int count)
Sets the column count
Parameters:
count - number of columns

setColumnNames

public void setColumnNames(java.lang.String[] names)
Sets the columns names
Parameters:
names - column names

setColumnTypes

public void setColumnTypes(int[] types)
Sets the column types. It has to the predefined ones at the top of the file
Parameters:
types - column types

buildColumns

public void buildColumns(java.sql.ResultSet rs)
                  throws java.sql.SQLException
Builds column information from a SqlResultRest.
Parameters:
rs - result set
Throws:
java.sql.SQLException

writeData

public void writeData(java.sql.ResultSet rs)
               throws java.sql.SQLException,
                      java.io.IOException
Writes row data from the result set
Parameters:
rs - result set
Throws:
java.sql.SQLException
java.io.IOException

startNewRow

public void startNewRow()
                 throws java.io.IOException
Starts a new row for writing
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(int col,
                           java.lang.Object value)
                    throws java.io.IOException
Writes a row column
Parameters:
col - column
value - value to be written
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(long value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(short value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(int value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(float value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(double value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(java.sql.Date value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(java.util.Date value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRowColumn

public void writeRowColumn(java.sql.Timestamp value)
                    throws java.io.IOException
Throws:
java.io.IOException

writeRow

public void writeRow(java.lang.Object[] values)
              throws java.io.IOException
Writes a row information to the file
Parameters:
values - the column values for the row. It has to be of the same format defined by the column types.
Throws:
java.io.IOException

writeOffsets

public void writeOffsets()
                  throws java.io.IOException
Writes the row offsets to teh file
Throws:
java.io.IOException

writeRowCount

public void writeRowCount()
                   throws java.io.IOException
Writes the row count to the file
Throws:
java.io.IOException

writeToFile

public boolean writeToFile(java.sql.ResultSet rs)
Writes a result set to a file
Parameters:
rs - resultset
Returns:
true if success

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableModel

getFile

public java.io.File getFile()

deleteFile

public void deleteFile()
                throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

getColumnName

public java.lang.String getColumnName(int columnIndex)
Specified by:
getColumnName in interface javax.swing.table.TableModel

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface javax.swing.table.TableModel

getRowData

public java.lang.Object[] getRowData(int rowIndex,
                                     java.lang.Object[] data)

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Specified by:
getValueAt in interface javax.swing.table.TableModel

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener l)
Specified by:
addTableModelListener in interface javax.swing.table.TableModel

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener l)
Specified by:
removeTableModelListener in interface javax.swing.table.TableModel

getVersion

public int getVersion()

setVersion

public void setVersion(int version)

getRowOffset

public long getRowOffset(int row)

setDeleteOnExit

public void setDeleteOnExit(boolean delete)

getRAFFile

public java.io.RandomAccessFile getRAFFile()

dispose

public void dispose()

Skip navigation links


Copyright © 2001, 2012, Oracle. All rights reserved.