Package org.exist.source

Examples of org.exist.source.DBSource


            } else {
                final XmldbURI pathUri = XmldbURI.create(xqueryresource);
                resource = broker.getXMLResource(pathUri, Lock.READ_LOCK);

                if(resource != null) {
                    source = new DBSource(broker, (BinaryDocument)resource, true);
                }
            }

            if(source != null) {
View Full Code Here


          try {
        final XmldbURI pathUri = XmldbURI.create(scriptURI);
       
        resource = broker.getXMLResource(pathUri, Lock.READ_LOCK);
        if (resource != null)
          {return new DBSource(broker, (BinaryDocument)resource, true);}
       
          } catch (final PermissionDeniedException e) {
            //XXX: log
        e.printStackTrace();
      } finally {
View Full Code Here

            resource = broker.getXMLResource(pathUri, Lock.READ_LOCK);

            if(resource != null) {
                LOG.info("Resource " + xqueryResourcePath + " exists.");
                source = new DBSource(broker, (BinaryDocument)resource, true);
            } else {
                LOG.info("Resource " + xqueryResourcePath + " does not exist.");
                LOG.info("pathURI " + pathUri );
                return true;
            }
View Full Code Here

                if(metadata.getMimeType().equals(XQUERY_MIME_TYPE)){
           
                    //compile the query
                    final XQuery xquery = broker.getXQueryService();
                    final XQueryContext context = xquery.newContext(AccessContext.REST);
                    final Source source = new DBSource(broker, (BinaryDocument)document, true);

                    //set the module load path for any module imports that are relative
                    context.setModuleLoadPath(XmldbURI.EMBEDDED_SERVER_URI_PREFIX + ((XmldbURI)source.getKey()).removeLastSegment());
                   
                    return broker.getXQueryService().compile(context, source);
                } else {
                    throw new RestXqServiceCompilationException("Invalid mimetype '" +  metadata.getMimeType() + "' for XQuery: "  + document.getURI().toString().toString());
                }
View Full Code Here

            if(!xquery.getPermissions().validate(user, Permission.READ | Permission.EXECUTE)) {
                throw new PermissionDeniedException("Insufficient privileges to access resource");
            }
           
            source = new DBSource(broker, xquery, true);
            compiled = compile(broker, source, parameters);
            queryResult = doQuery(broker, compiled, nodes, parameters);
            if(queryResult == null) {
                return ret;
            }
View Full Code Here

        //if setUid or setGid, become Effective User
        EffectiveSubject effectiveSubject = null;
        final Source src = expression.getContext().getSource();
        if(src instanceof DBSource) {
            final DBSource dbSrc = (DBSource)src;
            final Permission perm = dbSrc.getPermissions();

            if(perm.isSetUid()) {
                if(perm.isSetGid()) {
                    //setUid and SetGid
                    effectiveSubject = new EffectiveSubject(perm.getOwner(), perm.getGroup());
View Full Code Here

                        {throw new XPathException(this, "source for module " + location + " not found in database");}
                    if (sourceDoc.getResourceType() != DocumentImpl.BINARY_FILE ||
                            !"application/xquery".equals(sourceDoc.getMetadata().getMimeType()))
                        {throw new XPathException(this, "source for module " + location + " is not an XQuery or " +
                        "declares a wrong mime-type");}
                    querySource = new DBSource(context.getBroker(), (BinaryDocument) sourceDoc, true);
                } catch (final PermissionDeniedException e) {
                    throw new XPathException(this, "permission denied to read module source from " + location);
                } finally {
                    if(sourceDoc != null)
                        {sourceDoc.getUpdateLock().release(Lock.READ_LOCK);}
View Full Code Here

    private void executeXQuery(final DBBroker broker, final DocumentImpl resource,
            final HttpServletRequest request, final HttpServletResponse response,
            final Properties outputProperties, final String servletPath, final String pathInfo)
            throws XPathException, BadRequestException, PermissionDeniedException {

        final Source source = new DBSource(broker, (BinaryDocument) resource, true);
        final XQuery xquery = broker.getXQueryService();
        final XQueryPool pool = xquery.getXQueryPool();
        XQueryContext context;

        CompiledXQuery compiled = pool.borrowCompiledXQuery(broker, source);
View Full Code Here

                resource = broker.getXMLResource(pathUri, Lock.READ_LOCK);

                if(resource != null) {
                    LOG.info("Resource [" + xqueryResourcePath + "] exists.");
                    source = new DBSource(broker, (BinaryDocument)resource, true);
                } else {
                    LOG.error("Resource [" + xqueryResourcePath + "] does not exist.");
                    return;
                }
View Full Code Here

        } else {
            // process the xpointer or the stored XQuery
            try {
                Source source;
                if (xpointer == null)
                    {source = new DBSource(serializer.broker, (BinaryDocument) doc, true);}
                else {
                    xpointer = checkNamespaces(xpointer);
                    source = new StringSource(xpointer);
                }
                final XQuery xquery = serializer.broker.getXQueryService();
View Full Code Here

TOP

Related Classes of org.exist.source.DBSource

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.