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

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

public abstract class BridgeUpgrade
extends Thread

Base abstract class that implements the upgrade procedure from an "old style" RewsultSet to a new gRS2 IBuffer. 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  org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator locator
          The locator of the ResultSet input that needs to be upgraded
protected  Class<org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordInputClass
          The type of records that are moved with the ResultSet input
protected  Class<GCubeRecord> recordOutputClass
          The type of records to be produced in the output
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BridgeUpgrade()
           
 
Method Summary
abstract  void doUpgrade()
          Iterate over the input, produce the output and store it in the output writer
abstract  URI getLocator()
          Retrieves the locator of the create IBuffer
abstract  Logger getLogger()
          The logger defined by the extending class to use the same logger
protected  GCubeRecord getRecord(org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase record)
          Instantiates the appropriate output record and populates it through the provided record
abstract  void initialize()
          Perform any initialization needed before the upgrade begins
 void run()
           
 void setLocator(org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator locator)
          Sets the RSLocator pointing to the input ResultSet
 void setRecordInputClass(Class<org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordClass)
          Sets the type of records that are moved with the ResultSet input
 void setRecordOutputClass(Class<GCubeRecord> recordClass)
          Sets the type of records to be produced in the output
 URI upgrade()
          Perform the upgrade.
 
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 org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator locator
The locator of the ResultSet input that needs to be upgraded


recordInputClass

protected Class<org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordInputClass
The type of records that are moved with the ResultSet input


recordOutputClass

protected Class<GCubeRecord> recordOutputClass
The type of records to be produced in the output

Constructor Detail

BridgeUpgrade

public BridgeUpgrade()
Method Detail

upgrade

public URI upgrade()
            throws GCubeBridgeException
Perform the upgrade. 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 locator URI of the created gRS2 IBuffer
Throws:
GCubeBridgeException - The upgrade could not be completed

setLocator

public void setLocator(org.gcube.common.searchservice.searchlibrary.rsclient.elements.RSLocator locator)
Sets the RSLocator pointing to the input ResultSet

Parameters:
locator - the locator

setRecordInputClass

public void setRecordInputClass(Class<org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase> recordClass)
Sets the type of records that are moved with the ResultSet input

Parameters:
recordClass - the type of record input

setRecordOutputClass

public void setRecordOutputClass(Class<GCubeRecord> recordClass)
Sets the type of records to be produced in the output

Parameters:
recordClass - the type of record output

getRecord

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

Parameters:
record - the record to upgrade
Returns:
the new upgraded record
Throws:
GCubeBridgeException - The record upgrade was not possible

doUpgrade

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

Throws:
GCubeBridgeException - the upgrade could not be completed

initialize

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

Throws:
GCubeBridgeException - the initialization could not be completed

getLocator

public abstract URI getLocator()
                        throws GCubeBridgeException
Retrieves the locator of the create IBuffer

Returns:
the locator URI
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.