/** * Provides detail information of a business context definition (application). * * <p> * <i> Example URL: /bc/definition/app/{id}</i> * </p> * * @param id * Application ID. * * @return detail information of an {@link ApplicationDefinition}. * @throws BusinessException * If given ID of the application is not valid. */ @RequestMapping(method = GET, value = "{id}") @ResponseBody public ApplicationDefinition getApplicationDefinition(@PathVariable int id) throws BusinessException { return configurationInterfaceService.getApplicationDefinition(id); }
/** * Provides informations of business context definition. * * <p> * <i> Example URL: /bc/definition/app</i> * </p> * * @return a list of {@link ApplicationDefinition}. */ @RequestMapping(method = GET, value = "") @ResponseBody public List<ApplicationDefinition> getApplicationDefinitions() { return configurationInterfaceService.getApplicationDefinitions(); }
/** * {@inheritDoc} */ @Override protected IStatus run(IProgressMonitor monitor) { if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.OFFLINE) { return Status.CANCEL_STATUS; } try { AgentMappings mappings = cmrRepositoryDefinition.getConfigurationInterfaceService().getAgentMappings(); Collection<Environment> environments = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllEnvironments(); final AgentMappingInput input = new AgentMappingInput(cmrRepositoryDefinition, mappings, environments); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { activePage.openEditor(input, AgentMappingEditor.ID, true); } catch (PartInitException e) { InspectIT.getDefault().createErrorDialog("Exception occurred opening the Agent mapping settings editor.", e, -1); } } }); return Status.OK_STATUS; } catch (Exception e) { return new Status(IStatus.ERROR, InspectIT.ID, "Exception occurred loading the data from the CMR.", e); } }
/** * {@inheritDoc} */ @Override protected IStatus run(IProgressMonitor monitor) { if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.OFFLINE) { return Status.CANCEL_STATUS; } try { Environment environment = cmrRepositoryDefinition.getConfigurationInterfaceService().getEnvironment(environmentId); Collection<Profile> profiles = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllProfiles(); final EnvironmentEditorInput environmentEditorInput = new EnvironmentEditorInput(environment, profiles, cmrRepositoryDefinition); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { page.openEditor(environmentEditorInput, EnvironmentEditor.ID, true); } catch (PartInitException e) { InspectIT.getDefault().createErrorDialog("Exception occurred opening the Environment editor.", e, -1); } } }); return Status.OK_STATUS; } catch (BusinessException e) { return new Status(IStatus.ERROR, InspectIT.ID, "Exception occurred loading the environment from the CMR.", e); } }
List<Profile> existingProfiles = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllProfiles(); Collection<Environment> existingEnvironments = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllEnvironments(); Profile imported = cmrRepositoryDefinition.getConfigurationInterfaceService().importProfile(profile); Environment imported = cmrRepositoryDefinition.getConfigurationInterfaceService().importEnvironment(environment);
/** * {@inheritDoc} */ @Override protected IStatus run(IProgressMonitor monitor) { if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.OFFLINE) { return Status.CANCEL_STATUS; } try { Profile profile = cmrRepositoryDefinition.getConfigurationInterfaceService().getProfile(profileId); final ProfileEditorInput profileEditorInput = new ProfileEditorInput(profile, cmrRepositoryDefinition); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { page.openEditor(profileEditorInput, ProfileEditor.ID, true); } catch (PartInitException e) { InspectIT.getDefault().createErrorDialog("Exception occurred opening the Profile editor.", e, -1); } } }); return Status.OK_STATUS; } catch (BusinessException e) { return new Status(IStatus.OK, InspectIT.ID, "Exception occurred loading the profile from the CMR.", e); } }
/** * {@inheritDoc} */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof ICmrRepositoryProvider) { cmrRepositoryDefinition = ((ICmrRepositoryProvider) structuredSelection.getFirstElement()).getCmrRepositoryDefinition(); environments = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllEnvironments(); profiles = cmrRepositoryDefinition.getConfigurationInterfaceService().getAllProfiles(); // remove common profiles as they can not be exported for (Iterator<Profile> it = profiles.iterator(); it.hasNext();) { if (it.next().isCommonProfile()) { it.remove(); } } } for (Object selected : structuredSelection.toArray()) { if (selected instanceof IProfileProvider) { selectedProfilesIds.add(((IProfileProvider) selected).getProfile().getId()); } } for (Object selected : structuredSelection.toArray()) { if (selected instanceof IEnvironmentProvider) { selectedEnvironmentsIds.add(((IEnvironmentProvider) selected).getEnvironment().getId()); } } }
AlertingDefinition updatedAlertingDefinition = cmrRepositoryDefinition.getConfigurationInterfaceService().updateAlertingDefinition(alertDefinition); InspectIT.getDefault().getInspectITConfigurationInterfaceManager().alertDefinitionUpdated(updatedAlertingDefinition, cmrRepositoryDefinition); } else { AlertingDefinition newAlertingDefinition = cmrRepositoryDefinition.getConfigurationInterfaceService().createAlertingDefinition(alertDefinition); InspectIT.getDefault().getInspectITConfigurationInterfaceManager().alertDefinitionCreated(newAlertingDefinition, cmrRepositoryDefinition);
/** * {@inheritDoc} */ @Override public void addPages() { List<AlertingDefinition> alertDefinitions = cmrRepositoryDefinition.getConfigurationInterfaceService().getAlertingDefinitions(); List<String> existingNames = new ArrayList<>(); for (AlertingDefinition alertDef : alertDefinitions) { existingNames.add(alertDef.getName()); } if (null != initialAlertDefinition) { // editing mode existingNames.remove(initialAlertDefinition.getName()); alertSourcePage = new AlertSourceDefinitionWizardPage(cmrRepositoryDefinition.getInfluxDBService(), existingNames, initialAlertDefinition.getName(), initialAlertDefinition.getMeasurement(), initialAlertDefinition.getField(), initialAlertDefinition.getTags()); alertdetailsPage = new AlertDetailsWizardPage(initialAlertDefinition.getThreshold(), initialAlertDefinition.getThresholdType().equals(ThresholdType.LOWER_THRESHOLD), initialAlertDefinition.getTimeRange(TimeUnit.MINUTES), initialAlertDefinition.getNotificationEmailAddresses()); } else { // new alerting definition creation mode alertSourcePage = new AlertSourceDefinitionWizardPage(cmrRepositoryDefinition.getInfluxDBService(), existingNames); alertdetailsPage = new AlertDetailsWizardPage(); } addPage(alertSourcePage); addPage(alertdetailsPage); }
newApplication = cmrRepositoryDefinition.getConfigurationInterfaceService().addApplicationDefinition(newApplication, insertBeforeIndex); InspectIT.getDefault().getInspectITConfigurationInterfaceManager().applicationCreated(newApplication, insertBeforeIndex, cmrRepositoryDefinition); new OpenApplicationDefinitionJob(cmrRepositoryDefinition, newApplication.getId(), workbench.getActiveWorkbenchWindow().getActivePage()).schedule();
@Test public void executorClient() throws BusinessException { Profile profile = mock(Profile.class); when(profile.isActive()).thenReturn(true); when(environment.getProfileIds()).thenReturn(Sets.newHashSet("profile-id")); when(ciService.getProfile("profile-id")).thenReturn(profile); SensorAssignmentProfileData sapData = mock(SensorAssignmentProfileData.class); when(profile.getProfileData()).thenReturn((AbstractProfileData) sapData); MethodSensorAssignment msAssignment = mock(MethodSensorAssignment.class); when(sapData.getMethodSensorAssignments()).thenReturn(Lists.newArrayList(msAssignment)); when(msAssignment.getSensorConfigClass()).thenReturn((Class) ExecutorClientSensorConfig.class); Collection<SpecialMethodSensorAssignment> assignments = factory.getSpecialAssignments(environment); assertThat(assignments, is(not(empty()))); assertThat(assignments, hasItem(hasProperty("specialMethodSensorConfig", is(ExecutorIntercepterSensorConfig.INSTANCE)))); assertThat(assignments, hasItem(hasProperty("specialMethodSensorConfig", is(CloseableHttpAsyncClientSensorConfig.INSTANCE)))); }
Environment updatedEnvironment = repositoryDefinition.getConfigurationInterfaceService().getEnvironment(input.getEnvironment().getId()); List<Profile> updatedProfiles = repositoryDefinition.getConfigurationInterfaceService().getAllProfiles();
/** * Provides information of all business transaction definitions of an application. * * <p> * <i> Example URL: /bc/definition/app/{id}/btx</i> * </p> * * @param id * Application ID. * * @return a list of {@link BusinessTransactionData}. * @throws BusinessException * If given ID of the application is not valid. */ @RequestMapping(method = GET, value = "{id}/btx") @ResponseBody public List<BusinessTransactionDefinition> getBusinessTransactionDefinitions(@PathVariable int id) throws BusinessException { return configurationInterfaceService.getApplicationDefinition(id).getBusinessTransactionDefinitions(); }
/** * {@inheritDoc} */ @Override public void addPages() { if (cmrRepositoryDefinition.getOnlineStatus() != OnlineStatus.OFFLINE) { List<ApplicationDefinition> applications = cmrRepositoryDefinition.getConfigurationInterfaceService().getApplicationDefinitions(); String[] items = new String[applications.size()]; int i = 0; for (ApplicationDefinition app : applications) { items[i] = app.getApplicationName(); i++; } newApplicationWizardPage = new NameDescriptionInsertBeforeWizardPage(TITLE, MESSAGE, items, BusinessContextManagerViewPart.APP_ORDER_INFO_TOOLTIP); addPage(newApplicationWizardPage); } else { InspectIT.getDefault().createErrorDialog("Application can not be created. Selected CMR repository is currently not available.", -1); } }
AgentMappings updatedAgentMappings = repositoryDefinition.getConfigurationInterfaceService().getAgentMappings(); Collection<Environment> updatedEnvironments = repositoryDefinition.getConfigurationInterfaceService().getAllEnvironments();
/** * Provides detail information of a business transaction definition and application. * * <p> * <i> Example URL: /bc/definition/app/{id}/btx/{businessTxId}</i> * </p> * * @param id * Application ID. * @param businessTxId * Business transaction ID. * * @return detail information of a {@link BusinessTransactionData}. * @throws BusinessException * If given ID of the application is not valid. */ @RequestMapping(method = GET, value = "{id}/btx/{businessTxId}") @ResponseBody public BusinessTransactionDefinition getBusinessTransactionDefinition(@PathVariable int id, @PathVariable int businessTxId) throws BusinessException { return configurationInterfaceService.getApplicationDefinition(id).getBusinessTransactionDefinition(businessTxId); }
/** * Assigns the business context to the passed {@link InvocationSequenceData} instance. * * @param invocSequence * {@link InvocationSequenceData} instance to assign the business context for. */ private void assignBusinessContext(InvocationSequenceData invocSequence) { List<ApplicationDefinition> applicationDefinitions = configurationInterfaceService.getApplicationDefinitions(); ApplicationDefinition appDefinition = identify(invocSequence, applicationDefinitions); if (null == appDefinition) { appDefinition = ApplicationDefinition.DEFAULT_APPLICATION_DEFINITION; } ApplicationData application = businessContextRegistryService.registerApplication(appDefinition); invocSequence.setApplicationId(application.getId()); BusinessTransactionDefinition businessTxDefinition = identify(invocSequence, appDefinition.getBusinessTransactionDefinitions()); String businessTxName = businessTxDefinition.determineBusinessTransactionName(invocSequence, cachedDataService); BusinessTransactionData businessTransaction = businessContextRegistryService.registerBusinessTransaction(application, businessTxDefinition, businessTxName); invocSequence.setBusinessTransactionId(businessTransaction.getId()); }
application = cmrRepositoryDefinition.getConfigurationInterfaceService().getApplicationDefinition(applicationId); } catch (BusinessException e) { return new Status(IStatus.ERROR, InspectIT.ID, "Exception occurred loading the application from the CMR.", e);