Package org.exist.collections

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


           
            broker.saveCollection(transaction, collection);
           
            @SuppressWarnings("unused")
      BinaryDocument doc =
                    collection.addBinaryResource(transaction, broker,
                    DOCUMENT_NAME_URI , EMPTY_BINARY_FILE.getBytes(), "text/text");
           
            transact.commit(transaction);
            System.out.println("Transaction commited ...");
        } catch (Exception e) {
View Full Code Here


           
            broker.saveCollection(transaction, collection);
           
            @SuppressWarnings("unused")
      BinaryDocument doc =
                    collection.addBinaryResource(transaction, broker,
                    DOCUMENT_NAME_URI , EMPTY_BINARY_FILE.getBytes(), "text/text");
           
            transact.commit(transaction);
            System.out.println("Transaction commited ...");
        } catch (Exception e) {
View Full Code Here

                response.setStatus(HttpServletResponse.SC_CREATED);
            } else {

                is = vtempFile.getByteStream();
                try {
                    collection.addBinaryResource(transaction, broker, docUri, is,
                            contentType, vtempFile.length());
                } finally {
                    is.close();
                }
                response.setStatus(HttpServletResponse.SC_CREATED);
View Full Code Here

               
            } else {
                LOG.debug("storing Binary resource");
                final InputStream is = new FileInputStream(tmp);
                try {
                  collection.addBinaryResource(txn, broker, documentUri, is, contentType, tmp.length());
                } finally {
                  is.close();
                }
                LOG.debug("done");
            }
View Full Code Here

            root.store(txn, broker, info, XML2, false);

            doc2 =  info.getDocument();

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

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

            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);

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

            //store test data
            IndexInfo info = root.validateXMLResource(txn, broker, doc1uri.lastSegment(), XML1);
            root.store(txn, broker, info, XML1, false);
            info = root.validateXMLResource(txn, broker, doc2uri.lastSegment(), XML2);
            root.store(txn, broker, info, XML2, false);
            root.addBinaryResource(txn, broker, doc3uri.lastSegment(), BINARY.getBytes(), null);

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

                throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, "Collection " + path + " not found");
            }
           
            final long conLength = res.getStreamLength();
            if(conLength != -1) {
                collection.addBinaryResource(txn, broker, resURI, res.getStreamContent(), res.getMimeType(), conLength, res.datecreated, res.datemodified);
            } else {
                collection.addBinaryResource(txn, broker, resURI, (byte[])res.getContent(), res.getMimeType(), res.datecreated, res.datemodified);
            }
           
            transact.commit(txn);
View Full Code Here

           
            final long conLength = res.getStreamLength();
            if(conLength != -1) {
                collection.addBinaryResource(txn, broker, resURI, res.getStreamContent(), res.getMimeType(), conLength, res.datecreated, res.datemodified);
            } else {
                collection.addBinaryResource(txn, broker, resURI, (byte[])res.getContent(), res.getMimeType(), res.datecreated, res.datemodified);
            }
           
            transact.commit(txn);
        } catch(final Exception e) {
            transact.abort(txn);
View Full Code Here

              new InputSource(new InputStreamReader(is, charset)), false);
         
          is.close();
        } else {
          final FileInputStream is = new FileInputStream(tempFile);
          collection.addBinaryResource(transaction, broker, docUri, is, contentType, tempFile.length());
          is.close();
        }

        try {
          LOG.debug("Acquiring lock on feed document...");
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.