Java Doc for RecordStoreImpl.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.RecordStoreImpl

RecordStoreImpl
public class RecordStoreImpl implements AbstractRecordStoreImpl(Code)
A class implementing a MIDP a record store.


Field Summary
final static  intAUTHMODE_ANY_RO
     Internal indicator for AUTHMODE_ANY with read only access AUTHMODE_ANY_RO has a value of 2.
 byte[]dbHeader
    
 ObjectrsLock
    
 intsuiteId
    


Method Summary
public  intaddRecord(byte[] data, int offset, int numBytes)
     Adds a new record to the record store.
public  voidcloseRecordStore()
     This method is called when the MIDlet requests to have the record store closed.
public  AbstractRecordStoreFilecreateIndexFile(int suiteId, String name)
    
public  voiddeleteRecord(int recordId)
     The record is deleted from the record store.
public static  voiddeleteRecordStore(SecurityToken token, int suiteId, String recordStoreName)
     Deletes the named record store.
public  intgetAuthMode()
     Get the authorization mode for this record store.
public  AbstractRecordStoreFilegetDbFile()
    
public  longgetLastModified()
     Returns the last time the record store was modified, in the format used by System.currentTimeMillis().
public  intgetNextRecordID()
     Returns the recordId of the next record to be added to the record store.
public  intgetNumRecords()
     Returns the number of records currently in the record store.
public  intgetRecord(int recordId, byte[] buffer, int offset)
     Returns the data stored in the given record.
public  byte[]getRecord(int recordId)
     Returns a copy of the data stored in the given record.
Parameters:
  recordId - the ID of the record to use in this operation
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  InvalidRecordIDException - if the recordId is invalid
exception:
  RecordStoreException - if a general record storeexception occurs the data stored in the given record.
public  int[]getRecordIDs()
     Returns all of the recordId's currently in the record store.
public  intgetRecordSize(int recordId)
     Returns the size (in bytes) of the MIDlet data available in the given record.
public  intgetSize()
     Returns the amount of space, in bytes, that the record store occupies.
public  intgetSizeAvailable()
     Returns the amount of additional room (in bytes) available for this record store to grow.
public  intgetVersion()
     Each time a record store is modified (by addRecord, setRecord, or deleteRecord methods) its version is incremented.
public static  String[]listRecordStores(SecurityToken token, int suiteId)
     Returns an array of the names of record stores owned by the MIDlet suite.
public static  RecordStoreImplopenRecordStore(SecurityToken token, int suiteId, String recordStoreName, boolean createIfNecessary)
     Open (and possibly create) a record store associated with the given MIDlet suite.
public  voidsetMode(int authmode, boolean writable)
     Changes the access mode for this RecordStore.
public  voidsetRecord(int recordId, byte[] newData, int offset, int numBytes)
     Sets the data in the given record to that passed in.

Field Detail
AUTHMODE_ANY_RO
final static int AUTHMODE_ANY_RO(Code)
Internal indicator for AUTHMODE_ANY with read only access AUTHMODE_ANY_RO has a value of 2.



dbHeader
byte[] dbHeader(Code)
data block header stored here



rsLock
Object rsLock(Code)
lock used to synchronize this record store



suiteId
int suiteId(Code)
unique id for suite that owns this record store





Method Detail
addRecord
public int addRecord(byte[] data, int offset, int numBytes) throws RecordStoreNotOpenException, RecordStoreException, RecordStoreFullException(Code)
Adds a new record to the record store. The recordId for this new record is returned. This is a blocking atomic operation. The record is written to persistent storage before the method returns.
Parameters:
  data - the data to be stored in this record. If the recordis to have zero-length data (no data), this parameter may benull.
Parameters:
  offset - the index into the data buffer of the firstrelevant byte for this record
Parameters:
  numBytes - the number of bytes of the data buffer to usefor this record (may be zero) the recordId for the new record
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  RecordStoreException - if a different recordstore-related exception occurred
exception:
  RecordStoreFullException - if the operation cannot becompleted because the record store has no more room
exception:
  SecurityException - if the MIDlet has read-only accessto the RecordStore



closeRecordStore
public void closeRecordStore() throws RecordStoreNotOpenException, RecordStoreException(Code)
This method is called when the MIDlet requests to have the record store closed. Note that the record store will not actually be closed until closeRecordStore() is called as many times as openRecordStore() was called. In other words, the MIDlet needs to make a balanced number of close calls as open calls before the record store is closed.

