com.yahoo.component.Version.<init>()方法的使用及代码示例

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

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

Version.<init>介绍

[英]Creates an empty version
[中]创建一个空版本

代码示例

代码示例来源:origin: com.yahoo.vespa/config-model

public VespaModelFactory(ConfigModelRegistry configModelRegistry, Clock clock) {
  this(new Version(VespaVersion.major, VespaVersion.minor, VespaVersion.micro), configModelRegistry, clock);
}
public VespaModelFactory(Version version, ConfigModelRegistry configModelRegistry, Clock clock) {

代码示例来源:origin: com.yahoo.vespa/component

/** Returns new Version(versionString), or Version.emptyVersion if the input string is null or "" */
public static Version fromString(String versionString) {
  if (versionString == null) {
    return emptyVersion;
  } else {
    return new Version(versionString);
  }
}

代码示例来源:origin: com.yahoo.vespa/config-model

/**
 * Create id with given name, using default version 1.
 *
 * @param tagName Name of the id
 * @return A ConfigModelId instance
 */
public static ConfigModelId fromName(String tagName) {
  return new ConfigModelId(tagName, new Version(1));
}

代码示例来源:origin: com.yahoo.vespa/container-core

/** returns the version of a bundle, as specified by Bundle-Version in the manifest */
private static com.yahoo.component.Version versionOf(Bundle bundle) {
  Object bundleVersion=bundle.getHeaders().get("Bundle-Version");
  if (bundleVersion==null) return com.yahoo.component.Version.emptyVersion;
  return new com.yahoo.component.Version(bundleVersion.toString());
}

代码示例来源:origin: com.yahoo.vespa/config-model

private void checkVersion(Element spec) {
  String version = spec.getAttribute("version");
  if ( ! Version.fromString(version).equals(new Version(1))) {
    throw new RuntimeException("Expected container version to be 1.0, but got " + version);
  }
}

代码示例来源:origin: com.yahoo.vespa/messagebus

@Override
public void attach(NetworkOwner owner) {
  if (this.owner != null) {
    throw new IllegalStateException("Network is already attached to another owner.");
  }
  this.owner = owner;
  RPCSendAdapter adapter1 = new RPCSendV1();
  RPCSendAdapter adapter2 = new RPCSendV2();
  addSendAdapter(new Version(5), adapter1);
  addSendAdapter(new Version(6,149), adapter2);
}

代码示例来源:origin: com.yahoo.vespa/component

String newId=id.substring(0,dash);
try {
  version=new Version(id.substring(dash+1));
  id=newId;

代码示例来源:origin: com.yahoo.vespa/config-model

/** Creates a factory for vespa models for this version of the source */
@Inject
public VespaModelFactory(ComponentRegistry<ConfigModelPlugin> pluginRegistry,
             ComponentRegistry<MlModelImporter> modelImporters,
             Zone zone) {
  this.version = new Version(VespaVersion.major, VespaVersion.minor, VespaVersion.micro);
  List<ConfigModelBuilder> modelBuilders = new ArrayList<>();
  for (ConfigModelPlugin plugin : pluginRegistry.allComponents()) {
    if (plugin instanceof ConfigModelBuilder) {
      modelBuilders.add((ConfigModelBuilder) plugin);
    }
  }
  this.configModelRegistry = new MapConfigModelRegistry(modelBuilders);
  this.modelImporters = modelImporters.allComponents();
  this.zone = zone;
  this.clock = Clock.systemUTC();
}

代码示例来源:origin: com.yahoo.vespa/component

/**
 * Returns the lowest possible Version object that matches this spec
 **/
public Version lowestMatchingVersion() {
  return new Version(getMajor(), getMinor(), getMicro(), getQualifier());
}

代码示例来源:origin: com.yahoo.vespa/config-model

private void validate(ApplicationPackage appPkg) throws IOException {
    if (!validate) {
      return;
    }
    SchemaValidators schemaValidators = new SchemaValidators(new Version(VespaVersion.major));
    if (appPkg.getHosts() != null) {
      schemaValidators.hostsXmlValidator().validate(appPkg.getHosts());
    }
    schemaValidators.servicesXmlValidator().validate(appPkg.getServices());
  }
}

代码示例来源:origin: com.yahoo.vespa/messagebus

@Override
public void handleRequestDone(Request req) {
  List<VersionHandler> handlers;
  boolean shouldLog = log.isLoggable(LogLevel.DEBUG);
  synchronized (this) {
    targetInvoked = false;
    if (req.checkReturnTypes("s")) {
      String str = req.returnValues().get(0).asString();
      try {
        version = new Version(str);
        if (shouldLog) {
          log.log(LogLevel.DEBUG, "Target '" + name + "' has version " + version + ".");
        }
      } catch (IllegalArgumentException e) {
        log.log(LogLevel.WARNING, "Failed to parse '" + str + "' as version for target '" + name + "'.", e);
      }
    } else {
      log.log(LogLevel.INFO, "Method mbus.getVersion() failed for target '" + name + "'; " +
                  req.errorMessage());
    }
    handlers = versionHandlers;
    versionHandlers = new LinkedList<>();
  }
  for (VersionHandler handler : handlers) {
    handler.handleVersion(version);
  }
}

代码示例来源:origin: com.yahoo.vespa/node-repository

node4 = node4.with(node4.status().withVespaVersion(new Version("6.41.0")));
nodes.add(node4);
nodes.add(node5.with(node5.status().withVespaVersion(new Version("1.2.3"))));

代码示例来源:origin: com.yahoo.vespa/messagebus

protected Params toParams(Values args) {
  Params p = new Params();
  p.version = new Version(args.get(0).asUtf8Array());
  p.route = args.get(1).asString();
  p.session = args.get(2).asString();
  p.retryEnabled = (args.get(3).asInt8() != 0);
  p.retry = args.get(4).asInt32();
  p.timeRemaining = args.get(5).asInt64();
  p.protocolName = args.get(6).asUtf8Array();
  p.payload = args.get(7).asData();
  p.traceLevel = args.get(8).asInt32();
  return p;
}

代码示例来源:origin: com.yahoo.vespa/messagebus

@Override
protected Reply createReply(Values ret, String serviceName, Trace trace) {
  Version version = new Version(ret.get(0).asUtf8Array());
  double retryDelay = ret.get(1).asDouble();
  int[] errorCodes = ret.get(2).asInt32Array();

代码示例来源:origin: com.yahoo.vespa/messagebus

protected Params toParams(Values args) {
  CompressionType compression = CompressionType.valueOf(args.get(3).asInt8());
  byte[] slimeBytes = compressor.decompress(args.get(5).asData(), compression, args.get(4).asInt32());
  Slime slime = BinaryFormat.decode(slimeBytes);
  Inspector root = slime.get();
  Params p = new Params();
  p.version = new Version(root.field(VERSION_F).asString());
  p.route = root.field(ROUTE_F).asString();
  p.session = root.field(SESSION_F).asString();
  p.retryEnabled = root.field(USERETRY_F).asBool();
  p.retry = (int)root.field(RETRY_F).asLong();
  p.timeRemaining = root.field(TIMEREMAINING_F).asLong();
  p.protocolName = new Utf8Array(Utf8.toBytes(root.field(PROTOCOL_F).asString()));
  p.payload = root.field(BLOB_F).asData();
  p.traceLevel = (int)root.field(TRACELEVEL_F).asLong();
  return p;
}

代码示例来源:origin: com.yahoo.vespa/messagebus

Inspector root = slime.get();
Version version = new Version(root.field(VERSION_F).asString());
byte[] payload = root.field(BLOB_F).asData();

相关文章