Package org.apache.stanbol.contenthub.servicesapi.store

Examples of org.apache.stanbol.contenthub.servicesapi.store.StoreException


        try {
            solrServer.deleteById(idList);
            solrServer.commit();
        } catch (SolrServerException e) {
            log.error("Solr Server Exception", e);
            throw new StoreException(e.getMessage(), e);
        } catch (IOException e) {
            log.error("IOException", e);
            throw new StoreException(e.getMessage(), e);
        }
    }
View Full Code Here


      jobManager.enhanceContent(sci);
    } catch (EnhancementException e) {
      String msg = String.format("Cannot enhance content with id: {}",
          sci.getUri().getUnicodeString());
      log.error(msg, e);
      throw new StoreException(msg, e);
    }
    updateEnhancementGraph(sci);
  }
View Full Code Here

      solrServer.add(doc);
      solrServer.commit();
      log.debug("Documents are committed to Solr Server successfully.");
    } catch (SolrServerException e) {
      log.error("Solr Server Exception", e);
      throw new StoreException(e.getMessage(), e);
    } catch (IOException e) {
      log.error("IOException", e);
      throw new StoreException(e.getMessage(), e);
    }
    return sci.getUri().getUnicodeString();
  }
View Full Code Here

    String content = null;
    try {
      Entry<UriRef, Blob> contentPart = ContentItemHelper.getBlob(ci,
          Collections.singleton("text/plain"));
      if (contentPart == null) {
        throw new StoreException(
            "There is no textual for the content item");
      }
      content = ContentItemHelper.getText(contentPart.getValue());
    } catch (IOException ex) {
      String msg = "Cannot read the stream of the ContentItem.";
      log.error(msg, ex);
      throw new StoreException(msg, ex);
    }

    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    String creationDate = sdf.format(cal.getTime());

    doc.addField(SolrFieldName.ID.toString(), ci.getUri()
        .getUnicodeString());
    doc.addField(SolrFieldName.CONTENT.toString(), content);
    try {
      doc.addField(SolrFieldName.BINARYCONTENT.toString(),
          IOUtils.toByteArray(ci.getStream()));
    } catch (IOException e) {
      throw new StoreException(
          "Failed to get bytes of conten item stream", e);
    }
    doc.addField(SolrFieldName.MIMETYPE.toString(), ci.getMimeType());
    doc.addField(SolrFieldName.CREATIONDATE.toString(), creationDate);
View Full Code Here

        log.warn("No matching item in Solr for the given id {}.", id);
        return null;
      }
    } catch (SolrServerException ex) {
      log.error("", ex);
      throw new StoreException(ex.getMessage(), ex);
    }

    String enhancementQuery = QueryGenerator.getEnhancementsOfContent(id);
    SelectQuery selectQuery = null;
    try {
      selectQuery = (SelectQuery) QueryParser.getInstance().parse(
          enhancementQuery);
    } catch (ParseException e) {
      String msg = "Cannot parse the SPARQL while trying to retrieve the enhancements of the ContentItem";
      log.error(msg, e);
      throw new StoreException(msg, e);
    }

    ResultSet resultSet = tcManager.executeSparqlQuery(selectQuery,
        this.getEnhancementGraph());
    MGraph metadata = new SimpleMGraph();
View Full Code Here

    try {
      solrServer.deleteById(id);
      solrServer.commit();
    } catch (SolrServerException e) {
      log.error("Solr Server Exception", e);
      throw new StoreException(e.getMessage(), e);
    } catch (IOException e) {
      log.error("IOException", e);
      throw new StoreException(e.getMessage(), e);
    }
  }
View Full Code Here

    try {
      solrServer.deleteById(idList);
      solrServer.commit();
    } catch (SolrServerException e) {
      log.error("Solr Server Exception", e);
      throw new StoreException(e.getMessage(), e);
    } catch (IOException e) {
      log.error("IOException", e);
      throw new StoreException(e.getMessage(), e);
    }
  }
View Full Code Here

        String jsonString;
        try {
            jsonString = JSONUtils.createJSONString(sci);
        } catch (JSONException e) {
            throw new StoreException(e.getMessage(), e);
        }
        ResponseBuilder rb = Response.ok(jsonString);
        addCORSOrigin(servletContext, rb, headers);
        return rb.build();
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.contenthub.servicesapi.store.StoreException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.