Package org.jboss.dna.graph

Examples of org.jboss.dna.graph.Graph$AccessQueryProcessor


    }

    protected Graph.Batch changes() {
        if (changes == null) {
            ConfigurationDefinition content = getConfigurationDefinition();
            Graph graph = Graph.create(content.getRepositorySource(), content.getContext());
            if (content.getWorkspace() != null) {
                graph.useWorkspace(content.getWorkspace());
            }
            changes = graph.batch();
        }
        return changes;
    }
View Full Code Here


                    }
                }
            }

            RepositorySource source = repositoryLibrary.getSource(repositorySourceName);
            Graph graph = Graph.create(source, context);
            Node node = null;
            if (!sequencers.isEmpty()) {

                // Find the changed node ...
                node = graph.getNodeAt(nodePath);

                // Figure out which sequencers should run ...
                sequencers = this.sequencerSelector.selectSequencers(sequencers, node, change);
            }
            if (sequencers.isEmpty()) {
View Full Code Here

            // ------------------------------------------------------------------------------------
            // Read the configuration ...
            // ------------------------------------------------------------------------------------

            // Read the configuration and repository source nodes (children under "/dna:sources") ...
            Graph graph = Graph.create(getConfigurationSourceName(), sources, context);
            Path pathToSourcesNode = context.getValueFactories().getPathFactory().create(pathToConfigurationRoot,
                                                                                         DnaLexicon.SOURCES);
            try {
                String workspaceName = getConfigurationWorkspaceName();
                if (workspaceName != null) graph.useWorkspace(workspaceName);

                Subgraph sourcesGraph = graph.getSubgraphOfDepth(3).at(pathToSourcesNode);

                // Iterate over each of the children, and create the RepositorySource ...
                for (Location location : sourcesGraph.getRoot().getChildren()) {
                    Node sourceNode = sourcesGraph.getNode(location);
                    sources.addSource(createRepositorySource(location.getPath(), sourceNode.getPropertiesByName(), problems));
View Full Code Here

    @Test
    public void shouldEstimateTimeToIndexContent() {
        // Prime the reading of the files ...
        InMemoryRepositorySource prime = new InMemoryRepositorySource();
        prime.setName(sourceName);
        Graph primeGraph = Graph.create(prime, context);
        primeGraph.createWorkspace().named(workspaceName1);
        primeGraph.createWorkspace().named(workspaceName2);

        // Prime the search engine ...
        sw.reset();
        sw.start();
        SearchEngineIndexer indexer = new SearchEngineIndexer(context, searchEngine, connectionFactory);
View Full Code Here

        mirrorSourceName = "Mirror Source";
        mirrorWorkspaceName = "Mirror Workspace";
        addProjection("fedSpace", "Mirror Projection", mirrorSourceName, mirrorWorkspaceName, "/ => /");

        // Add some data to the source ...
        Graph source = graphFor(mirrorSourceName, mirrorWorkspaceName);
        source.importXmlFrom(getClass().getClassLoader().getResource("cars.xml").toURI()).into("/");
    }
View Full Code Here

        // Set up the configuration repository ...
        configRepositorySource = new InMemoryRepositorySource();
        configRepositorySource.setName("Configuration Repository");
        configRepositorySource.setDefaultWorkspaceName(configurationWorkspaceName);
        Graph config = Graph.create(configRepositorySource, context);
        config.create("/a").and();
        config.create("/a/b").and();
        config.create("/a/b/Test Repository").and();
        config.create("/a/b/Test Repository/dna:workspaces").and();

        repositoryContext = new RepositoryContext() {
            public ExecutionContext getExecutionContext() {
                return context;
            }

            public Observer getObserver() {
                return null;
            }

            @SuppressWarnings( "synthetic-access" )
            public RepositoryConnectionFactory getRepositoryConnectionFactory() {
                return connectionFactory;
            }

            @SuppressWarnings( "synthetic-access" )
            public Subgraph getConfiguration( int depth ) {
                Graph result = Graph.create(configRepositorySource, context);
                result.useWorkspace(configurationWorkspaceName);
                return result.getSubgraphOfDepth(depth).at("/a/b/Test Repository");
            }
        };

        // Set up the source ...
        source = new FederatedRepositorySource();
View Full Code Here

                                             .getPath()
                                             .getString(context.getNamespaceRegistry());
        assertThat(configPath.endsWith("/"), is(false));
        String wsPath = configPath + "/dna:workspaces/" + federatedWorkspace;
        String projectionPath = wsPath + "/dna:projections/" + projectionName;
        Graph config = Graph.create(configRepositorySource, context);
        config.useWorkspace(configurationWorkspaceName);
        config.create(wsPath).ifAbsent().and();
        config.create(wsPath + "/dna:projections").ifAbsent().and();
        config.createAt(projectionPath)
              .with(DnaLexicon.PROJECTION_RULES, (Object[])projectionRules)
              .with(DnaLexicon.SOURCE_NAME, sourceName)
              .with(DnaLexicon.WORKSPACE_NAME, workspaceName)
              .and();
        // Make sure the source and workspace exist ...
View Full Code Here

                    return newSource.getConnection();
                }
            });
        }
        // Make sure there's a workspace for it ...
        Graph sourceGraph = Graph.create(sourceName, connectionFactory, context);
        if (sourceGraph.getWorkspaces().contains(workspaceName)) {
            sourceGraph.useWorkspace(workspaceName);
        } else {
            sourceGraph.createWorkspace().named(workspaceName);
        }
        return sourceGraph;
    }
View Full Code Here

        offsetSourceName = "Offset Source";
        offsetWorkspaceName = "Offset Workspace";
        addProjection("fedSpace", "Offset Projection", offsetSourceName, offsetWorkspaceName, "/a/b => /");

        // Add some data to the source ...
        Graph source = graphFor(offsetSourceName, offsetWorkspaceName);
        source.importXmlFrom(getClass().getClassLoader().getResource("cars.xml").toURI()).into("/");
    }
View Full Code Here

                }

                public Subgraph getConfiguration( int depth ) {
                    Subgraph result = null;
                    if (configSource != null) {
                        Graph config = Graph.create(configSource, getExecutionContext());
                        config.useWorkspace(null); // default workspace
                        result = config.getSubgraphOfDepth(depth).at(source.getName());
                    }
                    return result;
                }
            });
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.Graph$AccessQueryProcessor

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.