On 2/28/07, Wolf Benz <[EMAIL PROTECTED]> wrote:
Hi Stefan,
1/ It seems though, that the JR impl takes the spec a bit loosely...
since jackrabbit shares its code base with the official jsr 170 TCK
you may rest assured that jackrabbit doesn't 'take the spec a bit loosely'...
if you read the relevant sections of the specification carefully you'll
relalize that jackrabbit's implementation is absolutely compliant
with spec.
if you read source like these 2 snippets:
(snippet from Jackrabbit 1.2.2 -
org.apache.jackrabbit.core.NamespaceRegistryImpl)
Code: (you can't unregister a NS)
---------
/**
* [EMAIL PROTECTED]
*/
public void unregisterNamespace(String prefix)
throws NamespaceException,
UnsupportedRepositoryOperationException,
AccessDeniedException, RepositoryException {
...
/**
* as we can't guarantee that there are no references to the
specified
* namespace (in names of nodes/properties/node types etc.)
we simply
* don't allow it.
*/
throw new NamespaceException("unregistering namespaces is
not supported.");
---------
& The same goes for remapping: (presented as functionality that
actually works...)
Code: (you can't remap a NS)
---------
public void registerNamespace(String prefix, String uri) {
...
if (prefixToURI.containsKey(prefix)) {
/**
* prevent remapping of existing prefixes because this
would in effect
* remove the previously assigned namespace;
* as we can't guarantee that there are no references to
this namespace
* (in names of nodes/properties/node types etc.) we
simply don't allow it.
*/
throw new NamespaceException("failed to register
namespace "
+ prefix + " -> " + uri
+ ": remapping existing prefixes is not
supported.");
}
---------
So... whhat do I have to think if this? (or do I miss smth?)
you do indeed, see my previous comment.
2/ Apart from that: what would then be the preferred place to put a
custom CND file?
In /workspaces/myworkspace/nodetypes ?
3/ In reaction to text below from previous mail: the question was not
why we had to write
s.getRootNode().getNode("myapp:someNode"); // i.e. with the inclusion
of the NS (I do get the concept of NSes :-)
... but why the prior and explicit need for a second
"s.setNamespacePrefix("myapp", "http://your.com/ns/1");"
as it is already registered at that point. (Is it really necessary
within one app - fail to see why)
so do i. you only need to set your session prefix mappings if you want
to remap an already registered namespace to a different prefix in your
session.
cheers
stefan
>
> 2/ Why do you explicitely (again) do the
> "s.setNamespacePrefix("myapp", "http://your.com/ns/1");" as you not
> only registered the NS, but also provide the NS (myapp) in your call
> on the next line: "s.getRootNode().getNode("myapp:someNode");"
> Is it necessary?
namespaces in JCR are modelled after XML namespaces. for more
information
please refer to sections 4.5 and 6.3 in the jsr 170 specification.
cheers
stefan