Package org.apache.solr.handler.dataimport

Examples of org.apache.solr.handler.dataimport.DataImportHandlerException


    public Object transformRow(Map<String, Object> aRow, Context context) {
      try {
        return meth.invoke(o, aRow);
      } catch (Exception e) {
        log.warn("method invocation failed on transformer : " + trans, e);
        throw new DataImportHandlerException(WARN, e);
      }
    }
View Full Code Here


            throw e;
        } catch (Throwable t) {
          if (verboseDebug) {
            writer.log(SolrWriter.ENTITY_EXCEPTION, entity.name, t);
          }
          throw new DataImportHandlerException(DataImportHandlerException.SEVERE, t);
        } finally {
          if (verboseDebug) {
            writer.log(SolrWriter.ROW_END, entity.name, null);
            if (entity.isDocRoot)
              writer.log(SolrWriter.END_DOC, null, null);
View Full Code Here

    }

    value = arow.get("$skipDoc");
    if (value != null) {
      if (Boolean.parseBoolean(value.toString())) {
        throw new DataImportHandlerException(DataImportHandlerException.SKIP,
                "Document skipped :" + arow);
      }
    }

    value = arow.get("$skipRow");
    if (value != null) {
      if (Boolean.parseBoolean(value.toString())) {
        throw new DataImportHandlerException(DataImportHandlerException.SKIP_ROW);
      }
    }
  }
View Full Code Here

    String where = context.getEntityAttribute("where");

    String cacheKey = context.getEntityAttribute(CACHE_KEY);
    String lookupKey = context.getEntityAttribute(CACHE_LOOKUP);
    if(cacheKey != null && lookupKey == null){
      throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
              "'cacheKey' is specified for the entity "+ entityName+" but 'cacheLookup' is missing" );

    }
    if (where == null && cacheKey == null) {
      simpleCache = new HashMap<String, List<Map<String, Object>>>();
View Full Code Here

    Map<Object, List<Map<String, Object>>> rowIdVsRows = cacheWithWhereClause
            .get(query);
    List<Map<String, Object>> rows = null;
    Object key = context.resolve(cacheVariableName);
    if (key == null) {
      throw new DataImportHandlerException(DataImportHandlerException.WARN,
              "The cache lookup value : " + cacheVariableName + " is resolved to be null in the entity :" +
                      context.getEntityAttribute("name"));

    }
    if (rowIdVsRows != null) {
      rows = rowIdVsRows.get(key);
      if (rows == null)
        return null;
      dataSourceRowCache = new ArrayList<Map<String, Object>>(rows);
      return getFromRowCacheTransformed();
    } else {
      rows = getAllNonCachedRows();
      if (rows.isEmpty()) {
        return null;
      } else {
        rowIdVsRows = new HashMap<Object, List<Map<String, Object>>>();
        for (Map<String, Object> row : rows) {
          Object k = row.get(cachePk);
          if (k == null) {
            throw new DataImportHandlerException(DataImportHandlerException.WARN,
                    "No value available for the cache key : " + cachePk + " in the entity : " +
                            context.getEntityAttribute("name"));
          }
          if (!k.getClass().equals(key.getClass())) {
            throw new DataImportHandlerException(DataImportHandlerException.WARN,
                    "The key in the cache type : " + k.getClass().getName() +
                            "is not same as the lookup value type " + key.getClass().getName() + " in the entity " +
                            context.getEntityAttribute("name"));
          }
          if (rowIdVsRows.get(k) == null)
View Full Code Here

          if (meth == null) {
            String msg = "Transformer :"
                    + trans
                    + "does not implement Transformer interface or does not have a transformRow(Map m)method";
            log.error(msg);
            throw new DataImportHandlerException(
                    SEVERE, msg);
          }
          transformers.add(new ReflectionTransformer(meth, clazz, trans));
        }
      } catch (Exception e) {
        log.error("Unable to load Transformer: " + aTransArr, e);
        throw new DataImportHandlerException(SEVERE,
                e);
      }
    }

  }
View Full Code Here

    public Object transformRow(Map<String, Object> aRow, Context context) {
      try {
        return meth.invoke(o, aRow);
      } catch (Exception e) {
        log.warn("method invocation failed on transformer : " + trans, e);
        throw new DataImportHandlerException(WARN, e);
      }
    }
View Full Code Here

    String where = context.getEntityAttribute("where");

    String cacheKey = context.getEntityAttribute(CACHE_KEY);
    String lookupKey = context.getEntityAttribute(CACHE_LOOKUP);
    if(cacheKey != null && lookupKey == null){
      throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
              "'cacheKey' is specified for the entity "+ entityName+" but 'cacheLookup' is missing" );

    }
    if (where == null && cacheKey == null) {
      simpleCache = new HashMap<String, List<Map<String, Object>>>();
View Full Code Here

    Map<Object, List<Map<String, Object>>> rowIdVsRows = cacheWithWhereClause
            .get(query);
    List<Map<String, Object>> rows = null;
    Object key = resolver.resolve(cacheVariableName);
    if (key == null) {
      throw new DataImportHandlerException(DataImportHandlerException.WARN,
              "The cache lookup value : " + cacheVariableName + " is resolved to be null in the entity :" +
                      context.getEntityAttribute("name"));

    }
    if (rowIdVsRows != null) {
      rows = rowIdVsRows.get(key);
      if (rows == null)
        return null;
      dataSourceRowCache = new ArrayList<Map<String, Object>>(rows);
      return getFromRowCacheTransformed();
    } else {
      rows = getAllNonCachedRows();
      if (rows.isEmpty()) {
        return null;
      } else {
        rowIdVsRows = new HashMap<Object, List<Map<String, Object>>>();
        for (Map<String, Object> row : rows) {
          Object k = row.get(cachePk);
          if (k == null) {
            throw new DataImportHandlerException(DataImportHandlerException.WARN,
                    "No value available for the cache key : " + cachePk + " in the entity : " +
                            context.getEntityAttribute("name"));
          }
          if (!k.getClass().equals(key.getClass())) {
            throw new DataImportHandlerException(DataImportHandlerException.WARN,
                    "The key in the cache type : " + k.getClass().getName() +
                            "is not same as the lookup value type " + key.getClass().getName() + " in the entity " +
                            context.getEntityAttribute("name"));
          }
          if (rowIdVsRows.get(k) == null)
View Full Code Here

  @Override
  public void init(Context context) {
    super.init(context);
    collection = context.getEntityAttribute(COLLECTION);
    if (collection == null) {
      throw new DataImportHandlerException(SEVERE, "collection is null");
    }
    mongoDBDataSource = (MongoDBDataSource) context.getDataSource();
  }
View Full Code Here

TOP

Related Classes of org.apache.solr.handler.dataimport.DataImportHandlerException

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.