org.egothor.duplicity.algorithm
Class TankerImplDuplicityChecker

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

public class TankerImplDuplicityChecker
extends TankerImplSecure

This object encapsulates standard TankerImplSecure and adds duplicity checking ability.

Author:
Kate�ina Dufkov�

Field Summary
protected  DuplicityChecker dc
           
 
Fields inherited from class org.egothor.dir.TankerImplSecure
localDocDB, localTanker
 
Fields inherited from class org.egothor.dir.Group
cache
 
Constructor Summary
TankerImplDuplicityChecker()
           
 
Method Summary
 void append(BarrelReader barrelReader)
          Appends a reader to this tanker.
 java.util.Set<DocumentUnitID> append(BarrelReader barrelReader, boolean omitDuplicates, boolean visualizeDuplicities, boolean printDuplicitiesToCsv)
          Appends a reader to this tanker's duplicity checker.
 void appendOnlyToDC(BarrelReader barrelReader)
           
 void close()
          Closes this tanker.
 void commit()
          Commits all the changes.
 java.util.HashMap<java.lang.Long,java.lang.Boolean> commitWithResults()
          Performes a commit and returns information about the whole process.
 void destroy()
          Description of the Method
 TankerImplSecure getDuplicatesIndex()
           
 java.lang.String getDuplicatesIndexDir()
           
 java.lang.String getDuplicityCheckingMainDir()
           
 java.lang.String getDuplicityCheckingReportDir()
           
 java.lang.String getDuplicityCheckingTempDir()
           
 boolean hasDuplicityCheckingAbility()
           
 void initializeTankerSecure(java.lang.String indexDir, DataRepository repo, boolean useBerkeleyGP, boolean MTE, int capacity, int mergeFactor, java.lang.String lockServerConfigFilename, int indexConstPeriodOfTime)
          Initializations of the tanker.
 void initializeTankerSecure(java.lang.String indexDir, DataRepository repo, boolean useBerkeleyGP, boolean MTE, int capacity, int mergeFactor, java.lang.String lockServerConfigFilename, int indexConstPeriodOfTime, long seedDC)
          Initializations of the tanker.
 boolean isDirty()
          Test whether this Tanker has been modified.
 boolean removeDoc(long id)
          Deprecated. 
 void removeDoc(long id, int revision)
           
 
Methods inherited from class org.egothor.dir.TankerImplSecure
commitEmit, deleted, elements, elementsSecure, expand, expandDocMetadata, expandDocMetadataSecure, forEach, getBitmap, getCWI, getIListMeta, getMeta, getRootVersionID, initializeTankerSecure, iterate, loadState, open, openIList, openIListSecure, openSecure, optimize, query, query, querySecure, querySecure, reloadIndex, setBitmap, size
 
Methods inherited from class org.egothor.dir.TankerImpl
commitEmitEnd, initializeTanker, initializeTanker, removeDoc
 
Methods inherited from class org.egothor.dir.Tanker
finalize, initialize
 
Methods inherited from class org.egothor.dir.Group
getCache, initialize, initializeCache, initializeCache, initializeCache, initializeCache, resolve
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dc

protected DuplicityChecker dc
Constructor Detail

TankerImplDuplicityChecker

public TankerImplDuplicityChecker()
Method Detail

initializeTankerSecure

public void initializeTankerSecure(java.lang.String indexDir,
                                   DataRepository repo,
                                   boolean useBerkeleyGP,
                                   boolean MTE,
                                   int capacity,
                                   int mergeFactor,
                                   java.lang.String lockServerConfigFilename,
                                   int indexConstPeriodOfTime)
                            throws java.io.IOException,
                                   com.sleepycat.db.DatabaseException
Description copied from class: TankerImplSecure
Initializations of the tanker. Parameter lockServerConfigFilename specifies pathname to a config file for lock server. If it is null, then file locking is used. It must be in java.util.Properties format.

Overrides:
initializeTankerSecure in class TankerImplSecure
Throws:
java.io.IOException
com.sleepycat.db.DatabaseException

initializeTankerSecure

public void initializeTankerSecure(java.lang.String indexDir,
                                   DataRepository repo,
                                   boolean useBerkeleyGP,
                                   boolean MTE,
                                   int capacity,
                                   int mergeFactor,
                                   java.lang.String lockServerConfigFilename,
                                   int indexConstPeriodOfTime,
                                   long seedDC)
                            throws java.io.IOException,
                                   com.sleepycat.db.DatabaseException
Initializations of the tanker. Parameter lockServerConfigFilename specifies pathname to a config file for lock server. If it is null, then file locking is used. It must be in java.util.Properties format.

Parameters:
indexDir -
repo -
useBerkeleyGP -
MTE -
capacity -
mergeFactor -
lockServerConfigFilename -
indexConstPeriodOfTime -
seedDC - seed to be used for the duplicity checker
Throws:
java.io.IOException
com.sleepycat.db.DatabaseException

append

public java.util.Set<DocumentUnitID> append(BarrelReader barrelReader,
                                            boolean omitDuplicates,
                                            boolean visualizeDuplicities,
                                            boolean printDuplicitiesToCsv)
Appends a reader to this tanker's duplicity checker.


append

public void append(BarrelReader barrelReader)
Description copied from class: TankerImplSecure
Appends a reader to this tanker.

Specified by:
append in interface BarrelWriter
Overrides:
append in class TankerImplSecure
Parameters:
barrelReader - the Barrel to add

appendOnlyToDC

public void appendOnlyToDC(BarrelReader barrelReader)

commit

public void commit()
Description copied from class: TankerImplSecure
Commits all the changes.

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

commitWithResults

public java.util.HashMap<java.lang.Long,java.lang.Boolean> commitWithResults()
Description copied from class: TankerImplSecure
Performes a commit and returns information about the whole process.

Overrides:
commitWithResults in class TankerImplSecure
Returns:
Mapping between document's uid and its commit result.

destroy

public void destroy()
Description copied from class: TankerImpl
Description of the Method

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

close

public void close()
Description copied from class: TankerImplSecure
Closes this tanker.

In case of muliple thread sharing one instance of the tanker this method should be used everytime an TankerImplSecure.openSecure() method is called and synchronized by user as follows:

 synchronized (tanker) {
    try {
       tanker.openSecure();
       ...
    } finally {
       tanker.close();
    }
 }
 

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

isDirty

public boolean isDirty()
Description copied from class: Tanker
Test whether this Tanker has been modified.

Overrides:
isDirty in class TankerImplSecure
Returns:
true if it has, false otherwise

hasDuplicityCheckingAbility

public boolean hasDuplicityCheckingAbility()

getDuplicityCheckingMainDir

public java.lang.String getDuplicityCheckingMainDir()

getDuplicityCheckingReportDir

public java.lang.String getDuplicityCheckingReportDir()

getDuplicityCheckingTempDir

public java.lang.String getDuplicityCheckingTempDir()

getDuplicatesIndexDir

public java.lang.String getDuplicatesIndexDir()

getDuplicatesIndex

public TankerImplSecure getDuplicatesIndex()

removeDoc

@Deprecated
public boolean removeDoc(long id)
Deprecated. 

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 TankerImplSecure
Parameters:
id - the document to remove
Returns:
true if the removal was successful, false otherwise

removeDoc

public void removeDoc(long id,
                      int revision)
Overrides:
removeDoc in class TankerImplSecure
Parameters:
id - uid of the document
revision - revision of the document