OAK-10952: improve autogenerated namespace prefixes - test with prototype
PoC, hopefully illustrating the idea.
(needs more documentation and support for edge cases, final location in project to be decided)
Commit-Check ✔️
- could the
makeUpPrefixTryEvenHardermake a somewhat shorter (perhaps sha-hash) suggestion? - generally I think this is useful indeed, to avoid later namespace remorse. How impossible would it be to look into support for changing namespaces (I know it's a challenge)
could the makeUpPrefixTryEvenHarder make a somewhat shorter (perhaps sha-hash) suggestion?
SHA-1 would be 160 bits, thus 20 bytes, right? That's not always less than the actual namespace name. I could however special case that case.
generally I think this is useful indeed, to avoid later namespace remorse. How impossible would it be to look into support for changing namespaces (I know it's a challenge)
That's a separate issue. I believe we already found out that it can be done using the namespace registry, although risky. The point of this is to reduce the number of cases where it actually comes up.
I was thinking of something like the cca2a4f part of a cca2a4f1dbde1e0f7e337615763ac20a64e39160 git commit
I was thinking of something like the
cca2a4fpart of acca2a4f1dbde1e0f7e337615763ac20a64e39160git commit
-> https://github.com/apache/jackrabbit-oak/pull/2237/commits/7024038f2e79c3069164bf864f2d7652e8c860a1
re valid prefixes: the JCR spec allows many characters here; but checking exactly might be hard and overkill.
As valid URIs, strictly speaking, are only ASCII, we should filter out all non-ASCII. That would leaves with a short "allow" list of characters.
+1, "s-1578eb4" looks nice!
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
I would place this in org.apache.jackrabbit.oak.namepath.impl.GlobalNameMapper and then call this from according getOrCreateOakName(orNull) which should be used from all JCR methods potentially creating items (with expanded names). This should be imho the only place dealing with name resolving in Oak.