Examples of BinaryDocument


Examples of org.exist.dom.BinaryDocument

            {throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "The resource has not yet been stored");}
    final Subject preserveSubject = pool.getSubject();
    DBBroker broker = null;
    try {
      broker = pool.get(user);
      final BinaryDocument blob = (BinaryDocument)getDocument(broker, Lock.NO_LOCK);
      return new Date(blob.getMetadata().getLastModified());
    } catch (final EXistException e) {
      throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e.getMessage(), e);
    } finally {
      pool.release(broker);
      pool.setSubject(preserveSubject);
View Full Code Here

Examples of org.exist.dom.BinaryDocument

            {return mimeType;}
    final Subject preserveSubject = pool.getSubject();
        DBBroker broker = null;
        try {
            broker = pool.get(user);
            final BinaryDocument blob = (BinaryDocument)getDocument(broker, Lock.NO_LOCK);
            mimeType = blob.getMetadata().getMimeType();
            return mimeType;
        } catch (final EXistException e) {
            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e.getMessage(), e);
        } finally {
            pool.release(broker);
View Full Code Here

Examples of org.exist.dom.BinaryDocument

       *
       * @return true if the description is valid, false otherwise
       */
      public boolean isValid()
      {
        BinaryDocument docXQWS = null;
       
        try
        {
          docXQWS = getXQWS(broker, XQWSPath);
          return (docXQWS.getMetadata().getLastModified() == lastModifiedXQWS);
        }
        catch(final PermissionDeniedException e)
        {
          LOG.debug(e.getMessage());
          return false;
        }
        finally
        {
          if(docXQWS != null)
          {
            docXQWS.getUpdateLock().release(Lock.READ_LOCK);
          }
        }
      }
View Full Code Here

Examples of org.exist.dom.BinaryDocument

       * @param request The HttpServletRequest for which the description should be created
       */
      private void createInternalDescription(HttpServletRequest request) throws XPathException, SAXException, PermissionDeniedException, NotFoundException
      {
        // 1) Get the XQWS
        final BinaryDocument docXQWS = getXQWS(broker, XQWSPath);
   
        if(docXQWS == null)
        {
          throw new NotFoundException("Resource " + request.getRequestURL().toString() + " not found");
        }
   
        xqwsFileURI = docXQWS.getFileURI();
        xqwsCollectionURI = docXQWS.getCollection().getURI();
        final byte[] xqwsData = getXQWSData(broker, docXQWS);
           
        // 2) Store last modified date
        lastModifiedXQWS = docXQWS.getMetadata().getLastModified();
       
            // 3) Get the XQWS Namespace
            xqwsNamespace = getXQWSNamespace(xqwsData);
           
            // 4) Compile a Simple XQuery to access the module
            final CompiledXQuery compiled = XQueryIncludeXQWS(broker, docXQWS.getFileURI(), xqwsNamespace, docXQWS.getCollection().getURI());
           
            // 5) Inspect the XQWS and its function signatures and create a small XML document to represent it
            modXQWS = compiled.getContext().getModule(xqwsNamespace.getNamespaceURI());
            docXQWSDescription = describeWebService(modXQWS, xqwsFileURI, request, XQWSPath, null, null);
      }
View Full Code Here

Examples of org.exist.dom.BinaryDocument

         *
         * @return  The XQWS BinaryDocument
         */
        private BinaryDocument getXQWS(DBBroker broker, String path) throws PermissionDeniedException
        {
          BinaryDocument docXQWS = null;
            try
            {
              final XmldbURI pathUri = XmldbURI.create(path);       
              docXQWS = (BinaryDocument) broker.getXMLResource(pathUri, Lock.READ_LOCK);
              return docXQWS;
            }
            finally
            {
                //close the XQWS Document and release the read lock
              if(docXQWS != null)
              {
                docXQWS.getUpdateLock().release(Lock.READ_LOCK);
                }             
            }
        }
View Full Code Here

Examples of org.exist.dom.BinaryDocument

                    absoluteId = absoluteId.shiftRight(32);
                    final int collectionId = absoluteId.and(BigInteger.valueOf(0xFFFFFFFF)).intValue();
                   
                    doc = context.getBroker().getResourceById(collectionId, resourceType, documentId);
                    if(doc instanceof BinaryDocument) {
                        final BinaryDocument bin = (BinaryDocument) doc;
                        final InputStream is = context.getBroker().getBinaryResource(bin);
                        final Base64BinaryDocument b64doc = Base64BinaryDocument.getInstance(context, is);
                        return b64doc;
                    } else {
                        return new NodeProxy(doc);
View Full Code Here

Examples of org.exist.dom.BinaryDocument

            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

Examples of org.jmol.util.BinaryDocument

        doc.getAllData(name.replace('\\', '/'), "Molecule", fileData);
      } else if (ZipUtil.isZipFile(bis)) {
        ZipUtil.getAllData(bis, subFileList, name.replace('\\', '/'), "Molecule", fileData);
      } else if (asBinaryString) {
        // used for Spartan binary file reading
        BinaryDocument bd = new BinaryDocument();
        bd.setStream(bis, false);
        sb = new StringBuffer();
        //note -- these headers must match those in ZipUtil.getAllData and CompoundDocument.getAllData
        if (header != null)
          sb.append("BEGIN Directory Entry " + name0 + "\n");
        try {
          while (true)
            sb.append(Integer.toHexString(((int) bd.readByte()) & 0xFF))
                .append(' ');
        } catch (Exception e1) {
          sb.append('\n');
        }
        if (header != null)
View Full Code Here

Examples of org.jmol.util.BinaryDocument

   */

 
  Dsn6BinaryReader(SurfaceGenerator sg, String fileName, String data) {
    super(sg, null);
    binarydoc = new BinaryDocument();
    if (data == null)
      binarydoc.setStream(sg.getAtomDataServer().getBufferedInputStream(fileName), true);
    else
      binarydoc.setStream(new DataInputStream(new ByteArrayInputStream(data.getBytes())));
    // data are HIGH on the inside and LOW on the outside
View Full Code Here

Examples of org.jmol.util.BinaryDocument

   */

 
  MrcBinaryReader(SurfaceGenerator sg, String fileName, String data) {
    super(sg, null);
    binarydoc = new BinaryDocument();
    if (data == null)
      binarydoc.setStream(sg.getAtomDataServer().getBufferedInputStream(fileName), true);
    else
      binarydoc.setStream(new DataInputStream(new ByteArrayInputStream(data.getBytes())));
    // data are HIGH on the inside and LOW on the outside
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.