SDARTS

edu.columbia.cs.sdarts.dbselection
Class DBSelectionServer

java.lang.Object
  |
  +--edu.columbia.cs.sdarts.dbselection.DBSelectionServer

public class DBSelectionServer
extends java.lang.Object

this class runs under soap server, export method processInput(String type, String input), where type can be search: to query the rankings of available collections on given term add: to add a sdarts server with optional collection names; or remove: to remove a collection from given sdarts server

when given a term(s) to query, by default, a CORI ranking score for each collection that has been indexed is calculated, and returned within a XML string representation of a SubcolInfo object. Other ranking algorithm can be specified by giving algorithm=algorithm-name at the beginning of the term Currently, only CORI is supported.

when given command add or remove, with appropriate sdarts server url and collection names(s), the collection(s) will be added into (removed from) the in-memory indices

a sample code for calling to the dbselection server might be like this:

  Call call = new Call();
  call.setTargetObjectURI ("urn:db-selection-server");
  call.setMethodName ("processInput");
  call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC );
  Vector params = new Vector();
  params.addElement (new Parameter("type", type.getClass(), type, null));
  params.addElement (new Parameter("input", input.getClass(), input, null));
  call.setParams (params);
  Response resp = call.invoke(new URL("http://persival.cs.columbia.edu:8181/soap/servlet/rpcrouter"),"" );
  if (resp.generatedFault ()) {
   Fault fault = resp.getFault ();
   System.out.println ("Ouch, the call failed: ");
   System.out.println ("  Fault Code   = " + fault.getFaultCode ());
   System.out.println ("  Fault String = " + fault.getFaultString ());
   Vector details = fault.getDetailEntries();
   Enumeration detailsEnum = details.elements();
   while(detailsEnum.hasMoreElements())
    System.out.println(detailsEnum.nextElement().toString());
  }
  else {
    byte[] retval = (byte []) resp.getReturnValue().getValue();
System.out.println(new String(retval));
 }
 

See Also:
SoapClient

Field Summary
 java.lang.String defaultSdartsServerURL
           
 java.util.Vector indices
           
 
Constructor Summary
DBSelectionServer()
          default constructor, initialize the index vector, and index collections from the default sdarts server
 
Method Summary
 java.lang.String add(java.lang.String sdartsServerURL, java.lang.String[] collections)
          add one or more collections(s) for sdarts server at sdartsServerURL into the indecies in memory
static void main(java.lang.String[] args)
           
 byte[] processInput(java.lang.String type, java.lang.String input)
          given an command type, an input string input, returns a string
 java.lang.String search(java.lang.String input)
          given a string input, calculate the CORI ranking score for all available collections by calling processInput(String).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indices

public java.util.Vector indices

defaultSdartsServerURL

public java.lang.String defaultSdartsServerURL
Constructor Detail

DBSelectionServer

public DBSelectionServer()
default constructor, initialize the index vector, and index collections from the default sdarts server
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception

search

public java.lang.String search(java.lang.String input)
given a string input, calculate the CORI ranking score for all available collections by calling processInput(String).

This method is synchronized so that search and updating index will not conflict each other when accessing the in-memory index.

Parameters:
input - the input terms to search for
Returns:
a string representation of search result, which is an SubcolInfo object

add

public java.lang.String add(java.lang.String sdartsServerURL,
                            java.lang.String[] collections)
add one or more collections(s) for sdarts server at sdartsServerURL into the indecies in memory
Parameters:
sdartsServerURL - the sdarts server url for the server who hosts these collections
collections - the collection names
Returns:
a message indicates whether the adding succeeded or not

processInput

public byte[] processInput(java.lang.String type,
                           java.lang.String input)
given an command type, an input string input, returns a string

the command can be one of the following values:


SDARTS

Sdarts Homepage