org.egothor.dir
Class TankerImpl

java.lang.Object
  extended by org.egothor.dir.Group
      extended by org.egothor.dir.Tanker
          extended by org.egothor.dir.TankerImpl
All Implemented Interfaces:
Resolver<CachedQuery,CachedResult>, Barrel, BarrelWriter
Direct Known Subclasses:
TankerImplSecure

public class TankerImpl
extends Tanker

This object encapsulates core Tanker structure with some routines which make the life of a programmer easier.

Author:
Leo Galambos

Field Summary
 
Fields inherited from class org.egothor.dir.Group
cache
 
Constructor Summary
TankerImpl()
           
 
Method Summary
 void append(BarrelReader a)
          Add the given Barrel to this Tanker.
 void close()
          Close this Tanker.
 void commit()
          Save the state of the tanker object.
protected  void commitEmit(int recordsx4, long[] record4)
           
protected  void commitEmitEnd()
           
 void destroy()
          Description of the Method
 DocumentData expandDocMetadata(DocumentData ofBarrel, Token[] interest)
          Retrives the document data, but restrict the data block to the part relevant to some tokens of our interest.
 void initializeTanker(java.lang.String indexDir, DataRepository repo, boolean useBerkeleyGP, boolean MTE, int capacity)
          Init a tanker with Egothor dynamizer.
 void initializeTanker(java.lang.String indexDir, DataRepository repo, boolean useBerkeleyGP, boolean MTE, int capacity, int mergeFactor)
          Init a tanker with Standard dynamizer.
 java.util.Properties loadState()
          Read properties of the Tanker
protected  boolean removeDoc(GlobalPosition position)
           
 boolean removeDoc(long gid)
          Remove the document with the given ID and return whether the operation was successful.
 
Methods inherited from class org.egothor.dir.Tanker
elements, finalize, getRootVersionID, initialize, isDirty, optimize
 
Methods inherited from class org.egothor.dir.Group
deleted, expand, forEach, getBitmap, getCache, getCWI, getIListMeta, getMeta, initialize, initializeCache, initializeCache, initializeCache, initializeCache, iterate, open, openIList, query, query, resolve, setBitmap, size
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TankerImpl

public TankerImpl()
Method Detail

initializeTanker

public void initializeTanker(java.lang.String indexDir,
                             DataRepository repo,
                             boolean useBerkeleyGP,
                             boolean MTE,
                             int capacity)
                      throws java.io.IOException,
                             com.sleepycat.db.DatabaseException
Init a tanker with Egothor dynamizer.

Parameters:
indexDir -
repo -
useBerkeleyGP -
MTE -
capacity -
Throws:
java.io.IOException
DatabaseException

initializeTanker

public void initializeTanker(java.lang.String indexDir,
                             DataRepository repo,
                             boolean useBerkeleyGP,
                             boolean MTE,
                             int capacity,
                             int mergeFactor)
                      throws java.io.IOException,
                             com.sleepycat.db.DatabaseException
Init a tanker with Standard dynamizer.

Parameters:
indexDir -
repo -
useBerkeleyGP -
MTE -
capacity -
mergeFactor -
Throws:
java.io.IOException
DatabaseException

append

public void append(BarrelReader a)
Description copied from class: Tanker
Add the given Barrel to this Tanker.

Specified by:
append in interface BarrelWriter
Overrides:
append in class Tanker
Parameters:
a - the Barrel to add

removeDoc

public boolean removeDoc(long gid)
Description copied from class: Group
Remove the document with the given ID and return whether the operation was successful.

Specified by:
removeDoc in interface Barrel
Overrides:
removeDoc in class Group
Parameters:
gid - the document to remove
Returns:
true if the removal was successful, false otherwise

removeDoc

protected boolean removeDoc(GlobalPosition position)

loadState

public java.util.Properties loadState()
                               throws java.io.IOException
Read properties of the Tanker

Parameters:
p - The properties
Returns:
LastModified of the state file, 0L on any error
Throws:
java.io.IOException

expandDocMetadata

public DocumentData expandDocMetadata(DocumentData ofBarrel,
                                      Token[] interest)
Description copied from class: Group
Retrives the document data, but restrict the data block to the part relevant to some tokens of our interest. Full data block is retrieved if none interest is specified.

Specified by:
expandDocMetadata in class Tanker

commit

public void commit()
Save the state of the tanker object.

Specified by:
commit in interface Barrel
Overrides:
commit in class Tanker

commitEmit

protected void commitEmit(int recordsx4,
                          long[] record4)
                   throws java.io.IOException
Overrides:
commitEmit in class Tanker
Throws:
java.io.IOException

commitEmitEnd

protected void commitEmitEnd()
                      throws java.io.IOException
Overrides:
commitEmitEnd in class Tanker
Throws:
java.io.IOException

destroy

public void destroy()
Description of the Method

Specified by:
destroy in interface Barrel
Overrides:
destroy in class Tanker

close

public void close()
Description copied from class: Tanker
Close this Tanker.

Specified by:
close in interface Barrel
Specified by:
close in interface BarrelWriter
Overrides:
close in class Tanker