io.cattle.platform.util.resource.UUID类的使用及代码示例

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

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

UUID介绍

暂无

代码示例

代码示例来源:origin: rancher/cattle

  1. protected void createExternalDeploymentUnit(DeploymentServiceContext context,
  2. Map<String, Map<String, String>> uuidToLabels, Map<String, List<DeploymentUnitInstance>> uuidToInstances,
  3. Service service, String externalIp, String hostName) {
  4. String uuid = io.cattle.platform.util.resource.UUID.randomUUID().toString();
  5. DeploymentUnitInstance unitInstance = createDeploymentUnitInstance(context, uuid, service, null,
  6. Pair.of(externalIp, hostName), ServiceConstants.PRIMARY_LAUNCH_CONFIG_NAME);
  7. addToDeploymentUnitList(uuidToLabels, uuidToInstances, new HashMap<String, String>(), uuid,
  8. unitInstance);
  9. }

代码示例来源:origin: rancher/cattle

  1. @SuppressWarnings("unchecked")
  2. public EventVO() {
  3. id = io.cattle.platform.util.resource.UUID.randomUUID().toString();
  4. time = new Date();
  5. context = MDC.getMDCAdapter().getCopyOfContextMap();
  6. }

代码示例来源:origin: rancher/cattle

  1. public DeploymentUnit(DeploymentServiceContext context, Service service, Map<String, String> labels,
  2. DeploymentUnitInstanceIdGenerator svcInstanceIdGenerator, Stack stack) {
  3. this(context, io.cattle.platform.util.resource.UUID.randomUUID().toString(), service, stack, null);
  4. setLabels(labels);
  5. if (StringUtils.equalsIgnoreCase(ServiceConstants.SERVICE_INDEX_DU_STRATEGY,
  6. DataAccessor.fieldString(service, ServiceConstants.FIELD_SERVICE_INDEX_STRATEGY))) {
  7. Map<String, Object> params = new HashMap<>();
  8. // create deploymentunit
  9. params.put("uuid", this.uuid);
  10. params.put(ServiceConstants.FIELD_SERVICE_ID, service.getId());
  11. params.put(InstanceConstants.FIELD_SERVICE_INSTANCE_SERVICE_INDEX,
  12. svcInstanceIdGenerator.getNextAvailableId());
  13. params.put("accountId", service.getAccountId());
  14. params.put(InstanceConstants.FIELD_LABELS, this.unitLabels);
  15. this.unit = context.objectManager.create(io.cattle.platform.core.model.DeploymentUnit.class, params);
  16. }
  17. }

代码示例来源:origin: rancher/cattle

  1. @Override
  2. public PhysicalHost createMachineForHost(final Host host, String driver) {
  3. String uuid = UUID.randomUUID().toString();
  4. final Map<Object, Object> data = new HashMap<Object, Object>(DataUtils.getFields(host));
  5. data.put(PHYSICAL_HOST.KIND, MachineConstants.KIND_MACHINE);
  6. data.put(PHYSICAL_HOST.NAME, DataAccessor.fieldString(host, HostConstants.FIELD_HOSTNAME));
  7. data.put(PHYSICAL_HOST.DESCRIPTION, host.getDescription());
  8. data.put(PHYSICAL_HOST.ACCOUNT_ID, host.getAccountId());
  9. data.put(PHYSICAL_HOST.EXTERNAL_ID, uuid);
  10. data.put(PHYSICAL_HOST.DRIVER, driver);
  11. PhysicalHost phyHost = DeferredUtils.nest(new Callable<PhysicalHost>() {
  12. @Override
  13. public PhysicalHost call() throws Exception {
  14. return genericResourceDao.createAndSchedule(PhysicalHost.class, objectManager.convertToPropertiesFor(PhysicalHost.class, data));
  15. }
  16. });
  17. objectManager.setFields(host,
  18. HOST.PHYSICAL_HOST_ID, phyHost.getId(),
  19. HostConstants.FIELD_REPORTED_UUID, uuid);
  20. return phyHost;
  21. }

