Java Doc for RecordStoreIndex.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » rms » 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 » 6.0 JDK Modules » j2me » com.sun.midp.rms 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.midp.rms.RecordStoreIndex

RecordStoreIndex
class RecordStoreIndex (Code)
A class implementing a index of the record store. Methods used by the RecordStoreImpl close() deleteIndex() getRecordIDs() getRecordHeader() getFreeBlock() updateBlock() deleteRecordIndex() removeBlock()

Inner Class :class Node

Field Summary
final static  intIDX0_SIZE
    
final static  intIDX1_ID_ROOT
    
final static  intIDX2_FREE_BLOCK_ROOT
    
final static  intIDX3_FREE_NODE_HEAD
    
final static  intIDX_HEADER_SIZE
    
final static  intNODE_ELEMENTS
    
final static  intNODE_SIZE
    

Constructor Summary
 RecordStoreIndex(AbstractRecordStoreImpl rs, int suiteId, String recordStoreName)
     Constructor for creating an index object for the given Record Store.

Method Summary
 voidclose()
     Closes the index file.
static  booleandeleteIndex(int suiteId, String recordStoreName)
     Deletes index files of the named record store.
 intdeleteKey(Node node, int key)
     Searches the tree starting with the given node for the given key.
 voiddeleteRecordIndex(int recordId)
     The record is deleted from the record store index.
 intgetBlockOffsetOfRecord(int recordId)
    
 intgetFreeBlock(byte[] header)
     Searches for a free block large enough for the record.
 intgetFreeBlockRootOffset()
     Gets the offset to the root of the free block tree.
 intgetKeyValue(Node node, int key)
    
 intgetRecordHeader(int recordId, byte[] header)
     Finds the record header for the given record and returns the offset to the header.
 int[]getRecordIDs()
     Returns all of the recordId's currently in the record store index.
 intgetRecordIdRootOffset()
     Gets the offset to the root of the recordId tree.
 intgetRecordIds(int[] recordIdList)
     Returns places all of the recordId's in the index.
 voidremoveBlock(int blockOffset, byte[] header)
     Removes the given block from the list of free blocks.
 voidsetFreeBlockRootOffset(int newOffset)
     Sets the offset to the root of the free block tree.
 voidsetRecordIdRootOffset(int newOffset)
     Sets the offset to the root of the recordId tree.
 voidupdateBlock(int blockOffset, byte[] header)
     Updates the index of the given block and its offset.
 intupdateKey(Node node, int key, int value)
     Updates the tree starting with the given node with the key value pair. If the key is already in the tree, the value is updated.
 voidupdateRecordId(int recordId, int blockOffset)
     Updates the given recordId with the given offset.
 intwalk(Node node, int[] keyList, int count)
     Walks the tree starting at the given node and loads all of the tree's keys into the given array.

Field Detail
IDX0_SIZE
final static int IDX0_SIZE(Code)
IDX_SIZE offset



IDX1_ID_ROOT
final static int IDX1_ID_ROOT(Code)
IDX_ID_ROOT offset



IDX2_FREE_BLOCK_ROOT
final static int IDX2_FREE_BLOCK_ROOT(Code)
IDX_FREE_ROOT offset



IDX3_FREE_NODE_HEAD
final static int IDX3_FREE_NODE_HEAD(Code)
IDX_FREE_NODES offset



IDX_HEADER_SIZE
final static int IDX_HEADER_SIZE(Code)
Size of the index header



NODE_ELEMENTS
final static int NODE_ELEMENTS(Code)
The maximum number of data elements in each node



NODE_SIZE
final static int NODE_SIZE(Code)
The size of the tree blocks




Constructor Detail
RecordStoreIndex
RecordStoreIndex(AbstractRecordStoreImpl rs, int suiteId, String recordStoreName) throws IOException(Code)
Constructor for creating an index object for the given Record Store.
Parameters:
  rs - record store that this object indexes
Parameters:
  suiteId - unique ID of the suite that owns the store
Parameters:
  recordStoreName - a string to name the record store
exception:
  IOException - if there are any file errors




Method Detail
close
void close() throws IOException(Code)
Closes the index file.
exception:
  IOException - if there are any file errors



deleteIndex
static boolean deleteIndex(int suiteId, String recordStoreName)(Code)
Deletes index files of the named record store. MIDlet suites are only allowed to delete their own record stores.
Parameters:
  suiteId - ID of the MIDlet suite that owns the record store
Parameters:
  recordStoreName - the MIDlet suite unique record store todelete true if file was found and deleted successfully,false otherwise.



deleteKey
int deleteKey(Node node, int key) throws IOException(Code)
Searches the tree starting with the given node for the given key. If the key is in the tree, the key value pair is deleted. If the key is not in the tree, nothing happens. If the deletion causes the root node to be merged, the offset to the new root is returned, otherwise 0 is returned.
Parameters:
  node - the root node of the tree to remove key from
Parameters:
  key - the key to remove
