org.netbeans.mdr.persistence.btreeimpl.btreestorage
Class BtreeMDRSource

java.lang.Object
  extended by org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeMDRSource
All Implemented Interfaces:
BtreePageSource, MofidGenerator

public class BtreeMDRSource
extends java.lang.Object
implements BtreePageSource

BtreePageSource whose pages are MOF repository objects

Version:
1.0
Author:
Dana Bergen

Constructor Summary
BtreeMDRSource(BtreeStorage storage, int pageSize)
           
 
Method Summary
 void dirtyPage(BtreePage page)
          Notify the BtreePageSource that the caller is going to modify this page.
 java.lang.String getMofidPrefix()
          Get the prefix for this repository
 long getNextMofid()
          get the next unique ID for this repository
 BtreePage getPage(byte[] pageId, Btree btree)
          Retrieve a page.
 EntryTypeInfo getPageIdInfo()
          Get an EntryTypeInfo for the datatype of this BtreePageSource's page IDs.
 int getPageIdLength()
          Returns the length of a page ID.
 int getPageSize()
          Returns the size of a page.
 BtreePage getRootPage(Btree btree)
          Retrieve the root page for this btree.
 BtreeStorage getStorage()
           
 boolean isNoPage(byte[] pageId)
          Test whether the passed-in pageId contains the special value noPageId
 BigKeyPage newBigKeyPage(Btree btree)
          Creates a new oversize-key page and returns it.
 BtreePage newPage(Btree btree)
          Creates a new page and returns it.
 void setNoPage(byte[] pageId)
          Set the passed-in pageId to contain the special value noPageId
 void unpinPage(BigKeyPage page)
          Notify the BtreePageSource that the caller is done using this page.
 void unpinPage(BtreePage page)
          Notify the BtreePageSource that the caller is done using this page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BtreeMDRSource

public BtreeMDRSource(BtreeStorage storage,
                      int pageSize)
               throws StorageException
Throws:
StorageException
Method Detail

newBigKeyPage

public BigKeyPage newBigKeyPage(Btree btree)
                         throws StorageException
Description copied from interface: BtreePageSource
Creates a new oversize-key page and returns it.

Specified by:
newBigKeyPage in interface BtreePageSource
Parameters:
btree - btree to which the page belongs
Returns:
the BigKeyPage
Throws:
StorageException

newPage

public BtreePage newPage(Btree btree)
                  throws StorageException
Description copied from interface: BtreePageSource
Creates a new page and returns it.

Specified by:
newPage in interface BtreePageSource
Parameters:
btree - btree to which the page belongs
Returns:
the BtreePage
Throws:
StorageException

getPage

public BtreePage getPage(byte[] pageId,
                         Btree btree)
                  throws StorageException
Description copied from interface: BtreePageSource
Retrieve a page.

Specified by:
getPage in interface BtreePageSource
Parameters:
pageId - byte array buffer containing pageId
btree - btree to which the page belongs
Returns:
the BtreePage
Throws:
StorageException

getRootPage

public BtreePage getRootPage(Btree btree)
                      throws StorageException
Description copied from interface: BtreePageSource
Retrieve the root page for this btree.

Specified by:
getRootPage in interface BtreePageSource
Parameters:
btree - Btree
Returns:
the root BtreePage
Throws:
StorageException

unpinPage

public void unpinPage(BtreePage page)
Description copied from interface: BtreePageSource
Notify the BtreePageSource that the caller is done using this page.

Specified by:
unpinPage in interface BtreePageSource
Parameters:
page - BtreePage

unpinPage

public void unpinPage(BigKeyPage page)
Description copied from interface: BtreePageSource
Notify the BtreePageSource that the caller is done using this page.

Specified by:
unpinPage in interface BtreePageSource
Parameters:
page - BigKeyPage

dirtyPage

public void dirtyPage(BtreePage page)
               throws StorageException
Description copied from interface: BtreePageSource
Notify the BtreePageSource that the caller is going to modify this page.

Specified by:
dirtyPage in interface BtreePageSource
Parameters:
page - BtreePage
Throws:
StorageException

getPageIdInfo

public EntryTypeInfo getPageIdInfo()
Description copied from interface: BtreePageSource
Get an EntryTypeInfo for the datatype of this BtreePageSource's page IDs.

Specified by:
getPageIdInfo in interface BtreePageSource

getPageIdLength

public int getPageIdLength()
Description copied from interface: BtreePageSource
Returns the length of a page ID.

Specified by:
getPageIdLength in interface BtreePageSource
Returns:
length of a page ID from this BtreePageSource

getPageSize

public int getPageSize()
Description copied from interface: BtreePageSource
Returns the size of a page.

Specified by:
getPageSize in interface BtreePageSource
Returns:
size of a page from this BtreePageSource

setNoPage

public void setNoPage(byte[] pageId)
Set the passed-in pageId to contain the special value noPageId

Specified by:
setNoPage in interface BtreePageSource
Parameters:
pageId - byte array to be filled in

isNoPage

public boolean isNoPage(byte[] pageId)
Test whether the passed-in pageId contains the special value noPageId

Specified by:
isNoPage in interface BtreePageSource
Returns:
true if the pageId is the null page ID, otherwise false

getNextMofid

public long getNextMofid()
get the next unique ID for this repository

Specified by:
getNextMofid in interface MofidGenerator

getMofidPrefix

public java.lang.String getMofidPrefix()
Get the prefix for this repository

Specified by:
getMofidPrefix in interface MofidGenerator

getStorage

public BtreeStorage getStorage()
Specified by:
getStorage in interface BtreePageSource


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.