Package org.modeshape.common.collection

Examples of org.modeshape.common.collection.Problems


         * configuration components will be null.
         *
         * @return the immutable list of custom providers; never null but possibly empty
         */
        protected List<Component> getCustomProviders() {
            Problems problems = new SimpleProblems();
            List<Component> components = getCustomProviders(problems);
            assert !problems.hasErrors();
            return components;
        }
View Full Code Here


        shutdownDefaultRepository();
        RepositoryConfiguration config = RepositoryConfiguration.read(getClass().getClassLoader()
                                                                                .getResourceAsStream("config/repo-config-with-startup-problems.json"),
                                                                      "Deprecated config");
        repository = new JcrRepository(config);
        Problems problems = repository.getStartupProblems();
        assertEquals("Invalid startup problems:" + problems.toString(), 3, problems.size());
        repository.shutdown().get();
        problems = repository.getStartupProblems();
        assertEquals("Invalid startup problems:" + problems.toString(), 3, problems.size());
    }
View Full Code Here

                                                                                .getResourceAsStream(
                                                                                        "config/repo-config-with-startup-problems.json"),
                                                                      "Deprecated config");
        repository = new JcrRepository(config);
        repository.start();
        Problems problems = repository.getStartupProblems();
        assertEquals("Expected 2 startup warnings:" + problems.toString(), 1, problems.warningCount());
        assertEquals("Expected 2 startup errors: " + problems.toString(), 2, problems.errorCount());
    }
View Full Code Here

        shutdownDefaultRepository();
        RepositoryConfiguration config = RepositoryConfiguration.read(getClass().getClassLoader()
                                                                                .getResourceAsStream("config/repo-config-with-startup-problems.json"),
                                                                      "Deprecated config");
        repository = new JcrRepository(config);
        Problems problems = repository.getStartupProblems();
        assertEquals("Expected 2 startup warnings:" + problems.toString(), 1, problems.warningCount());
        assertEquals("Expected 2 startup errors: " + problems.toString(), 2, problems.errorCount());
    }
View Full Code Here

                                    final String repositoryKey ) throws ConfigurationException, RepositoryException {
        CheckArg.isNotNull(repositoryConfiguration, "repositoryConfiguration");
        checkRunning();

        final String repoName = repositoryKey != null ? repositoryKey : repositoryConfiguration.getName();
        Problems problems = repositoryConfiguration.validate();
        if (problems.hasErrors()) {
            throw new ConfigurationException(problems, JcrI18n.repositoryConfigurationIsNotValid.text(repoName,
                                                                                                      problems.toString()));
        }

        // Now try to deploy the repository ...
        JcrRepository repository = null;
        final Lock lock = this.lock.writeLock();
View Full Code Here

                throw new NoSuchRepositoryException(JcrI18n.repositoryDoesNotExist.text(repositoryName));
            }

            // Determine if the changes would result in a valid repository configuration ...
            RepositoryConfiguration config = repository.getConfiguration();
            Problems problems = config.validate(changes);
            repository.setConfigurationProblems(problems);
            if (problems.hasErrors()) {
                throw new ConfigurationException(problems, JcrI18n.repositoryConfigurationIsNotValid.text(repositoryName,
                                                                                                          problems.toString()));
            }

            // Apply the changes immediately (synchronously) ...
            try {
                repository.apply(changes);
View Full Code Here

                    repository.warn(JcrI18n.cannotLoadCndFile, cndFile);
                    return;
                }

                CndImporter cndImporter = new CndImporter(repository.context());
                Problems importProblems = new SimpleProblems();
                cndImporter.importFrom(cndFileStream, importProblems, cndFile);

                for (Problem problem : importProblems) {
                    if (problem.getStatus() == Problem.Status.ERROR) {
                        if (problem.getThrowable() != null) {
                            repository.error(problem.getThrowable(), problem.getMessage(), problem.getParameters());
                        } else {
                            repository.error(problem.getMessage(), problem.getParameters());
                        }
                    } else if (problem.getStatus() == Problem.Status.WARNING) {
                         repository.warn(problem.getMessage(), problem.getParameters());
                    }
                }
                if (importProblems.hasErrors()) {
                    return;
                }
                this.nodeTypeDefinitions = cndImporter.getNodeTypeDefinitions();
                this.namespaces = cndImporter.getNamespaces();
            } catch (IOException e) {
View Full Code Here

    @Override
    protected void startRepositoryWithConfiguration( InputStream configInputStream ) throws Exception {
        stopRepository();
        config = RepositoryConfiguration.read(configInputStream, REPO_NAME).with(environment);
        Problems problems = config.validate();
        if (problems.hasProblems()) {
            System.out.println(problems);
            fail("Problems encountered during repository startup: " + problems);
        }
        repository = new JcrRepository(config);
        repository.start();
View Full Code Here

        return new Column(new SelectorName(table), columnName, alias);
    }

    protected PlanNode optimize( String sql ) {
        QueryCommand query = new BasicSqlQueryParser().parseQuery(sql, context.getTypeSystem());
        Problems problems = context.getProblems();
        assertThat("Problems parsing query: " + sql + "\n" + problems, problems.hasErrors(), is(false));
        PlanNode plan = new CanonicalPlanner().createPlan(context, query);
        assertThat("Problems planning query: " + sql + "\n" + problems, problems.hasErrors(), is(false));
        PlanNode optimized = new RuleBasedOptimizer().optimize(context, plan);
        assertThat("Problems optimizing query: " + sql + "\n" + problems, problems.hasErrors(), is(false));
        if (print) {
            System.out.println(sql);
            System.out.println(optimized);
            System.out.println();
        }
View Full Code Here

    public PlanNode optimize( QueryContext context,
                              PlanNode plan ) {
        LinkedList<OptimizerRule> rules = new LinkedList<OptimizerRule>();
        populateRuleStack(rules, context.getHints());

        Problems problems = context.getProblems();
        while (rules.peek() != null && !problems.hasErrors()) {
            OptimizerRule nextRule = rules.poll();
            LOGGER.trace("Running query optimizer rule {0}", nextRule);
            plan = nextRule.execute(context, plan, rules);
            LOGGER.trace("Plan after running query optimizer rule {0}: \n{1}", nextRule, plan);
        }
View Full Code Here

TOP

Related Classes of org.modeshape.common.collection.Problems

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.