本文整理了Java中io.cattle.platform.util.resource.UUID.randomUUID()
方法的一些代码示例,展示了UUID.randomUUID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.randomUUID()
方法的具体详情如下:
包路径:io.cattle.platform.util.resource.UUID
类名称:UUID
方法名:randomUUID
暂无
代码示例来源:origin: rancher/cattle
protected void createExternalDeploymentUnit(DeploymentServiceContext context,
Map<String, Map<String, String>> uuidToLabels, Map<String, List<DeploymentUnitInstance>> uuidToInstances,
Service service, String externalIp, String hostName) {
String uuid = io.cattle.platform.util.resource.UUID.randomUUID().toString();
DeploymentUnitInstance unitInstance = createDeploymentUnitInstance(context, uuid, service, null,
Pair.of(externalIp, hostName), ServiceConstants.PRIMARY_LAUNCH_CONFIG_NAME);
addToDeploymentUnitList(uuidToLabels, uuidToInstances, new HashMap<String, String>(), uuid,
unitInstance);
}
代码示例来源:origin: rancher/cattle
@SuppressWarnings("unchecked")
public EventVO() {
id = io.cattle.platform.util.resource.UUID.randomUUID().toString();
time = new Date();
context = MDC.getMDCAdapter().getCopyOfContextMap();
}
代码示例来源:origin: rancher/cattle
public DeploymentUnit(DeploymentServiceContext context, Service service, Map<String, String> labels,
DeploymentUnitInstanceIdGenerator svcInstanceIdGenerator, Stack stack) {
this(context, io.cattle.platform.util.resource.UUID.randomUUID().toString(), service, stack, null);
setLabels(labels);
if (StringUtils.equalsIgnoreCase(ServiceConstants.SERVICE_INDEX_DU_STRATEGY,
DataAccessor.fieldString(service, ServiceConstants.FIELD_SERVICE_INDEX_STRATEGY))) {
Map<String, Object> params = new HashMap<>();
// create deploymentunit
params.put("uuid", this.uuid);
params.put(ServiceConstants.FIELD_SERVICE_ID, service.getId());
params.put(InstanceConstants.FIELD_SERVICE_INSTANCE_SERVICE_INDEX,
svcInstanceIdGenerator.getNextAvailableId());
params.put("accountId", service.getAccountId());
params.put(InstanceConstants.FIELD_LABELS, this.unitLabels);
this.unit = context.objectManager.create(io.cattle.platform.core.model.DeploymentUnit.class, params);
}
}
代码示例来源:origin: rancher/cattle
@Override
public PhysicalHost createMachineForHost(final Host host, String driver) {
String uuid = UUID.randomUUID().toString();
final Map<Object, Object> data = new HashMap<Object, Object>(DataUtils.getFields(host));
data.put(PHYSICAL_HOST.KIND, MachineConstants.KIND_MACHINE);
data.put(PHYSICAL_HOST.NAME, DataAccessor.fieldString(host, HostConstants.FIELD_HOSTNAME));
data.put(PHYSICAL_HOST.DESCRIPTION, host.getDescription());
data.put(PHYSICAL_HOST.ACCOUNT_ID, host.getAccountId());
data.put(PHYSICAL_HOST.EXTERNAL_ID, uuid);
data.put(PHYSICAL_HOST.DRIVER, driver);
PhysicalHost phyHost = DeferredUtils.nest(new Callable<PhysicalHost>() {
@Override
public PhysicalHost call() throws Exception {
return genericResourceDao.createAndSchedule(PhysicalHost.class, objectManager.convertToPropertiesFor(PhysicalHost.class, data));
}
});
objectManager.setFields(host,
HOST.PHYSICAL_HOST_ID, phyHost.getId(),
HostConstants.FIELD_REPORTED_UUID, uuid);
return phyHost;
}
代码示例来源:origin: rancher/cattle
newLaunchConfig.put(InstanceConstants.FIELD_LABELS, labels);
String version = io.cattle.platform.util.resource.UUID.randomUUID().toString();
newLaunchConfig.put(ServiceConstants.FIELD_VERSION, version);
代码示例来源:origin: rancher/cattle
String externalId = (String)instance.get("externalId");
if (externalId == null) {
externalId = io.cattle.platform.util.resource.UUID.randomUUID().toString();
update = CollectionUtils.asMap("instanceHostMap", CollectionUtils.asMap("instance", CollectionUtils.asMap("externalId", externalId)));
代码示例来源:origin: rancher/cattle
protected void setVersion(InServiceUpgradeStrategy upgrade) {
String version = io.cattle.platform.util.resource.UUID.randomUUID().toString();
if (upgrade.getSecondaryLaunchConfigs() != null) {
for (Object launchConfigObj : upgrade.getSecondaryLaunchConfigs()) {
setLaunchConfigVersion(version, launchConfigObj);
}
}
if (upgrade.getLaunchConfig() != null) {
setLaunchConfigVersion(version, upgrade.getLaunchConfig());
}
}
代码示例来源:origin: rancher/cattle
private Instance setupLabels(Instance instance, String service, String project) {
Map<String, Object> labels = DataAccessor.fieldMap(instance, InstanceConstants.FIELD_LABELS);
setIfNot(labels, ServiceConstants.LABEL_SERVICE_DEPLOYMENT_UNIT, io.cattle.platform.util.resource.UUID.randomUUID());
setIfNot(labels, ServiceConstants.LABEL_SERVICE_LAUNCH_CONFIG, ServiceConstants.PRIMARY_LAUNCH_CONFIG_NAME);
setIfNot(labels, ServiceConstants.LABEL_STACK_NAME, project);
setIfNot(labels, ServiceConstants.LABEL_STACK_SERVICE_NAME, String.format("%s/%s", project, service));
DataAccessor.setField(instance, InstanceConstants.FIELD_LABELS, labels);
return objectManager.persist(instance);
}
代码示例来源:origin: rancher/cattle
@Override
public Entry start(Service service, String type, String message) {
ServiceLog auditLog = newServiceLog(service);
auditLog.setEventType(type);
auditLog.setDescription(message);
auditLog.setTransactionId(io.cattle.platform.util.resource.UUID.randomUUID().toString());
if (entries.size() > 0) {
ServiceLog parentLog = entries.peek().auditLog;
auditLog.setSubLog(true);
auditLog.setEventType(parentLog.getEventType() + "." + type);
auditLog.setTransactionId(parentLog.getTransactionId());
}
EntryImpl impl = new EntryImpl(this, service, objectManager.create(auditLog));
ObjectUtils.publishChanged(eventService, objectManager, impl.auditLog);
entries.push(impl);
return impl;
}
代码示例来源:origin: rancher/cattle
host.put(ObjectMetaDataManager.KIND_FIELD, "sim");
host.put(ObjectMetaDataManager.TYPE_FIELD, "host");
host.put(ObjectMetaDataManager.NAME_FIELD, "testhost-" + io.cattle.platform.util.resource.UUID.randomUUID());
代码示例来源:origin: rancher/cattle
final String postfix = io.cattle.platform.util.resource.UUID.randomUUID().toString();
if (template.getPerContainer()) {
String name = stack.getName() + "_" + volumeNamePostfix + "_" + this.unit.getServiceIndex() + "_"
内容来源于网络,如有侵权,请联系作者删除!