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


java.lang.Object
   org.apache.derby.impl.store.raw.data.BaseContainer

All known Subclasses:   org.apache.derby.impl.store.raw.data.FileContainer,
BaseContainer
abstract class BaseContainer implements Lockable(Code)
BaseContainer is an abstract class that provides the locking bahaviour for an object representing an active container, that is the actual storage container, not the ContainerHandle interface. This class is designed so that it can change the container it represents to avoid creating a new object for every container.

This object implements lockable to provide an object to lock while a page is being allocated.
MT - Mutable - mutable identity :



Field Summary
protected  ContainerKeyidentity
     Identity of the container.
protected  booleanisCommittedDrop
     Committed Drop state of the container.
protected  booleanisDropped
     Dropped state of the container.
MT - mutable : single thread required.
protected  booleanisReusableRecordId
     Is reusable recordId.

Constructor Summary
 BaseContainer()
    

Method Summary
public  PageaddPage(BaseContainerHandle handle, boolean isOverflow)
     Add a page to this container.
abstract protected  voidbackupContainer(BaseContainerHandle handle, String backupContainerPath)
     Backup the container to the specified path.
Parameters:
  handle - the container handle.
Parameters:
  backupContainerPath - location of the backup container.
abstract protected  booleancanUpdate()
     Can the container be updated.
public  voidclearIdentity()
    
abstract protected  voidclearPreallocThreshold()
     The container will have no pre-allocate threshold, i.e., if the implementation supports it, page preallocation will happen the next time a new page is allocated.
public  voidcompressContainer(BaseContainerHandle handle)
     Release free space to the OS.

As is possible release any free space to the operating system.

abstract protected  voidcompressContainer(RawTransaction t, BaseContainerHandle allocHandle)
    
abstract protected  voiddeallocatePage(BaseContainerHandle userhandle, BasePage page)
     Deallocate a page from the container.
abstract protected  voiddropContainer(LogInstant instant, boolean drop)
     Mark the container as drop or not drop depending on the input value.
abstract protected  voidencryptContainer(BaseContainerHandle handle, String newFilePath)
     Create encrypted version of the container with the user specified encryption properties.
protected  voidfillInIdentity(ContainerKey key)
    
abstract protected  voidflushAll()
     Flush all outstanding changes in this container to persistent storage.
protected  PagegetAllocPage(BaseContainerHandle handle, long pageNumber, boolean wait)
     Get an allocation page and latch it.
abstract protected  BasePagegetAllocPage(long pageNumber)
     Return a BasePage that represents the given alloc page number in this container.
protected  PagegetAnyPage(BaseContainerHandle handle, long pageNumber, boolean wait)
     Get any page and latch it .
abstract protected  BasePagegetAnyPage(BaseContainerHandle handle, long pageNumber)
     Return a BasePage that represents any page - alloc page, valid page, free page, dealloced page etc.
protected  booleangetCommittedDropState()
    
public  longgetContainerId()
    
abstract public  voidgetContainerProperties(Properties prop)
     Request the system properties associated with a container.

Request the value of properties that are associated with a container.

public  intgetContainerStatus()
    
abstract protected  longgetContainerVersion()
     Get the logged container version.
protected  booleangetDeallocLock(BaseContainerHandle handle, RecordHandle deallocLock, boolean wait, boolean zeroDuration)
    
protected  booleangetDroppedState()
    
abstract public  longgetEstimatedPageCount(BaseContainerHandle handle, int flag)
    
abstract public  longgetEstimatedRowCount(int flag)
    
abstract protected  BasePagegetFirstHeadPage(BaseContainerHandle handle, boolean wait)
     Get the first page in the container.
protected  PagegetFirstPage(BaseContainerHandle handle)
     Get the first valid page.
abstract protected  BasePagegetHeadPage(BaseContainerHandle handle, long pagenumber, boolean wait)
     Get only a valid, non-overflow page.
public  ObjectgetIdentity()
    
abstract protected  BasePagegetNextHeadPage(BaseContainerHandle handle, long pageNumber, boolean wait)
     Get the next page in the container.
protected  PagegetNextPage(BaseContainerHandle handle, long pageNumber)
    
abstract protected  BasePagegetPage(BaseContainerHandle handle, long pageNumber, boolean wait)
     Return a BasePage that represents the given page number in this container.
