Examples of addBinaryResource()


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

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

            root.addBinaryResource(transaction, broker, XmldbURI.create(name), data.getBytes(), "application/xquery");

            transact.commit(transaction);
        } catch (Exception e) {
            if (transact != null)
                transact.abort(transaction);
View Full Code Here

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

                            "Old document exists and overwrite is not allowed");}
            }
            LOG.debug("Storing binary resource to collection " + collection.getURI());
           
            /*DocumentImpl doc = */
            collection.addBinaryResource(txn, broker, docUri, data, mimeType);
//            if (created != null)
//                doc.setCreated(created.getTime());
//            if (modified != null)
//                doc.setLastModified(modified.getTime());
            transact.commit(txn);
View Full Code Here

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

                    LOG.debug(String.format("Inserting BINARY document '%s'", mime.getName()));

                // Stream into database
                InputStream fis = vtf.getByteStream();
                bis = new BufferedInputStream(fis);
                collection.addBinaryResource(txn, broker, newNameUri, bis, mime.getName(), length);
                bis.close();
            }

            // Commit change
            txnManager.commit(txn);
View Full Code Here

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

      throws Exception
   {
      String data = bin+suffix;
      System.out.println("Stored: "+data);
      Collection top = broker.getCollection(XmldbURI.create("xmldb:exist:///"));
      top.addBinaryResource(txn,broker,XmldbURI.create("xmldb:exist:///bin"),data.getBytes(),"text/plain");
      return top;
   }
  
   public boolean getBin(DBBroker broker,String suffix)
      throws Exception
View Full Code Here

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

            info = root.validateXMLResource(transaction, broker, doc03uri.lastSegment(), XML3);
            assertNotNull(info);
            root.store(transaction, broker, info, XML3, false);

            System.out.println("store "+doc11uri);
            root.addBinaryResource(transaction, broker, doc11uri.lastSegment(), BINARY.getBytes(), null);

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

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

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

            binaryDoc = root.addBinaryResource(transaction, broker, XmldbURI.create(name), data.getBytes(), mimeType);

            if(transact != null) {
                transact.commit(transaction);
            }
        } catch (Exception e) {
View Full Code Here

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

            assertNotNull(files);
           
            File f;
            IndexInfo info;
           
            BinaryDocument doc = test2.addBinaryResource(transaction, broker, TestConstants.TEST_BINARY_URI, "Some text data".getBytes(), null);
            assertNotNull(doc);
           
            // store some documents. Will be replaced below
            for (int i = 0; i < files.length; i++) {
                f = files[i];
View Full Code Here

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

              {info.getDocument().getMetadata().setCreated(created.getTime());}                 
            if (modified != null)
              {info.getDocument().getMetadata().setLastModified(modified.getTime());}                 
          } else {
            final InputStream is = source.getByteStream();
            doc = collection.addBinaryResource(transaction, broker, docUri.lastSegment(), is,
                mime.getName(), source.getByteStreamLength());
            is.close();
            if (created != null)
              {doc.getMetadata().setCreated(created.getTime());}
            if (modified != null)
View Full Code Here

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

                    throw new PermissionDeniedException("Old document exists and overwrite is not allowed");
                }
            }
            LOG.debug("Storing binary resource to collection " + collection.getURI());
           
            doc = collection.addBinaryResource(transaction, broker, docUri.lastSegment(), data, mimeType);
            if (created != null)
                {doc.getMetadata().setCreated(created.getTime());}
            if (modified != null)
                {doc.getMetadata().setLastModified(modified.getTime());}
            transact.commit(transaction);
View Full Code Here

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

            int count = 0;
            while ((count = is.read(buf)) > -1) {
                os.write(buf, 0, count);
            }
            BinaryDocument doc =
        root.addBinaryResource(transaction, broker, TestConstants.TEST_BINARY_URI, os.toByteArray()"text/text");
            assertNotNull(doc);
           
            transact.commit(transaction);
            System.out.println("Transaction commited ...");
           
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.