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

How to use
ConfigGroupMarshaller
in
org.guvnor.structure.backend.config

Best Java code snippets using org.guvnor.structure.backend.config.ConfigGroupMarshaller (Showing top 10 results out of 315)

origin: org.kie.workbench/kie-wb-common-cli-project-migration

  private void saveConfiguration(final ConfigGroup configGroup,
                  final Path filePath,
                  final CommentedOption commentedOption) {
    try {
      ioService.startBatch(filePath.getFileSystem());
      ioService.write(filePath,
              marshaller.marshall(configGroup),
              commentedOption);

      updateLastModified();
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    } finally {
      ioService.endBatch();
    }
  }
}
origin: kiegroup/appformer

private List<ConfigGroup> getConfiguration(final Path dir,
                      final ConfigType type) {
  final List<ConfigGroup> configGroups = new ArrayList<>();
  if (!ioService.exists(dir)) {
    return configGroups;
  }
  final DirectoryStream<Path> foundConfigs = getDirectoryStreamForFilesWithParticularExtension(dir,
                                                 type.getExt());
  //Only load and cache if a file was found!
  final Iterator<Path> it = foundConfigs.iterator();
  if (it.hasNext()) {
    while (it.hasNext()) {
      final String content = ioService.readAllString(it.next());
      final ConfigGroup configGroup = marshaller.unmarshall(content);
      configGroups.add(configGroup);
    }
    return configGroups;
  }
  return null;
}
origin: org.kie.workbench/kie-wb-common-cli-project-migration

@Before
public void setup() throws IOException {
  fileSystemTestingUtils.setup();
  when(systemRepository.getUri()).thenReturn("git://amend-repo-test");
  marshaller = new ConfigGroupMarshaller();
  configurationFactory = new MigrationConfigurationFactoryImpl(new DefaultPasswordServiceImpl());
  ioService = mockIoService();
  configurationService = new MigrationConfigurationServiceImpl(systemRepository,
                                 marshaller,
                                 identity,
                                 ioService,
                                 repoChangedEvent,
                                 spaceChangedEvent,
                                 changedEvent,
                                 fileSystemTestingUtils.getFileSystem());
}
origin: org.uberfire/uberfire-structure-backend

@Before
public void setup() throws IOException {
  fileSystemTestingUtils.setup();
  when(systemRepository.getUri()).thenReturn("git://amend-repo-test");
  marshaller = new ConfigGroupMarshaller();
  configurationFactory = new ConfigurationFactoryImpl(new DefaultPasswordServiceImpl());
  ioService = mockIoService();
  configurationService = new ConfigurationServiceImpl(systemRepository,
                            marshaller,
                            identity,
                            ioService,
                            repoChangedEvent,
                            spaceChangedEvent,
                            changedEvent,
                            fileSystemTestingUtils.getFileSystem());
}
origin: org.guvnor/guvnor-structure-backend

@Override
public boolean updateConfiguration(ConfigGroup configGroup) {
  String filename = configGroup.getName().replaceAll(INVALID_FILENAME_CHARS,
                            "_");
  final Path filePath = ioService.get(systemRepository.getUri()).resolve(filename + configGroup.getType().getExt());
  final CommentedOption commentedOption = new CommentedOption(getIdentityName(),
                                "Updated config " + filePath.getFileName());
  try {
    ioService.startBatch(filePath.getFileSystem());
    ioService.write(filePath,
            marshaller.marshall(configGroup),
            commentedOption);
    updateLastModified();
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  } finally {
    ioService.endBatch();
  }
  //Invalidate cache if a new item has been created; otherwise cached value is stale
  configuration.remove(configGroup.getType());
  return true;
}
origin: org.guvnor/guvnor-structure-backend

