org.apache.hadoop.hive.hwi
Class HWISessionItem

java.lang.Object
  extended by org.apache.hadoop.hive.hwi.HWISessionItem
All Implemented Interfaces:
Comparable<HWISessionItem>, Runnable

public class HWISessionItem
extends Object
implements Runnable, Comparable<HWISessionItem>

HWISessionItem can be viewed as a wrapper for a Hive shell. With it the user has a session on the web server rather then in a console window.


Nested Class Summary
static class HWISessionItem.WebSessionItemStatus
          Represents the state a session item can be in.
 
Field Summary
protected static org.apache.commons.logging.Log l4j
           
 Thread runnable
           
 
Constructor Summary
HWISessionItem(HWIAuth auth, String sessionName)
          Creates an instance of WebSessionItem, sets status to NEW.
 
Method Summary
 void addQuery(String query)
          Adds a new query to the execution list.
 void clearQueries()
           
 void clientKill()
           
 void clientRenew()
          This method clears the private member variables.
 void clientStart()
          HWISessionItem is a Runnable instance.
 int compareTo(HWISessionItem other)
          to support sorting/Set.
 boolean equals(Object other)
          Uses the sessionName property to compare to sessions.
 HWIAuth getAuth()
           
 String getErrorFile()
          Currently unused.
 HiveHistoryViewer getHistoryViewer()
           
 String getHiveConfVar(HiveConf.ConfVars wanted)
          Helper function to get configuration variables.
 String getHiveConfVar(String s)
           
 String getJobTrackerURL(String jobid)
           
 List<String> getQueries()
          Returns an unmodifiable list of queries.
 List<Integer> getQueryRet()
          The HWISessionItem stores the result of each query in an array.
 ArrayList<ArrayList<String>> getResultBucket()
          gets the value for resultBucket.
 int getResultBucketMaxSize()
          returns the value for resultBucketMaxSize.
 String getResultFile()
           
 String getSessionName()
          The session name is an identifier to recognize the session.
 boolean getSSIsSilent()
          This is a chained call to SessionState.getIsSilent().
 HWISessionItem.WebSessionItemStatus getStatus()
          Used to represent to the user and other components what state the HWISessionItem is in.
protected  void killIt()
          This is a callback style function used by the HiveSessionManager.
 void removeQuery(int item)
          Removes a query from the execution list.
 void run()
           
 void runQuery()
          runQuery iterates the list of queries executing each query.
protected  void setAuth(HWIAuth auth)
           
 void setErrorFile(String errorFile)
          Currently unused.
 void setResultBucketMaxSize(int size)
          sets the value for resultBucketMaxSize.
 void setResultFile(String resultFile)
           
 void setSSIsSilent(boolean silent)
          This is a chained call to SessionState.setIsSilent().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

l4j

protected static final org.apache.commons.logging.Log l4j

runnable

public Thread runnable
Constructor Detail

HWISessionItem

public HWISessionItem(HWIAuth auth,
                      String sessionName)
Creates an instance of WebSessionItem, sets status to NEW.

Method Detail

clientStart

public void clientStart()
                 throws HWIException
HWISessionItem is a Runnable instance. Calling this method will change the status to QUERY_SET and notify(). The run method detects this and then continues processing.

Throws:
HWIException

clientKill

public void clientKill()
                throws HWIException
Throws:
HWIException

clientRenew

public void clientRenew()
                 throws HWIException
This method clears the private member variables.

Throws:
HWIException

killIt

protected void killIt()
This is a callback style function used by the HiveSessionManager. The HiveSessionManager notices this and attempts to stop the query.


getHiveConfVar

public String getHiveConfVar(HiveConf.ConfVars wanted)
                      throws HWIException
Helper function to get configuration variables.

Parameters:
wanted - a ConfVar
Returns:
Value of the configuration variable.
Throws:
HWIException

getHiveConfVar

public String getHiveConfVar(String s)
                      throws HWIException
Throws:
HWIException

getJobTrackerURL

public String getJobTrackerURL(String jobid)
                        throws HWIException
Throws:
HWIException

run

public void run()
Specified by:
run in interface Runnable

runQuery

public void runQuery()
runQuery iterates the list of queries executing each query.


setSSIsSilent

public void setSSIsSilent(boolean silent)
                   throws HWIException
This is a chained call to SessionState.setIsSilent(). Use this if you do not want the result file to have information status

Throws:
HWIException

getSSIsSilent

public boolean getSSIsSilent()
                      throws HWIException
This is a chained call to SessionState.getIsSilent().

Throws:
HWIException

compareTo

public int compareTo(HWISessionItem other)
to support sorting/Set.

Specified by:
compareTo in interface Comparable<HWISessionItem>

getHistoryViewer

public HiveHistoryViewer getHistoryViewer()
                                   throws HWIException
Returns:
the HiveHistoryViewer for the session
Throws:
HWIException

equals

public boolean equals(Object other)
Uses the sessionName property to compare to sessions.

Overrides:
equals in class Object
Returns:
true if sessionNames are equal false otherwise

getResultFile

public String getResultFile()

setResultFile

public void setResultFile(String resultFile)

getSessionName

public String getSessionName()
The session name is an identifier to recognize the session.

Returns:
the session's name

getStatus

public HWISessionItem.WebSessionItemStatus getStatus()
Used to represent to the user and other components what state the HWISessionItem is in. Certain commands can only be run when the application is in certain states.

Returns:
the current status of the session

getErrorFile

public String getErrorFile()
Currently unused.

Returns:
a String with the full path to the error file.

setErrorFile

public void setErrorFile(String errorFile)
Currently unused.

Parameters:
errorFile - the full path to the file for results.

getAuth

public HWIAuth getAuth()
Returns:
the auth

setAuth

protected void setAuth(HWIAuth auth)
Parameters:
auth - the auth to set

getQueries

public List<String> getQueries()
Returns an unmodifiable list of queries.


addQuery

public void addQuery(String query)
              throws HWIException
Adds a new query to the execution list.

Parameters:
query - query to be added to the list
Throws:
HWIException

removeQuery

public void removeQuery(int item)
                 throws HWIException
Removes a query from the execution list.

Parameters:
item - the 0 based index of the item to be removed
Throws:
HWIException

clearQueries

public void clearQueries()
                  throws HWIException
Throws:
HWIException

getResultBucketMaxSize

public int getResultBucketMaxSize()
returns the value for resultBucketMaxSize.


setResultBucketMaxSize

public void setResultBucketMaxSize(int size)
sets the value for resultBucketMaxSize.

Parameters:
size - the new size

getResultBucket

public ArrayList<ArrayList<String>> getResultBucket()
gets the value for resultBucket.


getQueryRet

public List<Integer> getQueryRet()
The HWISessionItem stores the result of each query in an array.

Returns:
unmodifiable list of return codes


Copyright © 2013 The Apache Software Foundation