abstract protected  BasePagegetPageForCompress(BaseContainerHandle handle, int flag, long pageno)
    
abstract protected  BasePagegetPageForInsert(BaseContainerHandle handle, int flag)
     Get a potentially suitable page for insert and latch it.
abstract public  longgetReusableRecordIdSequenceNumber()
     Get the reusable RecordId sequence number for the container.
public  longgetSegmentId()
    
abstract protected  SpaceInfogetSpaceInfo(BaseContainerHandle handle)
     Get information about space used by the container.
abstract protected  voidincrementReusableRecordIdSequenceNumber()
     Increment the reusable RecordId sequence number.
protected  booleanisReusableRecordId()
    
protected  BasePagelatchPage(BaseContainerHandle handle, BasePage foundPage, boolean wait)
    
protected  voidletGo(BaseContainerHandle handle)
     Discontinue use of this container.
public  booleanlockAttributes(int flag, Hashtable attributes)
    
public  voidlockEvent(Latch lockInfo)
    
public  booleanlockerAlwaysCompatible()
    
abstract protected  ByteArraylogCreateContainerInfo()
     Log all information on the container creation necessary to recreate teh container during a load tran.
abstract protected  BasePagenewPage(BaseContainerHandle userhandle, RawTransaction t, BaseContainerHandle allocHandle, boolean isOverflow)
     Create a new page in the container.
abstract protected  voidpreDirty(boolean preDirtyOn)
     The container is about to be modified.
abstract protected  voidprepareForBulkLoad(BaseContainerHandle handle, int numPage)
     The container will be grown vastly, prepare for it.
abstract protected  BasePagereCreatePageForRedoRecovery(BaseContainerHandle handle, int pageFormat, long pageNumber, long pageOffset)
     ReCreate a page for rollforward recovery.
abstract protected  voidremoveContainer(LogInstant instant, boolean leaveStub)
     Remove the container and reclaim its space.
protected  voidremovePage(BaseContainerHandle handle, BasePage page)
     Remove a page from this container.
public  booleanrequestCompatible(Object requestedQualifier, Object grantedQualifier)
    
protected  voidsetCommittedDropState(boolean isCommittedDrop)
    
protected  voidsetDroppedState(boolean isDropped)
    
abstract public  voidsetEstimatedRowCount(long count, int flag)
    
protected  voidsetReusableRecordIdState(boolean isReusableRecordId)
    
protected  voidtruncate(BaseContainerHandle handle)
    
abstract protected  voidtruncatePages(long lastValidPagenum)
    
public  voidunlockEvent(Latch lockInfo)
    
protected  booleanuse(BaseContainerHandle handle, boolean forUpdate, boolean droppedOK)
     Lock the container and mark the container as in-use by this container handle.

Field Detail
identity
protected ContainerKey identity(Code)
Identity of the container.
MT - Mutable



isCommittedDrop
protected boolean isCommittedDrop(Code)
Committed Drop state of the container. If a post comit action determined that the drop container operation is committed, the whole container may be removed and space reclaimed.
MT - mutable : single thread required. Either the container must be exclusive locked by this thread, or the container must have no identity (ie. it is being created or opened).



isDropped
protected boolean isDropped(Code)
Dropped state of the container.
MT - mutable : single thread required. Either the container must be exclusive locked by this thread, or the container must have no identity (ie. it is being created or opened).



isReusableRecordId
protected boolean isReusableRecordId(Code)
Is reusable recordId. By default, record Ids are not reusable when a page is reused. However, under special circumstances, clients to raw store may decide that record Ids may be reused after the page is reused. When this flag is set, pages that are reused will have its next recordId set to RecordHandle.FIRST_RECORD_ID




Constructor Detail
BaseContainer
BaseContainer()(Code)




Method Detail
addPage
public Page addPage(BaseContainerHandle handle, boolean isOverflow) throws StandardException(Code)
Add a page to this container.
MT - thread aware - The add page operation involves 2 transactions, one is the user transaction (the transaction which owns the passed in handle), the other one is a NestedTopTransaction created by this BaseContainer. The nestedTopTransaction is used by the underlying container to change high contention structures, such as link list anchor or bit map pages. The nestedTopTransaction commits or aborts before this routine returns. The user transaction is used to latch the newly created page.
exception:
  StandardException - Standard Cloudscape error policy



