Package org.infinispan.schematic.document

Examples of org.infinispan.schematic.document.Document$Field


    @Test( expected = javax.jcr.LoginException.class )
    public void shouldNotAllowLoginIfCredentialsReturnNullLoginContext() throws Exception {
        String repoName = REPO_NAME;
        String jaasPolicyName = "modeshape-jcr";
        String[] anonRoleNames = {};
        Document config = createRepositoryConfiguration(repoName, jaasPolicyName, anonRoleNames);

        startRepositoryWith(config, repoName);

        repository.login(new Credentials() {
View Full Code Here


    }

    protected List<Document> readAllDocuments() {
        List<Document> results = new ArrayList<Document>();
        while (true) {
            Document doc = reader.read();
            if (doc == null) break;
            results.add(doc);
        }
        return results;
    }
View Full Code Here

    @Test
    public void shouldWriteAndReadSingleFileWithoutCompression() throws Exception {
        useCompression(false, 5);
        // Write one document
        Document doc = documents.get(0);
        writer.write(doc);
        writer.close();
        assertNoProblems();
        // Read all documents ...
        List<Document> readDocs = readAllDocuments();
View Full Code Here

    @Test
    public void shouldWriteAndReadSingleFileWithCompression() throws Exception {
        useCompression(true, 5);
        // Write one document
        Document doc = documents.get(0);
        writer.write(doc);
        writer.close();
        assertNoProblems();
        // Read all documents ...
        List<Document> readDocs = readAllDocuments();
View Full Code Here

        documentsByLocation.put(NONT_QUERYABLE_DOC_LOCATION, nonQueryableDoc);
    }

    @Override
    public Document getDocumentById( String id ) {
        Document doc = documentsById.get(id);
        // this is hard-coded in order to be able to validate the paging mechanism
        if (PAGED_DOCUMENT_ID.equals(id)) {
            DocumentReader reader = readDocument(doc);
            List<? extends Document> children = reader.getChildren();
            DocumentWriter writer = newDocument(id).setPrimaryType(JcrNtLexicon.UNSTRUCTURED).setChildren(children.subList(0, 1))
View Full Code Here

        return doc;
    }

    @Override
    public String getDocumentId( String path ) {
        Document document = documentsByLocation.get(path);
        return document != null ? readDocument(document).getDocumentId() : null;
    }
View Full Code Here

        return path == null ? Collections.<String>emptyList() : Collections.singletonList(path);
    }

    protected String getDocumentPathById( String id ) {
        for (Map.Entry<String, Document> entry : documentsByLocation.entrySet()) {
            Document doc = entry.getValue();
            if (readDocument(doc).getDocumentId().equals(id)) return entry.getKey();
        }
        return null;
    }
View Full Code Here

        return null;
    }

    @Override
    public boolean removeDocument( String id ) {
        Document doc = documentsById.get(id);
        if (doc != null) {
            preRemoveDocument(id, doc);
            String loc = getDocumentPathById(id);
            // Now remove them ...
            documentsById.remove(id);
View Full Code Here

    public void updateDocument( DocumentChanges documentChanges ) {
        String id = documentChanges.getDocumentId();
        if (!documentsById.containsKey(id)) {
            return;
        }
        Document existingDocument = documentsById.get(id);
        DocumentReader existingDocumentReader = readDocument(existingDocument);

        DocumentWriter updatedDocumentWriter = newDocument(id);
        updateProperties(existingDocumentReader, updatedDocumentWriter, documentChanges);
        updateMixins(existingDocumentReader, updatedDocumentWriter, documentChanges);
View Full Code Here

            documentsByLocation.put(location, doc);
        } else {
            // Need to get the path of the parent(s) and determine the path ...
            for (String parentId : readDocument(doc).getParentIds()) {
                String parentPath = getDocumentPathById(parentId);
                Document parent = getDocumentById(parentId);
                Name childName = readDocument(parent).getChildrenMap().get(id);
                String childPath = parentPath + "/" + stringFrom(childName);
                documentsByLocation.put(childPath, doc);
            }
        }
View Full Code Here

TOP

Related Classes of org.infinispan.schematic.document.Document$Field

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.