org.modeshape.jcr.RepositoryConfiguration.validate()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(97)

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

RepositoryConfiguration.validate介绍

[英]Validate this configuration against the JSON Schema.
[中]根据JSON模式验证此配置。

代码示例

代码示例来源:origin: ModeShape/modeshape

protected RepositoryConfiguration assertValid( RepositoryConfiguration config ) {
  Problems results = config.validate();
  assertThat(results.toString(), results.hasProblems(), is(false));
  return config;
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

});
Problems problems = config.get().validate();
if (problems.hasErrors()) {
  log.error("Problems with the ModeShape repository configuration: \n{}", problems);

代码示例来源:origin: ModeShape/modeshape

private Repository deployRepository( String uri ) throws ResourceException {
  if (engine == null) {
    engine = ra.getEngine();
    if (engine == null) {
      throw new ResourceException("Engine not started by resource adapter!");
    }
  }
  // load configuration
  RepositoryConfiguration config = null;
  try {
    URL url = isAbsolutePath(uri) ? getClass().getClassLoader().getResource(uri) : new URL(uri);
    config = RepositoryConfiguration.read(url);
  } catch (Exception e) {
    throw new ResourceException(e);
  }
  // check configuration
  Problems problems = config.validate();
  if (problems.hasErrors()) {
    throw new ResourceException(problems.toString());
  }
  try {
    return engine.deploy(config);
  } catch (RepositoryException e) {
    throw new ResourceException(e);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.repository.jcr.modeshape

Problems problems = config.validate();
if (problems.hasErrors()) {
  String message = "Problems in the Modeshape configuration";

代码示例来源:origin: ModeShape/modeshape

protected RepositoryConfiguration assertHasWarnings( int numberOfWarnings,
                           RepositoryConfiguration config ) {
  Problems results = config.validate();
  assertThat(results.toString(), results.warningCount(), is(numberOfWarnings));
  assertThat(results.toString(), results.hasWarnings(), is(numberOfWarnings != 0));
  if (print) {
    System.out.println(results);
  }
  return config;
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

/**
 * Create a Repository instance given the {@link RepositoryConfiguration configuration}.
 *
 * @param configuration the repository configuration; may not be null
 * @throws ConfigurationException if there is a problem with the configuration
 */
protected JcrRepository( RepositoryConfiguration configuration ) throws ConfigurationException {
  ModeShape.getName(); // force log message right up front
  this.config.set(configuration);
  RepositoryConfiguration config = this.config.get();
  // Validate the configuration to make sure there are no errors ...
  Problems results = configuration.validate();
  setConfigurationProblems(results);
  if (results.hasErrors()) {
    String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName, results.errorCount(),
                                 results.toString());
    throw new ConfigurationException(results, msg);
  }
  this.repositoryName.set(config.getName());
  this.logger = Logger.getLogger(getClass());
  this.logger.debug("Activating '{0}' repository", this.repositoryName);
  // Set up the descriptors ...
  this.descriptors = new HashMap<String, Object>();
  initializeDescriptors();
}

代码示例来源:origin: ModeShape/modeshape

/**
 * Create a Repository instance given the {@link RepositoryConfiguration configuration}.
 *
 * @param configuration the repository configuration; may not be null
 * @throws ConfigurationException if there is a problem with the configuration
 */
protected JcrRepository( RepositoryConfiguration configuration ) throws ConfigurationException {
  ModeShape.getName(); // force log message right up front
  this.config.set(configuration);
  RepositoryConfiguration config = this.config.get();
  // Validate the configuration to make sure there are no errors ...
  Problems results = configuration.validate();
  setConfigurationProblems(results);
  if (results.hasErrors()) {
    String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName, results.errorCount(),
                                 results.toString());
    throw new ConfigurationException(results, msg);
  }
  this.repositoryName.set(config.getName());
  this.logger = Logger.getLogger(getClass());
  this.logger.debug("Activating '{0}' repository", this.repositoryName);
  // Set up the descriptors ...
  this.descriptors = new HashMap<String, Object>();
  initializeDescriptors();
}

代码示例来源:origin: ModeShape/modeshape

protected RepositoryConfiguration assertValidWithWarnings( int warnings,
                              RepositoryConfiguration config ) {
  Problems results = config.validate();
  assertThat(results.toString(), results.hasErrors(), is(false));
  assertThat(results.toString(), results.warningCount(), is(warnings));
  return config;
}

代码示例来源:origin: ModeShape/modeshape

protected RepositoryConfiguration assertNotValid( int numberOfErrors,
                         RepositoryConfiguration config ) {
  Problems results = config.validate();
  assertThat(results.toString(), results.hasProblems(), is(true));
  assertThat(results.toString(), results.hasErrors(), is(true));
  assertThat(results.toString(), results.errorCount(), is(numberOfErrors));
  if (print) {
    System.out.println(results);
  }
  return config;
}

代码示例来源:origin: ModeShape/modeshape-examples

Problems problems = config.validate();
if (problems.hasErrors()) {
  System.err.println("Problems starting the engine.");

代码示例来源:origin: org.fcrepo/modeshape-jcr

Problems problems = repositoryConfiguration.validate();
if (problems.hasErrors()) {
  throw new ConfigurationException(problems, JcrI18n.repositoryConfigurationIsNotValid.text(repoName,

代码示例来源:origin: ModeShape/modeshape

Problems problems = repositoryConfiguration.validate();
if (problems.hasErrors()) {
  throw new ConfigurationException(problems, JcrI18n.repositoryConfigurationIsNotValid.text(repoName,

代码示例来源:origin: org.fcrepo/modeshape-jcr

/***
 * Validate this configuration if the supplied changes were made to this. Note that this does <i>not</i> actually change this
 * configuration.
 *
 * @param changes the proposed changes to this configuration's underlying document; never null
 * @return the validation results; never null
 * @see #edit()
 * @see #validate()
 */
public Problems validate( Changes changes ) {
  // Create a copy of this configuration ...
  Editor copy = edit();
  copy.apply(changes);
  RepositoryConfiguration updated = new RepositoryConfiguration(copy.unwrap(), this.getName());
  return updated.validate();
}

代码示例来源:origin: ModeShape/modeshape

/***
 * Validate this configuration if the supplied changes were made to this. Note that this does <i>not</i> actually change this
 * configuration.
 *
 * @param changes the proposed changes to this configuration's underlying document; never null
 * @return the validation results; never null
 * @see #edit()
 * @see #validate()
 */
public Problems validate( Changes changes ) {
  // Create a copy of this configuration ...
  Editor copy = edit();
  copy.apply(changes);
  RepositoryConfiguration updated = new RepositoryConfiguration(copy.unwrap(), this.getName());
  return updated.validate();
}

代码示例来源:origin: ModeShape/modeshape

Problems validationResults = repositoryConfig.validate(changes);

代码示例来源:origin: ModeShape/modeshape

@Test( expected = ConfigurationException.class )
public void shouldFailToDeployRepositoryConfigurationWithoutName() throws Throwable {
  config = new RepositoryConfiguration(); // without a name!
  assertThat(config.validate().hasErrors(), is(true));
  engine.start();
  engine.deploy(config);
}

代码示例来源:origin: ModeShape/modeshape

Problems validationResults = repositoryConfig.validate(changes);

代码示例来源:origin: ModeShape/modeshape

Problems validationResults = repositoryConfig.validate(changes);

代码示例来源:origin: ModeShape/modeshape

@Override
protected void startRepositoryWithConfiguration( InputStream configInputStream ) throws Exception {
  stopRepository();
  RepositoryConfiguration config = RepositoryConfiguration.read(configInputStream, REPO_NAME).with(new TestingEnvironment());
  Problems problems = config.validate();
  if (problems.hasProblems()) {
    System.out.println(problems);
    fail("Problems encountered during repository startup: " + problems);
  }
  repository = new JcrRepository(config);
  repository.start();
  session = repository.login();
  rootNode = session.getRootNode();
  addSequencingListeners(session);
}

代码示例来源:origin: ModeShape/modeshape

Problems problems = repositoryConfiguration.validate();
if (!problems.isEmpty()) {
  LOG.debugv("Problems with configuration for '{0}' repository: {1}", repositoryName, problems);

相关文章

微信公众号

最新文章

更多