Package org.exist

Examples of org.exist.EXistException


        Collection collection = null;
        try {
            broker = factory.getBrokerPool().get(user);
            collection = broker.openCollection(collUri, Lock.READ_LOCK);
            if (collection == null)
                {throw new EXistException("collection " + collUri + " not found");}
            return new Date(collection.getCreationTime());
        } finally {
            if(collection != null)
                {collection.release(Lock.READ_LOCK);}
            factory.getBrokerPool().release(broker);
View Full Code Here


        try {
            broker = factory.getBrokerPool().get(user);
            doc = broker.getXMLResource(docUri, Lock.READ_LOCK);
            if (doc == null) {
                LOG.debug("document " + docUri + " not found!");
                throw new EXistException("document not found");
            }
            final DocumentMetadata metadata = doc.getMetadata();
            final Vector<Date> vector = new Vector<Date>(2);
            vector.addElement(new Date(metadata.getCreated()));
            vector.addElement(new Date(metadata.getLastModified()));
View Full Code Here

        try {
            broker = factory.getBrokerPool().get(user);

            final Account u = factory.getBrokerPool().getSecurityManager().getAccount(name);
            if (u == null) {
                throw new EXistException("account '" + name + "' does not exist");
            }
         
            final HashMap<String, Object> tab = new HashMap<String, Object>();
            tab.put("uid", user.getId());
            tab.put("name", u.getName());
View Full Code Here

                    }
                    return null;
                }
            });
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        }
    }
View Full Code Here

                    broker.getBrokerPool().getSecurityManager().deleteGroup(name);
                    return null;
                }
            });
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        }
    }
View Full Code Here

            Collection collection = null;
            try {
              collection = broker.openCollection(docUri.removeLastSegment(), Lock.WRITE_LOCK);
              if (collection == null) {
                  transact.abort(transaction);
                  throw new EXistException("Collection " + docUri.removeLastSegment() + " not found");
              }
 
              if (overwrite == 0) {
                  final DocumentImpl old = collection.getDocument(broker, docUri.lastSegment());
                  //TODO : register the lock within the transaction ?
View Full Code Here

      try {
        final int handle = Integer.parseInt(localFile);
        final SerializedResult sr = factory.resultSets.getSerializedResult(handle);
        if(sr==null)
          {throw new EXistException("Invalid handle specified");}
       
        source = new VirtualTempFileInputSource(sr.result);
       
        // Unlinking the VirtualTempFile from the SerializeResult
        sr.result=null;
        factory.resultSets.remove(handle);
      } catch(final NumberFormatException nfe) {
        // As this file can be a non-temporal one, we should not
        // blindly erase it!
        final File file = new File(localFile);
          if (!file.canRead())
            {throw new EXistException("unable to read file " + file.getAbsolutePath());}
         
          source = new VirtualTempFileInputSource(file);
      } catch(final IOException ioe) {
      throw new EXistException("Error preparing virtual temp file for parsing");
      }

      final TransactionManager transact = factory.getBrokerPool().getTransactionManager();
      final Txn transaction = transact.beginTransaction();
      DBBroker broker = null;
      DocumentImpl doc = null;

      // DWES
      MimeType mime = MimeTable.getInstance().getContentType(mimeType);
      if (mime == null)
        {mime = MimeType.BINARY_TYPE;}

      final boolean treatAsXML=(isXML!=null && isXML.booleanValue()) || (isXML==null && mime.isXMLType());
      try {
        broker = factory.getBrokerPool().get(user);
        Collection collection = null;
        IndexInfo info = null;

        try {

          collection = broker.openCollection(docUri.removeLastSegment(), Lock.WRITE_LOCK);
          if (collection == null) {
            transact.abort(transaction);
            throw new EXistException("Collection " + docUri.removeLastSegment() + " not found");
          }

          if (overwrite == 0) {
            final DocumentImpl old = collection.getDocument(broker, docUri.lastSegment());
            if (old != null) {
View Full Code Here

        try {
            broker = factory.getBrokerPool().get(user);
            final Collection collection = broker.openCollection(docUri.removeLastSegment(), Lock.WRITE_LOCK);
            if (collection == null) {
              transact.abort(transaction);
                throw new EXistException("Collection " + docUri.removeLastSegment() + " not found");
            }
            // keep the write lock in the transaction
            transaction.registerLock(collection.getLock(), Lock.WRITE_LOCK);
            if (overwrite == 0) {
                final DocumentImpl old = collection.getDocument(broker, docUri.lastSegment());
View Full Code Here

//            LOG.debug("appending to file " + fileName);
          try {
            final int handle = Integer.parseInt(fileName);
            final SerializedResult sr = factory.resultSets.getSerializedResult(handle);
            if(sr==null)
              {throw new EXistException("Invalid handle specified");}
            // This will keep the serialized result in the cache
            sr.touch();
            vtempFile = sr.result;
          } catch(final NumberFormatException nfe) {
             throw new EXistException("Syntactically invalid handle specified");
          }
        }
        if (compressed)
            {Compressor.uncompress(chunk, vtempFile);}
        else
View Full Code Here

        }
        if (howmany > resultSet.getItemCount() || howmany == 0)
            {howmany = resultSet.getItemCount();}
       
        if (start < 1 || start > resultSet.getItemCount())
            {throw new EXistException("start parameter out of range");}
       
        final StringWriter writer = new StringWriter();
        writer.write("<exist:result xmlns:exist=\"");
        writer.write(Namespaces.EXIST_NS);
        writer.write("\" hits=\"");
View Full Code Here

TOP

Related Classes of org.exist.EXistException

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.