backupContainer
abstract protected void backupContainer(BaseContainerHandle handle, String backupContainerPath) throws StandardException(Code)
Backup the container to the specified path.
Parameters:
  handle - the container handle.
Parameters:
  backupContainerPath - location of the backup container.
exception:
  StandardException - Standard Derby error policy



canUpdate
abstract protected boolean canUpdate()(Code)
Can the container be updated. true if the container can be updated, false otherwise.



clearIdentity
public void clearIdentity()(Code)



clearPreallocThreshold
abstract protected void clearPreallocThreshold()(Code)
The container will have no pre-allocate threshold, i.e., if the implementation supports it, page preallocation will happen the next time a new page is allocated.



compressContainer
public void compressContainer(BaseContainerHandle handle) throws StandardException(Code)
Release free space to the OS.

As is possible release any free space to the operating system. This will usually mean releasing any free pages located at the end of the file using the java truncate() interface.
exception:
  StandardException - Standard Cloudscape error policy




compressContainer
abstract protected void compressContainer(RawTransaction t, BaseContainerHandle allocHandle) throws StandardException(Code)



deallocatePage
abstract protected void deallocatePage(BaseContainerHandle userhandle, BasePage page) throws StandardException(Code)
Deallocate a page from the container.
exception:
  StandardException - Standard Cloudscape error policy



dropContainer
abstract protected void dropContainer(LogInstant instant, boolean drop)(Code)
Mark the container as drop or not drop depending on the input value.



encryptContainer
abstract protected void encryptContainer(BaseContainerHandle handle, String newFilePath) throws StandardException(Code)
Create encrypted version of the container with the user specified encryption properties.
Parameters:
  handle - the container handle.
Parameters:
  newFilePath - file to store the new encrypted version of the container
exception:
  StandardException - Standard Derby error policy



fillInIdentity
protected void fillInIdentity(ContainerKey key)(Code)



flushAll
abstract protected void flushAll() throws StandardException(Code)
Flush all outstanding changes in this container to persistent storage.
exception:
  StandardException - Standard Cloudscape error policy



getAllocPage
protected Page getAllocPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)
Get an allocation page and latch it.
exception:
  StandardException - Standard Cloudscape error policy



getAllocPage
abstract protected BasePage getAllocPage(long pageNumber) throws StandardException(Code)
Return a BasePage that represents the given alloc page number in this container.
exception:
  StandardException - Standard Cloudscape error policy



getAnyPage
protected Page getAnyPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)
Get any page and latch it .
exception:
  StandardException - Standard Cloudscape error policy



getAnyPage
abstract protected BasePage getAnyPage(BaseContainerHandle handle, long pageNumber) throws StandardException(Code)
Return a BasePage that represents any page - alloc page, valid page, free page, dealloced page etc. The only requirement is that the page is initialized...
exception:
  StandardException - Cloudscape Standard error policy



getCommittedDropState
protected boolean getCommittedDropState()(Code)



getContainerId
public long getContainerId()(Code)



getContainerProperties
abstract public void getContainerProperties(Properties prop) throws StandardException(Code)
Request the system properties associated with a container.

Request the value of properties that are associated with a container. The following properties can be requested: derby.storage.pageSize derby.storage.pageReservedSpace derby.storage.minimumRecordSize

To get the value of a particular property add it to the property list, and on return the value of the property will be set to it's current value. For example: get_prop(BaseContainer base) { Properties prop = new Properties(); prop.put("derby.storage.pageSize", ""); base.getContainerProperties(prop); System.out.println( "container's page size = " + prop.getProperty("derby.storage.pageSize"); }
Parameters:
  prop - Property list to fill in.
exception:
  StandardException - Standard exception policy.




getContainerStatus
public int getContainerStatus()(Code)



getContainerVersion
abstract protected long getContainerVersion() throws StandardException(Code)
Get the logged container version.
exception:
  StandardException - Standard Cloudscape error policy