When the record store is closed, all listeners are removed and all RecordEnumerations associated with it become invalid. If the MIDlet attempts to perform operations on the RecordStore object after it has been closed, the methods will throw a RecordStoreNotOpenException.
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  RecordStoreException - if a different recordstore-related exception occurred




createIndexFile
public AbstractRecordStoreFile createIndexFile(int suiteId, String name) throws IOException(Code)
Creates data base index file associated with this record store
Parameters:
  suiteId - unique ID of the suite that owns the store
Parameters:
  name - a string to name the index file data base index file
exception:
  IOException - if failed to create a file



deleteRecord
public void deleteRecord(int recordId) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException(Code)
The record is deleted from the record store. The recordId for this record is NOT reused.
Parameters:
  recordId - the ID of the record to delete
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  InvalidRecordIDException - if the recordId is invalid
exception:
  RecordStoreException - if a general record storeexception occurs
exception:
  SecurityException - if the MIDlet has read-only accessto the RecordStore



deleteRecordStore
public static void deleteRecordStore(SecurityToken token, int suiteId, String recordStoreName) throws RecordStoreException, RecordStoreNotFoundException(Code)
Deletes the named record store. MIDlet suites are only allowed to delete their own record stores. If the named record store is open (by a MIDlet in this suite or a MIDlet in a different MIDlet suite) when this method is called, a RecordStoreException will be thrown. If the named record store does not exist a RecordStoreNotFoundException will be thrown. Calling this method does NOT result in recordDeleted calls to any registered listeners of this RecordStore.
Parameters:
  token - security token for authorization
Parameters:
  suiteId - ID of the MIDlet suite that owns the record store
Parameters:
  recordStoreName - the MIDlet suite unique record store todelete
exception:
  RecordStoreException - if a record store-relatedexception occurred
exception:
  RecordStoreNotFoundException - if the record storecould not be found



getAuthMode
public int getAuthMode()(Code)
Get the authorization mode for this record store. authorization mode



getDbFile
public AbstractRecordStoreFile getDbFile()(Code)
Returns data base file associated with this record store data base file



getLastModified
public long getLastModified()(Code)
Returns the last time the record store was modified, in the format used by System.currentTimeMillis(). the last time the record store was modified, in theformat used by System.currentTimeMillis()



getNextRecordID
public int getNextRecordID()(Code)
Returns the recordId of the next record to be added to the record store. This can be useful for setting up pseudo-relational relationships. That is, if you have two or more record stores whose records need to refer to one another, you can predetermine the recordIds of the records that will be created in one record store, before populating the fields and allocating the record in another record store. Note that the recordId returned is only valid while the record store remains open and until a call to addRecord(). the recordId of the next record to be added to therecord store



getNumRecords
public int getNumRecords()(Code)
Returns the number of records currently in the record store. the number of records currently in the record store



getRecord
public int getRecord(int recordId, byte[] buffer, int offset) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException(Code)
Returns the data stored in the given record.
Parameters:
  recordId - the ID of the record to use in this operation
Parameters:
  buffer - the byte array in which to copy the data
Parameters:
  offset - the index into the buffer in which to start copying
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  InvalidRecordIDException - if the recordId is invalid
exception:
  RecordStoreException - if a general record storeexception occurs
exception:
  ArrayIndexOutOfBoundsException - if the record islarger than the buffer supplied the number of bytes copied into the buffer, starting atindex offset
See Also:   RecordStoreImpl.setRecord



getRecord
public byte[] getRecord(int recordId) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException(Code)
Returns a copy of the data stored in the given record.
Parameters:
  recordId - the ID of the record to use in this operation
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  InvalidRecordIDException - if the recordId is invalid
exception:
  RecordStoreException - if a general record storeexception occurs the data stored in the given record. Note that if therecord has no data, this method will return null.
See Also:   RecordStoreImpl.setRecord



getRecordIDs
public int[] getRecordIDs()(Code)
Returns all of the recordId's currently in the record store. an array of the recordId's currently in the record storeor null if the record store is closed.



getRecordSize
public int getRecordSize(int recordId) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException(Code)
Returns the size (in bytes) of the MIDlet data available in the given record.
Parameters:
  recordId - the ID of the record to use in this operation the size (in bytes) of the MIDlet data availablein the given record
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  InvalidRecordIDException - if the recordId is invalid
exception:
  RecordStoreException - if a general record storeexception occurs



