package org.xbib.io.webdav.client;

import org.xbib.io.webdav.common.DavException;
import org.xbib.io.webdav.common.MultiStatus;

/**
 * <code>SearchResource</code> defines METHODS required in order to handle
 * a SEARCH request.
 */
public interface SearchResource {

    /**
     * The 'SEARCH' method
     */
    String METHODS = "SEARCH";


    /**
     * Returns the protected DAV:supported-method-set property which is defined
     * mandatory by RTF 3253. This method call is a shortcut for
     * <code>DavResource.getProperty(SearchConstants.QUERY_GRAMMER_SET)</code>.
     *
     * @return the DAV:supported-query-grammer-set
     * @see SearchConstants#QUERY_GRAMMER_SET
     */
    QueryGrammerSet getQueryGrammerSet();

    /**
     * Runs a search with the language and query defined in the {@link SearchInfo}
     * object specified and returns a {@link MultiStatus} object listing the
     * results.
     *
     * @param sInfo <code>SearchInfo</code> element encapsulating the SEARCH
     *              request body.
     * @return <code>MultiStatus</code> object listing the results.
     * @throws DavException
     */
    MultiStatus search(SearchInfo sInfo) throws DavException;
}