gr.uoa.di.madgik.grs.bridge
Class BridgeDowngrade

java.lang.Object
  extended by java.lang.Thread
      extended by gr.uoa.di.madgik.grs.bridge.BridgeDowngrade
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
XMLDowngrade

public abstract class BridgeDowngrade
extends Thread

Base abstract class that implements the downgrade procedure from a new gRS2 IBuffer to an "old style" RewsultSet. The class defines hooks that need to be implemented by extenders that will handle with the specific type of ResultSet type

Author:
gpapanikos

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  URI locator
          The locator of the gRS2 IBuffer input that needs to be downgraded
protected  Class<? extends org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordClass
          The type of records that to be produced in the ResultSet output
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BridgeDowngrade()
           
 
Method Summary
abstract  void doDowngrade()
          Iterate over the input, produce the output and store it in the output writer
 org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator downgrade()
          Perform the downgrade.
abstract  org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator getLocator()
          Retrieves the locator of the create ResultSet
abstract  Logger getLogger()
          The logger defined by the extending class to use the same logger
protected  org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase getRecord(GCubeRecord record)
          Instantiates the appropriate output record and populates it through the provided record
abstract  void initialize()
          Perform any initialization needed before the downgrade begins
 void run()
           
 void setLocator(URI locator)
          Set the URI locator of the gRS2 input IBuffer to downgrade
 void setRecordClass(Class<? extends org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordClass)
          Sets the type of records that to be produced in the ResultSet output
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

locator

protected URI locator
The locator of the gRS2 IBuffer input that needs to be downgraded


recordClass

protected Class<? extends org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordClass
The type of records that to be produced in the ResultSet output

Constructor Detail

BridgeDowngrade

public BridgeDowngrade()
Method Detail

downgrade

public org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator downgrade()
                                                                                   throws GCubeBridgeException
Perform the downgrade. After all the configuration parameters are set, this is the only method the client needs to invoke. The operation takes pace in the background

Returns:
The RS locator of the created ResultSet
Throws:
GCubeBridgeException - The downgrade could not be completed

setLocator

public void setLocator(URI locator)
Set the URI locator of the gRS2 input IBuffer to downgrade

Parameters:
locator - the locator

setRecordClass

public void setRecordClass(Class<? extends org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordClass)
Sets the type of records that to be produced in the ResultSet output

Parameters:
recordClass - the record type to produce

getRecord

protected org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase getRecord(GCubeRecord record)
                                                                                               throws GCubeBridgeException
Instantiates the appropriate output record and populates it through the provided record

Parameters:
record - the record to downgrade
Returns:
the new downgraded record
Throws:
GCubeBridgeException - the record downgrade could not be completed

doDowngrade

public abstract void doDowngrade()
                          throws GCubeBridgeException
Iterate over the input, produce the output and store it in the output writer

Throws:
GCubeBridgeException - the downgrade could not be completed

initialize

public abstract void initialize()
                         throws GCubeBridgeException
Perform any initialization needed before the downgrade begins

Throws:
GCubeBridgeException - the initialization could not be completed

getLocator

public abstract org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator getLocator()
                                                                                             throws GCubeBridgeException
Retrieves the locator of the create ResultSet

Returns:
the RSlocator
Throws:
GCubeBridgeException - the locator could not be retrieved

getLogger

public abstract Logger getLogger()
The logger defined by the extending class to use the same logger

Returns:
the logger

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread


Copyright © 2014. All Rights Reserved.