com.redhat.lightblue.metadata.Version类的使用及代码示例

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

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

Version介绍

暂无

代码示例

代码示例来源: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/metadata

try {
  T obj = newNode();
  if (v.getValue() != null) {
    putString(obj, STR_VALUE, v.getValue());
  String[] ex = v.getExtendsVersions();
  if (ex != null && ex.length > 0) {
    Object arr = newArrayField(obj, STR_EXTEND_VERSIONS);
  if (v.getChangelog() != null) {
    putString(obj, STR_CHANGELOG, v.getChangelog());

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

try {
  if (object != null) {
    Version v = new Version();
    v.setValue(getRequiredStringProperty(object, STR_VALUE));
    List<String> l = getStringList(object, STR_EXTEND_VERSIONS);
    if (l != null) {
      v.setExtendsVersions(l.toArray(new String[l.size()]));
    v.setChangelog(getRequiredStringProperty(object, STR_CHANGELOG));
    return v;
  } else {

代码示例来源: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: lightblue-platform/lightblue-core

try {
  T obj = newNode();
  if (v.getValue() != null) {
    putString(obj, STR_VALUE, v.getValue());
  String[] ex = v.getExtendsVersions();
  if (ex != null && ex.length > 0) {
    Object arr = newArrayField(obj, STR_EXTEND_VERSIONS);
  if (v.getChangelog() != null) {
    putString(obj, STR_CHANGELOG, v.getChangelog());

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

try {
  if (object != null) {
    Version v = new Version();
    v.setValue(getRequiredStringProperty(object, STR_VALUE));
    List<String> l = getStringList(object, STR_EXTEND_VERSIONS);
    if (l != null) {
      v.setExtendsVersions(l.toArray(new String[l.size()]));
    v.setChangelog(getRequiredStringProperty(object, STR_CHANGELOG));
    return v;
  } else {

代码示例来源: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/lightblue-core-metadata

try {
  T obj = newNode();
  if (v.getValue() != null) {
    putString(obj, STR_VALUE, v.getValue());
  String[] ex = v.getExtendsVersions();
  if (ex != null && ex.length > 0) {
    Object arr = newArrayField(obj, STR_EXTEND_VERSIONS);
  if (v.getChangelog() != null) {
    putString(obj, STR_CHANGELOG, v.getChangelog());

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

try {
  if (object != null) {
    Version v = new Version();
    v.setValue(getRequiredStringProperty(object, STR_VALUE));
    List<String> l = getStringList(object, STR_EXTEND_VERSIONS);
    if (l != null) {
      v.setExtendsVersions(l.toArray(new String[l.size()]));
    v.setChangelog(getRequiredStringProperty(object, STR_CHANGELOG));
    return v;
  } else {

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

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

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

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());
ret[i].setStatus(MetadataParser.statusFromString((String) ((DBObject) object.get(LITERAL_STATUS)).get("value")));
if (defaultVersion != null && defaultVersion.equals(ret[i].getValue())) {

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

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

代码示例来源: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());
ret[i].setStatus(MetadataParser.statusFromString((String) ((DBObject) object.get(LITERAL_STATUS)).get("value")));
if (defaultVersion != null && defaultVersion.equals(ret[i].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-metadata

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());
ret[i].setStatus(MetadataParser.statusFromString((String) ((DBObject) object.get(LITERAL_STATUS)).get("value")));
if (defaultVersion != null && defaultVersion.equals(ret[i].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;
  }
}

相关文章