Hi Florent,

> > Why not upload the CQ files through WEBDAV just like the other
> > modules? But you must do so with a WEBDAV server connected to the
> > Modules database. Alternatively, just create a dedicated
> HTTP server
> > for CQ.
>
>   That's what I tried.  But I would have made something
> wrong, as this does not work.  I created the following servers:
>
>     - HTTP:   database=Modules, modules=Modules
>     - WebDAV: database=Modules
>     - XDBC:   database=Modules, modules=Modules
>
>   I uploaded CQ via this WebDAV server (I created a directory
> /cq/ and copied all files within there.)  Then I tried to
> access the HTTP server at http://localhost:<port>/cq/, and I
> got a "404 Not Found".

Sounds like a document permission problem. Try accessing CQ with admin rights. 
If that does work, then the modules are uploaded without document permissions. 
Without document permissions only users with admin rights can access them.

If you give the webdav user or one of its roles the necessary default 
permissions to allow the user that is trying to execute the modules the 
necessary execute permission.

PS: only the WEBDAV server needs to have the database set to Modules, otherwise 
the HTTP and XDBC servers will look for plain documents in the Modules database 
as well..

> > I personally prefer using xdmp:eval that does document-inserts,
> > setting the database-id option to the one of the modules database
> > using either xdmp:modules-database() or
> xdmp:database('Modules') (note
> > that the last two function calls don't have the same meaning)..
>
>   Would you have a concrete sample doing so?

Not a full sample, but I wrote some helper functions to make things easier. I 
have written them to facilitate application deployment on various servers, 
making promotion to production easier as well. These functions are called from 
an small admin maintenance webapp, written in xquery..

The user will have to have xdmp:eval and xdmp:filesystem-file privilege and 
permission to insert into the modules database (uri permission or any-uri 
privilege). Cut n paste the following to CQ and see if you can get it working:

(:---- helper function ----:)

declare function local:insert-module($modules-database as xs:unsignedLong, $uri 
as xs:string, $module as document-node(), $permissions as 
element(sec:permission)*, $collections as xs:string*) as empty-sequence() {
    (: Just evaluate a plain document-insert, but against the modules-database 
:)
    xdmp:eval(
        concat('
            xquery version "1.0-ml";

            declare variable $uri as xs:string external;
            declare variable $module as document-node() external;
            declare variable $permissions as element(sec:permission)* ', if 
($permissions) then 'external' else ':= ()', ';
            declare variable $collections as xs:string* ', if ($collections) 
then 'external' else ':= ()', ';

            xdmp:document-insert($uri, $module, $permissions, $collections)
        '),

        (xs:QName("uri"), $uri,
         xs:QName("module"), $module,
         if ($permissions) then (
             xs:QName("permissions"), $permissions
         ) else (),
         if ($collections) then (
             xs:QName("collections"), $collections
         ) else ()
        ),

        <options xmlns="xdmp:eval">
            <isolation>different-transaction</isolation>
            <database>{$modules-database}</database>
        </options>
    )
};

(:---- the actual insert call ---:)

local:insert-module(xdmp:database('Modules'), '/my-app/my-module-uri.xqy', 
document { xdmp:filesystem-file('/filesystem/path/of/module.xqy') }, 
xdmp:permission('app-role', 'execute'), ())

Note: ignore the clumsy if ($permissions) then.. statements, the eval doesn't 
like to receive empty sequences as variable values..

>   Thanks for your perseverence...

You are welcome..

Kind regards,
Geert


Drs. G.P.H. Josten
Consultant


http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.



_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to