Java Doc for BTree.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » access » btree » 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 » db derby 10.2 » org.apache.derby.impl.store.access.btree 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.derby.impl.store.access.conglomerate.GenericConglomerate
   org.apache.derby.impl.store.access.btree.BTree

All known Subclasses:   org.apache.derby.impl.store.access.btree.index.B2I,
BTree
abstract public class BTree extends GenericConglomerate (Code)
A b-tree object corresponds to an instance of a b-tree conglomerate. It contains the static information about a conglomerate which is built at create conglomerate time.

This generic implementation is expected to be extended by the concreate implementations.

The fields are set when the conglomerate is created and never changed thereafter. When alter table is supported then it will change under the control of a table level lock.

They have package scope because they're read by the scans and controllers.

A table of all conglomerates in the system is maintained by the accessmanager. A cache of conglomerates is maintained in the accessmanager, and references to the read only objects are handed out. A copy of the Conglomerate object is kept in the control row of the root page, so that during logical undo this information can be read without needing to access the possibly corrupt table maintained by the access manager.



Field Summary
final public static  StringPROPERTY_ALLOWDUPLICATES
    
final public static  StringPROPERTY_MAX_ROWS_PER_PAGE_PARAMETER
     Property name for the maximum number of rows to place in a btree page (leaf or branch).
final public static  StringPROPERTY_NKEYFIELDS
    
final public static  StringPROPERTY_NUNIQUECOLUMNS
    
final public static  StringPROPERTY_PARENTLINKS
    
final public static  longROOTPAGEID
     The page number of the root page is always at the fixed page number: ROOTPAGEID.
 booleanallowDuplicates
     Whether the index allows duplicates or not.
protected  boolean[]ascDescInfo
    
protected  intconglom_format_id
     Format id of the conglomerate.
 int[]format_ids
     The array of format id's, one for each column in the template.
protected  ContainerKeyid
     The id of the container in which this b-tree is stored.
 booleanmaintainParentLinks
     Whether the parent should maintain links from child pages to their parent. These links are only used for consistency checking purposes.
static  intmaxRowsPerPage
     Maximum rows per page to place on a btree leaf or nonleaf page.
protected  intnKeyFields
     The number of key fields.
 intnUniqueColumns
     The number of uniqueness columns.


Method Summary
public  voidaddColumn(TransactionManager xact_manager, int column_id, Storable template_column)
     Add a column to the conglomerate.

Currently B2I does not support this operation. input template column.

public  voidcreate(Transaction rawtran, int segmentId, long input_containerid, DataValueDescriptor[] template, Properties properties, int conglom_format_id, int tmpFlag)
     Do the generic part of creating a b-tree conglomerate.
final  DataValueDescriptor[]createBranchTemplate(DataValueDescriptor page_ptr)
     Create a branch row template for this conglomerate.

Reads the format id's of each of the columns and manufactures object of the given type for each.

final public  DataValueDescriptor[]createTemplate()
     Create a template for this conglomerate.

Reads the format id's of each of the columns and manufactures object of the given type for each.

abstract public  voiddrop(TransactionManager xact_manager)
     Drop this btree.
abstract protected  BTreeLockingPolicygetBtreeLockingPolicy(Transaction rawtran, int lock_level, int mode, int isolation_level, ConglomerateController base_cc, OpenBTree open_btree)
     Create a new btree locking policy from scratch.
public  longgetContainerid()
    
public  DynamicCompiledOpenConglomInfogetDynamicCompiledConglomInfo(long conglomId)
     Return dynamic information about the conglomerate to be dynamically reused in repeated execution of a statement.

The dynamic info is a set of variables to be used in a given ScanController or ConglomerateController.

final public  ContainerKeygetId()
     Get the id of the container of the conglomerate.

Will have to change when a conglomerate could have more than one container.

public  booleanisNull()
     Return whether the value is null or not.
public  booleanisTemporary()
    
final public  booleanisUnique()
    
abstract public  longload(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource)
     Load a b-tree.
abstract public  ConglomerateControllerlockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level)
     Lock the base table.
abstract public  ConglomerateControlleropen(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info)
     Open a b-tree controller.
public  voidreadExternal(ObjectInput in)
     Restore the in-memory representation from the stream.
public  voidreadExternalFromArray(ArrayInputStream in)
    
public  voidrestoreToNull()
     Restore the in-memory representation to the null value.
public  StringtoString()
    
public  voidwriteExternal(ObjectOutput out)
     Store the stored representation of the column value in the stream.

Field Detail
PROPERTY_ALLOWDUPLICATES
final public static String PROPERTY_ALLOWDUPLICATES(Code)



