use of org.apache.jackrabbit.webdav.xml.Namespace in project jackrabbit by apache.
the class DefaultHandler method getJcrName.
/**
* Build jcr property name from dav property name. If the property name
* defines a namespace uri, that has not been registered yet, an attempt
* is made to register the uri with the prefix defined.
*
* @param propName name of the dav property
* @param session repository session
* @return jcr name
* @throws RepositoryException if an error during repository access occurs.
*/
private String getJcrName(DavPropertyName propName, Session session) throws RepositoryException {
// remove any encoding necessary for xml compliance
String pName = ISO9075.decode(propName.getName());
Namespace propNamespace = propName.getNamespace();
if (!Namespace.EMPTY_NAMESPACE.equals(propNamespace)) {
NamespaceHelper helper = new NamespaceHelper(session);
String prefix = helper.registerNamespace(propNamespace.getPrefix(), propNamespace.getURI());
pName = prefix + ":" + pName;
}
return pName;
}
use of org.apache.jackrabbit.webdav.xml.Namespace in project jackrabbit by apache.
the class DefaultHandler method getDavName.
// ------------------------------------------------------------< private >---
/**
* Builds a webdav property name from the given jcrName. In case the jcrName
* contains a namespace prefix that would conflict with any of the predefined
* webdav namespaces a new prefix is assigned.<br>
* Please note, that the local part of the jcrName is checked for XML
* compatibility by calling {@link ISO9075#encode(String)}
*
* @param jcrName name of the jcr property
* @param session session
* @return a <code>DavPropertyName</code> for the given jcr name.
* @throws RepositoryException if an error during repository access occurs.
*/
private DavPropertyName getDavName(String jcrName, Session session) throws RepositoryException {
// make sure the local name is xml compliant
String localName = ISO9075.encode(Text.getLocalName(jcrName));
String prefix = Text.getNamespacePrefix(jcrName);
String uri = session.getNamespaceURI(prefix);
Namespace namespace = Namespace.getNamespace(prefix, uri);
DavPropertyName name = DavPropertyName.create(localName, namespace);
return name;
}
Aggregations