getDeallocLock
protected boolean getDeallocLock(BaseContainerHandle handle, RecordHandle deallocLock, boolean wait, boolean zeroDuration) throws StandardException(Code)
Get the special dealloc lock on the page - the lock is gotten by the transaction that owns the container handle
exception:
  StandardException - Standard Cloudscape error policy



getDroppedState
protected boolean getDroppedState()(Code)



getEstimatedPageCount
abstract public long getEstimatedPageCount(BaseContainerHandle handle, int flag) throws StandardException(Code)

See Also:   ContainerHandle.getEstimatedPageCount
exception:
  StandardException - Standard Cloudscape error policy



getEstimatedRowCount
abstract public long getEstimatedRowCount(int flag) throws StandardException(Code)

See Also:   ContainerHandle.getEstimatedRowCount
exception:
  StandardException - Standard Cloudscape error policy



getFirstHeadPage
abstract protected BasePage getFirstHeadPage(BaseContainerHandle handle, boolean wait) throws StandardException(Code)
Get the first page in the container.
exception:
  StandardException - Standard Cloudscape error policy



getFirstPage
protected Page getFirstPage(BaseContainerHandle handle) throws StandardException(Code)
Get the first valid page. Result is latched.
exception:
  StandardException - Standard Cloudscape error policy



getHeadPage
abstract protected BasePage getHeadPage(BaseContainerHandle handle, long pagenumber, boolean wait) throws StandardException(Code)
Get only a valid, non-overflow page. If page number is either invalid or overflow, returns null
exception:
  StandardException - Cloudscape Standard error policy



getIdentity
public Object getIdentity()(Code)



getNextHeadPage
abstract protected BasePage getNextHeadPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)
Get the next page in the container.
exception:
  StandardException - Standard Cloudscape error policy



getNextPage
protected Page getNextPage(BaseContainerHandle handle, long pageNumber) throws StandardException(Code)
Get the next valid page and latch it
exception:
  StandardException - Standard Cloudscape error policy



getPage
abstract protected BasePage getPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)
Return a BasePage that represents the given page number in this container. The resulting page is latched.
exception:
  StandardException - Standard Cloudscape error policy



getPageForCompress
abstract protected BasePage getPageForCompress(BaseContainerHandle handle, int flag, long pageno) throws StandardException(Code)



getPageForInsert
abstract protected BasePage getPageForInsert(BaseContainerHandle handle, int flag) throws StandardException(Code)
Get a potentially suitable page for insert and latch it.
exception:
  StandardException - Standard Cloudscape error policy



getReusableRecordIdSequenceNumber
abstract public long getReusableRecordIdSequenceNumber()(Code)
Get the reusable RecordId sequence number for the container. This sequence number should be incremented every time there is an operation which may cause RecorIds to be reused. This method can be used by clients to check if a RecordId they obtained is still guaranteed to be valid. If the sequence number has changed, the RecordId may have been reused for another row. sequence number for reusable RecordId



getSegmentId
public long getSegmentId()(Code)



getSpaceInfo
abstract protected SpaceInfo getSpaceInfo(BaseContainerHandle handle) throws StandardException(Code)
Get information about space used by the container.



incrementReusableRecordIdSequenceNumber
abstract protected void incrementReusableRecordIdSequenceNumber()(Code)
Increment the reusable RecordId sequence number.



isReusableRecordId
protected boolean isReusableRecordId()(Code)



latchPage
protected BasePage latchPage(BaseContainerHandle handle, BasePage foundPage, boolean wait) throws StandardException(Code)



letGo
protected void letGo(BaseContainerHandle handle)(Code)
Discontinue use of this container. Note that the unlockContainer call made from this method may not release any locks. The container lock may be held until the end of the transaction.



lockAttributes
public boolean lockAttributes(int flag, Hashtable attributes)(Code)



lockEvent
public void lockEvent(Latch lockInfo)(Code)



lockerAlwaysCompatible
public boolean lockerAlwaysCompatible()(Code)



logCreateContainerInfo
abstract protected ByteArray logCreateContainerInfo() throws StandardException(Code)
Log all information on the container creation necessary to recreate teh container during a load tran.
exception:
  StandardException - Cloudscape Standard error policy



newPage
abstract protected BasePage newPage(BaseContainerHandle userhandle, RawTransaction t, BaseContainerHandle allocHandle, boolean isOverflow) throws StandardException(Code)
Create a new page in the container.
exception:
  StandardException - Standard Cloudscape error policy



