Examples of BinaryDocument


Examples of org.exist.dom.BinaryDocument

            e.printStackTrace();
        }
    }

    private BinaryDocument getBinary(XmldbURI uri) throws EXistException {
        BinaryDocument binaryDoc = null;
        Database pool = BrokerPool.getInstance();;

        DBBroker broker = null;
        try {
            broker = pool.get(pool.getSecurityManager().getSystemSubject());
View Full Code Here

Examples of org.exist.dom.BinaryDocument

        return binaryDoc;
    }

    private BinaryDocument storeBinary(String name,  String data, String mimeType) throws EXistException {
      BinaryDocument binaryDoc = null;
        Database pool = BrokerPool.getInstance();;

        DBBroker broker = null;
        TransactionManager transact = null;
        Txn transaction = null;
View Full Code Here

Examples of org.exist.dom.BinaryDocument

            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.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

Examples of org.exist.dom.BinaryDocument

            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

Examples of org.exist.dom.BinaryDocument

                } 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

Examples of org.exist.dom.BinaryDocument

            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

Examples of org.exist.dom.BinaryDocument

        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

Examples of org.exist.dom.BinaryDocument

      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

Examples of org.exist.dom.BinaryDocument

            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
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.