gr.uoa.di.madgik.searchlibrary.operatorlibrary.merge
Class MergeOp

java.lang.Object
  extended by gr.uoa.di.madgik.searchlibrary.operatorlibrary.merge.MergeOp

public class MergeOp
extends Object

Operator class used to create a merged ResultSet output from the contents of an array of input ResultSet

Author:
UoA

Field Summary
static int BufferCapacityDef
          The default capacity of the RecordWriters and, if applicable, of all IRecordReaders' buffers
static OperationMode OperationModeDef
          The default operation mode.
static String RankFieldNameDef
          The default name of the field which contains the record rank.
static long TimeoutDef
          The default timeout used by the IRecordWriter and all IRecordReaders.
static TimeUnit TimeUnitDef
          The default timeout unit used by the RecordWriter and all IRecordReaders.
 
Constructor Summary
MergeOp(URI[] locators, OperationMode operationMode, long timeout, TimeUnit timeUnit, int bufferCapacity, StatsContainer stats)
          Creates a new MergeOp with configurable operation mode and timeout
MergeOp(URI[] locators, OperationMode operationMode, long timeout, TimeUnit timeUnit, StatsContainer stats)
          Creates a new MergeOp with configurable operation mode and timeout
MergeOp(URI[] locators, OperationMode operationMode, StatsContainer stats)
          Creates a new MergeOp with configurable operation mode and the default timeout used both for readers and the writer
MergeOp(URI[] locators, StatsContainer stats)
          Creates a new MergeOp with the default operation mode and the default timeout used both for readers and the writer
 
Method Summary
 URI compute()
          Performs the merging operation
 void setQuery(String query)
           
 void setRankFieldName(String rankFieldName)
          Sets the name of the field which contains the record rank Used only if operationMode is set to OperationMode.Sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OperationModeDef

public static final OperationMode OperationModeDef
The default operation mode. Currently set to OperationMode.FIFO


TimeoutDef

public static final long TimeoutDef
The default timeout used by the IRecordWriter and all IRecordReaders. Currently set to 60.

See Also:
Constant Field Values

TimeUnitDef

public static final TimeUnit TimeUnitDef
The default timeout unit used by the RecordWriter and all IRecordReaders. The current default unit is seconds.


BufferCapacityDef

public static final int BufferCapacityDef
The default capacity of the RecordWriters and, if applicable, of all IRecordReaders' buffers

See Also:
Constant Field Values

RankFieldNameDef

public static final String RankFieldNameDef
The default name of the field which contains the record rank. Used if operationMode is set to OperationMode.Sort

See Also:
Constant Field Values
Constructor Detail

MergeOp

public MergeOp(URI[] locators,
               StatsContainer stats)
Creates a new MergeOp with the default operation mode and the default timeout used both for readers and the writer

Parameters:
locators - The locators of the inputs that will be merged
stats - Statistics

MergeOp

public MergeOp(URI[] locators,
               OperationMode operationMode,
               StatsContainer stats)
Creates a new MergeOp with configurable operation mode and the default timeout used both for readers and the writer

Parameters:
locators - The locators of the inputs that will be merged
operationMode - The operation mode. One of OperationMode.FIFO and OperationMode.FirstAvailable
stats - Statistics

MergeOp

public MergeOp(URI[] locators,
               OperationMode operationMode,
               long timeout,
               TimeUnit timeUnit,
               StatsContainer stats)
Creates a new MergeOp with configurable operation mode and timeout

Parameters:
locators - The locators of the inputs that will be merged
operationMode - The operation mode. One of OperationMode.FIFO and OperationMode.FirstAvailable
timeout - The timeout that will be used by the RecordWriter and all ForwardReaders
timeUnit - The timeout unit that will be used by the RecordWriter and all ForwardReaders
stats - Statistics

MergeOp

public MergeOp(URI[] locators,
               OperationMode operationMode,
               long timeout,
               TimeUnit timeUnit,
               int bufferCapacity,
               StatsContainer stats)
Creates a new MergeOp with configurable operation mode and timeout

Parameters:
locators - The locators of the inputs that will be merged
operationMode - The operation mode. One of OperationMode.FIFO and OperationMode.FirstAvailable
timeout - The timeout that will be used by the RecordWriter and all ForwardReaders
timeUnit - The timeout unit that will be used by the RecordWriter and all ForwardReaders
bufferCapacity - The capacity of the buffer which will be used by the RecordWriter and all ForwardReaders (if applicable)
stats - Statistics
Method Detail

setRankFieldName

public void setRankFieldName(String rankFieldName)
Sets the name of the field which contains the record rank Used only if operationMode is set to OperationMode.Sort

Parameters:
rankFieldName - The name of the field which contains the record rank

setQuery

public void setQuery(String query)

compute

public URI compute()
            throws Exception
Performs the merging operation

Returns:
The locator of the merged result set
Throws:
Exception - An unrecoverable for the operation error ocurred


Copyright © 2013. All Rights Reserved.