while (it.hasNext()) {
  final String content = ioService.readAllString(it.next());
  final ConfigGroup configGroup = marshaller.unmarshall(content);
  configGroups.add(configGroup);
origin: kiegroup/appformer

@Before
public void setup() throws IOException {
  fileSystemTestingUtils.setup();
  when(systemRepository.getUri()).thenReturn("git://amend-repo-test");
  marshaller = new ConfigGroupMarshaller();
  configurationFactory = new ConfigurationFactoryImpl(new DefaultPasswordServiceImpl());
  ioService = mockIoService();
  configurationService = new ConfigurationServiceImpl(systemRepository,
                            marshaller,
                            identity,
                            ioService,
                            repoChangedEvent,
                            spaceChangedEvent,
                            changedEvent,
                            fileSystemTestingUtils.getFileSystem());
}
origin: kiegroup/appformer

private boolean saveConfiguration(final ConfigGroup configGroup,
                 final Path path,
                 final String commitMessage,
                 final boolean isNew) {
  // avoid duplicated writes to not cause cyclic cluster sync
  if (isNew && ioService.exists(path)) {
    return true;
  }
  final CommentedOption commentedOption = new CommentedOption(getIdentityName(),
                                commitMessage);
  try {
    ioService.startBatch(path.getFileSystem());
    ioService.write(path,
            marshaller.marshall(configGroup),
            commentedOption);
    updateLastModified();
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  } finally {
    ioService.endBatch();
  }
  invalidateCacheAfterUpdatingConfigGroup(configGroup);
  return true;
}
origin: org.kie.workbench/kie-wb-common-cli-project-migration

@Override
public List<ConfigGroup> getConfiguration(ConfigType configType) {
  if (ConfigType.SPACE.equals(configType)) {
    configType = ConfigType.ORGANIZATIONAL_UNIT;
  }
  final ConfigType type = configType;
  final List<ConfigGroup> configGroups = new ArrayList<>();
  final DirectoryStream<Path> foundConfigs = ioService.newDirectoryStream(ioService.get(systemRepository.getUri()),
                                      entry -> {
                                        if (!Files.isDirectory(entry) &&
                                            !entry.getFileName().toString().startsWith(".") &&
                                            entry.getFileName().toString().endsWith(type.getExt())) {
                                          return true;
                                        }
                                        return false;
                                      }
  );
  //Only load and cache if a file was found!
  final Iterator<Path> it = foundConfigs.iterator();
  if (it.hasNext()) {
    while (it.hasNext()) {
      final String content = ioService.readAllString(it.next());
      final ConfigGroup configGroup = marshaller.unmarshall(content);
      configGroups.add(configGroup);
    }
    configGroupsByTypeWithoutNamespace.put(type,
                        configGroups);
  }
  return configGroups;
}
origin: org.guvnor/guvnor-structure-backend

@Override
public boolean addConfiguration(final ConfigGroup configGroup) {
  String filename = configGroup.getName().replaceAll(INVALID_FILENAME_CHARS,
                            "_");
  final Path filePath = ioService.get(systemRepository.getUri()).resolve(filename + configGroup.getType().getExt());
  // avoid duplicated writes to not cause cyclic cluster sync
  if (ioService.exists(filePath)) {
    return true;
  }
  final CommentedOption commentedOption = new CommentedOption(getIdentityName(),
                                "Created config " + filePath.getFileName());
  try {
    ioService.startBatch(filePath.getFileSystem());
    ioService.write(filePath,
            marshaller.marshall(configGroup),
            commentedOption);
    updateLastModified();
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  } finally {
    ioService.endBatch();
  }
  //Invalidate cache if a new item has been created; otherwise cached value is stale
  configuration.remove(configGroup.getType());
  return true;
}
org.guvnor.structure.backend.configConfigGroupMarshaller

Javadoc

Marshall a ConfigGroup to and from XML

Most used methods

  • marshall
  • unmarshall
  • <init>

Popular in Java

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JLabel (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Option (scala)
  • From CI to AI: The AI layer in your organization
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