/** * 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 < !DOCTYPE * > 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); }
/** * Performs a search. Results returned as a combined SDLIP/STARS XML string of the form: * * <pre> * <SearchResult> * <doc> * <DID> 0...n </DID> * <propList> * <starts:sqresults> * . . . . . . . * </starts:sqresults> * </propList> * </doc> * ..... * </SearchResult> * </pre> * * <br> * There will be one <code><doc></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 * <subcols> 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 <starts:squery> * .... </starts:squery>. 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: <SearchResult> ... * <starts:sqresults> .... </starts:sqresults> </SearchResult> */ 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; } }
/** * Calls the equivalent of the <code>sdlip.Metadata.getSubcollectionInfo()</code> method. This * returns an SDLIP string containing an SDLIP <subcolInfo> 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 <subcolInfo> element */ public String getSubcollectionInfo() throws SDLIPException { XMLObject subcolInfo = new sdlip.xml.dom.XMLObject(); tm.getSubcollectionInfo(subcolInfo); // return postProcess (subcolInfo, "subcolInfo", false); return subcolInfo.getString(); }
/** * 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 <propList>, with the STARTS header <starts:smeta-attributes> * embedded inside. See the SDLIP documentation for description of the SDLIP method, and the * STARTS documentation for information about the <starts:smeta-attributes> tag * * @param subcolName which subcollection (aka back-end) of the SDARTS LSP to get property * information about * @return an SDLIP XML string of doctype <propList>, with the STARTS header * <starts:smeta-attributes> 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(); }
/** * Calls the equivalent of the <code>sdlip.Metadata.getInterface()</code> method. See the SDLIP * documentation. * * @return an SDLIP XML string of doctype < SDLIPInterface > */ public String getInterface() throws SDLIPException { XMLObject theInterface = new sdlip.xml.dom.XMLObject(); tm.getInterface(theInterface); // return postProcess (theInterface, "SDLIPInterface", false); return theInterface.getString(); }