private String getDefaultDomain(CloudControllerClient client) { CloudDomain defaultDomain = client.getDefaultDomain(); if (defaultDomain != null) { return defaultDomain.getName(); } return null; }
private String getDefaultDomain(CloudControllerClient client) { CloudDomain defaultDomain = client.getDefaultDomain(); if (defaultDomain != null) { return defaultDomain.getName(); } return null; }
protected void deleteAllocatedRoutes(HistoryService historyService, String processInstanceId) { HistoricVariableInstance allocatedPortsInstance = getHistoricVarInstanceValue(historyService, processInstanceId, Constants.VAR_ALLOCATED_PORTS); if (allocatedPortsInstance == null) { return; } CloudControllerClient client = getCloudFoundryClient(historyService, processInstanceId); String defaultDomain = client.getDefaultDomain() != null ? client.getDefaultDomain() .getName() : null; if (defaultDomain == null) { LOGGER.warn(Messages.COULD_NOT_COMPUTE_DEFAULT_DOMAIN); return; } Integer[] allocatedPorts = JsonUtil.fromBinaryJson((byte[]) allocatedPortsInstance.getValue(), Integer[].class); for (Integer port : allocatedPorts) { try { client.deleteRoute(port.toString(), defaultDomain); } catch (CloudOperationException e) { LOGGER.warn(format(Messages.COULD_NOT_DELETE_ROUTE_FOR_PORT, port.toString())); } } }
protected void deleteAllocatedRoutes(HistoryService historyService, String processInstanceId) { HistoricVariableInstance allocatedPortsInstance = getHistoricVarInstanceValue(historyService, processInstanceId, Constants.VAR_ALLOCATED_PORTS); if (allocatedPortsInstance == null) { return; } CloudControllerClient client = getCloudFoundryClient(historyService, processInstanceId); String defaultDomain = client.getDefaultDomain() != null ? client.getDefaultDomain() .getName() : null; if (defaultDomain == null) { LOGGER.warn(Messages.COULD_NOT_COMPUTE_DEFAULT_DOMAIN); return; } Integer[] allocatedPorts = JsonUtil.fromBinaryJson((byte[]) allocatedPortsInstance.getValue(), Integer[].class); for (Integer port : allocatedPorts) { try { client.deleteRoute(port.toString(), defaultDomain); } catch (CloudOperationException e) { LOGGER.warn(format(Messages.COULD_NOT_DELETE_ROUTE_FOR_PORT, port.toString())); } } }