Package org.xmldb.api.base

Examples of org.xmldb.api.base.Collection.storeResource()


        try {
            Collection testCollection = getTestCollection();
            Resource doc = testCollection.createResource(MODULE8_NAME, "BinaryResource");
            doc.setContent(module8);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);

            XPathQueryService service = (XPathQueryService) testCollection.getService("XPathQueryService", "1.0");
            service.setProperty(OutputKeys.INDENT, "no");
            String query = "import module namespace dr = \"double-root2\" at \"" + URI + "/test/" + MODULE8_NAME + "\";\n"
                    +"let $doc1 := dr:documentIn() \n"
View Full Code Here


        try {
            Collection testCollection = getTestCollection();
            Resource doc = testCollection.createResource(MODULE5_NAME, "BinaryResource");
            doc.setContent(module5);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);

            doc = testCollection.createResource(MODULE6_NAME, "BinaryResource");
            doc.setContent(module6);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);
View Full Code Here

            testCollection.storeResource(doc);

            doc = testCollection.createResource(MODULE6_NAME, "BinaryResource");
            doc.setContent(module6);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);

            System.out.println("testGlobalVars 1: ========");
            XQueryService service = (XQueryService) testCollection.getService("XPathQueryService", "1.0");
            String query = "xquery version \"1.0\";\n" + "import module namespace foo=\"foo\" at \"" + URI + "/test/" + MODULE5_NAME + "\";\n" + "$foo:bar";
            ResourceSet result = service.query(query);
View Full Code Here

        try {
            Collection testCollection = getTestCollection();
            doc = testCollection.createResource(module_name, "BinaryResource");
            doc.setContent(module);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);
        } catch (XMLDBException ex) {
            ex.printStackTrace();
            fail(ex.getMessage());
        }
View Full Code Here

        try {
            Collection testCollection = getTestCollection();
            doc = testCollection.createResource(module_name, "BinaryResource");
            doc.setContent(module);
            ((EXistResource) doc).setMimeType("application/xquery");
            testCollection.storeResource(doc);
        } catch (XMLDBException ex) {
            ex.printStackTrace();
            fail(ex.getMessage());
        }
View Full Code Here

      super.setUp();
     
      Collection col = getTestCollection();
      XMLResource res = (XMLResource) col.createResource("testappend.xml", "XMLResource");
      res.setContent("<root><node id=\"1\"/></root>");
      col.storeResource(res);
     
      addAction(new XQueryUpdateAction(URI + "/C1", "testappend.xml"), 20, 0, 0);
      addAction(new XQueryUpdateAction(URI + "/C1", "testappend.xml"), 20, 0, 0);
    } catch (Exception e) {           
            fail(e.getMessage());
View Full Code Here

            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT1_CONTENT);
            root.storeResource(resource);

            assertEquals(3, AnotherTrigger.createDocumentEvents);

            assertEquals(26, AnotherTrigger.count);
View Full Code Here

            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT2_CONTENT);
            root.storeResource(resource);

            resource = root.createResource("data.xml", "XMLResource");

            assertEquals(DOCUMENT3_CONTENT, resource.getContent().toString());
View Full Code Here

            IndexQueryService idxConf = (IndexQueryService) root.getService("IndexQueryService", "1.0");
            idxConf.configureCollection(COLLECTION_CONFIG);

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT2_CONTENT);
            root.storeResource(resource);

            resource = root.createResource("data.xml", "XMLResource");

            assertEquals(DOCUMENT3_CONTENT, resource.getContent().toString());
View Full Code Here

        for (int j = 0; j < files.length; j++) {
            MimeType mime = mimeTab.getContentTypeFor(files[j].getName());
            if(mime != null && mime.isXMLType()) {
                Resource resource = collection.createResource(files[j].getName(), "XMLResource");
                resource.setContent(files[j]);
                collection.storeResource(resource);
            }
        }
    }

    @BeforeClass
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.