Tabnine Logo
ConfigurationInterfacePathResolver
Code IndexAdd Tabnine to your IDE (free)

How to use
ConfigurationInterfacePathResolver
in
rocks.inspectit.server.ci

Best Java code snippets using rocks.inspectit.server.ci.ConfigurationInterfacePathResolver (Showing top 20 results out of 315)

origin: inspectIT/inspectIT

/**
 * Saves agent mapping.
 *
 * @param agentMappings
 *            To save
 * @throws IOException
 *             If {@link IOException} occurs.
 * @throws JAXBException
 *             If {@link JAXBException} occurs. If saving fails.
 */
private void saveAgentMapping(AgentMappings agentMappings) throws JAXBException, IOException {
  transformator.marshall(pathResolver.getAgentMappingFilePath(), agentMappings, getRelativeToSchemaPath(pathResolver.getDefaultCiPath()).toString(),
      ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION);
}
origin: inspectIT/inspectIT

/**
 * Save the given {@link AlertingDefinition}.
 *
 * @param alertingDefinition
 *            the {@link AlertingDefinition} to save
 * @throws IOException
 *             if {@link IOException} occurs
 * @throws JAXBException
 *             if {@link JAXBException} occurs. If saving fails
 */
private void saveAlertingDefinition(AlertingDefinition alertingDefinition) throws JAXBException, IOException {
  transformator.marshall(pathResolver.getAlertingDefinitionFilePath(alertingDefinition), alertingDefinition, getRelativeToSchemaPath(pathResolver.getDefaultCiPath()).toString(),
      ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION);
}
origin: inspectIT/inspectIT

/**
 * Returns path pointing to the alerting definition file.
 *
 * @param alertingDefinition
 *            {@link AlertingDefinition}
 * @return Path to the file.
 */
public Path getAlertingDefinitionFilePath(AlertingDefinition alertingDefinition) {
  String secureDefinitionName = removeIllegalFilenameCharacters(alertingDefinition.getName());
  String fileName = alertingDefinition.getId() + "-" + secureDefinitionName + ".xml";
  return getAlertingDefinitionsPath().resolve(fileName);
}
origin: inspectIT/inspectIT

/**
 * Returns the {@link ConfigurationInterfaceImportData} from the given import data bytes.
 *
 * @param importData
 *            bytes that were exported.
 * @return {@link ConfigurationInterfaceImportData}.
 * @throws SAXException
 *             IF {@link SAXException} occurs during unmarshall.
 * @throws IOException
 *             If {@link IOException} occurs during unmarshall.
 * @throws JAXBException
 *             If {@link JAXBException} occurs during unmarshall.
 */
public ConfigurationInterfaceImportData getImportData(byte[] importData) throws JAXBException, IOException, SAXException {
  return transformator.unmarshall(importData, pathResolver.getSchemaPath(), ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION, pathResolver.getMigrationPath(),
      ConfigurationInterfaceImportData.class);
}
origin: inspectIT/inspectIT

/**
 * Returns path pointing to the environment file.
 *
 * @param environment
 *            {@link Environment}
 * @return Path to the file.
 */
public Path getEnvironmentFilePath(Environment environment) {
  String secureEnvironmentName = removeIllegalFilenameCharacters(environment.getName());
  String fileName = environment.getId() + "-" + secureEnvironmentName + ".xml";
  return getEnvironmentPath().resolve(fileName);
}
origin: inspectIT/inspectIT

final ConfigurationInterfacePathResolver resolverHelper = new ConfigurationInterfacePathResolver();
resolverHelper.init();
when(pathResolver.getDefaultCiPath()).thenReturn(Paths.get(TEST_FOLDER));
when(pathResolver.getAgentMappingFilePath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAgentMappingFilePath())));
when(pathResolver.getEnvironmentPath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getEnvironmentPath())));
when(pathResolver.getProfilesPath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getProfilesPath())));
when(pathResolver.getSchemaPath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getSchemaPath())));
when(pathResolver.getBusinessContextFilePath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getBusinessContextFilePath())));
when(pathResolver.getAlertingDefinitionsPath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAlertingDefinitionsPath())));
doAnswer(new Answer<Path>() {
  @Override
        .resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getEnvironmentFilePath((Environment) invocation.getArguments()[0])));
}).when(pathResolver).getEnvironmentFilePath(Matchers.<Environment> any());
doAnswer(new Answer<Path>() {
  @Override
        .resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getProfileFilePath((Profile) invocation.getArguments()[0])));
}).when(pathResolver).getProfileFilePath(Matchers.<Profile> any());
doAnswer(new Answer<Path>() {
  @Override
        .resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAlertingDefinitionFilePath((AlertingDefinition) invocation.getArguments()[0])));
}).when(pathResolver).getAlertingDefinitionFilePath(Matchers.<AlertingDefinition> any());
origin: inspectIT/inspectIT

