Java Doc for DataTable.java in  » Database-DBMS » mckoi » com » mckoi » database » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » mckoi » com.mckoi.database 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.mckoi.database.Table
      com.mckoi.database.AbstractDataTable
         com.mckoi.database.DefaultDataTable
            com.mckoi.database.DataTable

DataTable
final public class DataTable extends DefaultDataTable (Code)
DataTable is a wrapper for a MutableTableDataSource that fits into the query hierarchy level. A DataTable represents a table within a transaction. Adding, removing rows to a DataTable will change the contents only with the context of the transaction the table was created in.


author:
   Tobias Downer



Field Summary
final static  booleanLOCK_DEBUG
     ------ NOTE: Following values are only kept for lock debugging reasons.

Constructor Summary
 DataTable(DatabaseConnection connection, MutableTableDataSource data_source)
     Cosntructs the data table.

Method Summary
final public  DebugLoggerDebug()
     Convenience - used to log debug messages.
final public  voidadd(RowData row_data)
     Adds a given 'RowData' object to the table.
final public  voidadd(RowData[] row_data_arr)
     Adds an array of 'RowData' objects to the table.
public  voidaddDataTableListener(DataTableListener listener)
     Adds a DataTableListener to the DataTable objects at the root of this table tree hierarchy.
protected  voidblankSelectableSchemes(int type)
     Overwritten from DefaultDataTable to do nothing.
final public  RowDatacreateRowDataObject(QueryContext context)
     Generates an empty RowData object for 'addRow'ing into the Table.
public  ReferenceTabledeclareAs(TableName new_name)
     We can declare a DataTable as a new type.
public  intdelete(Table table, int limit)
     This is the public method for removing a given result set from this table.
public  intdelete(Table table)
    
public  intfindFieldName(Variable v)
    
public  TObjectgetCellContents(int column, int row)
     Returns an object that represents the information in the given cell in the table.
public  intgetColumnCount()
    
public  DataTableDefgetDataTableDef()
     Returns the DataTableDef object for this table.
public  VariablegetResolvedVariable(int column)
    
protected  SelectableSchemegetRootColumnScheme(int column)
     Returns the SelectableScheme for the given column. (Overridden from DefaultDataTable).
public  intgetRowCount()
     Returns the current row count.
public  StringgetSchema()
     Returns the schema that this table is within.
 SelectableSchemegetSelectableSchemeFor(int column, int original_column, Table table)
    
