本文整理汇总了Java中com.cloud.utils.exception.CloudRuntimeException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java CloudRuntimeException.getMessage方法的具体用法?Java CloudRuntimeException.getMessage怎么用?Java CloudRuntimeException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cloud.utils.exception.CloudRuntimeException
的用法示例。
在下文中一共展示了CloudRuntimeException.getMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
CallContext.current().setEventDetails("Vm Id: " + getId());
try {
final UserVm result = _userVmService.expungeVm(this.getId());
if (result != null) {
final SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to expunge vm");
}
} catch (final InvalidParameterValueException ipve) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (final CloudRuntimeException cre) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
示例2: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
try {
final List<Host> devices = nwDeviceMgr.listNetworkDevice(this);
final List<NetworkDeviceResponse> nwdeviceResponses = new ArrayList<>();
final ListResponse<NetworkDeviceResponse> listResponse = new ListResponse<>();
for (final Host d : devices) {
final NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(d);
response.setObjectName("networkdevice");
response.setResponseName(getCommandName());
nwdeviceResponses.add(response);
}
listResponse.setResponses(nwdeviceResponses);
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (final InvalidParameterValueException ipve) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (final CloudRuntimeException cre) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
示例3: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
try {
final boolean result = nwDeviceMgr.deleteNetworkDevice(this);
if (result) {
final SuccessResponse response = new SuccessResponse(getCommandName());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network device:" + getId());
}
} catch (final InvalidParameterValueException ipve) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (final CloudRuntimeException cre) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
示例4: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
try {
final NiciraNvpDeviceVO niciraNvpDeviceVO = niciraNvpElementService.addNiciraNvpDevice(this);
if (niciraNvpDeviceVO != null) {
final NiciraNvpDeviceResponse response = niciraNvpElementService.createNiciraNvpDeviceResponse(niciraNvpDeviceVO);
response.setObjectName("niciranvpdevice");
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Nicira NVP device due to internal error.");
}
} catch (final InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (final CloudRuntimeException runtimeExcp) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}
示例5: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException {
try {
final List<NiciraNvpDeviceVO> niciraDevices = niciraNvpElementService.listNiciraNvpDevices(this);
final ListResponse<NiciraNvpDeviceResponse> response = new ListResponse<>();
final List<NiciraNvpDeviceResponse> niciraDevicesResponse = new ArrayList<>();
if (niciraDevices != null && !niciraDevices.isEmpty()) {
for (final NiciraNvpDeviceVO niciraDeviceVO : niciraDevices) {
final NiciraNvpDeviceResponse niciraDeviceResponse = niciraNvpElementService.createNiciraNvpDeviceResponse(niciraDeviceVO);
niciraDevicesResponse.add(niciraDeviceResponse);
}
}
response.setResponses(niciraDevicesResponse);
response.setResponseName(getCommandName());
setResponseObject(response);
} catch (final InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (final CloudRuntimeException runtimeExcp) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}
示例6: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
try {
final List<? extends Network> networks = niciraNvpElementService.listNiciraNvpDeviceNetworks(this);
final ListResponse<NetworkResponse> response = new ListResponse<>();
final List<NetworkResponse> networkResponses = new ArrayList<>();
if (networks != null && !networks.isEmpty()) {
for (final Network network : networks) {
final NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(ResponseView.Full, network);
networkResponses.add(networkResponse);
}
}
response.setResponses(networkResponses);
response.setResponseName(getCommandName());
setResponseObject(response);
} catch (final InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (final CloudRuntimeException runtimeExcp) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}
示例7: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
try {
final boolean result = niciraNvpElementService.deleteNiciraNvpDevice(this);
if (result) {
final SuccessResponse response = new SuccessResponse(getCommandName());
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Nicira device.");
}
} catch (final InvalidParameterValueException invalidParamExcp) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
} catch (final CloudRuntimeException runtimeExcp) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
}
}
示例8: execute
import com.cloud.utils.exception.CloudRuntimeException; //导入方法依赖的package包/类
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
try {
final Host device = nwDeviceMgr.addNetworkDevice(this);
final NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(device);
response.setObjectName("networkdevice");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (final InvalidParameterValueException ipve) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (final CloudRuntimeException cre) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}