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


org.apache.derby.impl.store.access.btree.BTree
   org.apache.derby.impl.store.access.btree.index.B2I

B2I
public class B2I extends BTree (Code)
Implements an instance of a B-Tree secondary index conglomerate. A B2I object has two roles.
  1. The B2I object is stored on disk, and holds the store specific information needed to access/describe the conglomerate. This includes information such as the format ids of the columns, the conglomerate id of the base table, the location of row location column.
  2. Access to all the interfaces start by making a call off the Conglomerate interface. So for instance to get a scan on the conglomerate method B2I.openScan openScan should be called.


Field Summary
final public static  intFORMAT_NUMBER
    
final public static  StringPROPERTY_BASECONGLOMID
    
final public static  StringPROPERTY_ROWLOCCOLUMN
    
protected  longbaseConglomerateId
     The id of the conglomerate which contains the base table. Row locations inserted into this secondary index are assumed to refer to that conglomerate.
protected  introwLocationColumn
     The column id (zero-based integer index) of the column which holds the row location to the base conglomerate.


Method Summary
public  voidcompressConglomerate(TransactionManager xact_manager, Transaction rawtran)
    
public  voidcreate(TransactionManager xact_manager, int segmentId, long input_conglomid, DataValueDescriptor[] template, ColumnOrdering[] columnOrder, Properties properties, int temporaryFlag)
     Create an empty secondary index b-tree, using the generic b-tree to do the generic part of the creation process. This routine opens the newly created container, adds a single page, and makes this page the root by inserting a LeafControlRow onto this page at slot 0 and marking in that control row that the page is a root page. The following properties are specific to the b-tree secondary index:
  • "baseConglomerateId" (integer).
public  ScanManagerdefragmentConglomerate(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level)
     Open a b-tree compress scan.
public  voiddrop(TransactionManager xact_manager)
     Drop this b-tree secondary index.
public  intestimateMemoryUsage()
    
public  booleanfetchMaxOnBTree(TransactionManager xact_manager, Transaction rawtran, long conglomId, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] fetchRow)
     Retrieve the maximum value row in an ordered conglomerate.

Returns true and fetches the rightmost row of an ordered conglomerate into "fetchRow" if there is at least one row in the conglomerate.

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  StaticCompiledOpenConglomInfogetStaticCompiledConglomInfo(TransactionController xact_manager, long conglomId)
     Return static information about the conglomerate to be included in a a compiled plan.

The static info would be valid until any ddl was executed on the conglomid, and would be up to the caller to throw away when that happened.

public  intgetTypeFormatId()
     Return my format identifier.
public  longload(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource)
     Bulk Load a B-tree secondary index.
final public  ConglomerateControllerlockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level)
     Lock the base table.
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  ScanManageropenScan(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info)
     Open a b-tree secondary index scan controller.
public  StoreCostControlleropenStoreCost(TransactionManager xact_manager, Transaction rawtran)
     Return an open StoreCostController for the conglomerate.

Return an open StoreCostController which can be used to ask about the estimated row counts and costs of ScanController and ConglomerateController operations, on the given conglomerate.


Parameters:
  xact_manager - The TransactionController under which this operation takes place.
Parameters:
  rawtran - raw transaction context in which scan is managed.

public  voidpurgeConglomerate(TransactionManager xact_manager, Transaction rawtran)
    
public  voidreadExternal(ObjectInput in)
    
public  voidreadExternalFromArray(ArrayInputStream in)
    
public  voidreadExternal_v36(ObjectInput in)
     Restore the in-memory representation from the stream.
public  voidwriteExternal(ObjectOutput out)
     Store the stored representation of the column value in the stream.
public  voidwriteExternal_v36(ObjectOutput out)
     Store the stored representation of the column value in the stream.

Field Detail
FORMAT_NUMBER
final public static int FORMAT_NUMBER(Code)



PROPERTY_BASECONGLOMID
final public static String PROPERTY_BASECONGLOMID(Code)



PROPERTY_ROWLOCCOLUMN
final public static String PROPERTY_ROWLOCCOLUMN(Code)



baseConglomerateId
protected long baseConglomerateId(Code)
The id of the conglomerate which contains the base table. Row locations inserted into this secondary index are assumed to refer to that conglomerate. Used to obtain table/row locks on the base table rows which the index rows point at.