PROPERTY_MAX_ROWS_PER_PAGE_PARAMETER
final public static String PROPERTY_MAX_ROWS_PER_PAGE_PARAMETER(Code)
Property name for the maximum number of rows to place in a btree page (leaf or branch). Equal to 'derby.access.btreeMaxRowPerPage'. Used by tests and debugging to exactly control split points, and to make it easier to test tall trees without needing lots of data.



PROPERTY_NKEYFIELDS
final public static String PROPERTY_NKEYFIELDS(Code)



PROPERTY_NUNIQUECOLUMNS
final public static String PROPERTY_NUNIQUECOLUMNS(Code)



PROPERTY_PARENTLINKS
final public static String PROPERTY_PARENTLINKS(Code)



ROOTPAGEID
final public static long ROOTPAGEID(Code)
The page number of the root page is always at the fixed page number: ROOTPAGEID. This means that given an open container, during logical undo one can always find the root page and look up the conglomerate information.



allowDuplicates
boolean allowDuplicates(Code)
Whether the index allows duplicates or not.



ascDescInfo
protected boolean[] ascDescInfo(Code)



conglom_format_id
protected int conglom_format_id(Code)
Format id of the conglomerate.



format_ids
int[] format_ids(Code)
The array of format id's, one for each column in the template.



id
protected ContainerKey id(Code)
The id of the container in which this b-tree is stored.



maintainParentLinks
boolean maintainParentLinks(Code)
Whether the parent should maintain links from child pages to their parent. These links are only used for consistency checking purposes. They improve consistency checking at the cost of run-time efficiency.



maxRowsPerPage
static int maxRowsPerPage(Code)
Maximum rows per page to place on a btree leaf or nonleaf page. Used by testing to finely control split points. Only changed for debugging purposes. RESOLVE (mikem) - this should not be static. Need to design a way in debugging mode to get btree created with a persistent "maxRowsPerPage". This hack makes all btrees get created with the "last" maxRowsPerPage value set.



nKeyFields
protected int nKeyFields(Code)
The number of key fields.



nUniqueColumns
int nUniqueColumns(Code)
The number of uniqueness columns. These are the columns that are considered for the purpose of detecting duplicate keys and rows.





Method Detail
addColumn
public void addColumn(TransactionManager xact_manager, int column_id, Storable template_column) throws StandardException(Code)
Add a column to the conglomerate.

Currently B2I does not support this operation. input template column.
Parameters:
  xact_manager - Transaction to associate the lock with.
Parameters:
  column_id - The column number to add this column at.
Parameters:
  template_column - An instance of the column to be added to table.
exception:
  StandardException - Standard exception policy.




create
public void create(Transaction rawtran, int segmentId, long input_containerid, DataValueDescriptor[] template, Properties properties, int conglom_format_id, int tmpFlag) throws StandardException(Code)
Do the generic part of creating a b-tree conglomerate. This method is called from the concrete subclass (which may also read some properties).

This method processes all properties which are generic to all BTree's. It creates the container for the btree.

