com.redhat.lightblue.metadata.Version.getValue()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(88)

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

Version.getValue介绍

[英]Gets the value of value
[中]获取value的值

代码示例

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

protected final Version checkVersionIsValid(Version ver) {
  if (ver == null || ver.getValue() == null || ver.getValue().length() == 0) {
    throw new IllegalArgumentException(MetadataConstants.ERR_INVALID_VERSION);
  }
  String value = ver.getValue();
  if (!value.matches(SEMVER_REGEX)) {
    throw com.redhat.lightblue.util.Error.get(MetadataConstants.ERR_INVALID_VERSION_NUMBER, ver.getValue());
  }
  return ver;
}

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

protected final Version checkVersionIsValid(Version ver) {
  if (ver == null || ver.getValue() == null || ver.getValue().length() == 0) {
    throw new IllegalArgumentException(MetadataConstants.ERR_INVALID_VERSION);
  }
  String value = ver.getValue();
  if (!value.matches(SEMVER_REGEX)) {
    throw com.redhat.lightblue.util.Error.get(MetadataConstants.ERR_INVALID_VERSION_NUMBER, ver.getValue());
  }
  return ver;
}

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

protected final Version checkVersionIsValid(Version ver) {
  if (ver == null || ver.getValue() == null || ver.getValue().length() == 0) {
    throw new IllegalArgumentException(MetadataConstants.ERR_INVALID_VERSION);
  }
  String value = ver.getValue();
  if (!value.matches(SEMVER_REGEX)) {
    throw com.redhat.lightblue.util.Error.get(MetadataConstants.ERR_INVALID_VERSION_NUMBER, ver.getValue());
  }
  return ver;
}

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

/**
 * Returns the top level entity version
 */
public String getTopLevelEntityVersion() {
  return cmd.getVersion().getValue();
}

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

/**
 * Returns the top level entity version
 */
public String getTopLevelEntityVersion() {
  return cmd.getVersion().getValue();
}

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

/**
 * Returns the top level entity version
 */
public String getTopLevelEntityVersion() {
  return cmd.getVersion().getValue();
}

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

public synchronized void put(EntityMetadata md) {
  cache.put(new EntityVersion(md.getName(), md.getVersion().getValue()), new WeakReference(md));
}

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

public synchronized void put(EntityMetadata md) {
  cache.put(new EntityVersion(md.getName(),md.getVersion().getValue()),new WeakReference(md));
}

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

private EntityMetadata getMetadata(String entityName,
                    String version) {
    EntityMetadata emd=metadataMap.get(entityName);
    if(emd!=null) {
      if (!emd.getVersion().getValue().equals(version)) {
        throw new IllegalArgumentException(CrudConstants.ERR_METADATA_APPEARS_TWICE + entityName + " " + version + 
                          " and " + emd.getVersion().getValue());
      }
    } else {
      LOGGER.debug("Retrieving entity metadata {}:{}",entityName,version);
      emd=md.getEntityMetadata(entityName,version);
      if (emd == null || emd.getEntitySchema() == null) {
        throw new IllegalArgumentException("Unknown entity:" + entityName + ":" + version);
      }
      if (emd.getEntitySchema().getStatus() == MetadataStatus.DISABLED) {
        throw new IllegalArgumentException(CrudConstants.ERR_DISABLED_METADATA + " " + entityName + " " + version);
      }
      metadataMap.put(entityName,emd);
    }
    return emd;
  }
}

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

@Override
  protected EntityMetadata retrieveMetadata(Path injectionPath, String entityName, String entityVersion) {
    EntityMetadata metadata=metadataMap.get(entityName);
    if(metadata!=null) {
      if(entityVersion!=null&&!entityVersion.equals(metadata.getVersion().getValue())) {
        throw Error.get(CrudConstants.ERR_METADATA_APPEARS_TWICE, entityName + ":" + entityVersion + " and " + metadata.getVersion().getValue());
      } 
    } else if(entityVersion!=null) {
      metadata = md.getEntityMetadata(entityName, entityVersion);
      if (metadata == null) {
        throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY, entityName + ":"+ entityVersion);
      }
      metadataMap.put(entityName,metadata);
    } else {
      // Metadata is requested with default version, and we haven't loaded it yet
      metadata=md.getEntityMetadata(entityName,null);
      if (metadata == null) {
        throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY, entityName + ":"+ entityVersion);
      }
      metadataMap.put(entityName,metadata);
    }
    return metadata;
  }
}

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

@Override
  protected EntityMetadata retrieveMetadata(Path injectionPath, String entityName, String entityVersion) {
    EntityMetadata metadata=metadataMap.get(entityName);
    if(metadata!=null) {
      if(entityVersion!=null&&!entityVersion.equals(metadata.getVersion().getValue())) {
        throw Error.get(CrudConstants.ERR_METADATA_APPEARS_TWICE, entityName + ":" + entityVersion + " and " + metadata.getVersion().getValue());
      } 
    } else if(entityVersion!=null) {
      metadata = md.getEntityMetadata(entityName, entityVersion);
      if (metadata == null) {
        throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY, entityName + ":"+ entityVersion);
      }
      metadataMap.put(entityName,metadata);
    } else {
      // Metadata is requested with default version, and we haven't loaded it yet
      metadata=md.getEntityMetadata(entityName,null);
      if (metadata == null) {
        throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY, entityName + ":"+ entityVersion);
      }
      metadataMap.put(entityName,metadata);
    }
    return metadata;
  }
}

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