rowLocationColumn
protected int rowLocationColumn(Code)
The column id (zero-based integer index) of the column which holds the row location to the base conglomerate. The default value of RowLocationColumn is the last key column. Used to obtain table/row locks on the base table rows with the index rows point at. Currently, RowLocationColumn must be the last key column.





Method Detail
compressConglomerate
public void compressConglomerate(TransactionManager xact_manager, Transaction rawtran) throws StandardException(Code)



create
public void create(TransactionManager xact_manager, int segmentId, long input_conglomid, DataValueDescriptor[] template, ColumnOrdering[] columnOrder, Properties properties, int temporaryFlag) throws StandardException(Code)
Create an empty secondary index b-tree, using the generic b-tree to do the generic part of the creation process. This routine opens the newly created container, adds a single page, and makes this page the root by inserting a LeafControlRow onto this page at slot 0 and marking in that control row that the page is a root page. The following properties are specific to the b-tree secondary index:
  • "baseConglomerateId" (integer). The conglomerate id of the base conglomerate is never actually accessed by the b-tree secondary index implementation, it only serves as a namespace for row locks. This property is required.
  • "rowLocationColumn" (integer). The zero-based index into the row which the b-tree secondary index will assume holds a @see RowLocation of the base row in the base conglomerate. This value will be used for acquiring locks. In this implementation RowLocationColumn must be the last key column. This property is required.
A secondary index i (a, b) on table t (a, b, c) would have rows which looked like (a, b, row_location). baseConglomerateId is set to the conglomerate id of t. rowLocationColumns is set to 2. allowsDuplicates would be set to false, @see BTree#create. To create a unique secondary index set uniquenessColumns to 2, this means that the btree code will compare the key values but not the row id when determing uniqueness. To create a nonunique secondary index set uniquenessColumns to 3, this would mean that the uniqueness test would include the row location and since all row locations will be unique all rows inserted into the index will be differentiated (at least) by row location.
See Also:   BTree.create
exception:
  StandardException - Standard exception policy.



defragmentConglomerate
public ScanManager defragmentConglomerate(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level) throws StandardException(Code)
Open a b-tree compress scan.

B2I does not support a compress scan.


See Also:   Conglomerate.defragmentConglomerate
exception:
  StandardException - Standard exception policy.




drop
public void drop(TransactionManager xact_manager) throws StandardException(Code)
Drop this b-tree secondary index.
See Also:   Conglomerate.drop
See Also:   BTree.drop
exception:
  StandardException - Standard exception policy.



estimateMemoryUsage
public int estimateMemoryUsage()(Code)



fetchMaxOnBTree
public boolean fetchMaxOnBTree(TransactionManager xact_manager, Transaction rawtran, long conglomId, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] fetchRow) throws StandardException(Code)
Retrieve the maximum value row in an ordered conglomerate.

Returns true and fetches the rightmost row of an ordered conglomerate into "fetchRow" if there is at least one row in the conglomerate. If there are no rows in the conglomerate it returns false.

Non-ordered conglomerates will not implement this interface, calls will generate a StandardException.

RESOLVE - this interface is temporary, long term equivalent (and more) functionality will be provided by the openBackwardScan() interface.
Parameters:
  xact_manager - The TransactionController under which this operation takes place.
Parameters:
  conglomId - The identifier of the conglomerateto open the scan for.
Parameters:
  open_mode - Specifiy flags to control opening of table. OPENMODE_FORUPDATE - if set open the table forupdate otherwise open table shared.
Parameters:
  lock_level - One of (MODE_TABLE, MODE_RECORD, or MODE_NONE).
Parameters:
  isolation_level - The isolation level to lock the conglomerate at.One of (ISOLATION_READ_COMMITTED or ISOLATION_SERIALIZABLE).
Parameters:
  scanColumnList - A description of which columns to return from every fetch in the scan. template, and scanColumnList work togetherto describe the row to be returned by the scan - see RowUtil for description of how these three parameters work together to describe a "row".
Parameters:
  fetchRow - The row to retrieve the maximum value into. boolean indicating if a row was found and retrieved or not.
exception:
  StandardException - Standard exception policy.




getBtreeLockingPolicy
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.



getStaticCompiledConglomInfo
public StaticCompiledOpenConglomInfo getStaticCompiledConglomInfo(TransactionController xact_manager, long conglomId) throws StandardException(Code)
Return static information about the conglomerate to be included in a a compiled plan.

