Example #1
0
  /**
   * Instantiates a <code>SDARTSBean</code> and immediately connects it to the SDARTS LSP it is
   * meant to communicate with
   *
   * @param lspURL the URL of the SDARTS LSP this bean is communicating with
   * @param startsDTDURL the URL for the STARTS DTD, which is mentioned as an external parameter
   *     entity in all outputted XML
   * @param sdlipDTDURL the URL for the SDLIP DTD, which is mentioned as the primary &lt !DOCTYPE
   *     &gt for all outputted XML
   */
  public SDARTSBean(String lspURL, String startsDTDURL, String sdlipDTDURL) throws SDLIPException {
    ClientTransportModule.register(
        sdlip.SDLIP.NameServerURISchema, "sdlip.helpers.ClientCorbaTransport");
    tm = ClientTransportModule.create(lspURL);
    // tm.setDBG(new DBG (DBG.VERBOSE));
    this.startsDTDURL = startsDTDURL;
    this.sdlipDTDURL = sdlipDTDURL;

    // INITIALIZE XMLWRITER
    XMLWriter.addSystemDocType("STARTS", startsDTDURL);
    XMLWriter.addSystemDocType(STARTS.NAMESPACE_NAME + ":smeta-attributes", startsDTDURL);
    XMLWriter.addSystemDocType(STARTS.NAMESPACE_NAME + ":scontent-summary", startsDTDURL);
    XMLWriter.addSystemDocType("SearchResult", sdlipDTDURL);
    XMLWriter.addSystemDocType("subcols", sdlipDTDURL);
    XMLWriter.addSystemDocType("subcolInfo", sdlipDTDURL);
    XMLWriter.addSystemDocType("SDLIPInterface", sdlipDTDURL);
    XMLWriter.addSystemDocType("redirect", sdlipDTDURL);
    XMLWriter.addSystemDocType("propList", sdlipDTDURL);
  }
Example #2
0
  /**
   * Performs a search. Results returned as a combined SDLIP/STARS XML string of the form:
   *
   * <pre>
   * &lt;SearchResult&gt;
   *    &lt;doc&gt;
   *       &lt;DID&gt; 0...n &lt;/DID&gt;
   *           &lt;propList&gt;
   *              &lt;starts:sqresults&gt;
   *                 . . . . . . .
   *              &lt;/starts:sqresults&gt;
   *           &lt;/propList&gt;
   *    &lt;/doc&gt;
   *    .....
   * &lt;/SearchResult&gt;
   * </pre>
   *
   * <br>
   * There will be one <code>&lt;doc&gt;</code> element, with associated embedded STARTS XML, for
   * each subcollection/back-end that is queried.
   *
   * <p>
   *
   * @param subcols an SDLIP header that lists the subcollections to be queried. This should be of
   *     &lt;subcols&gt; type - see the SDLIP DTD. This overlaps with the "sources" element of the
   *     STARTS XML query. The policy is <b>to search the union of sources in this parameter and
   *     what is in the STARTS header.</b> Subcollections or sources are another name for Back End
   *     LSPs.
   * @param query the actual query. This should be STARTS XML in the form of &lt;starts:squery&gt;
   *     .... &lt;/starts:squery&gt;. See the STARTS DTD.
   * @param numDocs number of documents to be returned. This overlaps with the <code>max-docs</code>
   *     attribute of the STARTS query. The policy is to <b>use the maximum of these two numbers</b>
   *     for number of documents returned.
   * @param expectedTotal an <b>OUT</b> parameter. Will contain the sum of all <code>numDocs</code>
   *     attributes of the returned STARTS <code>starts:sqresults</code> objects. This cannot be
   *     <code>null</code> - a caller of this class must pass in an empty <code>
   *     org.omg.CORBA.IntHolder</code>.
   * @return A combined SDLIP/STARTS XML string of the form: &lt;SearchResult&gt; ...
   *     &lt;starts:sqresults&gt; .... &lt;/starts:sqresults&gt; &lt;/SearchResult&gt;
   */
  public String search(
      String sdlipSubCollections, String startsXMLQuery, IntHolder expectedTotal, int numDocs)
      throws SDLIPException {
    if (startsXMLQuery == null) {
      throw new SDLIPException(SDLIPException.BAD_QUERY_EXC, "null query");
    }
    if (expectedTotal == null) {
      throw new SDLIPException(
          SDLIPException.BAD_QUERY_EXC, "expected total is an OUT parameter and cannot be null");
    }

    XMLObject subCols = new sdlip.xml.dom.XMLObject(sdlipSubCollections);
    XMLObject query = new sdlip.xml.dom.XMLObject(startsXMLQuery);
    IntHolder stateTimeout = new IntHolder(); // unused but can't be null
    IntHolder serverSID = new IntHolder(); // unused but can't be null
    XMLObject serverDelegate = new sdlip.xml.dom.XMLObject(); // unused but can't be null
    XMLObject result = new sdlip.xml.dom.XMLObject();

    tm.search(
        0,
        subCols,
        query,
        numDocs,
        null,
        0,
        null,
        expectedTotal,
        stateTimeout,
        serverSID,
        serverDelegate,
        result);

    if (result != null) {
      // return postProcess (result,"SearchResult",true);
      return result.getString();
    } else {
      return null;
    }
  }
Example #3
0
 /**
  * Calls the equivalent of the <code>sdlip.Metadata.getSubcollectionInfo()</code> method. This
  * returns an SDLIP string containing an SDLIP &lt;subcolInfo&gt; element. Note that the
  * subcollections listed in this response correspond to the names of the SDARTS LSP's back-end
  * LSPs. See the SDLIP documentation for more information about this reply.
  *
  * @return an SDLIP string containing an SDLIP &lt;subcolInfo&gt; element
  */
 public String getSubcollectionInfo() throws SDLIPException {
   XMLObject subcolInfo = new sdlip.xml.dom.XMLObject();
   tm.getSubcollectionInfo(subcolInfo);
   //    return postProcess (subcolInfo, "subcolInfo", false);
   return subcolInfo.getString();
 }
Example #4
0
 /**
  * Calls the equivalent of the <code>sdlip.Metadata.getPropertyInfo()</code> method. The caller
  * specifies which "subcollection" or "SDARTS backend" to search. The method returns an SDLIP XML
  * string of doctype &lt;propList&gt;, with the STARTS header &lt;starts:smeta-attributes&gt;
  * embedded inside. See the SDLIP documentation for description of the SDLIP method, and the
  * STARTS documentation for information about the &lt;starts:smeta-attributes&gt; tag
  *
  * @param subcolName which subcollection (aka back-end) of the SDARTS LSP to get property
  *     information about
  * @return an SDLIP XML string of doctype &lt;propList&gt;, with the STARTS header
  *     &lt;starts:smeta-attributes&gt; embedded inside.
  */
 public String getPropertyInfo(String subcolName) throws SDLIPException {
   XMLObject propInfo = new sdlip.xml.dom.XMLObject();
   tm.getPropertyInfo(subcolName, propInfo);
   // return postProcess (propInfo, "propList", true);
   return propInfo.getString();
 }
Example #5
0
 /**
  * Calls the equivalent of the <code>sdlip.Metadata.getInterface()</code> method. See the SDLIP
  * documentation.
  *
  * @return an SDLIP XML string of doctype &lt SDLIPInterface &gt
  */
 public String getInterface() throws SDLIPException {
   XMLObject theInterface = new sdlip.xml.dom.XMLObject();
   tm.getInterface(theInterface);
   // return postProcess (theInterface, "SDLIPInterface", false);
   return theInterface.getString();
 }