exception:
  IOException - if there is an error accessing the index file the offset of the new tree root if the old one was removed,otherwise 0



deleteRecordIndex
void deleteRecordIndex(int recordId) throws IOException(Code)
The record is deleted from the record store index.
Parameters:
  recordId - the ID of the record index to delete
exception:
  IOException - if there is an error accessing the db index



getBlockOffsetOfRecord
int getBlockOffsetOfRecord(int recordId) throws IOException, InvalidRecordIDException(Code)
Returns the offset to the header for the given recordId
Parameters:
  recordId - the ID of the record to use in this operation
exception:
  IOException - if there is an error accessing the db file
exception:
  InvalidRecordIDException - if the recordId is invalid the offset in the db file of the record block



getFreeBlock
int getFreeBlock(byte[] header) throws IOException(Code)
Searches for a free block large enough for the record.
Parameters:
  header - a block header with the size set to the record data size
exception:
  IOException - if there is an error accessing the db file the offset in the db file of the block added



getFreeBlockRootOffset
int getFreeBlockRootOffset() throws IOException(Code)
Gets the offset to the root of the free block tree.
exception:
  IOException - if there is an error accessing the index file the offset of the free block tree



getKeyValue
int getKeyValue(Node node, int key) throws IOException(Code)
Searches the tree starting at the given node for the given key and returns the value associated with the key
Parameters:
  node - the root node of the tree to search for the key
Parameters:
  key - the search key
exception:
  IOException - if there is an error accessing the index file the value for the key or 0 if the key was not found



getRecordHeader
int getRecordHeader(int recordId, byte[] header) throws IOException, InvalidRecordIDException(Code)
Finds the record header for the given record and returns the offset to the header.
Parameters:
  recordId - the ID of the record to use in this operation
Parameters:
  header - the header of the block to free
exception:
  IOException - if there is an error accessing the db file
exception:
  InvalidRecordIDException - if the recordId is invalid the offset in the db file of the block added



getRecordIDs
int[] getRecordIDs()(Code)
Returns all of the recordId's currently in the record store index. an array of the recordId's currently in the index.



getRecordIdRootOffset
int getRecordIdRootOffset() throws IOException(Code)
Gets the offset to the root of the recordId tree.
exception:
  IOException - if there is an error accessing the index file the offset of the recordId tree root



getRecordIds
int getRecordIds(int[] recordIdList)(Code)
Returns places all of the recordId's in the index. If the array is not big enough, the recordId list will be limited to the size of the given array.
Parameters:
  recordIdList - array to place the recordId's the number of recordId's placed in the array.



removeBlock
void removeBlock(int blockOffset, byte[] header) throws IOException(Code)
Removes the given block from the list of free blocks.
Parameters:
  blockOffset - the offset in db file to the block to remove
Parameters:
  header - the header of the block to remove
exception:
  IOException - if there is an error accessing the db file



setFreeBlockRootOffset
void setFreeBlockRootOffset(int newOffset) throws IOException(Code)
Sets the offset to the root of the free block tree.
Parameters:
  newOffset - the new root offset
exception:
  IOException - if there is an error accessing the index file



setRecordIdRootOffset
void setRecordIdRootOffset(int newOffset) throws IOException(Code)
Sets the offset to the root of the recordId tree.
Parameters:
  newOffset - the new root offset
exception:
  IOException - if there is an error accessing the index file



updateBlock
void updateBlock(int blockOffset, byte[] header) throws IOException(Code)
Updates the index of the given block and its offset.
Parameters:
  blockOffset - the offset in db file to the block to update
Parameters:
  header - the header of the block to update
exception:
  IOException - if there is an error accessing the index file



updateKey
int updateKey(Node node, int key, int value) throws IOException(Code)
Updates the tree starting with the given node with the key value pair. If the key is already in the tree, the value is updated. If the key is not in the tree, it is inserted. If the insertion causes the root node to be split, the offset to the new root is returned, otherwise 0 is returned.
Parameters:
  node - the root node of the tree to update the key with
Parameters:
  key - the key to update
Parameters:
  value - the new value
exception:
  IOException - if there is an error accessing the index file the offset of the new tree root if one was added, 0 otherwise



updateRecordId
void updateRecordId(int recordId, int blockOffset) throws IOException(Code)
Updates the given recordId with the given offset. Adds the recordId if it did not already exist.
Parameters:
  recordId - the id of the record
Parameters:
  blockOffset - the offset in db file to the block to update
exception:
  IOException - if there is an error accessing the index file



walk
int walk(Node node, int[] keyList, int count) throws IOException(Code)
Walks the tree starting at the given node and loads all of the tree's keys into the given array.
Parameters:
  node - the root node of the tree to walk
Parameters:
  keyList - array to fill with the tree's keys
Parameters:
  count - must be 0 for user call, other value for recursive call
exception:
  IOException - if there is an error accessing the index file the number of keys placed into the array.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(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.