Package org.modeshape.jcr

Examples of org.modeshape.jcr.RepositoryConfiguration


        // security
        parseSecurity(context, model, configDoc);

        // Now create the repository service that manages the lifecycle of the JcrRepository instance ...
        RepositoryConfiguration repositoryConfig = new RepositoryConfiguration(configDoc, repositoryName);
        RepositoryService repositoryService = new RepositoryService(repositoryConfig);

        // Journaling
        parseJournaling(repositoryService, context, model, configDoc);
View Full Code Here


            repository = engine.getRepository(repositoryName);
        } catch (NoSuchRepositoryException e) {
            throw new StartException(e);
        }

        RepositoryConfiguration repositoryConfig = repository.getConfiguration();

        Editor editor = repositoryConfig.edit();

        EditableDocument indexes = editor.getOrCreateDocument(FieldName.INDEXES);

        EditableDocument indexDefinition = Schematic.newDocument();
        String definitionName = definitionProperties.getProperty(FieldName.NAME);
        for (Object key : definitionProperties.keySet()) {
            String keyStr = (String)key;
            if (FieldName.NAME.equals(keyStr)) continue;
            Object value = definitionProperties.get(keyStr);
            if (value instanceof List<?>) {
                for (Object val : (List<?>)value) {
                    indexDefinition.getOrCreateArray(keyStr).addValue(val);
                }
            } else {
                // Just set the value as a field
                indexDefinition.set(keyStr, value);
            }
        }

        indexes.set(definitionName, indexDefinition);

        // Get the changes and validate them ...
        Changes changes = editor.getChanges();
        Problems validationResults = repositoryConfig.validate(changes);

        if (validationResults.hasErrors()) {
            String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName,
                                                                      validationResults.errorCount(),
                                                                      validationResults.toString());
View Full Code Here

            repository = engine.getRepository(repositoryName);
        } catch (NoSuchRepositoryException e) {
            throw new StartException(e);
        }

        RepositoryConfiguration repositoryConfig = repository.getConfiguration();

        Editor configEditor = repositoryConfig.edit();
        EditableDocument externalSources = configEditor.getOrCreateDocument(RepositoryConfiguration.FieldName.EXTERNAL_SOURCES);

        EditableDocument externalSource = Schematic.newDocument();

        for (Object key : sourceProperties.keySet()) {
View Full Code Here

            repository = engine.getRepository(repositoryName);
        } catch (NoSuchRepositoryException e) {
            throw new StartException(e);
        }

        RepositoryConfiguration repositoryConfig = repository.getConfiguration();

        Editor configEditor = repositoryConfig.edit();
        EditableDocument textExtracting = configEditor.getOrCreateDocument(FieldName.TEXT_EXTRACTION);
        EditableDocument extractors = textExtracting.getOrCreateDocument(FieldName.EXTRACTORS);

        EditableDocument extractor = Schematic.newDocument();
        String extractorName = extractorProperties.getProperty(FieldName.NAME);
        for (Object key : extractorProperties.keySet()) {
            String keyStr = (String)key;
            if (FieldName.NAME.equals(keyStr)) continue;
            Object value = extractorProperties.get(keyStr);
            if (value instanceof List<?>) {
                for (Object val : (List<?>)value) {
                    extractor.getOrCreateArray(keyStr).addValue(val);
                }
            } else {
                // Just set the value as a field
                extractor.set(keyStr, value);
            }
        }

        extractors.set(extractorName, extractor);

        // Get the changes and validate them ...
        Changes changes = configEditor.getChanges();
        Problems validationResults = repositoryConfig.validate(changes);

        if (validationResults.hasErrors()) {
            String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName,
                                                                      validationResults.errorCount(),
                                                                      validationResults.toString());
View Full Code Here

            repository = engine.getRepository(repositoryName);
        } catch (NoSuchRepositoryException e) {
            throw new StartException(e);
        }

        RepositoryConfiguration repositoryConfig = repository.getConfiguration();

        Editor editor = repositoryConfig.edit();

        EditableDocument sequencing = editor.getOrCreateDocument(FieldName.SEQUENCING);
        EditableDocument sequencers = sequencing.getOrCreateDocument(FieldName.SEQUENCERS);

        EditableDocument seq = Schematic.newDocument();
        String sequencerName = sequencerProperties.getProperty(FieldName.NAME);
        for (Object key : sequencerProperties.keySet()) {
            String keyStr = (String)key;
            if (FieldName.NAME.equals(keyStr)) continue;
            Object value = sequencerProperties.get(keyStr);
            if (value instanceof List<?>) {
                for (Object val : (List<?>)value) {
                    seq.getOrCreateArray(keyStr).addValue(val);
                }
            } else {
                // Just set the value as a field
                seq.set(keyStr, value);
            }
        }

        sequencers.set(sequencerName, seq);

        // Get the changes and validate them ...
        Changes changes = editor.getChanges();
        Problems validationResults = repositoryConfig.validate(changes);

        if (validationResults.hasErrors()) {
            String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName,
                                                                      validationResults.errorCount(),
                                                                      validationResults.toString());
View Full Code Here

                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 {
View Full Code Here

        // Load the configuration for a repository via the classloader (can also use path to a file)...
        Repository repository = null;
        String repositoryName = null;
        try {
            URL url = EmbeddedRepositoryDemo.class.getClassLoader().getResource("my-repository-config.json");
            RepositoryConfiguration config = RepositoryConfiguration.read(url);

            // We could change the name of the repository programmatically ...
            // config = config.withName("Some Other Repository");

            // Verify the configuration for the repository ...
            Problems problems = config.validate();
            if (problems.hasErrors()) {
                //CHECKSTYLE:OFF
                System.err.println("Problems starting the engine.");
                System.err.println(problems);
                System.exit(-1);
                //CHECKSTYLE:ON
            }

            // Deploy the repository ...
            repository = engine.deploy(config);
            repositoryName = config.getName();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(-1);
            return;
        }
View Full Code Here

        Document configDoc = Json.read(configStream);

        STARTUP.start();
        INFINISPAN_STARTUP.start();
        config = new RepositoryConfiguration(configDoc, configFileName);
        INFINISPAN_STARTUP.stop();

        MODESHAPE_STARTUP.start();
        engine = new ModeShapeEngine();
        engine.start();
View Full Code Here

        // Load the configuration for a repository via the classloader (can also use path to a file)...
        Repository repository = null;
        String repositoryName = null;
        try {
            URL url = SequencerDemo.class.getClassLoader().getResource("my-repository.json");
            RepositoryConfiguration config = RepositoryConfiguration.read(url);

            // Verify the configuration for the repository ...
            Problems problems = config.validate();
            if (problems.hasErrors()) {
                //CHECKSTYLE:OFF
                System.err.println("Problems starting the engine.");
                System.err.println(problems);
                System.exit(-1);
                //CHECKSTYLE:ON
            }

            // Deploy the repository ...
            repository = engine.deploy(config);
            repositoryName = config.getName();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(-1);
            return;
        }
View Full Code Here

       
        engine = new ModeShapeEngine();
        engine.start();
       
        try {
            RepositoryConfiguration config = RepositoryConfiguration.read(context.getResource(url));
            engine.deploy(config);
           
            for (String name : engine.getRepositoryNames()) {               
                Repository repo = engine.getRepository(name);
               
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.RepositoryConfiguration

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.