getSize
public int getSize()(Code)
Returns the amount of space, in bytes, that the record store occupies. The size returned includes any overhead associated with the implementation, such as the data structures used to hold the state of the record store, etc. the size of the record store in bytes



getSizeAvailable
public int getSizeAvailable()(Code)
Returns the amount of additional room (in bytes) available for this record store to grow. Note that this is not necessarily the amount of extra MIDlet-level data which can be stored, as implementations may store additional data structures with each record to support integration with native applications, synchronization, etc. the amount of additional room (in bytes) available forthis record store to grow



getVersion
public int getVersion() throws RecordStoreNotOpenException(Code)
Each time a record store is modified (by addRecord, setRecord, or deleteRecord methods) its version is incremented. This can be used by MIDlets to quickly tell if anything has been modified. The initial version number is implementation dependent. The increment is a positive integer greater than 0. The version number increases only when the RecordStore is updated. The increment value need not be constant and may vary with each update. the current record store version



listRecordStores
public static String[] listRecordStores(SecurityToken token, int suiteId)(Code)
Returns an array of the names of record stores owned by the MIDlet suite. Note that if the MIDlet suite does not have any record stores, this function will return null. The order of RecordStore names returned is implementation dependent.
Parameters:
  token - security token for authorization
Parameters:
  suiteId - ID of the MIDlet suite that owns the record store array of the names of record stores owned by theMIDlet suite. Note that if the MIDlet suite does nothave any record stores, this function will return null.



openRecordStore
public static RecordStoreImpl openRecordStore(SecurityToken token, int suiteId, String recordStoreName, boolean createIfNecessary) throws RecordStoreException, RecordStoreFullException, RecordStoreNotFoundException(Code)
Open (and possibly create) a record store associated with the given MIDlet suite. If this method is called by a MIDlet when the record store is already open by a MIDlet in the MIDlet suite, this method returns a reference to the same RecordStoreImpl object.
Parameters:
  token - security token for authorization
Parameters:
  suiteId - ID of the MIDlet suite that owns the record store
Parameters:
  recordStoreName - the MIDlet suite unique name for therecord store, consisting of between one and 32 Unicodecharacters inclusive.
Parameters:
  createIfNecessary - if true, the record store will becreated if necessary RecordStore object for the record store
exception:
  RecordStoreException - if a record store-relatedexception occurred
exception:
  RecordStoreNotFoundException - if the record storecould not be found
exception:
  RecordStoreFullException - if the operation cannot becompleted because the record store is full
exception:
  IllegalArgumentException - ifrecordStoreName is invalid



setMode
public void setMode(int authmode, boolean writable) throws RecordStoreException(Code)
Changes the access mode for this RecordStore. The authorization mode choices are:
  • AUTHMODE_PRIVATE - Only allows the MIDlet suite that created the RecordStore to access it. This case behaves identically to openRecordStore(recordStoreName, createIfNecessary).
  • AUTHMODE_ANY - Allows any MIDlet to access the RecordStore. Note that this makes your recordStore accessible by any other MIDlet on the device. This could have privacy and security issues depending on the data being shared. Please use carefully.

The owning MIDlet suite may always access the RecordStore and always has access to write and update the store. Only the owning MIDlet suite can change the mode of a RecordStore.


Parameters:
  authmode - the mode under which to check or create access.Must be one of AUTHMODE_PRIVATE or AUTHMODE_ANY.
Parameters:
  writable - true if the RecordStore is to be writable byother MIDlet suites that are granted access
exception:
  RecordStoreException - if a record store-relatedexception occurred
exception:
  SecurityException - if this MIDlet Suite is notallowed to change the mode of the RecordStore
exception:
  IllegalArgumentException - if authmode is invalid



setRecord
public void setRecord(int recordId, byte[] newData, int offset, int numBytes) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException(Code)
Sets the data in the given record to that passed in. After this method returns, a call to getRecord(int recordId) will return an array of numBytes size containing the data supplied here.
Parameters:
  recordId - the ID of the record to use in this operation
Parameters:
  newData - the new data to store in the record
Parameters:
  offset - the index into the data buffer of the firstrelevant byte for this record
Parameters:
  numBytes - the number of bytes of the data buffer to usefor this record
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  InvalidRecordIDException - if the recordId is invalid
exception:
  RecordStoreException - if a general record storeexception occurs
exception:
  RecordStoreFullException - if the operation cannot becompleted because the record store has no more room
exception:
  SecurityException - if the MIDlet has read-only accessto the RecordStore
See Also:   RecordStoreImpl.getRecord



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.