代码示例来源:origin: rancher/cattle

  1. newLaunchConfig.put(InstanceConstants.FIELD_LABELS, labels);
  2. String version = io.cattle.platform.util.resource.UUID.randomUUID().toString();
  3. newLaunchConfig.put(ServiceConstants.FIELD_VERSION, version);

代码示例来源:origin: rancher/cattle

  1. String externalId = (String)instance.get("externalId");
  2. if (externalId == null) {
  3. externalId = io.cattle.platform.util.resource.UUID.randomUUID().toString();
  4. update = CollectionUtils.asMap("instanceHostMap", CollectionUtils.asMap("instance", CollectionUtils.asMap("externalId", externalId)));

代码示例来源:origin: rancher/cattle

  1. protected void setVersion(InServiceUpgradeStrategy upgrade) {
  2. String version = io.cattle.platform.util.resource.UUID.randomUUID().toString();
  3. if (upgrade.getSecondaryLaunchConfigs() != null) {
  4. for (Object launchConfigObj : upgrade.getSecondaryLaunchConfigs()) {
  5. setLaunchConfigVersion(version, launchConfigObj);
  6. }
  7. }
  8. if (upgrade.getLaunchConfig() != null) {
  9. setLaunchConfigVersion(version, upgrade.getLaunchConfig());
  10. }
  11. }

代码示例来源:origin: rancher/cattle

  1. private Instance setupLabels(Instance instance, String service, String project) {
  2. Map<String, Object> labels = DataAccessor.fieldMap(instance, InstanceConstants.FIELD_LABELS);
  3. setIfNot(labels, ServiceConstants.LABEL_SERVICE_DEPLOYMENT_UNIT, io.cattle.platform.util.resource.UUID.randomUUID());
  4. setIfNot(labels, ServiceConstants.LABEL_SERVICE_LAUNCH_CONFIG, ServiceConstants.PRIMARY_LAUNCH_CONFIG_NAME);
  5. setIfNot(labels, ServiceConstants.LABEL_STACK_NAME, project);
  6. setIfNot(labels, ServiceConstants.LABEL_STACK_SERVICE_NAME, String.format("%s/%s", project, service));
  7. DataAccessor.setField(instance, InstanceConstants.FIELD_LABELS, labels);
  8. return objectManager.persist(instance);
  9. }

代码示例来源:origin: rancher/cattle

  1. @Override
  2. public Entry start(Service service, String type, String message) {
  3. ServiceLog auditLog = newServiceLog(service);
  4. auditLog.setEventType(type);
  5. auditLog.setDescription(message);
  6. auditLog.setTransactionId(io.cattle.platform.util.resource.UUID.randomUUID().toString());
  7. if (entries.size() > 0) {
  8. ServiceLog parentLog = entries.peek().auditLog;
  9. auditLog.setSubLog(true);
  10. auditLog.setEventType(parentLog.getEventType() + "." + type);
  11. auditLog.setTransactionId(parentLog.getTransactionId());
  12. }
  13. EntryImpl impl = new EntryImpl(this, service, objectManager.create(auditLog));
  14. ObjectUtils.publishChanged(eventService, objectManager, impl.auditLog);
  15. entries.push(impl);
  16. return impl;
  17. }

代码示例来源:origin: rancher/cattle

  1. host.put(ObjectMetaDataManager.KIND_FIELD, "sim");
  2. host.put(ObjectMetaDataManager.TYPE_FIELD, "host");
  3. host.put(ObjectMetaDataManager.NAME_FIELD, "testhost-" + io.cattle.platform.util.resource.UUID.randomUUID());

代码示例来源:origin: rancher/cattle

  1. final String postfix = io.cattle.platform.util.resource.UUID.randomUUID().toString();
  2. if (template.getPerContainer()) {
  3. String name = stack.getName() + "_" + volumeNamePostfix + "_" + this.unit.getServiceIndex() + "_"

相关文章

UUID类方法