Package org.exist.collections

Examples of org.exist.collections.Collection.store()


            File existDir = existHome==null ? new File(".") : new File(existHome);
      File f = new File(existDir,"samples/shakespeare/r_and_j.xml");
      assertNotNull(f);
      IndexInfo info = subTestCollection.validateXMLResource(transaction, broker, XmldbURI.create("test2.xml"), new InputSource(f.toURI().toASCIIString()));
      assertNotNull(info);
      subTestCollection.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);

      transact.commit(transaction);
      System.out.println("Transaction commited ...");

      transaction = transact.beginTransaction();
View Full Code Here


                File f = new File("samples/shakespeare/macbeth.xml");
                IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create("test.xml"),
                        new InputSource(f.toURI().toASCIIString()));
                assertNotNull(info);
                root.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);

                transact.commit(transaction);
            }
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

            File f = new File("samples/shakespeare/hamlet.xml");
            IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create("test.xml"),
                    new InputSource(f.toURI().toASCIIString()));
            assertNotNull(info);
            root.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);

            transact.commit(transaction);

            transaction = transact.beginTransaction();
            XQuery xquery = broker.getXQueryService();
View Full Code Here

            IndexInfo info = test.validateXMLResource(transaction, broker, XmldbURI.create("test_string.xml"),
                TEST_XML);
            //TODO : unlock the collection here ?
            assertNotNull(info);

            test.store(transaction, broker, info, TEST_XML, false);

            transact.commit(transaction);
            System.out.println("Transaction commited ...");
        } catch (Exception e) {
          transact.abort(transaction);
View Full Code Here

            if (mime.isXMLType()) {
                final InputSource vtfis = new VirtualTempFileInputSource(vtempFile, charset);

                final IndexInfo info = collection.validateXMLResource(transaction, broker, docUri, vtfis);
                info.getDocument().getMetadata().setMimeType(contentType);
                collection.store(transaction, broker, info, vtfis, false);
                response.setStatus(HttpServletResponse.SC_CREATED);
            } else {

                is = vtempFile.getByteStream();
                try {
View Full Code Here

                final IndexInfo info = collection.validateXMLResource(txn, broker, documentUri, inputsource);
                final DocumentImpl doc = info.getDocument();
                doc.getMetadata().setMimeType(contentType);
                collection.release(Lock.READ_LOCK);
                collectionLocked = false;
                collection.store(txn, broker, info, inputsource, false);
                LOG.debug("done");
               
            } else {
                LOG.debug("storing Binary resource");
                final InputStream is = new FileInputStream(tmp);
View Full Code Here

              Collection collection = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
              broker.saveCollection(transaction, collection);
 
              IndexInfo info = collection.validateXMLResource(transaction, broker, XmldbURI.create("test.xml"), xml);
              //TODO : unlock the collection here ?
              collection.store(transaction, broker, info, xml, false);
              transact.commit(transaction);
      } catch (Exception e) {
        transact.abort(transaction);
              e.printStackTrace();
              fail(e.getMessage());
View Full Code Here

            System.out.println("STORING DOCUMENT....");
            IndexInfo info = root.validateXMLResource(txn, broker, doc1uri.lastSegment(), XML1);
            assertNotNull(info);
            System.out.println("STORING DOCUMENT....SECOND ROUND....");
            root.store(txn, broker, info, XML1, false);
            assertNotNull(info.getDocument());
            System.out.println("STORING DOCUMENT....DONE.");

            doc1 = info.getDocument();
View Full Code Here

            doc1 = info.getDocument();

            info = root.validateXMLResource(txn, broker, doc2uri.lastSegment(), XML2);
            assertNotNull(info);
            root.store(txn, broker, info, XML2, false);

            doc2 =  info.getDocument();

            System.out.println("store "+doc3uri);
            root.addBinaryResource(txn, broker, doc3uri.lastSegment(), BINARY.getBytes(), null);
View Full Code Here

            mgr.addConfiguration(transaction, broker, root, COLLECTION_CONFIG);

            System.out.println("store "+doc1uri);
            IndexInfo info = root.validateXMLResource(transaction, broker, doc1uri.lastSegment(), XML);
            assertNotNull(info);
            root.store(transaction, broker, info, XML, false);

            System.out.println("store "+doc2uri);
            BinaryDocument doc = root.addBinaryResource(transaction, broker, doc2uri.lastSegment(), BINARY.getBytes(), null);
            assertNotNull(doc);
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.