Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All namespaces not used in node type definitions missing from the export #2

Closed
stefanseifert opened this issue Nov 26, 2020 · 14 comments · Fixed by #3
Closed

All namespaces not used in node type definitions missing from the export #2

stefanseifert opened this issue Nov 26, 2020 · 14 comments · Fixed by #3

Comments

@stefanseifert
Copy link
Contributor

filevault package validation outputs a warning like this

[WARNING] ValidationViolation: "jackrabbit-nodetypes: crx: is not a registered namespace prefix. Skip validation of nodes with that type/name", filePath=jcr_root\conf\filevaultsample\settings\wcm\policies\_rep_policy.xml, nodePath=/conf/filevaultsample/settings/wcm/policies/rep:policy/allow1, line=11, column=49

if the package contains an ACL definition with a rule like this:

    <allow1
        jcr:primaryType="rep:GrantACE"
        rep:principalName="content-authors"
        rep:privileges="{Name}[crx:replicate,jcr:read]"/>

the crx namespace is missing from the cnd files here.

a lot of other namespaces are missing as well (e.g. all those that are often used in DAM metadata like Iptc4xmpCore. by what process was the list of namespaces defined? manually or in some automatic process?

@kwin
Copy link
Member

kwin commented Nov 26, 2020

by what process was the list of namespaces defined? manually or in some automatic process?

This is explained in

// being generated from http://localhost:4502/crx/de/exportnodetype.jsp

I don't know why the crx namespace is not contained in that dump. @stefanseifert Do you have any idea how to get the full dump?

@kwin
Copy link
Member

kwin commented Nov 26, 2020

I just checked http://localhost:4502/crx/explorer/nodetypes/list.jsp?view=cnf&selection= and also that does not have the crx namespace....

It seems that the CND for some reason always only includes those namespaces which are used in node type definitions, but not those which are just used with property names/node names outside of NT definitions....

That is a shame as CND actually stands for "Compact Namespace and(!) Node Type Definition" (https://jackrabbit.apache.org/jcr/node-type-notation.html)

@stefanseifert
Copy link
Contributor Author

it's there if you look at http://localhost:4502/crx/explorer/ui/namespace_editor.jsp?ck=1606407982435&Path=&Callback=reload

probably the export contains only namespaces defined by CND files, and not those that are added dynamically during the livetime of a repository? (iirc this happens e.g. when uploading assets, they may contain namespaces not known before)

@kwin
Copy link
Member

kwin commented Nov 26, 2020

The code behind http://localhost:4502/crx/explorer/nodetypes/list.jsp?view=cnf&selection= looks like this

...
 if (req.getParameter("view", "").equalsIgnoreCase("cnf")) {
        response.setContentType("text/plain; charset=utf-8");
        CompactNodeTypeDefWriter cnd = new CompactNodeTypeDefWriter((Writer)out, repSession, true);
        if (ntMgr == null) {
          NodeTypeIterator<NodeType> nodeTypeIterator = repSession.getWorkspace().getNodeTypeManager().getAllNodeTypes();
          while (nodeTypeIterator.hasNext()) {
            NodeType ntImpl = nodeTypeIterator.next();
            if (nodeTypeFilter == 1 && !ntImpl.isMixin())
              continue; 
            if (nodeTypeFilter == 2 && ntImpl.isMixin())
              continue; 
            cnd.write((NodeTypeDefinition)ntImpl);
          } 
        }
...

Probably one would need to call http://jackrabbit.apache.org/api/2.20/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefWriter.html#write-java.util.Collection-org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefWriter.NamespaceMapping-java.io.Writer- instead internally to also include namespaces not bound to a node type definition. I will investigate, whether there is a servlet exposing that. Otherwise I fear I have to come up with my own implementation for doing a full export.

@stefanseifert
Copy link
Contributor Author

namespaces defined in bundle headers like

Sling-Namespaces: wcmio=http://wcm.io/ns

are also not contained in the output of exportnodetype.jsp.

@kwin
Copy link
Member

kwin commented Nov 26, 2020

Are those used in nodetypes?
I would rather assume that only namespaces used in nodetypes are exported, the others not. Compare with #2 (comment)

@stefanseifert
Copy link
Contributor Author

no - but the namespace may by used by properties stored in content packages

@kwin
Copy link
Member

kwin commented Nov 26, 2020

Just to clarify: I do agree that this is a bug and we must export all namespaces, the only question is how to achieve this easily.

@kwin kwin changed the title crx JCR namespace missing All namespace not used in node type definitions missing from the export Nov 26, 2020
@kwin kwin changed the title All namespace not used in node type definitions missing from the export All namespaces not used in node type definitions missing from the export Nov 26, 2020
@kwin
Copy link
Member

kwin commented Nov 26, 2020

This version:
aem-2020.11.4506.20201112T235200Z.cnd.txt has been created with a custom servlet now (I will push that later as well).
@stefanseifert WDYT?

@stefanseifert
Copy link
Contributor Author

looks good!
it think this line should be omitted:

<''=''>

@kwin
Copy link
Member

kwin commented Nov 26, 2020

All future versions will be based on the export from https://issues.apache.org/jira/browse/SLING-9945 which contains all namespaces.

kwin added a commit that referenced this issue Nov 27, 2020
Use export from new WebConsolePlugin containing all namespaces

This closes #2
kwin added a commit that referenced this issue Nov 27, 2020
Use export from new WebConsolePlugin containing all namespaces

This closes #2
@kwin kwin closed this as completed in #3 Nov 30, 2020
@stefanseifert
Copy link
Contributor Author

thanks!
maybe you should publish an updated version of the AEM 6.5 node type set as well with all namespaces?

@kwin
Copy link
Member

kwin commented Dec 1, 2020

@stefanseifert Would you be able to provide a PR for 6.5.7?

@stefanseifert
Copy link
Contributor Author

done, created 2 PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants