Search in sources :

Example 11 with SearchServiceStatus

use of org.olat.search.SearchServiceStatus in project openolat by klemens.

the class IndexerWebService method getPlainTextStatus.

/**
 * Return the status of the indexer: running, stopped
 * @response.representation.200.mediaType text/plain
 * @response.representation.200.doc The status of the indexer
 * @response.representation.401.doc The roles of the authenticated user are not sufficient
 * @return The status of the indexer
 */
@GET
@Path("status")
@Produces({ MediaType.TEXT_PLAIN })
public Response getPlainTextStatus() {
    String status;
    SearchServiceStatus serviceStatus = SearchServiceFactory.getService().getStatus();
    if (serviceStatus instanceof SearchServiceStatusImpl) {
        status = serviceStatus.getStatus();
    } else {
        status = "disabled";
    }
    return Response.ok(status).build();
}
Also used : SearchServiceStatusImpl(org.olat.search.service.SearchServiceStatusImpl) SearchServiceStatus(org.olat.search.SearchServiceStatus) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 12 with SearchServiceStatus

use of org.olat.search.SearchServiceStatus in project openolat by klemens.

the class IndexerWebService method getStatus.

/**
 * Return the status of the indexer: running, stopped
 * @response.representation.200.mediaType application/xml, application/json
 * @response.representation.200.doc The status of the indexer
 * @response.representation.401.doc The roles of the authenticated user are not sufficient
 * @return The status of the indexer
 */
@GET
@Path("status")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getStatus() {
    String status;
    SearchServiceStatus serviceStatus = SearchServiceFactory.getService().getStatus();
    if (serviceStatus instanceof SearchServiceStatusImpl) {
        status = serviceStatus.getStatus();
    } else {
        status = "disabled";
    }
    return Response.ok(new IndexerStatus(status)).build();
}
Also used : IndexerStatus(org.olat.restapi.system.vo.IndexerStatus) FullIndexerStatus(org.olat.search.service.indexer.FullIndexerStatus) SearchServiceStatusImpl(org.olat.search.service.SearchServiceStatusImpl) SearchServiceStatus(org.olat.search.SearchServiceStatus) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

SearchServiceStatus (org.olat.search.SearchServiceStatus)12 SearchServiceStatusImpl (org.olat.search.service.SearchServiceStatusImpl)10 FullIndexerStatus (org.olat.search.service.indexer.FullIndexerStatus)8 IOException (java.io.IOException)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 SessionsVO (org.olat.restapi.system.vo.SessionsVO)4 FileOutputStream (java.io.FileOutputStream)2 OutputStream (java.io.OutputStream)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 Transformer (javax.xml.transform.Transformer)2 TransformerFactory (javax.xml.transform.TransformerFactory)2 DOMSource (javax.xml.transform.dom.DOMSource)2 StreamResult (javax.xml.transform.stream.StreamResult)2 ParseException (org.apache.lucene.queryparser.classic.ParseException)2 DatabaseConnectionVO (org.olat.admin.sysinfo.model.DatabaseConnectionVO)2