Package org.exist.xmldb

Examples of org.exist.xmldb.XmldbURI.lastSegment()


        final boolean isGroup = uri.endsWith(SecurityManager.GROUPS_COLLECTION_URI);
   
        if(isAccount || isGroup) {
            uri = uri.removeLastSegment();

            final String realmId = uri.lastSegment().toString();
     
            final AbstractRealm realm = (AbstractRealm)findRealmForRealmId(realmId);
            final Configuration conf = Configurator.parse(document);

            Integer id = -1;
View Full Code Here


      broker = db.get(null);
     
      XmldbURI uri = XmldbURI.create(ms.uri);
      Collection col = broker.getCollection(uri.removeLastSegment());
      if (col != null) {
        return col.getDocument(broker, uri.lastSegment());
      }
     
      return null;
    } finally {
      if (db != null)
View Full Code Here

            for (final Iterator j = documents.entrySet().iterator(); j.hasNext(); l++) {
                final Map.Entry docEntry = (Map.Entry) j.next();
                doc = new QueryResponseDocument();
                docId = (XmldbURI) docEntry.getKey();
                //TODO: Unnecessary?
                docId = docId.lastSegment();
                doc.setDocumentName(docId.toString());
                doc.setHitCount(((Integer) docEntry.getValue()).intValue());
                docs[l] = doc;
            }
        }
View Full Code Here

            final String[] resources = new String[collection.getDocumentCount(broker)];
            j = 0;
            XmldbURI resource;
            for (final Iterator i = collection.iterator(broker); i.hasNext(); j++) {
                resource = ((DocumentImpl) i.next()).getFileURI();
                resources[j] = resource.lastSegment().toString();
            }
            c.setResources(new StringArray(resources));
            c.setCollections(new StringArray(childCollections));
            return c;
        } catch (final EXistException e) {
View Full Code Here

                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");
            }
View Full Code Here

                    collection = context.getBroker().openCollection(resourceURI.removeLastSegment(), Lock.READ_LOCK);
                    if (collection == null) {
                        LOG.warn("collection not found: " + resourceURI.getCollectionPath());
                        return Sequence.EMPTY_SEQUENCE;
                    }
                    doc = collection.getDocumentWithLock(context.getBroker(), resourceURI.lastSegment(), Lock.READ_LOCK);
                    if (doc == null)
                        return Sequence.EMPTY_SEQUENCE;
                    if (doc.getResourceType() != DocumentImpl.BINARY_FILE ||
                            !doc.getMetadata().getMimeType().equals("application/xquery")) {
                        throw new XPathException(this, "XQuery resource: " + uri + " is not an XQuery or " +
View Full Code Here

                    // remove the document
                    LOG.debug("removing document " + path);
                    txn = transact.beginTransaction();

                    if (doc.getResourceType() == DocumentImpl.BINARY_FILE) {
                        doc.getCollection().removeBinaryResource(txn, broker, pathURI.lastSegment());
                    } else {
                        doc.getCollection().removeXMLResource(txn, broker, pathURI.lastSegment());
                    }

                    response.setStatus(HttpServletResponse.SC_OK);
View Full Code Here

                    txn = transact.beginTransaction();

                    if (doc.getResourceType() == DocumentImpl.BINARY_FILE) {
                        doc.getCollection().removeBinaryResource(txn, broker, pathURI.lastSegment());
                    } else {
                        doc.getCollection().removeXMLResource(txn, broker, pathURI.lastSegment());
                    }

                    response.setStatus(HttpServletResponse.SC_OK);
                }
            }
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.