org.matalon.pagerankhits.servlet
Class GetRoutineServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.matalon.pagerankhits.servlet.AbstractServlet
              extended byorg.matalon.pagerankhits.servlet.GetRoutineServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class GetRoutineServlet
extends AbstractServlet

This servlet is responsible for returning the relevant MATLAB routine, according to the given request parameters.

Author:
Yonatan Matalon
See Also:
Serialized Form

Field Summary
static java.lang.String HITS_MATRIX_ROUTINE_FILE_NAME
           
static java.lang.String HITS_MODIFIED_MATRIX_FILE_NAME
           
static java.lang.String HITS_MODIFIED_ROUTINE_FILE_NAME
           
static java.lang.String HITS_ROUTINE_FILE_NAME
           
static java.lang.String PAGERANK_ROUTINE_FILE_NAME
           
static java.lang.String REQ_PARAM_COLS_START
           
static java.lang.String REQ_PARAM_ROUTINE_FILE_NAME
           
static java.lang.String REQ_PARAM_ROWS_START
           
static java.lang.String SEPARATOR_CONTENT1
           
static java.lang.String SEPARATOR_CONTENT2
           
static java.lang.String SEPARATOR_END_HITS_VECTOR
           
static java.lang.String SEPARATOR_END_MODIFIED_HITS_VECTOR
           
static java.lang.String SEPARATOR_END_PAGERANK_VECTOR
           
static java.lang.String SEPARATOR_START_HITS_VECTOR
           
static java.lang.String SEPARATOR_START_MODIFIED_HITS_VECTOR
           
static java.lang.String SEPARATOR_START_PAGERANK_VECTOR
           
private static long serialVersionUID
           
 
Fields inherited from class org.matalon.pagerankhits.servlet.AbstractServlet
PARAM_NAME_STATUS, PARAM_VALUE_STATUS_ERROR, PARAM_VALUE_STATUS_IDLE, PARAM_VALUE_STATUS_RUNNING, PARAM_VALUE_STATUS_SUCCESS, RECENTLY_MODIFIED_INTERVAL
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
GetRoutineServlet()
           
 
Method Summary
private  java.util.Vector getUrls(Graph webGraph, boolean addVirtualNode)
           
protected  void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
private  void writeHitsMatrixRoutine(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean modified)
          Writes the requested HITS matrix routine to the OutputStream of the given response.
private  void writeHitsRoutine(javax.servlet.http.HttpServletResponse response, boolean modified)
          Writes the requested Kleinberg's HITS routine to the PrintWriter of the given response.
private  void writePageRankRoutine(javax.servlet.http.HttpServletResponse response)
          Writes the requested PageRank routine to the PrintWriterof the given response.
 
Methods inherited from class org.matalon.pagerankhits.servlet.AbstractServlet
printErrorMessage, printStandByMessage
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

REQ_PARAM_ROUTINE_FILE_NAME

public static final java.lang.String REQ_PARAM_ROUTINE_FILE_NAME
See Also:
Constant Field Values

PAGERANK_ROUTINE_FILE_NAME

public static final java.lang.String PAGERANK_ROUTINE_FILE_NAME
See Also:
Constant Field Values

HITS_ROUTINE_FILE_NAME

public static final java.lang.String HITS_ROUTINE_FILE_NAME
See Also:
Constant Field Values

HITS_MODIFIED_ROUTINE_FILE_NAME

public static final java.lang.String HITS_MODIFIED_ROUTINE_FILE_NAME
See Also:
Constant Field Values

HITS_MATRIX_ROUTINE_FILE_NAME

public static final java.lang.String HITS_MATRIX_ROUTINE_FILE_NAME
See Also:
Constant Field Values

HITS_MODIFIED_MATRIX_FILE_NAME

public static final java.lang.String HITS_MODIFIED_MATRIX_FILE_NAME
See Also:
Constant Field Values

REQ_PARAM_ROWS_START

public static final java.lang.String REQ_PARAM_ROWS_START
See Also:
Constant Field Values

REQ_PARAM_COLS_START

public static final java.lang.String REQ_PARAM_COLS_START
See Also:
Constant Field Values

SEPARATOR_START_PAGERANK_VECTOR

public static final java.lang.String SEPARATOR_START_PAGERANK_VECTOR
See Also:
Constant Field Values

SEPARATOR_END_PAGERANK_VECTOR

public static final java.lang.String SEPARATOR_END_PAGERANK_VECTOR
See Also:
Constant Field Values

SEPARATOR_START_HITS_VECTOR

public static final java.lang.String SEPARATOR_START_HITS_VECTOR
See Also:
Constant Field Values

SEPARATOR_END_HITS_VECTOR

public static final java.lang.String SEPARATOR_END_HITS_VECTOR
See Also:
Constant Field Values

SEPARATOR_START_MODIFIED_HITS_VECTOR

public static final java.lang.String SEPARATOR_START_MODIFIED_HITS_VECTOR
See Also:
Constant Field Values

SEPARATOR_END_MODIFIED_HITS_VECTOR

public static final java.lang.String SEPARATOR_END_MODIFIED_HITS_VECTOR
See Also:
Constant Field Values

SEPARATOR_CONTENT1

public static final java.lang.String SEPARATOR_CONTENT1
See Also:
Constant Field Values

SEPARATOR_CONTENT2

public static final java.lang.String SEPARATOR_CONTENT2
See Also:
Constant Field Values
Constructor Detail

GetRoutineServlet

public GetRoutineServlet()
Method Detail

service

protected void service(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

writePageRankRoutine

private void writePageRankRoutine(javax.servlet.http.HttpServletResponse response)
Writes the requested PageRank routine to the PrintWriterof the given response.

Parameters:
response -

writeHitsRoutine

private void writeHitsRoutine(javax.servlet.http.HttpServletResponse response,
                              boolean modified)
Writes the requested Kleinberg's HITS routine to the PrintWriter of the given response. If modified is true then our modified version to Kleinberg's HITS algorithm shall be written, otherwise the original version shall be written.

Parameters:
response -
modified -

writeHitsMatrixRoutine

private void writeHitsMatrixRoutine(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    boolean modified)
Writes the requested HITS matrix routine to the OutputStream of the given response. If the value of modified is true then the _modified_ matrix will be written, otherwise the _original_ matrix will be written.

Parameters:
request -
response -
modified -

getUrls

private java.util.Vector getUrls(Graph webGraph,
                                 boolean addVirtualNode)
Parameters:
webGraph -
addVirtualNode -
Returns:
Returns all Graph's URLs, sorted by the order they were visited by the crawler. If addVirtualNode is true, then the returned URLs list shall include an additional virtual URL.