Examples of Subgraph


Examples of org.jboss.dna.graph.Subgraph

        assertThat(content, is(notNullValue()));
        sequencer.sequence(content, output, context);
       
        output.close();

        Subgraph subgraph = graph.getSubgraphOfDepth(10).at("/");
        assertThat(subgraph, is(notNullValue()));
        //String value = subgraph.toString();
        //System.out.println(value);
       
        SubgraphNode rootNode = subgraph.getNode(".");
        assertThat(rootNode.getChildren().size(), is(1));
       
        SubgraphNode statementsNode = rootNode.getNode(path("ddl:statements"));
        assertNotNull(statementsNode);
        assertThat(statementsNode.getChildren().size(), is(3));
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

        assertThat(content, is(notNullValue()));
        sequencer.sequence(content, output, context);
       
        output.close();

        Subgraph subgraph = graph.getSubgraphOfDepth(10).at("/");
        assertThat(subgraph, is(notNullValue()));
        //String value = subgraph.toString();
        //System.out.println(value);
       
        SubgraphNode rootNode = subgraph.getNode(".");
        assertThat(rootNode.getChildren().size(), is(1));
       
        SubgraphNode statementsNode = rootNode.getNode(path("ddl:statements"));
        assertNotNull(statementsNode);
        assertThat(statementsNode.getChildren().size(), is(20));
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

        assertThat(content, is(notNullValue()));
        sequencer.sequence(content, output, context);
       
        output.close();

        Subgraph subgraph = graph.getSubgraphOfDepth(10).at("/");
        assertThat(subgraph, is(notNullValue()));
        //String value = subgraph.toString();
        //System.out.println(value);
       
        SubgraphNode rootNode = subgraph.getNode(".");
        assertThat(rootNode.getChildren().size(), is(1));
       
        SubgraphNode statementsNode = rootNode.getNode(path("ddl:statements"));
        assertNotNull(statementsNode);
        assertThat(statementsNode.getChildren().size(), is(64));
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

        assertThat(content, is(notNullValue()));
        sequencer.sequence(content, output, context);
       
        output.close();

        Subgraph subgraph = graph.getSubgraphOfDepth(10).at("/");
        assertThat(subgraph, is(notNullValue()));
        //String value = subgraph.toString();
        //System.out.println(value);
       
        SubgraphNode rootNode = subgraph.getNode(".");
        assertThat(rootNode.getChildren().size(), is(1));
       
        SubgraphNode statementsNode = rootNode.getNode(path("ddl:statements"));
        assertNotNull(statementsNode);
        assertThat(statementsNode.getChildren().size(), is(50));
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

                     .and()
                     .save();

        // Verify that the graph has been updated correctly ...
        DnaConfiguration.ConfigurationDefinition content = configuration.getConfigurationDefinition();
        Subgraph subgraph = content.graph().getSubgraphOfDepth(3).at("/");
        assertThat(subgraph.getNode("/dna:sources"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/name"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/name"), hasProperty(DnaLexicon.RETRY_LIMIT, 100));
        assertThat(subgraph.getNode("/dna:sources/name"), hasProperty("defaultCachePolicy", cachePolicy));
        assertThat(subgraph.getNode("/dna:sources/name"), hasProperty("defaultWorkspaceName", "default workspace name"));
        assertThat(subgraph.getNode("/dna:sources/name"), hasProperty("rootNodeUuid", rootUuid));
    }
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

        engine = configuration.build();
        engine.start();

        // Verify that the graph has been updated correctly ...
        Graph config = engine.getGraph(JcrConfiguration.DEFAULT_CONFIGURATION_SOURCE_NAME);
        Subgraph subgraph = config.getSubgraphOfDepth(6).at("/");
        assertThat(subgraph.getNode("/dna:sources"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Source2"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Source2"), hasProperty(DnaLexicon.CLASSNAME,
                                                                         InMemoryRepositorySource.class.getName()));
        assertThat(subgraph.getNode("/dna:repositories"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:repositories/JCR Repository"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:repositories/JCR Repository"), hasProperty(DnaLexicon.SOURCE_NAME, "Source2"));
        assertThat(subgraph.getNode("/dna:repositories/JCR Repository/dna:options"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:repositories/JCR Repository/dna:options/JAAS_LOGIN_CONFIG_NAME"),
                   hasProperty(DnaLexicon.VALUE, "test"));

        JcrRepository repository = engine.getRepository("JCR Repository");

        Map<Option, String> options = new HashMap<Option, String>();
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

        assertThat(configuration.getProblems().isEmpty(), is(true));

        // Verify that the graph has been updated correctly ...
        DnaConfiguration.ConfigurationDefinition content = configuration.getConfigurationDefinition();
        Subgraph subgraph = content.graph().getSubgraphOfDepth(6).at("/");

        assertThat(subgraph.getNode("/dna:sources"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Cars"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Cars"), hasProperty(DnaLexicon.RETRY_LIMIT, "3"));
        assertThat(subgraph.getNode("/dna:sources/Cars"), hasProperty(DnaLexicon.CLASSNAME,
                                                                      InMemoryRepositorySource.class.getName()));
        assertThat(subgraph.getNode("/dna:sources/Aircraft"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Aircraft"), hasProperty("defaultWorkspaceName", "default"));
        assertThat(subgraph.getNode("/dna:sources/Aircraft"), hasProperty(DnaLexicon.CLASSNAME,
                                                                          InMemoryRepositorySource.class.getName()));
        assertThat(subgraph.getNode("/dna:sources/Cache"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Cache"), hasProperty(DnaLexicon.CLASSNAME,
                                                                       InMemoryRepositorySource.class.getName()));

        assertThat(subgraph.getNode("/dna:mimeTypeDetectors").getChildren(), hasChild(segment("Detector")));
        assertThat(subgraph.getNode("/dna:mimeTypeDetectors/Detector"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:mimeTypeDetectors/Detector"),
                   hasProperty(DnaLexicon.DESCRIPTION, "Standard extension-based MIME type detector"));
        assertThat(subgraph.getNode("/dna:mimeTypeDetectors/Detector"),
                   hasProperty(DnaLexicon.CLASSNAME, ExtensionBasedMimeTypeDetector.class.getName()));

        assertThat(subgraph.getNode("/dna:repositories").getChildren(), hasChild(segment("Car Repository")));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository"), hasProperty(DnaLexicon.SOURCE_NAME, "Cars"));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository").getChildren(), hasChild(segment("dna:options")));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/dna:options"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/dna:options").getChildren(),
                   hasChild(segment("jaasLoginConfigName")));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/dna:options/jaasLoginConfigName"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/dna:options/jaasLoginConfigName"),
                   hasProperty(DnaLexicon.VALUE, "dna-jcr"));

        // Initialize IDTrust and a policy file (which defines the "dna-jcr" login config name)
        String configFile = "security/jaas.conf.xml";
        IDTrustConfiguration idtrustConfig = new IDTrustConfiguration();
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

                                .getNamespaceRegistry()
                                .isRegisteredNamespaceUri("http://www.jboss.org/dna/test/1.0"), is(true));

        // Verify that the graph has been updated correctly ...
        DnaConfiguration.ConfigurationDefinition content = configuration.getConfigurationDefinition();
        Subgraph subgraph = content.graph().getSubgraphOfDepth(6).at("/");

        assertThat(subgraph.getNode("/dna:repositories").getChildren(), hasChild(segment("Car Repository")));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository"), hasProperty(DnaLexicon.SOURCE_NAME, "Cars"));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository").getChildren(), hasChild(segment("dna:options")));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/jcr:nodeTypes"), is(notNullValue()));
        // for (Location child : subgraph.getNode("/dna:repositories/Car Repository/dna:nodeTypes").getChildren()) {
        // System.out.println(child.getPath().getLastSegment().getString(context().getNamespaceRegistry()));
        // }
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/jcr:nodeTypes").getChildren(),
                   hasChildren(segment("dnatest:noSameNameSibs"),
                               segment("dnatest:referenceableUnstructured"),
                               segment("dnatest:nodeWithMandatoryProperty"),
                               segment("dnatest:nodeWithMandatoryChild"),
                               segment("dnatest:unorderableUnstructured")));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/dna:namespaces"), is(notNullValue()));

        // Check that the namespace in the CND file was persisted correctly ...
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/dna:namespaces").getChildren(),
                   hasChild(segment("dnatest")));
        assertThat(subgraph.getNode("/dna:repositories/Car Repository/dna:namespaces/dnatest"),
                   hasProperty(DnaLexicon.NAMESPACE_URI, "http://www.jboss.org/dna/test/1.0"));

        // Initialize IDTrust and a policy file (which defines the "dna-jcr" login config name)
        String configFile = "security/jaas.conf.xml";
        IDTrustConfiguration idtrustConfig = new IDTrustConfiguration();
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

     */
    List<JcrNodeType> registerNodeTypes( JcrNodeTypeSource nodeTypeSource )
        throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, RepositoryException {
        assert nodeTypeSource != null;
        Graph nodeTypesGraph = nodeTypeSource.getNodeTypes();
        Subgraph nodeTypesSubgraph = nodeTypesGraph.getSubgraphOfDepth(3).at("/");
        return registerNodeTypes(nodeTypesSubgraph, nodeTypesSubgraph.getLocation());
    }
