Package org.exist.collections

Examples of org.exist.collections.IndexInfo


                System.out.println("Transaction started ...");
                XMLFilenameFilter filter = new XMLFilenameFilter();
                File files[] = dir.listFiles(filter);
               
                File f;
                IndexInfo info;
                // store some documents into the test collection
                for (int i = 0; i < files.length; i++) {
                    f = files[i];
                    try {
                        info = test.validateXMLResource(transaction, broker, XmldbURI.create(f.getName()), new InputSource(f.toURI().toASCIIString()));
View Full Code Here


                System.out.println("\nREMOVING DOCUMENT\n");
                test.removeXMLResource(transaction, broker, doc.getFileURI());
               
                File f = new File(dir + File.separator + "hamlet.xml");
                try {
                    IndexInfo info = test.validateXMLResource(transaction, broker, XmldbURI.create("test.xml"), new InputSource(f.toURI().toASCIIString()));
                    test.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
                } catch (SAXException e) {
                    System.err.println("Error found while parsing document: " + f.getName() + ": " + e.getMessage());
                }
               
View Full Code Here

            broker.saveCollection(transaction, test);
   
            String existHome = System.getProperty("exist.home");
            File existDir = existHome==null ? new File(".") : new File(existHome);
            File f = new File(existDir,"samples/biblio.rdf");
            IndexInfo info = test.validateXMLResource(transaction, broker, XmldbURI.create("test.xml"),
                    new InputSource(f.toURI().toASCIIString()));
            test.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
           
            Collection dest = broker.getOrCreateCollection(transaction, XmldbURI.ROOT_COLLECTION_URI.append("destination"));
            broker.saveCollection(transaction, dest);
View Full Code Here

   
            String existHome = System.getProperty("exist.home");
            File existDir = existHome==null ? new File(".") : new File(existHome);
            File f = new File(existDir,"samples/biblio.rdf");
            assertNotNull(f);
            IndexInfo info = test2.validateXMLResource(transaction, broker, XmldbURI.create("test.xml"), new InputSource(f.toURI().toASCIIString()));
            test2.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
           
            transact.commit(transaction);
            System.out.println("Transaction commited ...");
           
View Full Code Here

            String existHome = System.getProperty("exist.home");
            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("test.xml"), new InputSource(f.toURI().toASCIIString()));
      assertNotNull(info);
      subTestCollection.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);

      broker.copyResource(transaction, info.getDocument(), testCollection, XmldbURI.create("new_test.xml"));
      broker.saveCollection(transaction, testCollection);

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

            String existHome = System.getProperty("exist.home");
            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();
      System.out.println("Transaction started ...");

      broker.copyResource(transaction, info.getDocument(), testCollection, XmldbURI.create("new_test2.xml"));
      broker.saveCollection(transaction, testCollection);
     
//      Don't commit...
      pool.getTransactionManager().getJournal().flushToLog(true);
      System.out.println("Transaction interrupted ...");
View Full Code Here

            for (int i = 0; i < 50; i++) {
                System.out.println("Storing " + i + " out of 50...");
                transaction = transact.beginTransaction();

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

            Collection root = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
            assertNotNull(root);
            broker.saveCollection(transaction, root);

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

            String directory = "samples/shakespeare";
            File dir = new File(existDir, directory);

            // store some documents.
            for(File f : dir.listFiles(new XMLFilenameFilter())) {
                IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create(f.getName()), new InputSource(f.toURI().toASCIIString()));
                root.store(transaction, broker, info, new InputSource(f.toURI().toASCIIString()), false);
            }

            IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create("nested.xml"), NESTED_XML);
            root.store(transaction, broker, info, NESTED_XML, false);
            transact.commit(transaction);
           
           
            //for the tests
View Full Code Here

     
      InputSource is = new FileInputSource(testFile);
      transact = pool.getTransactionManager();
      assertNotNull(transact);
      transaction = transact.beginTransaction();
      IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create("test2.xml"), is);
     
      assertNotNull(info);
      root.store(transaction, broker, info, is, false);

      transact.commit(transaction);
View Full Code Here

TOP

Related Classes of org.exist.collections.IndexInfo

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.