Package org.modeshape.common.collection

Examples of org.modeshape.common.collection.SimpleProblems


         * 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


    public void setUp() throws Exception {
        testDirectory = new File("target/backupArea/writerTests");
        testDirectory.mkdirs();
        FileUtil.delete(testDirectory);
        testDirectory.mkdirs();
        problems = new SimpleProblems();
    }
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

    private CndImporter importer;
    private SimpleProblems problems;

    @Before
    public void beforeEach() {
        problems = new SimpleProblems();
        context = new ExecutionContext();
        context.getNamespaceRegistry().register(ModeShapeLexicon.Namespace.PREFIX, ModeShapeLexicon.Namespace.URI);
        context.getNamespaceRegistry().register(JcrLexicon.Namespace.PREFIX, JcrLexicon.Namespace.URI);
        context.getNamespaceRegistry().register(JcrNtLexicon.Namespace.PREFIX, JcrNtLexicon.Namespace.URI);
View Full Code Here

        typeSystem = executionContext.getValueFactories().getTypeSystem();
        repoCache = mock(RepositoryCache.class);
        workspaces = Collections.singleton("workspace");
        hints = new PlanHints();
        builder = new QueryBuilder(typeSystem);
        problems = new SimpleProblems();
        nodeTypes = mock(NodeTypes.class);
        indexDefns = mock(RepositoryIndexes.class);
        schemataBuilder = ImmutableSchemata.createBuilder(executionContext, nodeTypes);
        bufferMgr = new BufferManager(executionContext);
        print = false;
View Full Code Here

        this.typeSystem = context.getValueFactories().getTypeSystem();
        this.hints = hints != null ? hints : new PlanHints();
        this.indexDefns = indexDefns;
        this.schemata = schemata;
        this.nodeTypes = nodeTypes;
        this.problems = problems != null ? problems : new SimpleProblems();
        this.variables = variables != null ? new HashMap<String, Object>(variables) : new HashMap<String, Object>();
        this.overriddenNodeCachesByWorkspaceName = overriddenNodeCachesByWorkspaceName != null ? overriddenNodeCachesByWorkspaceName : Collections.<String, NodeCache>emptyMap();
        this.bufferManager = bufferManager;
        this.id = id;
        assert this.typeSystem != null;
View Full Code Here

        addressNode.setProperty("City", "Flagstaff");
        addressNode.setProperty("State", "AZ");
        addressNode.setProperty("Country", "US");
        addressNode.setProperty("Zip Code", 77777);

        problems = new SimpleProblems();
    }
View Full Code Here

        CheckArg.isNotNull(indexDefinitions, "indexDefinitions");

        // Before we do anything, validate each of the index definitions and throw an exception ...
        RepositoryNodeTypeManager nodeTypeManager = repository.nodeTypeManager();
        List<IndexDefinition> validated = new ArrayList<>(indexDefinitions.length);
        Problems problems = new SimpleProblems();
        for (IndexDefinition defn : indexDefinitions) {
            String name = defn.getName();
            String providerName = defn.getProviderName();

            if (name == null) {
                problems.addError(JcrI18n.indexMustHaveName, defn, repository.name());
                continue;
            }
            if (indexes.getIndexDefinitions().containsKey(name) && !allowUpdate) {
                // Throw this one immediately ...
                String msg = JcrI18n.indexAlreadyExists.text(defn.getName(), repository.name());
                throw new IndexExistsException(msg);
            }
            if (providerName == null) {
                problems.addError(JcrI18n.indexMustHaveProviderName, defn.getName(), repository.name());
                continue;
            }
            if (defn.hasSingleColumn()) {
                IndexColumnDefinition columnDefn = defn.getColumnDefinition(0);
                Name propName = context.getValueFactories().getNameFactory().create(columnDefn.getPropertyName());
                switch (defn.getKind()) {
                    case UNIQUE_VALUE:
                        if (NON_UNIQUE_PROPERTY_NAMES.contains(propName)) {
                            problems.addError(JcrI18n.unableToCreateUniqueIndexForColumn, defn.getName(),
                                              columnDefn.getPropertyName());
                        }
                        break;
                    case ENUMERATED_VALUE:
                        if (NON_ENUMERATED_PROPERTY_NAMES.contains(propName)) {
                            problems.addError(JcrI18n.unableToCreateEnumeratedIndexForColumn, defn.getName(),
                                              columnDefn.getPropertyName());
                        }
                        break;
                    case VALUE:
                    case NODE_TYPE:
                    case TEXT:
                        break;
                }
            } else {
                // Mulitple columns ...
                if (defn.getKind() == IndexKind.NODE_TYPE) {
                    // must be single-column indexes
                    problems.addError(JcrI18n.nodeTypeIndexMustHaveOneColumn, defn.getName());
                }
            }
            IndexProvider provider = providers.get(providerName);
            if (provider == null) {
                problems.addError(JcrI18n.indexProviderDoesNotExist, defn, repository.name());
            } else {
                // Have the provider validate the index
                provider.validateProposedIndex(context, defn, nodeTypeManager, problems);

                // Create an instance of our own definition implementation ...
                defn = RepositoryIndexDefinition.createFrom(defn, true);

                validated.add(defn);
            }
        }
        if (problems.hasErrors()) {
            String msg = JcrI18n.invalidIndexDefinitions.text(repository.name(), problems);
            throw new InvalidIndexDefinitionException(new JcrProblems(problems), msg);
        }

        SessionCache systemCache = repository.createSystemSession(context, false);
View Full Code Here

            this.binaryDirectory = new File(this.backupDirectory, BINARY_AREA_DIR_NAME);
            this.backupLocation = this.backupDirectory.getAbsolutePath();
            this.documentStore = documentStore;
            this.binaryStore = binaryStore;
            this.repositoryCache = repositoryCache;
            this.problems = new SimpleProblems();
        }
View Full Code Here

TOP

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

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.