本文整理匯總了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());
}
}