Package org.exist.dom

Examples of org.exist.dom.BinaryDocument


                Item next = i.nextItem();
                String value = serializer.serialize((NodeValue) next);
                //System.out.println(value);
            }
           
            BinaryDocument binDoc = (BinaryDocument) broker.getXMLResource(TestConstants.TEST_COLLECTION_URI2.append(TestConstants.TEST_BINARY_URI), Lock.READ_LOCK);
            assertNotNull("Binary document is null", binDoc);
            InputStream is = broker.getBinaryResource(binDoc);
            byte [] bdata = new byte[(int)broker.getBinaryResourceSize(binDoc)];
            is.read(bdata);
            is.close();
View Full Code Here


            URI uri = _getURI(pkgOrPath);
                pkg = parent_repo.installPackage(uri, force, interact);
                repo.reportAction(ExistRepository.Action.INSTALL, pkg.getName());
          } else {
            // .xar is stored as a binary resource
            BinaryDocument doc = null;
            try {
              doc = _getDocument(pkgOrPath);
              File file = ((NativeBroker)context.getBroker()).getCollectionBinaryFileFsPath(doc.getURI());
              LOG.debug("Installing file: " + file.getAbsolutePath());
              pkg = parent_repo.installPackage(file, force, interact);
                    repo.reportAction(ExistRepository.Action.INSTALL, pkg.getName());
            } finally {
              if (doc != null)
                doc.getUpdateLock().release(Lock.READ_LOCK);
            }
          }
            ExistPkgInfo info = (ExistPkgInfo) pkg.getInfo("exist");
            if (info != null && !info.getJars().isEmpty())
                ClasspathHelper.updateClasspath(context.getBroker().getBrokerPool(), pkg);
View Full Code Here

                } catch (PermissionDeniedException pde) {
                    throw new XPathException(pde.getMessage(), pde);
                }

    DocumentImpl docImage = null;
    BinaryDocument binImage = null;
    @SuppressWarnings("unused")
    BinaryDocument doc = null;
    BufferedImage bImage = null;
    @SuppressWarnings("unused")
    byte[] imgData = null;
    Image image = null;
View Full Code Here

            byte[] buf = new byte[512];
            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

        try {
          System.out.println("load() ...\n");
          assertNotNull(pool);
          broker = pool.get(pool.getSecurityManager().getSystemSubject());
          assertNotNull(broker);
            BinaryDocument binDoc = (BinaryDocument) broker.getXMLResource(TestConstants.TEST_COLLECTION_URI.append(TestConstants.TEST_BINARY_URI), Lock.READ_LOCK);
            assertNotNull("Binary document is null", binDoc);
            InputStream is = broker.getBinaryResource(binDoc);
            byte [] bdata = new byte[(int)broker.getBinaryResourceSize(binDoc)];
            is.read(bdata);
            is.close();
View Full Code Here

      Collection testCollection = broker.openCollection(TestConstants.TEST_COLLECTION_URI, Lock.READ_LOCK);
      try{

        XmldbURI docPath = TestConstants.TEST_COLLECTION_URI.append(DOCUMENT_NAME_URI);
       
        BinaryDocument binDoc = (BinaryDocument) broker.getXMLResource(docPath, Lock.NO_LOCK);
       
        // if document is not present, null is returned
        if(binDoc == null)
          fail("Binary document '" + docPath + " does not exist.");
View Full Code Here

            Collection collection = broker
                    .getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
           
            broker.saveCollection(transaction, collection);
           
            @SuppressWarnings("unused")
      BinaryDocument doc =
                    collection.addBinaryResource(transaction, broker,
                    DOCUMENT_NAME_URI , EMPTY_BINARY_FILE.getBytes(), "text/text");
           
            transact.commit(transaction);
View Full Code Here

                f = files[i];
                assertNotNull(f);
                if (f.isFile()) {
                    XmldbURI uri = test2.getURI().append(j + "_" + f.getName());
                    InputStream is = new FileInputStream(f);
                    BinaryDocument doc =
                        test2.addBinaryResource(transaction, broker, uri, is, MimeType.BINARY_TYPE.getName(),
                                f.length(), new Date(), new Date());
                    assertNotNull(doc);
                    is.close();
                }
View Full Code Here

            Collection collection = broker
                    .getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
           
            broker.saveCollection(transaction, collection);
           
            @SuppressWarnings("unused")
      BinaryDocument doc =
                    collection.addBinaryResource(transaction, broker,
                    DOCUMENT_NAME_URI , EMPTY_BINARY_FILE.getBytes(), "text/text");
           
            transact.commit(transaction);
View Full Code Here

            Txn transaction = transact.beginTransaction();
            System.out.println("Transaction started ...");
           
            XmldbURI docPath = TestConstants.TEST_COLLECTION_URI.append(DOCUMENT_NAME_URI);
           
            BinaryDocument binDoc = (BinaryDocument) broker
                    .getXMLResource(docPath, Lock.READ_LOCK);
           
            // if document is not present, null is returned
            if(binDoc == null){
                fail("Binary document '" + docPath + " does not exist.");
            } else {
               InputStream is = broker.getBinaryResource(binDoc);
               data = new byte[(int)broker.getBinaryResourceSize(binDoc)];
               is.read(data);
               is.close();
                binDoc.getUpdateLock().release(Lock.READ_LOCK);
            }
           
            Collection collection = broker.getCollection(TestConstants.TEST_COLLECTION_URI);
            collection.removeBinaryResource(transaction, broker, binDoc);
           
View Full Code Here

TOP

Related Classes of org.exist.dom.BinaryDocument

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.