/**
 * Loads the business context definition if it is not already loaded. If successfully loaded
 * definition will be placed in the {@link #businessContextDefinition} field.
 */
private void loadBusinessContextDefinition() {
  log.info("|-Loading the business context definition");
  Path path = pathResolver.getBusinessContextFilePath();
  BusinessContextDefinition businessContextDefinition = null;
  if (Files.exists(path)) {
    try {
      businessContextDefinition = transformator.unmarshall(path, pathResolver.getSchemaPath(), ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION, pathResolver.getMigrationPath(),
          BusinessContextDefinition.class);
    } catch (JAXBException | IOException | SAXException e) {
      log.error("Error loading Configuration interface business context file. File path: " + path.toString() + ".", e);
    }
  }
  if (null == businessContextDefinition) {
    businessContextDefinition = new BusinessContextDefinition();
    try {
      saveBusinessContext(businessContextDefinition);
    } catch (JAXBException | IOException e) {
      log.error("Error saving Configuration interface business context file. File path: " + path.toString() + ".", e);
    }
  }
  businessContextDefinitionReference.set(businessContextDefinition);
}
origin: inspectIT/inspectIT

Path path = pathResolver.getAgentMappingFilePath();
if (Files.notExists(path)) {
  log.info("||-The agent mappings file does not exists. Creating default mapping.");
    agentMappings = transformator.unmarshall(path, pathResolver.getSchemaPath(), ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION, pathResolver.getMigrationPath(), AgentMappings.class);
  } catch (JAXBException | IOException | SAXException e) {
    agentMappings = new AgentMappings(Collections.<AgentMapping> emptyList());
origin: inspectIT/inspectIT

/**
 * Saves {@link Environment} to the disk.
 *
 * @param environment
 *            {@link Environment} to save.
 * @throws IOException
 *             If {@link IOException} occurs.
 * @throws JAXBException
 *             If {@link JAXBException} occurs. If saving fails.
 */
private void saveEnvironment(Environment environment) throws JAXBException, IOException {
  transformator.marshall(pathResolver.getEnvironmentFilePath(environment), environment, getRelativeToSchemaPath(pathResolver.getEnvironmentPath()).toString(),
      ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION);
}
origin: inspectIT/inspectIT

/**
 * Returns the directory where profiles are saved.
 *
 * @return Profiles directory path.
 */
public Path getProfilesPath() {
  return getDefaultCiPath().resolve(PROFILES_FOLDER);
}
origin: inspectIT/inspectIT

/**
 * Saves the passed {@link IBusinessContextDefinition}.
 *
 * @param businessContextDefinition
 *            {@link IBusinessContextDefinition} to save
 * @throws IOException
 *             If {@link IOException} occurs.
 * @throws JAXBException
 *             If {@link JAXBException} occurs. If saving fails.
 */
private void saveBusinessContext(BusinessContextDefinition businessContextDefinition) throws JAXBException, IOException {
  businessContextDefinitionReference.set(businessContextDefinition);
  transformator.marshall(pathResolver.getBusinessContextFilePath(), businessContextDefinition, getRelativeToSchemaPath(pathResolver.getDefaultCiPath()).toString(),
      ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION);
}
origin: inspectIT/inspectIT

existingProfiles = new ConcurrentHashMap<>(16, 0.75f, 2);
Path path = pathResolver.getProfilesPath();
final Path schemaPath = pathResolver.getSchemaPath();
origin: inspectIT/inspectIT

  @Override
  public Path answer(InvocationOnMock invocation) throws Throwable {
    return Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getEnvironmentPath()))
        .resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getProfileFilePath((Profile) invocation.getArguments()[0])));
  }
}).when(pathResolver).getProfileFilePath(Matchers.<Profile> any());
origin: inspectIT/inspectIT

  @Override
  public Path answer(InvocationOnMock invocation) throws Throwable {
    return Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAlertingDefinitionsPath()))
        .resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAlertingDefinitionFilePath((AlertingDefinition) invocation.getArguments()[0])));
  }
}).when(pathResolver).getAlertingDefinitionFilePath(Matchers.<AlertingDefinition> any());
origin: inspectIT/inspectIT

