com.redhat.lightblue.util.Error.pop()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中com.redhat.lightblue.util.Error.pop()方法的一些代码示例,展示了Error.pop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Error.pop()方法的具体详情如下:
包路径:com.redhat.lightblue.util.Error
类名称:Error
方法名:pop

Error.pop介绍

[英]Pops the context information from current thread stack
[中]从当前线程堆栈中弹出上下文信息

代码示例

代码示例来源:origin: com.redhat.lightblue/lightblue-core-util

/**
 * Constructs a new error object by pushing the given context on top of the
 * current context
 */
public static Error get(String ctx, String errorCode, String msg) {
  push(ctx);
  try {
    return new Error(THREAD_CONTEXT.get(), errorCode, msg);
  } finally {
    pop();
  }
}

代码示例来源:origin: lightblue-platform/lightblue-core

/**
 * Constructs a new error object by pushing the given context on top of the
 * current context
 */
public static Error get(String ctx, String errorCode, String msg) {
  push(ctx);
  try {
    return new Error(THREAD_CONTEXT.get(), errorCode, msg);
  } finally {
    pop();
  }
}

代码示例来源:origin: com.redhat.lightblue/util

/**
 * Constructs a new error object by pushing the given context on top of the
 * current context
 */
public static Error get(String ctx, String errorCode, String msg) {
  push(ctx);
  try {
    Error x = new Error(THREAD_CONTEXT.get(), errorCode, msg);
    return x;
  } finally {
    pop();
  }
}

代码示例来源:origin: com.redhat.lightblue/metadata

