Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Support for 'Module Location Configuration' #209

Closed
rlouapre opened this issue Apr 18, 2014 · 12 comments
Closed

Support for 'Module Location Configuration' #209

rlouapre opened this issue Apr 18, 2014 · 12 comments
Milestone

Comments

@rlouapre
Copy link
Contributor

Ability to register some modules.

add-module-location-configuration

@grtjn
Copy link
Contributor

grtjn commented Apr 23, 2014

Looking into this. Also missing: schemas, and request-blackouts..

@rlouapre
Copy link
Contributor Author

rlouapre commented May 2, 2014

@grtjn
How to use this feature?

I try to add in ml-confg.xml:

<configuration>
  <module-locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://marklogic.com/xdmp/group">
    <module-location>
      <namespace-uri>http://github.com/robwhitby/xray/assertions</namespace-uri>
      <location>/_framework/lib/xray/src/assertions.xqy</location>
    </module-location>
    <module-location>
      <namespace-uri>http://github.com/robwhitby/xray</namespace-uri>
      <location>/_framework/lib/xray/src/xray.xqy</location>
    </module-location>
  </module-locations>

And execute ml local boostrap

@rlouapre
Copy link
Contributor Author

rlouapre commented May 2, 2014

I forget to put module-locations inside http-server.
It is working fine with one module-location element [1] but not with multiple [2].

    <http-server>
      <module-locations>
      <module-location>
        <namespace-uri>http://github.com/robwhitby/xray</namespace-uri>
        <location>/_framework/lib/xray/src/xray.xqy</location>
      </module-location>
    </module-locations>
...
    </http-server>
    <http-server>
      <module-locations>
      <module-location>
        <namespace-uri>http://github.com/robwhitby/xray</namespace-uri>
        <location>/_framework/lib/xray/src/xray.xqy</location>
      </module-location>
      <module-location>
        <namespace-uri>http://github.com/robwhitby/xray/assertions</namespace-uri>
        <location>/_framework/lib/xray/src/assertions.xqy</location>
      </module-location>
    </module-locations>
...
    </http-server>

I get the error message:
ERROR: [{"qid":null, "type":"string", "result":"XDMP-NONMIXEDCOMPLEXCONT: fn:data(<module-location xmlns="http://marklogic.com/xdmp/group" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">http://github.com/robwhitby/xray/assertions</name...</module-location>) -- Node has complex type with non-mixed complex content\nSee MarkLogic Server error log for more details."}]
ERROR: ... Bootstrap FAILED

@grtjn
Copy link
Contributor

grtjn commented May 3, 2014

Auch, classic mistake trying to pass a sequence of values into xdmp:eval..

dmcassel added a commit that referenced this issue May 5, 2014
Bug fix for #209, few other bug fixes..
@rlouapre
Copy link
Contributor Author

rlouapre commented May 6, 2014

If module-location/location is updated ml bootstrap will fail with the error:

ERROR: [{"qid":null, "type":"string", "result":"ADMIN-NOSUCHITEM: (err:FOER0000) Appserver Module Location does not exist: <module-location xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns=\"http:\/\/marklogic.com\/xdmp\/group\">\n  <namespace-uri>http:\/\/marklogic.com\/metadata\/import\/test\/setup<\/namespace-uri>\n  <location>\/test\/app\/lib\/test\/setup\/setup.xqy<\/location>\n<\/module-location>\nSee MarkLogic Server error log for more details."}]
ERROR: ... Bootstrap FAILED

Is it expected or should bootstrap delete and recreate module location ?

@dmcassel
Copy link
Collaborator

dmcassel commented May 6, 2014

That's a bug. Typical operation is to update the $config by removing those settings, then adding the specified ones. If there's no change, then there's no difference.

@dmcassel dmcassel reopened this May 6, 2014
@grtjn
Copy link
Contributor

grtjn commented May 7, 2014

Hmm, the self-test doesn't cover changing settings at the moment. Maybe a good moment to build that in..

@grtjn
Copy link
Contributor

grtjn commented May 8, 2014

The logic is a little 'smarter' actually. It tries to detect which ones should be added, which ones should be removed. Taking the blunt approach might indeed be more robust..

@grtjn
Copy link
Contributor

grtjn commented May 8, 2014

Ah, it is actually is silly mistake. The mechanism for ns, schemas, and modules is same: ns-prefix, schema-ns, and module-ns need to be unique. So, those with matching prefix or ns-uri are removed first, before adding missing ones. But the logic to delete them passed through the new spec instead of the old one, making delete fail.

By explicitly removing those that need to be deleted, and only adding those that are missing, any existing ns, schema or module-location will be preserved..

@rlouapre
Copy link
Contributor Author

How do I add module-location to XCC configuration?

@grtjn
Copy link
Contributor

grtjn commented May 20, 2014

Bootstrap normally replaces @ml.xdbc-server in ml-config.xml with the following:

      <xdbc-server>
        <xdbc-server-name>@ml.app-name-xcc</xdbc-server-name>
        <port>@ml.xcc-port</port>
        <database name="@ml.content-db"/>
        <modules name="@ml.modules-db"/>
        <authentication>digest</authentication>
      </xdbc-server>

That does not contain module-locations, and doesn't allow you to add them this way.

Bootstrap should however support module-locations for any server type. You could replace the placeholder with the above replacement in ml-config.xml yourself. That way you should be able to add module-locations to it. Haven't tested though..

@rlouapre
Copy link
Contributor Author

Adding module-locations node in your snippet works.

@dmcassel dmcassel closed this as completed Jun 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants