| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BeeTreeFilter
A BeeTreeFilter can be supplied to a BeeTreeCompactor to allow the objects in the database to be vetted as they pass. This provides a simple solution to certain kinds of master-file update problem.
| Method Summary | |
|---|---|
 boolean | 
btfFilter(BeeTree src,
          BeeTree dest,
          BeeObject bo)
The main filter function.  | 
 boolean | 
btfShouldUnmarshal()
States whether the compactor should attempt to unmarshal the object.  | 
 boolean | 
btfSrcChanged()
States whether you might have altered the state of the source database during the last call to btfFilter (e.g. by doing a find on it.) | 
| Method Detail | 
|---|
boolean btfFilter(BeeTree src,
                  BeeTree dest,
                  BeeObject bo)
                  throws java.io.IOException
src - The source (old) BeeTree. Allows the filter to e.g. check cross-
                references to work out what to do with this one. Many applications
                will not need this capability.dest - The destination (new) BeeTree Allows the filter to e.g. add
                cross-referenced objects to the new database. Many applications
                will not need this capability. If you do insert arbitrary objects,
                make sure that you don't cause a collision with subsequent objects
                from the old database - check for these and drop them.bo - The BeeObject whose future is being considered. Note: the BeeObject
                has not been properly unmarshalled at this point. Either its marshalled
                data is sitting in a buffer, waiting for transfer, or it hasn't been
                unmrshalled at all, and its data is still in the source BeeTree. This
                depends on the return of your btfShouldUnmarshal; if this
                returns true, then the marshalled data is buffered, if false it's left
                in the source BeeTree.This is necessary because some types of BeeObject (e.g. CDBObjects) require extra context to unmarshal properly and BeeTreeCompactor cannot provide this. If you need to manipulate the object:
bo
                                your btfSrcChanged() can safely return false - although you accessed
                                the source beetree, you didn't move the object pointer.
                true to insert the (changed?) BeeObject into the new beetree,
                false to drop it. This only has an effect if
                btfShouldUnmarshal returned true - otherwise
                the filter is responsible for copying the object.
java.io.IOException - if something fatal happens. Such a throw will abort the
                compaction, leaving the old copy intact but in a temporary file, and
                the new copy incomplete and possibly corrupt. Therefore catch 'em yourself
                if you can!boolean btfSrcChanged()
btfFilter (e.g. by doing a find on it.)
        If you did, the compactor has to do a find to get back to where it was.
        Clearly it is more efficient not to do this if unnecessary, hence the
        question. If you can't tell, return true - a false positive is a minor
        efficiency issue, a false negative will corrupt the database.
true if the source beetree might have been manipulated by
                the most recent btfFilter, false if it definitely
                was not.boolean btfShouldUnmarshal()
false and have your btfFilter do it.
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||