本文整理了Java中com.vmware.xenon.common.Utils.logWarning()
方法的一些代码示例,展示了Utils.logWarning()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.logWarning()
方法的具体详情如下:
包路径:com.vmware.xenon.common.Utils
类名称:Utils
方法名:logWarning
暂无
代码示例来源:origin: vmware/admiral
@Override
public void inspectImage(String imageName, String computeStateLink, Consumer<Throwable> errorHandler) {
Utils.logWarning("Not implemented");
errorHandler.accept(new Exception("Not implemented"));
}
代码示例来源:origin: vmware/admiral
@Override
public void cleanImage(String imageName, String computeStateLink, Consumer<Throwable> errorHandler) {
Utils.logWarning("Not implemented");
errorHandler.accept(new Exception("Not implemented"));
}
代码示例来源:origin: vmware/admiral
private static Integer getAsInt(Map<String, String> map, String key) {
String s;
if (map != null && (s = map.get(key)) != null) {
try {
return Integer.parseInt(s);
} catch (NumberFormatException e) {
Utils.logWarning("Error parsing '%s' for key %s to integer, reason: %s",
s, key, e.getMessage());
}
}
return null;
}
代码示例来源:origin: vmware/xenon
public static <T> T instantiate(Class<T> clazz) {
try {
Constructor<T> ctor = clazz.getDeclaredConstructor();
if (!ctor.isAccessible()) {
ctor.setAccessible(true);
}
return ctor.newInstance();
} catch (Exception e) {
Utils.logWarning("Reflection error: %s", Utils.toString(e));
}
return null;
}
代码示例来源:origin: vmware/admiral
public static Map<String, Object> jsonToMap(JsonElement json) {
Map<String, Object> retMap = new HashMap<String, Object>();
if (json != null && json.isJsonObject()) {
retMap = toMap((JsonObject) json);
} else {
Utils.logWarning("Log configuration is not a valid JsonObject!");
}
return retMap;
}
代码示例来源:origin: vmware/admiral
@Override
public void cleanClosure(Closure closure, Consumer<Throwable> errorHandler) {
logInfo("Cancelling execution of closure : %s", closure.documentSelfLink);
String documentSelfLink = closure.documentSelfLink;
Future<?> futureTask = submittedTasks.get(documentSelfLink);
if (futureTask == null) {
Utils.logWarning("Unable to cancel closure: %s", documentSelfLink);
return;
}
futureTask.cancel(true);
submittedTasks.remove(documentSelfLink);
}
代码示例来源:origin: vmware/xenon
public static Object getPropertyValue(PropertyDescription pd, Object instance) {
try {
return pd.accessor.get(instance);
} catch (Exception e) {
Utils.logWarning("Reflection error: %s", Utils.toString(e));
}
return null;
}
代码示例来源:origin: vmware/admiral
@Override
protected void completeWhenNoContainerDescriptionsFound(
final PlacementHostSelectionTaskState state,
final Map<String, HostSelection> filteredHostSelectionMap,
final Map<String, DescName> containerDescLinksWithNames,
final HostSelectionFilterCompletion callback) {
Utils.logWarning("No ContainerDescriptions found for anti-affinity with container desc %s",
containerDescriptionName);
callback.complete(filteredHostSelectionMap, null);
}
代码示例来源:origin: vmware/admiral
private String loadFileContent(String pemFile, boolean isResource) {
try (InputStream in = getInputStream(pemFile, isResource)) {
if (in == null) {
return null;
}
try (Scanner sc = new Scanner(in, "UTF-8")) {
return sc.useDelimiter("\\A").next();
}
} catch (IOException e) {
Utils.logWarning("Unable to load pem file %s, reason %s", pemFile, e.getMessage());
return null;
}
}
代码示例来源:origin: vmware/admiral
/**
* Extracts the Certificate Principal Common Name (CN).
*/
public static String getCommonName(Principal certPrincipal) {
if (certPrincipal == null || certPrincipal.getName() == null
|| certPrincipal.getName().isEmpty()) {
return null;
}
String attr = getAttributeFromDN(certPrincipal.getName(), "CN");
if (attr == null) {
Utils.logWarning("DN %s doesn't contain attribute 'CN'", certPrincipal.getName());
attr = certPrincipal.getName();
}
return attr;
}
代码示例来源:origin: vmware/admiral
public static VolumeBinding fromString(String volume) {
Matcher matcher = VOLUME_STRING_PATTERN.matcher(volume);
if (!matcher.matches()) {
Utils.logWarning("Cannot parse volume '%s'", volume);
throw new LocalizableValidationException(
"Volume must be [host_path|named_volume:]container_path[:ro]",
"compute.volume-binding.format");
}
VolumeBinding volumeString = new VolumeBinding();
volumeString.hostPart = matcher.group("src");
volumeString.containerPart = matcher.group("dst");
volumeString.readOnly = matcher.group("mode") != null;
return volumeString;
}
}
代码示例来源:origin: vmware/admiral
private void addTrustManager(String alias, String trustStore, String trustStorePassword) {
Utils.log(getClass(), getClass().getSimpleName(), Level.INFO,
"Adding trust store '%s' (path: '%s') to the trust manager...", alias, trustStore);
try (InputStream is = new FileInputStream(trustStore)) {
KeyStore store = KeyStore.getInstance(KeyStore.getDefaultType());
store.load(is, trustStorePassword.toCharArray());
delegatingTrustManager.putDelegate(alias,
(X509TrustManager) CertificateUtil.getTrustManagers(store)[0]);
} catch (Exception e) {
Utils.logWarning("Exception during trust manager configuration. Trust Store '%s'"
+ " (path: '%s'). Error: %s", alias, trustStore, Utils.toString(e));
}
}
代码示例来源:origin: vmware/admiral
private void addTrustManager(String alias, String trustStore, String trustStorePassword) {
Utils.log(getClass(), getClass().getSimpleName(), Level.INFO,
"Adding trust store '%s' (path: '%s') to the trust manager...", alias, trustStore);
try (InputStream is = new FileInputStream(trustStore)) {
KeyStore store = KeyStore.getInstance(KeyStore.getDefaultType());
store.load(is, trustStorePassword.toCharArray());
this.delegatingTrustManager.putDelegate(alias,
(X509TrustManager) CertificateUtil.getTrustManagers(store)[0]);
} catch (Exception e) {
Utils.logWarning(
"Exception during trust manager configuration. Trust Store '%s' (path: '%s'). Error: %s",
alias, trustStore, Utils.toString(e));
}
}
代码示例来源:origin: vmware/admiral
public static void reset() {
try {
Field field = ServerX509TrustManager.class.getDeclaredField("INSTANCE");
field.setAccessible(true);
field.set(null, null);
} catch (Exception e) {
Utils.logWarning("Cannot reset ServerX509TrustManager: %s", e.getMessage());
}
}
}
代码示例来源:origin: vmware/xenon
/**
* Creates a factory service instance that starts the specified child service
* on POST
*/
public static FactoryService create(Class<? extends Service> childServiceType,
ServiceOption... options) {
try {
Service s = childServiceType.newInstance();
Class<? extends ServiceDocument> childServiceDocumentType = s.getStateType();
FactoryService fs = create(childServiceType, childServiceDocumentType, options);
return fs;
} catch (Exception e) {
Utils.logWarning("Failure creating factory for %s: %s", childServiceType,
Utils.toString(e));
return null;
}
}
代码示例来源:origin: vmware/admiral
private static Map<String, JsonElement> parseStats(String statsJson) {
Map<String, JsonElement> stats = null;
try {
stats = Utils.fromJson(statsJson, new TypeToken<Map<String, JsonElement>>() {
}.getType());
} catch (Exception e) {
Utils.logWarning("Error parsing container stats: [%s]. Error: %s", statsJson,
Utils.toString(e));
}
return stats;
}
代码示例来源:origin: vmware/admiral
public void registerCertificate(SslTrustCertificateState sslTrustCert) {
String alias = sslTrustCert.getAlias();
try {
this.putDelegate(alias, sslTrustCert.certificate);
Utils.log(getClass(), "Self Signed Trust Store", Level.FINE,
"Certificate with alias %s updated", alias);
} catch (Throwable e) {
Utils.logWarning(
"Exception during certificate reload with alias: %s. Error: %s",
alias, Utils.toString(e));
}
}
代码示例来源:origin: vmware/admiral
private void loadCertificate(SslTrustCertificateState sslTrustCert) {
try {
self.putDelegate(sslTrustCert.getAlias(), sslTrustCert.certificate);
Utils.log(getClass(), "Self Signed Trust Store", Level.FINE,
"Certificate with alias %s updated", sslTrustCert.getAlias());
} catch (Throwable e) {
Utils.logWarning(
"Exception during certificate reload with alias: %s. Error: %s",
sslTrustCert.getAlias(), Utils.toString(e));
}
}
代码示例来源:origin: vmware/admiral
private void inspectContainer(ContainerState container, ServiceTaskCallback callback) {
AdapterRequest request = new AdapterRequest();
request.resourceReference = UriUtils.buildPublicUri(getHost(), container.documentSelfLink);
request.operationTypeId = ContainerOperationType.INSPECT.id;
request.serviceTaskCallback = callback;
sendRequest(Operation
.createPatch(getHost(), container.adapterManagementReference.toString())
.setBodyNoCloning(request)
.setCompletion((o, ex) -> {
if (ex != null) {
Utils.logWarning("Error while inspect request for container: %s. Error: %s",
container.documentSelfLink, Utils.toString(ex));
}
}));
}
代码示例来源:origin: vmware/admiral
private void sendSelfPatch(Closure body) {
URI uri = UriUtils.buildUri(getServiceHost(), body.documentSelfLink);
logInfo("Executing self patching of: %s", uri);
getServiceHost().sendRequest(Operation
.createPatch(uri)
.setReferer(getServiceHost().getUri())
.setBody(body)
.setCompletion((o, ex) -> {
if (ex != null) {
Utils.logWarning("Self patch failed: %s", Utils.toString(ex));
}
}));
}
内容来源于网络,如有侵权,请联系作者删除!