/** * Default constructor. * * @param errorCode * Error code describing the exception. * @param cause * Technical cause of the exception. */ public TechnicalException(IErrorCode errorCode, Throwable cause) { super(errorCode); initCause(cause); }
/** * Constructor that allows definition of the action. * * @param actionPerformed * Action being performed when exception occurred. * @param errorCode * Error code describing the exception. */ public BusinessException(String actionPerformed, IErrorCode errorCode) { super(generateMessage(actionPerformed, errorCode)); this.actionPerformed = actionPerformed; this.errorCode = errorCode; }
/** * Sets {@link #serviceMethodSignature}. * * @param serviceMethodSignature * New value for {@link #serviceMethodSignature} */ public void setServiceMethodSignature(String serviceMethodSignature) { this.serviceMethodSignature = serviceMethodSignature; // set also to the cause Throwable cause = getCause(); if (cause instanceof RemoteException) { ((RemoteException) cause).setServiceMethodSignature(serviceMethodSignature); } }
/** * {@inheritDoc} */ @Override @MethodLog public void writeToStorage(StorageData storageData, Collection<DefaultData> defaultDataCollection, Collection<AbstractDataProcessor> dataProcessors, boolean synchronously) throws BusinessException { if (!storageManager.isStorageOpen(storageData)) { throw new BusinessException("Write to the storage " + storageData + ".", StorageErrorCodeEnum.STORAGE_IS_NOT_OPENED); } try { storageManager.writeToStorage(storageData, defaultDataCollection, dataProcessors, synchronously); } catch (SerializationException e) { throw new TechnicalException("Write to the storage " + storageData + ".", StorageErrorCodeEnum.SERIALIZATION_FAILED, e); } catch (IOException e) { throw new TechnicalException("Write to the storage " + storageData + ".", StorageErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * Returns the {@link AlertingDefinition} for the given id. * * @param id * the identifier of the {@link AlertingDefinition} * @return {@link AlertingDefinition} of the given id * @throws BusinessException * if no {@link AlertingDefinition} exists for the given id */ public AlertingDefinition getAlertingDefinition(String id) throws BusinessException { AlertingDefinition alertingDefinition = existingAlertingDefinitions.get(id); if (null == alertingDefinition) { throw new BusinessException("Load alerting definition with the id=" + id + ".", AlertErrorCodeEnum.ALERTING_DEFINITION_DOES_NOT_EXIST); } return alertingDefinition; }
/** * {@inheritDoc} */ @Override public void create() { super.create(); this.setTitle(dialogTitle); this.setTitleImage(InspectIT.getDefault().getImage(InspectITImages.IMG_WIZBAN_ERROR)); if (null != exception.getErrorCode()) { this.setMessage(exception.getErrorCode().getName()); } }
/** * Creates a exception message based on the action performed and {@link IErrorCode}. * * @param actionPerformed * Action being performed when exception occurred. * @param errorCode * Error code describing the exception. * @return Exception message. */ private static String generateMessage(String actionPerformed, IErrorCode errorCode) { if (null == errorCode) { return null; } String s = "The '" + errorCode.getName() + "' exception occurred on the '" + errorCode.getComponent() + "' component."; if (null != actionPerformed) { s += " Exception occurred executing the action: '" + actionPerformed + "'."; } return s; }
/** * {@inheritDoc} */ @Override public ConfigurationInterfaceImportData getImportData(byte[] importData) throws BusinessException { try { return ciManager.getImportData(importData); } catch (JAXBException | SAXException e) { throw new TechnicalException("Export the data.", ConfigurationInterfaceErrorCodeEnum.JAXB_MARSHALLING_OR_DEMARSHALLING_FAILED, e); } catch (IOException e) { throw new TechnicalException("Export the data.", ConfigurationInterfaceErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * {@inheritDoc} */ @Override @MethodLog public Map<String, Long> getDataFilesLocations(StorageData storageData) throws BusinessException { if (!storageManager.isStorageExisting(storageData)) { throw new BusinessException("Load data files locations for the storage " + storageData + ".", StorageErrorCodeEnum.STORAGE_DOES_NOT_EXIST); } try { return storageManager.getFilesHttpLocation(storageData, StorageFileType.DATA_FILE.getExtension()); } catch (IOException e) { throw new TechnicalException("Load data files locations for the storage " + storageData + ".", StorageErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * Returns the environment with the given id. * * @param id * Id of environment. * @return {@link Environment} * @throws BusinessException * If environment with given id does not exist. */ public Environment getEnvironment(String id) throws BusinessException { Environment environment = existingEnvironments.get(id); if (null == environment) { throw new BusinessException("Load environemnt with the id=" + id + ".", ConfigurationInterfaceErrorCodeEnum.ENVIRONMENT_DOES_NOT_EXIST); } return environment; }
/** * {@inheritDoc} */ @Override public AgentMappings saveAgentMappings(AgentMappings agentMappings) throws BusinessException { try { return ciManager.saveAgentMappings(agentMappings, true); } catch (JAXBException e) { throw new TechnicalException("Update the agent mappings.", ConfigurationInterfaceErrorCodeEnum.JAXB_MARSHALLING_OR_DEMARSHALLING_FAILED, e); } catch (IOException e) { throw new TechnicalException("Update the agent mappings.", ConfigurationInterfaceErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * Constructor that allows definition of the action. * * @param actionPerformed * Action being performed when exception occurred. * @param errorCode * Error code describing the exception. * @param cause * Technical cause of the exception. */ public TechnicalException(String actionPerformed, IErrorCode errorCode, Throwable cause) { super(actionPerformed, errorCode); initCause(cause); }
/** * {@inheritDoc} */ @Override @MethodLog public Map<String, Long> getCachedDataFilesLocations(StorageData storageData) throws BusinessException { if (!storageManager.isStorageExisting(storageData)) { throw new BusinessException("Load cached files locations for the storage " + storageData + ".", StorageErrorCodeEnum.STORAGE_DOES_NOT_EXIST); } try { return storageManager.getFilesHttpLocation(storageData, StorageFileType.CACHED_DATA_FILE.getExtension()); } catch (IOException e) { throw new TechnicalException("Load cache files locations for the storage " + storageData + ".", StorageErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * {@inheritDoc} */ @Override public AlertingDefinition createAlertingDefinition(AlertingDefinition alertingDefinition) throws BusinessException { try { return ciManager.createAlertingDefinition(alertingDefinition); } catch (JAXBException e) { throw new TechnicalException("Update the alerting definition.", ConfigurationInterfaceErrorCodeEnum.JAXB_MARSHALLING_OR_DEMARSHALLING_FAILED, e); } catch (IOException e) { throw new TechnicalException("Update the alerting definition.", ConfigurationInterfaceErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * {@inheritDoc} */ @Override @MethodLog public Map<String, Long> getIndexFilesLocations(StorageData storageData) throws BusinessException { if (!storageManager.isStorageExisting(storageData)) { throw new BusinessException("Load index files locations for the storage " + storageData + ".", StorageErrorCodeEnum.STORAGE_DOES_NOT_EXIST); } try { return storageManager.getFilesHttpLocation(storageData, StorageFileType.INDEX_FILE.getExtension()); } catch (IOException e) { throw new TechnicalException("Load index files locations for the storage " + storageData + ".", StorageErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
@Override public StorageData copyDataToStorage(StorageData storageData, Collection<Long> elementIds, long platformIdent, Set<Long> traceIds, Collection<AbstractDataProcessor> dataProcessors, boolean autoFinalize) throws BusinessException { try { storageManager.copyDataToStorage(storageData, elementIds, platformIdent, traceIds, dataProcessors, autoFinalize); return storageData; } catch (SerializationException e) { throw new TechnicalException("Write to the storage " + storageData + ".", StorageErrorCodeEnum.SERIALIZATION_FAILED, e); } catch (IOException e) { throw new TechnicalException("Write to the storage " + storageData + ".", StorageErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * {@inheritDoc} */ @Override @MethodLog public Map<String, Long> getAgentFilesLocations(StorageData storageData) throws BusinessException { if (!storageManager.isStorageExisting(storageData)) { throw new BusinessException("Load agent files locations for the storage " + storageData + ".", StorageErrorCodeEnum.STORAGE_DOES_NOT_EXIST); } try { return storageManager.getFilesHttpLocation(storageData, StorageFileType.AGENT_FILE.getExtension()); } catch (IOException e) { throw new TechnicalException("Load agent files locations for the storage " + storageData + ".", StorageErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * {@inheritDoc} */ @Override public AlertingDefinition updateAlertingDefinition(AlertingDefinition alertingDefinition) throws BusinessException { try { return ciManager.updateAlertingDefinition(alertingDefinition); } catch (JAXBException e) { throw new TechnicalException("Update the alerting definition.", ConfigurationInterfaceErrorCodeEnum.JAXB_MARSHALLING_OR_DEMARSHALLING_FAILED, e); } catch (IOException e) { throw new TechnicalException("Update the alerting definition.", ConfigurationInterfaceErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * {@inheritDoc} */ @Override public byte[] getExportData(Collection<Environment> environments, Collection<Profile> profiles) throws BusinessException { try { return ciManager.getExportData(environments, profiles); } catch (JAXBException e) { throw new TechnicalException("Export the data.", ConfigurationInterfaceErrorCodeEnum.JAXB_MARSHALLING_OR_DEMARSHALLING_FAILED, e); } catch (IOException e) { throw new TechnicalException("Export the data.", ConfigurationInterfaceErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }
/** * {@inheritDoc} */ @Override public void deleteEnvironment(Environment environment) throws BusinessException { try { ciManager.deleteEnvironment(environment); } catch (IOException e) { throw new TechnicalException("Delete the environment '" + environment.getName() + "'.", ConfigurationInterfaceErrorCodeEnum.INPUT_OUTPUT_OPERATION_FAILED, e); } }