preDirty
abstract protected void preDirty(boolean preDirtyOn)(Code)
The container is about to be modified. Loggable actions use this to make sure the container gets cleaned if a checkpoint is taken after any log record is sent to the log stream but before the container is actually dirtied.



prepareForBulkLoad
abstract protected void prepareForBulkLoad(BaseContainerHandle handle, int numPage)(Code)
The container will be grown vastly, prepare for it.



reCreatePageForRedoRecovery
abstract protected BasePage reCreatePageForRedoRecovery(BaseContainerHandle handle, int pageFormat, long pageNumber, long pageOffset) throws StandardException(Code)
ReCreate a page for rollforward recovery.

During redo recovery it is possible for the system to try to redo the creation of a page (ie. going from non-existence to version 0). It first trys to read the page from disk, but a few different types of errors can occur: o the page does not exist at all on disk, this can happen during rollforward recovery applied to a backup where the file was copied and the page was added to the file during the time frame of the backup but after the physical file was copied. o space in the file exists, but it was never initalized. This can happen if you happen to crash at just the right moment during the allocation process. Also on some OS's it is possible to read from a part of the file that was not ever written - resulting in garbage from the store's point of view (often the result is all 0's). All these errors are easy to recover from as the system can easily create a version 0 from scratch and write it to disk. Because the system does not sync allocation of data pages, it is also possible at this point that whlie writing the version 0 to disk to create it we may encounter an out of disk space error (caught in this routine as a StandardException from the create() call. We can't recovery from this without help from outside, so the caught exception is nested and a new exception thrown which the recovery system will output to the user asking them to check their disk for space/errors. The arguments passed in need to be sufficient for the page cache to materialize a brand new page and write it to disk.
exception:
  StandardException - Standard exception policy.




removeContainer
abstract protected void removeContainer(LogInstant instant, boolean leaveStub) throws StandardException(Code)
Remove the container and reclaim its space. Once executed, this operation cannot be undone - as opposed to dropContainer which only marks the container as dropped and can be rolled back.
This operation should only be called by post commit clean up
Parameters:
  leaveStub - if true, leave a stub. If false, remove everything
See Also:   org.apache.derby.iapi.store.raw.data.RawContainerHandle.removeContainer
exception:
  StandardException - Standard Cloudscape error policy



removePage
protected void removePage(BaseContainerHandle handle, BasePage page) throws StandardException(Code)
Remove a page from this container. The page will be unlatched by this routine before it returns. Unlike addPage, this method done as part of the user transaction. The removed page is not usable by anyone until the user transaction comits. If the user transaction rolls back, the removed page is un-removed.
MT - thread aware -
Parameters:
  handle - the container handle that has opened the container and latched the page
Parameters:
  page - the latched page that is to be deallocated
exception:
  StandardException - Standard Cloudscape error policy



requestCompatible
public boolean requestCompatible(Object requestedQualifier, Object grantedQualifier)(Code)



setCommittedDropState
protected void setCommittedDropState(boolean isCommittedDrop)(Code)



setDroppedState
protected void setDroppedState(boolean isDropped)(Code)
Set the container's dropped state



setEstimatedRowCount
abstract public void setEstimatedRowCount(long count, int flag) throws StandardException(Code)

See Also:   ContainerHandle.setEstimatedRowCount
exception:
  StandardException - Standard Cloudscape error policy



setReusableRecordIdState
protected void setReusableRecordIdState(boolean isReusableRecordId)(Code)



truncate
protected void truncate(BaseContainerHandle handle) throws StandardException(Code)



truncatePages
abstract protected void truncatePages(long lastValidPagenum) throws StandardException(Code)



unlockEvent
public void unlockEvent(Latch lockInfo)(Code)



use
protected boolean use(BaseContainerHandle handle, boolean forUpdate, boolean droppedOK) throws StandardException(Code)
Lock the container and mark the container as in-use by this container handle.
Parameters:
  droppedOK - if true, use this container even if it is dropped., true if the container can be used, false if it has been droppedsince the lock was requested and droppedOK is not true.
exception:
  StandardException - I cannot be opened for update.



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)

w_w_w___.__j_a___va__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.