The following properties are generic to a b-tree conglomerate. :

  • "allowDuplicates" (boolean). If set to true the table will allow rows which are duplicate in key column's 0 through (nUniqueColumns - 1). Currently only supports "false". This property is optional, defaults to false.
  • "nKeyFields" (integer) Columns 0 through (nKeyFields - 1) will be included in key of the conglomerate. This implementation requires that "nKeyFields" must be the same as the number of fields in the conglomerate, including the rowLocationColumn. Other implementations may relax this restriction to allow non-key fields in the index. This property is required.
  • "nUniqueColumns" (integer) Columns 0 through "nUniqueColumns" will be used to check for uniqueness. So for a standard SQL non-unique index implementation set "nUniqueColumns" to the same value as "nKeyFields"; and for a unique index set "nUniqueColumns" to "nKeyFields" - 1 (ie. don't include the rowLocationColumn in the uniqueness check). This property is required.
  • "maintainParentLinks" (boolean) Whether the b-tree pages maintain the page number of their parent. Only used for consistency checking. It takes a certain amount more effort to maintain these links, but they're really handy for ensuring that the index is consistent. This property is optional, defaults to true.

exception:
  StandardException - Thrown by underlying raw store, or thrown bythis routine on an invalid containerid.



createBranchTemplate
final DataValueDescriptor[] createBranchTemplate(DataValueDescriptor page_ptr) throws StandardException(Code)
Create a branch row template for this conglomerate.

Reads the format id's of each of the columns and manufactures object of the given type for each. It then uses these "empty" objects to create a template row. The object passed in is then added to the last column of the row. The new template.
exception:
  StandardException - Standard exception policy.




createTemplate
final public DataValueDescriptor[] createTemplate() throws StandardException(Code)
Create a template for this conglomerate.

Reads the format id's of each of the columns and manufactures object of the given type for each. It then uses these "empty" objects to create a template row.

This method is public so that B2IUndo() can call it. The new template.
exception:
  StandardException - Standard exception policy.




drop
abstract public void drop(TransactionManager xact_manager) throws StandardException(Code)
Drop this btree. This must be done by a concrete implementation.
See Also:   Conglomerate.drop
exception:
  StandardException - Standard exception policy.



getBtreeLockingPolicy
abstract protected BTreeLockingPolicy getBtreeLockingPolicy(Transaction rawtran, int lock_level, int mode, int isolation_level, ConglomerateController base_cc, OpenBTree open_btree) throws StandardException(Code)
Create a new btree locking policy from scratch.
exception:
  StandardException - Standard exception policy.



getContainerid
public long getContainerid()(Code)



getDynamicCompiledConglomInfo
public DynamicCompiledOpenConglomInfo getDynamicCompiledConglomInfo(long conglomId) throws StandardException(Code)
Return dynamic information about the conglomerate to be dynamically reused in repeated execution of a statement.

The dynamic info is a set of variables to be used in a given ScanController or ConglomerateController. It can only be used in one controller at a time. It is up to the caller to insure the correct thread access to this info. The type of info in this is a scratch template for btree traversal, other scratch variables for qualifier evaluation, ...

The dynamic information.
Parameters:
  conglomId - The identifier of the conglomerate to open.
exception:
  StandardException - Standard exception policy.




getId
final public ContainerKey getId()(Code)
Get the id of the container of the conglomerate.

Will have to change when a conglomerate could have more than one container. The ContainerKey is a combination of the container id and segment id. The ContainerKey.




isNull
public boolean isNull()(Code)
Return whether the value is null or not. The containerid being zero is what determines nullness; subclasses are not expected to override this method.
See Also:   org.apache.derby.iapi.services.io.Storable.isNull



isTemporary
public boolean isTemporary()(Code)
Is this conglomerate temporary?

whether conglomerate is temporary or not.




isUnique
final public boolean isUnique()(Code)
Is this a "unique" index?



load
abstract public long load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException(Code)
Load a b-tree. This must be done by a concrete implementation.
See Also:   Conglomerate.load
exception:
  StandardException - Standard exception policy.



lockTable
abstract public ConglomerateController lockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level) throws StandardException(Code)
Lock the base table.

Assumes that segment of the base container is the same as the segment of the btree segment.

RESOLVE - we really want to get the lock without opening the container. raw store will be providing this.
Parameters:
  xact_manager - Transaction to associate the lock with.
exception:
  StandardException - Standard exception policy.




open
abstract public ConglomerateController open(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException(Code)
Open a b-tree controller. This must be done by a concrete implementation.
See Also:   Conglomerate.open
exception:
  StandardException - Standard exception policy.



readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)
Restore the in-memory representation from the stream.
exception:
  ClassNotFoundException - Thrown if the stored representation isserialized and a class named in the stream could not be found.
exception:
  IOException - thrown by readObject()
See Also:   java.io.Externalizable.readExternal



readExternalFromArray
public void readExternalFromArray(ArrayInputStream in) throws IOException, ClassNotFoundException(Code)



restoreToNull
public void restoreToNull()(Code)
Restore the in-memory representation to the null value. The containerid being zero is what determines nullness; subclasses are not expected to override this method.
See Also:   org.apache.derby.iapi.services.io.Storable.restoreToNull



toString
public String toString()(Code)
Public toString() Method:



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(Code)
Store the stored representation of the column value in the stream. It might be easier to simply store the properties - which would certainly make upgrading easier.
exception:
  IOException - thrown by writeObject()



Methods inherited from org.apache.derby.impl.store.access.conglomerate.GenericConglomerate
public int compare(DataValueDescriptor other) throws StandardException(Code)(Java Doc)
public DataValueDescriptor getClone()(Code)(Java Doc)
public int getLength() throws StandardException(Code)(Java Doc)
public DataValueDescriptor getNewNull()(Code)(Java Doc)
public Object getObject() throws StandardException(Code)(Java Doc)
public String getString() throws StandardException(Code)(Java Doc)
public String getTypeName()(Code)(Java Doc)
protected void setFrom(DataValueDescriptor theValue) throws StandardException(Code)(Java Doc)
public void setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable) throws StandardException, SQLException(Code)(Java Doc)

ww__w.__ja__v__a___2__s___.__c_om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.