info.magnolia.config.source.yaml.YamlConfigurationSourceBuilder类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中info.magnolia.config.source.yaml.YamlConfigurationSourceBuilder类的一些代码示例,展示了YamlConfigurationSourceBuilder类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfigurationSourceBuilder类的具体详情如下:
包路径:info.magnolia.config.source.yaml.YamlConfigurationSourceBuilder
类名称:YamlConfigurationSourceBuilder

YamlConfigurationSourceBuilder介绍

[英]Builder for info.magnolia.config.source.yaml.YamlConfigurationSource instances.
[中]信息的建设者。木兰花。配置。来源亚马尔。YamlConfiguration源实例。

代码示例

代码示例来源:origin: info.magnolia.core/magnolia-configuration

public YamlConfigurationSourceBuilder yaml() {
  return new YamlConfigurationSourceBuilder(origin, map2BeanTransformer, yamlReader, magnoliaConfigurationProperties, moduleRegistry);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

public void bindWithDefaults(Registry registry) {
  if (pathPattern != null) {
    throw new IllegalStateException(this + " is already partially configured, don't use bindWithDefaults().");
  }
  withPattern(moduleConventionsFormatFor(registry)).bindTo(registry);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Override
public void bindTo(Registry<?> registry) {
  final Pattern pathPattern = validatePathPattern(this.pathPattern);
  if (registry == null) {
    throw new NullPointerException("Must pass a registry instance");
  }
  new YamlConfigurationSource<>(origin, map2BeanTransformer, registry, pathPattern, yamlReader, magnoliaConfigurationProperties, moduleRegistry).start();
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Override
public void start(ModuleLifecycleContext moduleLifecycleContext) {
  if (moduleLifecycleContext.getPhase() == ModuleLifecycleContext.PHASE_SYSTEM_STARTUP) {
    cfgSourceFactory.jcr().bindWithDefaults(rendererRegistry);
    cfgSourceFactory.jcr().bindWithDefaults(templateDefinitionRegistry);
    cfgSourceFactory.yaml().bindWithDefaults(rendererRegistry);
    cfgSourceFactory.yaml().bindWithDefaults(templateDefinitionRegistry);
  }
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Test
public void javaFreeModulesConventions() throws Exception {
  // GIVEN
  final String pathPattern = new YamlConfigurationSourceBuilder(null, null, null, mock(MagnoliaConfigurationProperties.class), mock(ModuleRegistry.class)).moduleConventionsFormatFor(new DummyRegistry()); // Nevermind this, just getting the pattern any way I can. See TODO in moduleConventionsFormatFor()
  final RegexBasedPathToMetadataInferrer inferrer = new RegexBasedPathToMetadataInferrer(Pattern.compile(pathPattern));
  final DefinitionMetadataBuilder metadataBuilder = DefinitionMetadataBuilder.usingModuleAndRelativePathAsId();
  // WHEN
  DefinitionMetadata metadata = inferrer.populateFrom(metadataBuilder, DummyResourceOrigin.singleResource("/myModule/dummyThings/some/directories/awesome.yaml")).build();
  // THEN
  assertThat(metadata, metadata().withModule("myModule").withName("awesome").withRelativeLocation("some/directories/awesome"));
  assertThat(metadata, metadata().withReferenceId("myModule:some/directories/awesome"));
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Test
public void withCustomMultiConstruct() throws Exception {
  // GIVEN
  YamlReader yamlReader = new YamlReader();
  Construct construct = new DummyConstruct();
  String fileContent = "!tag-prefix:test\nHave a nice day!";
  InputStream stream = new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8));
  Resource resource = DummyResourceOrigin.singleResource(foo, "/anything.yaml", stream);
  // WHEN
  new YamlConfigurationSourceBuilder(null, null, yamlReader, null, null).withCustomMultiConstruct("!tag-prefix:", construct);
  // THEN
  String contentToAssert = (String) yamlReader.read(resource);
  assertEquals("Have a nice day!", contentToAssert);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Test
public void withCustomConstruct() throws Exception {
  // GIVEN
  YamlReader yamlReader = new YamlReader();
  Construct construct = new DummyConstruct();
  String fileContent = "!tag\nHave a wonderful day!";
  InputStream stream = new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8));
  Resource resource = DummyResourceOrigin.singleResource(foo, "/anything.yaml", stream);
  // WHEN
  new YamlConfigurationSourceBuilder(null, null, yamlReader, null, null).withCustomConstruct("!tag", construct);
  // THEN
  String contentToAssert = (String) yamlReader.read(resource);
  assertEquals("Have a wonderful day!", contentToAssert);
}

代码示例来源:origin: info.magnolia.rest/magnolia-rest-integration

@Override
public void start(ModuleLifecycleContext ctx) {
  if (ctx.getPhase() == ModuleLifecycleContext.PHASE_SYSTEM_STARTUP) {
    // explicitly add former JCR lookup path within modules: bound to be removed eventually
    cfgSourceFactory.jcr()
        .withModulePath("rest-endpoints")
        .bindTo(endpointRegistry);
    // endpoints are now looked up in <module>/restEndpoints (camel-case)
    cfgSourceFactory.jcr().bindWithDefaults(endpointRegistry);
    cfgSourceFactory.yaml().bindWithDefaults(endpointRegistry);
  }
}

代码示例来源:origin: info.magnolia.site/magnolia-site

configSourceFactory.yaml().bindWithDefaults(themeRegistry);

相关文章