public void convertPropertyParser(T object, Map<String, Object> properties) {
  Error.push("convertPropertyParser");
  try {
    for (Entry entry : properties.entrySet()) {
      String key = (String) entry.getKey();
      PropertyParser p = extensions.getPropertyParser(key);
      if (p != null) {
        p.convert(this, object, entry.getValue());
      }
    }
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: lightblue-platform/lightblue-core

public FieldTreeNode resolve(Path p) {
  Error.push(name);
  try {
    return fields.resolve(p);
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue/lightblue-core-crud

public void validateDocs(List<? extends JsonDoc> docList) {
  currentDocList = docList;
  currentDoc = null;
  LOGGER.debug("validateDocs() enter with {} docs", docList.size());
  Error.push("validateDocs");
  try {
    for (JsonDoc doc : docList) {
      validateDoc(doc);
    }
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(CrudConstants.ERR_CRUD, e.getMessage());
  } finally {
    Error.pop();
  }
  LOGGER.debug("validateDocs() complete");
}

代码示例来源:origin: com.redhat.lightblue/lightblue-core-metadata

public FieldTreeNode resolve(Path p) {
  Error.push(name);
  try {
    return fields.resolve(p);
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue/metadata

public FieldTreeNode resolve(Path p) {
  Error.push(name);
  try {
    return fields.resolve(p);
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue/crud

public void validateDocs(List<? extends JsonDoc> docList) {
  currentDocList = docList;
  currentDoc = null;
  LOGGER.debug("validateDocs() enter with {} docs", docList.size());
  Error.push("validateDocs");
  try {
    for (JsonDoc doc : docList) {
      validateDoc(doc);
    }
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(CrudConstants.ERR_CRUD, e.getMessage());
  } finally {
    Error.pop();
  }
  LOGGER.debug("validateDocs() complete");
}

代码示例来源:origin: com.redhat.lightblue/lightblue-core-metadata

/**
 * Builds a composite metadata rooted at the given entity metadata.
 */
public static CompositeMetadata buildCompositeMetadata(EntityMetadata root,
                            GetMetadata gmd) {
  LOGGER.debug("enter buildCompositeMetadata");
  Error.push("compositeMetadata");
  try {
    CompositeMetadata cmd = buildCompositeMetadata(root, gmd, new Path(), null, new MutablePath());
    return cmd;
  } finally {
    LOGGER.debug("end buildCompositeMetadata");
    Error.pop();
  }
}

代码示例来源:origin: lightblue-platform/lightblue-core

/**
 * Builds a composite metadata rooted at the given entity metadata.
 */
public static CompositeMetadata buildCompositeMetadata(EntityMetadata root,
                            GetMetadata gmd) {
  LOGGER.debug("enter buildCompositeMetadata");
  Error.push("compositeMetadata");
  try {
    CompositeMetadata cmd = buildCompositeMetadata(root, gmd, new Path(), null, new MutablePath());
    return cmd;
  } finally {
    LOGGER.debug("end buildCompositeMetadata");
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue.mongo/lightblue-mongo

@Override
public EntityInfo getEntityInfo(String entityName) {
  if (entityName == null || entityName.length() == 0) {
    throw new IllegalArgumentException(LITERAL_ENTITY_NAME);
  }
  Error.push("getEntityInfo(" + entityName + ")");
  try {
    BasicDBObject query = new BasicDBObject(LITERAL_ID, entityName + BSONParser.DELIMITER_ID);
    DBObject ei = collection.findOne(query);
    if (ei != null) {
      return mdParser.parseEntityInfo(ei);
    } else {
      return null;
    }
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    throw analyzeException(e, MetadataConstants.ERR_ILL_FORMED_METADATA);
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue.mongo/lightblue-mongo-crud

/**
 * Translates a query to Mongo query
 *
 * @param md Entity metadata
 * @param query The query expression
 */
public DBObject translate(EntityMetadata md, QueryExpression query) {
  Error.push("translateQuery");
  FieldTreeNode mdRoot = md.getFieldTreeRoot();
  try {
    return translate(mdRoot, query);
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MongoCrudConstants.ERR_INVALID_OBJECT, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue.mongo/lightblue-mongo

/**
 * Override to set _id appropriately.
 */
@Override
public BSONObject convert(EntityInfo info) {
  Error.push("convert[info|bson]");
  try {
    BSONObject doc = (BSONObject) super.convert(info);
    // entityInfo._id = {entityInfo.name}|
    putValue(doc, "_id", getStringProperty(doc, "name") + DELIMITER_ID);
    return doc;
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue.mongo/lightblue-mongo-metadata

/**
 * Override to set _id appropriately.
 */
@Override
public BSONObject convert(EntityInfo info) {
  Error.push("convert[info|bson]");
  try {
    BSONObject doc = super.convert(info);
    // entityInfo._id = {entityInfo.name}|
    putValue(doc, "_id", getStringProperty(doc, "name") + DELIMITER_ID);
    return doc;
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue/metadata

public void parsePropertyParser(T object, Map<String, Object> properties) {
  Error.push("parsePropertyParser");
  try {
    Set<String> propertyFields = findFieldsNotIn(object, ENTITY_INFO_FIELDS);
    for (String property : propertyFields) {
      PropertyParser p = extensions.getPropertyParser(property);
      if (p != null) {
        p.parseProperty(this, property, properties, getObjectProperty(object, property));
      }
    }
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue.mongo/mongo-metadata

/**
 * Override to set _id appropriately.
 */
@Override
public BSONObject convert(EntitySchema schema) {
  Error.push("convert[info|bson]");
  try {
    BSONObject doc = super.convert(schema);
    putValue(doc, "_id", getStringProperty(doc, "name") + DELIMITER_ID + getStringProperty(getObjectProperty(doc, "version"), "value"));
    return doc;
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue.mongo/lightblue-mongo

/**
 * Override to set _id appropriately.
 */
@Override
public BSONObject convert(EntitySchema schema) {
  Error.push("convert[info|bson]");
  try {
    BSONObject doc = (BSONObject) super.convert(schema);
    putValue(doc, "_id", getStringProperty(doc, "name") + DELIMITER_ID + getRequiredStringProperty(getRequiredObjectProperty(doc, "version"), "value"));
    return doc;
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

代码示例来源:origin: com.redhat.lightblue/lightblue-core-metadata

/**
 * Translates the source to a {@link JsonDoc}.
 * @param source - Object containing the source data.
 * @return {@link JsonDoc}
 */
public JsonDoc translate(S source){
  Error.push("translating to json");
  try{
    FieldCursor cursor = entityMetadata.getFieldCursor();
    if (cursor.firstChild()) {
      ObjectNode node = factory.objectNode();
      iterateOverNodes(source, node, cursor);
      return new JsonDoc(node);
    }
  }
  finally{
    Error.pop();
  }
  //TODO: What to do in case of a null value here?
  return null;
}

代码示例来源:origin: lightblue-platform/lightblue-core

/**
 * Converts the entity metadata to T
 */
public T convert(EntityMetadata md) {
  Error.push("convert[metadata]");
  try {
    T ret = newNode();
    putObject(ret, STR_ENTITY_INFO, convert(md.getEntityInfo()));
    putObject(ret, STR_SCHEMA, convert(md.getEntitySchema()));
    convertProperties(md, ret);
    return ret;
  } catch (Error e) {
    // rethrow lightblue error
    throw e;
  } catch (Exception e) {
    // throw new Error (preserves current error context)
    LOGGER.error(e.getMessage(), e);
    throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage());
  } finally {
    Error.pop();
  }
}

相关文章