/**
 * When EntityInfo is updated, we have to make sure any active/deprecated metadata is still valid
 */
protected void validateAllVersions(EntityInfo ei) {
  LOGGER.debug("Validating all versions of {}", ei.getName());
  String version = null;
  try {
    DBCursor cursor = new FindCommand(collection,
        new BasicDBObject(LITERAL_NAME, ei.getName()).
            append(LITERAL_VERSION, new BasicDBObject("$exists", 1)).
            append(LITERAL_STATUS_VALUE, new BasicDBObject("$ne", MetadataParser.toString(MetadataStatus.DISABLED))),
        null).executeAndUnwrap();
    while (cursor.hasNext()) {
      DBObject object = cursor.next();
      EntitySchema schema = mdParser.parseEntitySchema(object);
      version = schema.getVersion().getValue();
      LOGGER.debug("Validating {} {}", ei.getName(), version);
      EntityMetadata md = new EntityMetadata(ei, schema);
      md.validate();
    }
  } catch (Exception e) {
    String msg = ei.getName() + ":" + version + e.toString();
    throw analyzeException(e, MongoMetadataConstants.ERR_UPDATE_INVALIDATES_METADATA, msg);
  }
}

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

try {
  T obj = newNode();
  if (v.getValue() != null) {
    putString(obj, STR_VALUE, v.getValue());

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

try {
  T obj = newNode();
  if (v.getValue() != null) {
    putString(obj, STR_VALUE, v.getValue());

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

try {
  T obj = newNode();
  if (v.getValue() != null) {
    putString(obj, STR_VALUE, v.getValue());

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

public OperationContext getDerivedOperationContext(String entityName,CRUDFindRequest req) {
  // Create a new request with same header information, but different query information
  FindRequest newReq=new FindRequest();
  newReq.shallowCopyFrom( (Request)request, req );
  newReq.setEntityVersion(new EntityVersion(entityName,resolver.getEntityMetadata(entityName).getVersion().getValue()));
  // At this point, newReq has header information from the
  // original request, but query information from the argument
  // 'req'
  return new OperationContext(newReq,
                metadata,
                getFactory(),
                Operation.FIND,
                resolver,
                new ArrayList<DocCtx>(),
                getCallerRoles(),
                getHookManager());
}

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

public OperationContext getDerivedOperationContext(String entityName, CRUDFindRequest req) {
  // Create a new request with same header information, but different query information
  FindRequest newReq = new FindRequest();
  newReq.shallowCopyFrom((Request) request, req);
  newReq.setEntityVersion(new EntityVersion(entityName, resolver.getEntityMetadata(entityName).getVersion().getValue()));
  // At this point, newReq has header information from the
  // original request, but query information from the argument
  // 'req'
  return new OperationContext(newReq,
      metadata,
      getFactory(),
      CRUDOperation.FIND,
      resolver,
      new ArrayList<DocCtx>(),
      getCallerRoles(),
      getHookManager());
}

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

public OperationContext getDerivedOperationContext(String entityName, CRUDFindRequest req) {
  // Create a new request with same header information, but different query information
  FindRequest newReq = new FindRequest();
  newReq.shallowCopyFrom((Request) request, req);
  newReq.setEntityVersion(new EntityVersion(entityName, resolver.getEntityMetadata(entityName).getVersion().getValue()));
  // At this point, newReq has header information from the
  // original request, but query information from the argument
  // 'req'
  return new OperationContext(newReq,
      metadata,
      getFactory(),
      CRUDOperation.FIND,
      resolver,
      new ArrayList<DocCtx>(),
      getCallerRoles(),
      getHookManager());
}

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

/**
 * When EntityInfo is updated, we have to make sure any active/deprecated
 * metadata is still valid
 */
protected void validateAllVersions(EntityInfo ei) {
  LOGGER.debug("Validating all versions of {}", ei.getName());
  String version = null;
  DBCursor cursor = null;
  try {
    cursor = collection.find(new BasicDBObject(LITERAL_NAME, ei.getName()).
        append(LITERAL_VERSION, new BasicDBObject("$exists", 1)).
        append(LITERAL_STATUS_VALUE, new BasicDBObject("$ne", MetadataParser.toString(MetadataStatus.DISABLED))),
        null);
    while (cursor.hasNext()) {
      DBObject object = cursor.next();
      EntitySchema schema = mdParser.parseEntitySchema(object);
      version = schema.getVersion().getValue();
      LOGGER.debug("Validating {} {}", ei.getName(), version);
      EntityMetadata md = new EntityMetadata(ei, schema);
      md.validate();
    }
  } catch (Exception e) {
    String msg = ei.getName() + ":" + version + e.toString();
    throw analyzeException(e, MongoMetadataConstants.ERR_UPDATE_INVALIDATES_METADATA, msg);
  } finally {
    if (cursor != null) {
      cursor.close();
    }
  }
}

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

ret[i] = new VersionInfo();
Version v = mdParser.parseVersion((BSONObject) object.get(LITERAL_VERSION));
ret[i].setValue(v.getValue());
ret[i].setExtendsVersions(v.getExtendsVersions());
ret[i].setChangelog(v.getChangelog());

相关文章