Package org.jboss.dna.graph

Examples of org.jboss.dna.graph.ExecutionContext$NullSecurityContext


        source = new InMemoryRepositorySource();
        source.setName(workspaceName);
        source.setDefaultWorkspaceName(workspaceName);

        // Set up the execution context ...
        context = new ExecutionContext();
        // Register the test namespace
        context.getNamespaceRegistry().register(TestLexicon.Namespace.PREFIX, TestLexicon.Namespace.URI);
        PathFactory pathFactory = context.getValueFactories().getPathFactory();

        // Set up the initial content ...
View Full Code Here


        }
        if (problems.hasErrors()) {
            throw new IllegalStateException("Problems starting JCR repository");
        }

        ExecutionContext executionContext = engine.getExecutionContext();
        executionContext.getNamespaceRegistry().register(TestLexicon.Namespace.PREFIX, TestLexicon.Namespace.URI);

        try {
            repository = engine.getRepository(REPOSITORY_SOURCE_NAME);

            // This needs to check configProps directly to avoid an infinite loop
            String skipImport = (String)configProps.get(DNA_SKIP_IMPORT);
            if (!Boolean.valueOf(skipImport)) {

                // Set up some sample nodes in the graph to match the expected test configuration
                Graph graph = Graph.create(repository.getRepositorySourceName(),
                                           engine.getRepositoryConnectionFactory(),
                                           executionContext);
                Path destinationPath = executionContext.getValueFactories().getPathFactory().createRootPath();

                InputStream xmlStream = getClass().getResourceAsStream("/tck/repositoryForTckTests.xml");
                graph.importXmlFrom(xmlStream).into(destinationPath);

                graph.createWorkspace().named("otherWorkspace");
View Full Code Here

    private PropertyIterator iter;

    @Before
    public void before() throws Exception {
        MockitoAnnotations.initMocks(this);
        context = new ExecutionContext();
        properties = new HashMap<Name, Property>();
        properties.put(name("prop1"), Mockito.mock(Property.class));
        properties.put(name("prop2"), Mockito.mock(Property.class));
        properties.put(name("prop3"), Mockito.mock(Property.class));
        properties.put(name("prop4"), Mockito.mock(Property.class));
View Full Code Here

        source = new InMemoryRepositorySource();
        source.setName(workspaceName);
        source.setDefaultWorkspaceName(workspaceName);

        // Set up the execution context ...
        ExecutionContext context = new ExecutionContext();
        // Register the test namespace
        context.getNamespaceRegistry().register(TestLexicon.Namespace.PREFIX, TestLexicon.Namespace.URI);

        // Stub out the connection factory ...
        RepositoryConnectionFactory connectionFactory = new RepositoryConnectionFactory() {
            /**
             * {@inheritDoc}
 
View Full Code Here

        assert uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW
               || uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING
               || uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING
               || uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW;

        ExecutionContext context = session.getExecutionContext();
        this.namespaces = context.getNamespaceRegistry();
        this.nameFactory = context.getValueFactories().getNameFactory();
        this.uuidBehavior = uuidBehavior;

        this.saveMode = saveMode;
        switch (this.saveMode) {
            case SESSION:
View Full Code Here

        this.federatedSource.initialize(new FederatedRepositoryContext(this.connectionFactory));
    }

    protected void initializeSystemContent( Graph systemGraph ) {
        // Make sure the "/jcr:system" node exists ...
        ExecutionContext context = systemGraph.getContext();
        PathFactory pathFactory = context.getValueFactories().getPathFactory();
        Path systemPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM);
        Property systemPrimaryType = context.getPropertyFactory().create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.SYSTEM);
        systemGraph.create(systemPath, systemPrimaryType).ifAbsent().and();

        // Right now, the other nodes will be created as needed
    }
View Full Code Here

     */
    public synchronized Session login( Credentials credentials,
                                       String workspaceName ) throws RepositoryException {
        // Ensure credentials are either null or provide a JAAS method
        Map<String, Object> sessionAttributes = new HashMap<String, Object>();
        ExecutionContext execContext = null;
        if (credentials == null) {
            try {
                Subject subject = Subject.getSubject(AccessController.getContext());
                if (subject == null) {
                    throw new javax.jcr.LoginException(JcrI18n.mustBeInPrivilegedAction.text());
View Full Code Here

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

            }
            projectionsForSource.add(projection);
        }

        // Create the (most) appropriate projector ...
        ExecutionContext context = this.repositoryContext.getExecutionContext();
        Projector projector = MirrorProjector.with(context, projectionList);
        if (projector == null) projector = BranchedMirrorProjector.with(context, projectionList);
        if (projector == null) projector = OffsetMirrorProjector.with(context, projectionList);
        if (projector == null) projector = GeneralProjector.with(context, projectionList);
        assert projector != null;
View Full Code Here

        this.context = destination.getExecutionContext();
        assert this.context != null;

        // Set up a local namespace registry that is kept in sync with the namespaces found in this XML document ...
        NamespaceRegistry namespaceRegistry = new LocalNamespaceRegistry(this.context.getNamespaceRegistry());
        final ExecutionContext localContext = this.context.with(namespaceRegistry);

        // Set up references to frequently-used objects in the context ...
        this.nameFactory = localContext.getValueFactories().getNameFactory();
        this.pathFactory = localContext.getValueFactories().getPathFactory();
        this.propertyFactory = localContext.getPropertyFactory();
        this.namespaceRegistry = localContext.getNamespaceRegistry();
        assert this.nameFactory != null;
        assert this.pathFactory != null;
        assert this.propertyFactory != null;
        assert this.namespaceRegistry != null;
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.ExecutionContext$NullSecurityContext

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.