/**
 * Saves profile and persists it to the list.
 *
 * @param profile
 *            Profile to be saved.
 * @throws IOException
 *             If {@link IOException} occurs during save.
 * @throws JAXBException
 *             If {@link JAXBException} occurs during save.
 * @throws BusinessException
 *             If saving of the common profile is requested.
 */
private void saveProfile(Profile profile) throws BusinessException, JAXBException, IOException {
  if (profile.isCommonProfile()) {
    throw new BusinessException("Save the profile '" + profile.getName() + " to disk.", ConfigurationInterfaceErrorCodeEnum.COMMON_PROFILE_CAN_NOT_BE_ALTERED);
  }
  transformator.marshall(pathResolver.getProfileFilePath(profile), profile, getRelativeToSchemaPath(pathResolver.getProfilesPath()).toString(),
      ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION);
}
origin: inspectIT/inspectIT

existingEnvironments = new ConcurrentHashMap<>(16, 0.75f, 2);
Path path = pathResolver.getEnvironmentPath();
final Path schemaPath = pathResolver.getSchemaPath();
origin: inspectIT/inspectIT

/**
 * Returns path pointing to the profile file.
 *
 * @param profile
 *            {@link Profile}
 * @return Path to the file.
 */
public Path getProfileFilePath(Profile profile) {
  String secureProfileName = removeIllegalFilenameCharacters(profile.getName());
  String fileName = profile.getId() + "-" + secureProfileName + ".xml";
  return getProfilesPath().resolve(fileName);
}
origin: inspectIT/inspectIT

/**
 * Deletes the existing environment.
 *
 * @param environment
 *            Environment to delete.
 * @throws IOException
 *             If {@link IOException} occurs during delete.
 */
public void deleteEnvironment(Environment environment) throws IOException {
  String id = environment.getId();
  Environment local = existingEnvironments.remove(id);
  if (null != local) {
    Files.deleteIfExists(pathResolver.getEnvironmentFilePath(local));
    AgentMappings agentMappings = agentMappingsReference.get();
    if (checkEnvironments(agentMappings)) {
      try {
        saveAgentMappings(agentMappings, false);
      } catch (Exception e) {
        log.error("Update of the agent mappings on the environment deletion failed.", e);
      }
    }
  }
}
origin: inspectIT/inspectIT

Profile local = existingProfiles.get(id);
if (null != local) {
  Files.deleteIfExists(pathResolver.getProfileFilePath(local));
origin: inspectIT/inspectIT

/**
 * Deletes the alerting definition.
 *
 * @param alertingDefinition
 *            AlertingDefinition to delete.
 * @throws IOException
 *             If {@link IOException} occurs during delete.
 */
public void deleteAlertingDefinition(AlertingDefinition alertingDefinition) throws IOException {
  String id = alertingDefinition.getId();
  AlertingDefinition local = existingAlertingDefinitions.remove(id);
  if (local != null) {
    Files.deleteIfExists(pathResolver.getAlertingDefinitionFilePath(local));
    eventPublisher.publishEvent(new AbstractAlertingDefinitionEvent.AlertingDefinitionDeletedEvent(this, local));
  }
}
rocks.inspectit.server.ciConfigurationInterfacePathResolver

Javadoc

Class that knows how to resolve paths related to the configuration interface.

Most used methods

  • getAgentMappingFilePath
    Returns path pointing to the agent mapping file.
  • getAlertingDefinitionFilePath
    Returns path pointing to the alerting definition file.
  • getAlertingDefinitionsPath
    Returns the directory where alert thresholds are saved.
  • getBusinessContextFilePath
    Returns path pointing to the business context file.
  • getDefaultCiPath
    Returns the default CI folder.
  • getEnvironmentFilePath
    Returns path pointing to the environment file.
  • getEnvironmentPath
    Returns the directory where environments are saved.
  • getProfileFilePath
    Returns path pointing to the profile file.
  • getProfilesPath
    Returns the directory where profiles are saved.
  • getSchemaPath
    Returns the schema path.
  • <init>
  • getMigrationPath
    Returns the schema path.
  • <init>,
  • getMigrationPath,
  • init,
  • removeIllegalFilenameCharacters

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now