View Full Code Here

Examples of org.jboss.dna.graph.Subgraph

        // Read the subgraph that represents the repository ...
        PathFactory pathFactory = getExecutionContext().getValueFactories().getPathFactory();
        Path repositoriesPath = pathFactory.create(configuration.getPath(), DnaLexicon.REPOSITORIES);
        Path repositoryPath = pathFactory.create(repositoriesPath, repositoryName);
        Graph configuration = getConfigurationGraph();
        Subgraph subgraph = configuration.getSubgraphOfDepth(6).at(repositoryPath);

        // Read the options ...
        Node optionsNode = subgraph.getNode(DnaLexicon.OPTIONS);
        if (optionsNode != null) {
            for (Location optionLocation : optionsNode.getChildren()) {
                Node optionNode = configuration.getNodeAt(optionLocation);
                Path.Segment segment = optionLocation.getPath().getLastSegment();
                Property valueProperty = optionNode.getProperty(DnaLexicon.VALUE);
                if (valueProperty == null) continue;
                Option option = Option.findOption(segment.getName().getLocalName());
                if (option == null) continue;
                options.put(option, valueProperty.getFirstValue().toString());
            }
        }

        // Read the namespaces ...
        ExecutionContext context = getExecutionContext();
        Node namespacesNode = subgraph.getNode(DnaLexicon.NAMESPACES);
        if (namespacesNode != null) {
            GraphNamespaceRegistry registry = new GraphNamespaceRegistry(configuration, namespacesNode.getLocation().getPath(),
                                                                         DnaLexicon.NAMESPACE_URI);
            context = context.with(registry);
        }

        // Get the name of the source ...
        Property property = subgraph.getRoot().getProperty(DnaLexicon.SOURCE_NAME);
        if (property == null || property.isEmpty()) {
            String readableName = readable(DnaLexicon.SOURCE_NAME);
            String readablePath = readable(subgraph.getLocation());
            String msg = JcrI18n.propertyNotFoundOnNode.text(readableName, readablePath, configuration.getCurrentWorkspaceName());
            throw new RepositoryException(msg);
        }
        String sourceName = context.getValueFactories().getStringFactory().create(property.getFirstValue());

        // Create the repository ...
        JcrRepository repository = new JcrRepository(context, connectionFactory, sourceName, descriptors, options);

        // Register all the the node types ...
        Node nodeTypesNode = subgraph.getNode(JcrLexicon.NODE_TYPES);
        if (nodeTypesNode != null) {
            repository.getRepositoryTypeManager().registerNodeTypes(subgraph, nodeTypesNode.getLocation());// throws exception
        }

        return repository;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.