public  booleanhasRootsLocked()
     Returns true if the table has its row roots locked (via the lockRoot(int) method.
public  voidlockRoot(int lock_key)
     Locks the root table(s) of this table so that it is impossible to overwrite the underlying rows that may appear in this table. This is used when cells in the table need to be accessed 'outside' the lock.
final  voidnotifyAddRWLock(int lock_type)
     This is called by the 'Lock' class to notify this DataTable that a read/ write lock has been applied to this table.
final  voidnotifyReleaseRWLock(int lock_type)
     This is called by the 'Lock' class to notify this DataTable that a read/ write lock has been released from this table.
public  voidremoveDataTableListener(DataTableListener listener)
     Removes a DataTableListener from the DataTable objects at the root of this table tree hierarchy.
 RawTableInformationresolveToRawTable(RawTableInformation info)
    
public  RowEnumerationrowEnumeration()
     Returns an Enumeration of the rows in this table.
 voidsetToRowTableDomain(int column, IntegerVector row_set, TableDataSource ancestor)
     Given a set, this trickles down through the Table hierarchy resolving the given row_set to a form that the given ancestor understands.
public  voidunlockRoot(int lock_key)
     Unlocks the root tables so that the underlying rows may once again be used if they are not locked and have been removed.
final public  intupdate(QueryContext context, Table table, Assignment[] assign_list, int limit)
     Updates the table by applying the assignment operations over each row that is found in the input 'table' set.

Field Detail
LOCK_DEBUG
final static boolean LOCK_DEBUG(Code)
------ NOTE: Following values are only kept for lock debugging reasons. These is no technical reason why they shouldn't be removed. They allow us to check that a data table is locked correctly when accesses are performed on it. ------




Constructor Detail
DataTable
DataTable(DatabaseConnection connection, MutableTableDataSource data_source) throws DatabaseException(Code)
Cosntructs the data table.




Method Detail
Debug
final public DebugLogger Debug()(Code)
Convenience - used to log debug messages.



add
final public void add(RowData row_data) throws DatabaseException(Code)
Adds a given 'RowData' object to the table. This should be used for any rows added to the table. The order that rows are added into a table is not important.

This method performs some checking of the cells in the table. It first checks that all columns declared as 'not null' have a value that is not null. It then checks that a the added row will not cause any duplicates in a column declared as unique.

It then uses the low level io manager to store the data.

SYNCHRONIZATION ISSUE: We are assuming this is running in a synchronized environment that is unable to add or alter rows in this object within the lifetime of this method.




add
final public void add(RowData[] row_data_arr) throws DatabaseException(Code)
Adds an array of 'RowData' objects to the table. This should be used for adding a group of rows to the table. The order that rows are added into a table is not important.

This method performs some checking of the cells in the table. It first checks that all columns declared as 'not null' have a value that is not null. It then checks that a the added row will not cause any duplicates in a column declared as unique.

It then uses the low level io manager to store the data.

SYNCHRONIZATION ISSUE: We are assuming this is running in a synchronized environment that is unable to add or alter rows in this object within the lifetime of this method.




addDataTableListener
public void addDataTableListener(DataTableListener listener)(Code)
Adds a DataTableListener to the DataTable objects at the root of this table tree hierarchy. If this table represents the join of a number of tables then the DataTableListener is added to all the DataTable objects at the root.

A DataTableListener is notified of all modifications to the raw entries of the table. This listener can be used for detecting changes in VIEWs, for triggers or for caching of common queries.




blankSelectableSchemes
protected void blankSelectableSchemes(int type)(Code)
Overwritten from DefaultDataTable to do nothing. All selectable schemes are handled within the DataTableManager now.



createRowDataObject
final public RowData createRowDataObject(QueryContext context)(Code)
Generates an empty RowData object for 'addRow'ing into the Table. We must first call this method to retrieve a blank RowData object, fill it in with the required information, and then call 'addRow'



declareAs
public ReferenceTable declareAs(TableName new_name)(Code)
We can declare a DataTable as a new type. This means, instead of referencing a column as 'Customer.CustomerID' we can change the 'Customer' part to anything we wish such as 'C1'.



delete
public int delete(Table table, int limit) throws DatabaseException(Code)
This is the public method for removing a given result set from this table. Given a Table object, this will remove from this table any row that are in the given table. The given Table must have this object as its distant ancestor. If it does not then it will throw an exception. Examples: table.delete(table) -- delete the entire table. table.delete(table.select( < some condition > )); It returns the number of rows that were deleted.

INTERNAL NOTE: The 'table' parameter may be the result of joins. This may cause the same row in this table to be referenced more than once. We must make sure that we delete any given row only once by using the 'distinct' function.

'limit' dictates how many rows will be deleted. If 'limit' is less than 0 then this indicates there is no limit. Keep in mind that rows are picked out from top to bottom in the 'table' object. Normally the input table will be the result of an un-ordered 'where' clause so using a limit does not permit deletes in a deterministic manner.

ASSUMPTION: There are no duplicate rows in the input set.




delete
public int delete(Table table) throws DatabaseException(Code)



findFieldName
public int findFieldName(Variable v)(Code)



getCellContents
public TObject getCellContents(int column, int row)(Code)
Returns an object that represents the information in the given cell in the table. This can be used to obtain information about the given table cells.



getColumnCount
public int getColumnCount()(Code)



getDataTableDef
public DataTableDef getDataTableDef()(Code)
Returns the DataTableDef object for this table. This object describes how the table is made up.

NOTE: Do not keep references to this object. The DataTableDef is invalidated when a table is closed.




getResolvedVariable
public Variable getResolvedVariable(int column)(Code)



getRootColumnScheme
protected SelectableScheme getRootColumnScheme(int column)(Code)
Returns the SelectableScheme for the given column. (Overridden from DefaultDataTable). If the schemes are not in memory then they are loaded now. This will synchronize over the 'table_manager' which will effectively block this table at the lowest layer until the indices are loaded into memory.



getRowCount
public int getRowCount()(Code)
Returns the current row count. This queries the DataTableManager for the real value.



getSchema
public String getSchema()(Code)
Returns the schema that this table is within.



getSelectableSchemeFor
SelectableScheme getSelectableSchemeFor(int column, int original_column, Table table)(Code)



hasRootsLocked
public boolean hasRootsLocked()(Code)
Returns true if the table has its row roots locked (via the lockRoot(int) method.



lockRoot
public void lockRoot(int lock_key)(Code)
Locks the root table(s) of this table so that it is impossible to overwrite the underlying rows that may appear in this table. This is used when cells in the table need to be accessed 'outside' the lock. So we may have late access to cells in the table. 'lock_key' is a given key that will also unlock the root table(s).

NOTE: This is nothing to do with the 'LockingMechanism' object.




notifyAddRWLock
final void notifyAddRWLock(int lock_type)(Code)
This is called by the 'Lock' class to notify this DataTable that a read/ write lock has been applied to this table. This is for lock debugging purposes only.



notifyReleaseRWLock
final void notifyReleaseRWLock(int lock_type)(Code)
This is called by the 'Lock' class to notify this DataTable that a read/ write lock has been released from this table. This is for lock debugging purposes only.



removeDataTableListener
public void removeDataTableListener(DataTableListener listener)(Code)
Removes a DataTableListener from the DataTable objects at the root of this table tree hierarchy. If this table represents the join of a number of tables, then the DataTableListener is removed from all the DataTable objects at the root.



resolveToRawTable
RawTableInformation resolveToRawTable(RawTableInformation info)(Code)



rowEnumeration
public RowEnumeration rowEnumeration()(Code)
Returns an Enumeration of the rows in this table. Each call to 'nextRowIndex' returns the next valid row index in the table.



setToRowTableDomain
void setToRowTableDomain(int column, IntegerVector row_set, TableDataSource ancestor)(Code)
Given a set, this trickles down through the Table hierarchy resolving the given row_set to a form that the given ancestor understands. Say you give the set { 0, 1, 2, 3, 4, 5, 6 }, this function may check down three levels and return a new 7 element set with the rows fully resolved to the given ancestors domain.



unlockRoot
public void unlockRoot(int lock_key)(Code)
Unlocks the root tables so that the underlying rows may once again be used if they are not locked and have been removed. This should be called some time after the rows have been locked.



update
final public int update(QueryContext context, Table table, Assignment[] assign_list, int limit) throws DatabaseException(Code)
Updates the table by applying the assignment operations over each row that is found in the input 'table' set. The input table must be a direct child of this DataTable.

This operation assumes that there is a WRITE lock on this table. A WRITE lock means no other thread may access this table while the operation is being performed. (However, a result set may still be downloading from this table).

'limit' dictates how many rows will be updated. If 'limit' is less than 0 then this indicates there is no limit. Keep in mind that rows are picked out from top to bottom in the 'table' object. Normally the input table will be the result of an un-ordered 'where' clause so using a limit does not permit updates in a deterministic manner.

Returns the number of rows updated in this table.

NOTE: We assume there are no duplicate rows to the root set from the given 'table'.




Fields inherited from com.mckoi.database.DefaultDataTable
protected int row_count(Code)(Java Doc)

Methods inherited from com.mckoi.database.DefaultDataTable
void addCellToColumnSchemes(int row_number, int column_number)(Code)(Java Doc)
void addRowToColumnSchemes(int row_number)(Code)(Java Doc)
protected void blankSelectableSchemes()(Code)(Java Doc)
protected void blankSelectableSchemes(int type)(Code)(Java Doc)
protected void clearColumnScheme(int column)(Code)(Java Doc)
public int findFieldName(Variable v)(Code)(Java Doc)
public int getColumnCount()(Code)(Java Doc)
public Database getDatabase()(Code)(Java Doc)
public Variable getResolvedVariable(int column)(Code)(Java Doc)
protected SelectableScheme getRootColumnScheme(int column)(Code)(Java Doc)
public int getRowCount()(Code)(Java Doc)
SelectableScheme getSelectableSchemeFor(int column, int original_column, Table table)(Code)(Java Doc)
void removeRowToColumnSchemes(int row_number)(Code)(Java Doc)
RawTableInformation resolveToRawTable(RawTableInformation info)(Code)(Java Doc)
void setToRowTableDomain(int column, IntegerVector row_set, TableDataSource ancestor)(Code)(Java Doc)

Methods inherited from com.mckoi.database.AbstractDataTable
public TableName getTableName()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public boolean typeEquals(RootTable table)(Code)(Java Doc)

Fields inherited from com.mckoi.database.Table
protected static boolean DEBUG_QUERY(Code)(Java Doc)

Methods inherited from com.mckoi.database.Table
public DebugLogger Debug()(Code)(Java Doc)
abstract void addDataTableListener(DataTableListener listener)(Code)(Java Doc)
public Table all(QueryContext context, Expression lhs, Operator op, Table table)(Code)(Java Doc)
final public boolean allColumnMatchesValue(int column, Operator op, TObject ob)(Code)(Java Doc)
final IntegerVector allRowsIn(int column, Table table)(Code)(Java Doc)
final IntegerVector allRowsNotIn(int column, Table table)(Code)(Java Doc)
public Table any(QueryContext context, Expression lhs, Operator op, Table right_table)(Code)(Java Doc)
final public boolean columnContainsCell(int column, TObject cell)(Code)(Java Doc)
final public boolean columnContainsValue(int column, TObject ob)(Code)(Java Doc)
final public boolean columnMatchesValue(int column, Operator op, TObject ob)(Code)(Java Doc)
final public Table columnMerge(Table table)(Code)(Java Doc)
public static boolean compareCells(TObject ob1, TObject ob2, Operator op)(Code)(Java Doc)
final public VirtualTable distinct()(Code)(Java Doc)
final public Table distinct(int[] col_map)(Code)(Java Doc)
final public void dumpTo(PrintStream out) throws IOException(Code)(Java Doc)
final public Table emptySelect()(Code)(Java Doc)
final public Table exhaustiveSelect(QueryContext context, Expression exp)(Code)(Java Doc)
final public int fastFindFieldName(Variable col)(Code)(Java Doc)
abstract public int findFieldName(Variable v)(Code)(Java Doc)
abstract public TObject getCellContents(int column, int row)(Code)(Java Doc)
abstract public int getColumnCount()(Code)(Java Doc)
public DataTableColumnDef getColumnDefAt(int col_index)(Code)(Java Doc)
public SelectableScheme getColumnScheme(int column)(Code)(Java Doc)
abstract public DataTableDef getDataTableDef()(Code)(Java Doc)
abstract public Database getDatabase()(Code)(Java Doc)
final public TObject getFirstCellContent(int column)(Code)(Java Doc)
final public TObject[] getFirstCellContent(int[] col_map)(Code)(Java Doc)
final public TObject getLastCellContent(int column)(Code)(Java Doc)
final public TObject[] getLastCellContent(int[] col_map)(Code)(Java Doc)
abstract public Variable getResolvedVariable(int column)(Code)(Java Doc)
abstract public int getRowCount()(Code)(Java Doc)
abstract SelectableScheme getSelectableSchemeFor(int column, int original_column, Table table)(Code)(Java Doc)
final public TObject getSingleCellContent(int column)(Code)(Java Doc)
final public TObject[] getSingleCellContent(int[] col_map)(Code)(Java Doc)
final public TransactionSystem getSystem()(Code)(Java Doc)
public TType getTTypeForColumn(int column)(Code)(Java Doc)
public TType getTTypeForColumn(Variable v)(Code)(Java Doc)
final public TableAccessState getTableAccessState()(Code)(Java Doc)
final TableVariableResolver getVariableResolver()(Code)(Java Doc)
abstract public boolean hasRootsLocked()(Code)(Java Doc)
final public Table join(Table table)(Code)(Java Doc)
abstract public void lockRoot(int lock_key)(Code)(Java Doc)
final public VirtualTable orderByColumn(int col_index, boolean ascending)(Code)(Java Doc)
final public VirtualTable orderByColumn(Variable column, boolean ascending)(Code)(Java Doc)
final public VirtualTable orderByColumn(Variable column)(Code)(Java Doc)
final public Table orderByColumns(int[] col_map)(Code)(Java Doc)
final public IntegerVector orderedRowList(int[] col_map)(Code)(Java Doc)
final public VirtualTable outside(Table rtable)(Code)(Java Doc)
public void printGraph(PrintStream out, int indent)(Code)(Java Doc)
final public Table rangeSelect(Variable col_var, SelectableRange[] ranges)(Code)(Java Doc)
abstract void removeDataTableListener(DataTableListener listener)(Code)(Java Doc)
abstract RawTableInformation resolveToRawTable(RawTableInformation info)(Code)(Java Doc)
abstract public RowEnumeration rowEnumeration()(Code)(Java Doc)
final public IntegerVector selectAll(int column)(Code)(Java Doc)
final public IntegerVector selectAll()(Code)(Java Doc)
final public IntegerVector selectFirst(int column)(Code)(Java Doc)
final IntegerVector selectFromPattern(int column, Operator op, TObject ob)(Code)(Java Doc)
final IntegerVector selectFromRegex(int column, Operator op, TObject ob)(Code)(Java Doc)
final public IntegerVector selectLast(int column)(Code)(Java Doc)
final public IntegerVector selectRange(int column, SelectableRange[] ranges)(Code)(Java Doc)
final public IntegerVector selectRest(int column)(Code)(Java Doc)
final IntegerVector selectRows(int[] cols, Operator op, TObject[] cells)(Code)(Java Doc)
final IntegerVector selectRows(int column, Operator op, TObject cell)(Code)(Java Doc)
IntegerVector selectRows(int column, TObject min_cell, TObject max_cell)(Code)(Java Doc)
abstract void setToRowTableDomain(int column, IntegerVector row_set, TableDataSource ancestor)(Code)(Java Doc)
final public Table simpleJoin(QueryContext context, Table table, Variable lhs_var, Operator op, Expression rhs)(Code)(Java Doc)
final public Table simpleSelect(QueryContext context, Variable lhs_var, Operator op, Expression rhs)(Code)(Java Doc)
final public Table singleRowSelect(int row_index)(Code)(Java Doc)
public Map toMap()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public Table union(Table table)(Code)(Java Doc)
abstract public void unlockRoot(int lock_key)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.