The static info would be valid until any ddl was executed on the conglomid, and would be up to the caller to throw away when that happened. This ties in with what language already does for other invalidation of static info. The type of info in this would be containerid and array of format id's from which templates can be created. The info in this object is read only and can be shared among as many threads as necessary.

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




getTypeFormatId
public int getTypeFormatId()(Code)
Return my format identifier.
See Also:   org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId



load
public long load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException(Code)
Bulk Load a B-tree secondary index.
See Also:   Conglomerate.load
exception:
  StandardException - Standard Cloudscape Error policy.raise SQLState.STORE_CONGLOMERATE_DUPLICATE_KEY_EXCEPTION if a duplicate key is detected in the load.



lockTable
final 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
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.
See Also:   Conglomerate.open
exception:
  StandardException - Standard exception policy.



openScan
public ScanManager openScan(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException(Code)
Open a b-tree secondary index scan controller.
See Also:   Conglomerate.openScan
See Also:   BTree.openScan
exception:
  StandardException - Standard exception policy.



openStoreCost
public StoreCostController openStoreCost(TransactionManager xact_manager, Transaction rawtran) throws StandardException(Code)
Return an open StoreCostController for the conglomerate.

Return an open StoreCostController which can be used to ask about the estimated row counts and costs of ScanController and ConglomerateController operations, on the given conglomerate.


Parameters:
  xact_manager - The TransactionController under which this operation takes place.
Parameters:
  rawtran - raw transaction context in which scan is managed. The open StoreCostController.
exception:
  StandardException - Standard exception policy.
See Also:   StoreCostController




purgeConglomerate
public void purgeConglomerate(TransactionManager xact_manager, Transaction rawtran) throws StandardException(Code)



readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)



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



readExternal_v36
public void readExternal_v36(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.
See Also:   java.io.Externalizable.readExternal



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.



writeExternal_v36
public void writeExternal_v36(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.



Fields inherited from org.apache.derby.impl.store.access.btree.BTree
final public static String PROPERTY_ALLOWDUPLICATES(Code)(Java Doc)
final public static String PROPERTY_MAX_ROWS_PER_PAGE_PARAMETER(Code)(Java Doc)
final public static String PROPERTY_NKEYFIELDS(Code)(Java Doc)
final public static String PROPERTY_NUNIQUECOLUMNS(Code)(Java Doc)
final public static String PROPERTY_PARENTLINKS(Code)(Java Doc)
final public static long ROOTPAGEID(Code)(Java Doc)
protected boolean[] ascDescInfo(Code)(Java Doc)
protected int conglom_format_id(Code)(Java Doc)
protected ContainerKey id(Code)(Java Doc)
protected int nKeyFields(Code)(Java Doc)

Methods inherited from org.apache.derby.impl.store.access.btree.BTree
public void addColumn(TransactionManager xact_manager, int column_id, Storable template_column) throws StandardException(Code)(Java Doc)
public void create(Transaction rawtran, int segmentId, long input_containerid, DataValueDescriptor[] template, Properties properties, int conglom_format_id, int tmpFlag) throws StandardException(Code)(Java Doc)
final public DataValueDescriptor[] createTemplate() throws StandardException(Code)(Java Doc)
abstract public void drop(TransactionManager xact_manager) throws StandardException(Code)(Java Doc)
abstract protected BTreeLockingPolicy getBtreeLockingPolicy(Transaction rawtran, int lock_level, int mode, int isolation_level, ConglomerateController base_cc, OpenBTree open_btree) throws StandardException(Code)(Java Doc)
public long getContainerid()(Code)(Java Doc)
public DynamicCompiledOpenConglomInfo getDynamicCompiledConglomInfo(long conglomId) throws StandardException(Code)(Java Doc)
final public ContainerKey getId()(Code)(Java Doc)
public boolean isNull()(Code)(Java Doc)
public boolean isTemporary()(Code)(Java Doc)
final public boolean isUnique()(Code)(Java Doc)
abstract public long load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException(Code)(Java Doc)
abstract public ConglomerateController lockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level) throws StandardException(Code)(Java Doc)
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)(Java Doc)
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)(Java Doc)
public void readExternalFromArray(ArrayInputStream in) throws IOException, ClassNotFoundException(Code)(Java Doc)
public void restoreToNull()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public void writeExternal(ObjectOutput out) throws IOException(Code)(Java Doc)

w_w_w__.___jav___a__2__s_.__c_o___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.