Package org.exist

Examples of org.exist.EXistException


            broker = factory.getBrokerPool().get(user);
            try {
              collection = broker.openCollection(collUri, Lock.READ_LOCK);
              if (collection == null) {
                  transact.abort(transaction);
                  throw new EXistException("collection " + collUri + " not found!");
              }
            } finally {
              if (collection != null)
                {collection.release(Lock.READ_LOCK);}
            }
            final CollectionConfigurationManager mgr = factory.getBrokerPool().getConfigurationManager();
            mgr.addConfiguration(transaction, broker, collection, configuration);
            transact.commit(transaction);
            LOG.info("Configured '" + collection.getURI() + "'")
        } catch (final CollectionConfigurationException e) {
            transact.abort(transaction);
            throw new EXistException(e.getMessage());
        } finally {
            transact.close(transaction);
            factory.getBrokerPool().release(broker);
        }
        return false;
View Full Code Here


        final DBBroker broker = factory.getBrokerPool().get(user);
        Collection collection = null;
        try {
            collection = broker.openCollection(collUri, Lock.READ_LOCK);
            if (collection == null)
                {throw new EXistException("collection " + collUri + " not found!");}
            XmldbURI id;
            final Random rand = new Random();
            boolean ok;
            do {
                ok = true;
View Full Code Here

                return false;
            }
           
            return true;
        } catch(final URISyntaxException use) {
            throw new EXistException("Collection '" + collectionUri + "' does not indicate a valid collection URI: " + use.getMessage(), use);
        } finally {
            if(collection != null) {
                collection.release(Lock.READ_LOCK);
            }
            factory.getBrokerPool().release(broker);
View Full Code Here

        final DBBroker broker = factory.getBrokerPool().get(user);
        Collection collection = null;
        try {          
            collection = broker.openCollection(rootUri, Lock.READ_LOCK);
            if (collection == null) {
                throw new EXistException("collection " + rootUri + " not found!");
            }
            final HashMap<String, Object> desc = new HashMap<String, Object>();
            final Vector<Map<String, Object>> docs = new Vector<Map<String, Object>>();
            final Vector<String> collections = new Vector<String>();
            if (collection.getPermissionsNoLock().validate(user, Permission.READ)) {
View Full Code Here

        final DBBroker broker = factory.getBrokerPool().get(user);
        Collection collection = null;
        try {
            collection = broker.openCollection(collUri, Lock.READ_LOCK);
            if (collection == null) {
                throw new EXistException("collection " + collUri + " not found!");
            }
            final HashMap<String, Object> desc = new HashMap<String, Object>();
            final List<String> collections = new ArrayList<String>();
            if (collection.getPermissionsNoLock().validate(user, Permission.READ)) {
                for (final Iterator<XmldbURI> i = collection.collectionIterator(broker); i.hasNext(); ) {
View Full Code Here

        }

        try {
            final String xml = getDocumentAsString(name, parametri);
            if (xml == null)
                {throw new EXistException("document " + name + " not found!");}
            try {
                if ("no".equals(compression)) {
                    return xml.getBytes(encoding);
                } else {
                    LOG.debug("getdocument with compression");
View Full Code Here

                throw new PermissionDeniedException("Insufficient privileges to read resource");
            }
            doc = collection.getDocumentWithLock(broker, docUri.lastSegment(), Lock.READ_LOCK);
            if (doc == null) {
                LOG.debug("document " + docUri + " not found!");
                throw new EXistException("document not found");
            }
           
            if(!doc.getPermissions().validate(user, Permission.READ))
                {throw new PermissionDeniedException("Insufficient privileges to read resource " + docUri);}
            final Serializer serializer = broker.getSerializer();
View Full Code Here

            broker = factory.getBrokerPool().get(user);
            final XmldbURI docURI = XmldbURI.xmldbUriFor(docName)
            collection = broker.openCollection(docURI.removeLastSegment(), Lock.READ_LOCK);
            if (collection == null) {
                LOG.debug("collection " + docURI.removeLastSegment() + " not found!");
                throw new EXistException("Collection " + docURI.removeLastSegment() + " not found!");
            }
            //if(!collection.getPermissions().validate(user, Permission.READ)) {
            //  throw new PermissionDeniedException("Insufficient privileges to read resource");
            //}
            doc = collection.getDocumentWithLock(broker, docURI.lastSegment(), Lock.READ_LOCK);
            if (doc == null) {
                LOG.debug("document " + docURI + " not found!");
                throw new EXistException("document "+docURI+" not found");
            }

            //if(!doc.getPermissions().validate(user, Permission.READ)) {
            //  throw new PermissionDeniedException("Insufficient privileges to read resource " + docName);
            //}
View Full Code Here

      try {
        final int resultId = Integer.parseInt(handle);
        final SerializedResult sr = factory.resultSets.getSerializedResult(resultId);

        if(sr==null)
          {throw new EXistException("Invalid handle specified");}
        // This will keep the serialized result in the cache
        sr.touch();
        final VirtualTempFile vfile = sr.result;

        if(offset <= 0 || offset > vfile.length()) {
          factory.resultSets.remove(resultId);
          throw new EXistException("No more data available");
        }
        final byte[] chunk = vfile.getChunk(offset);
        final long nextChunk = offset + chunk.length;

        final HashMap<String, Object> result = new HashMap<String, Object>();
View Full Code Here

      try {
        final int resultId = Integer.parseInt(handle);
        final SerializedResult sr = factory.resultSets.getSerializedResult(resultId);

        if(sr==null)
          {throw new EXistException("Invalid handle specified");}
        // This will keep the serialized result in the cache
        sr.touch();
        final VirtualTempFile vfile = sr.result;

        final long longOffset=new Long(offset).longValue();
        if(longOffset< 0 || longOffset > vfile.length()) {
          factory.resultSets.remove(resultId);
          throw new EXistException("No more data available");
        }
        final byte[] chunk = vfile.getChunk(longOffset);
        final long nextChunk = longOffset + chunk.length;

        final HashMap<String, Object> result = new HashMap<String, Object>();
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.