private Name getName(String jcrName, Map<String,String> namespaces) { String prefix = Text.getNamespacePrefix(jcrName); String uri = (Name.NS_EMPTY_PREFIX.equals(prefix)) ? Name.NS_DEFAULT_URI : namespaces.get(prefix); return NAME_FACTORY.create(uri, Text.getLocalName(jcrName)); }
private Name getName(String jcrName, Map<String,String> namespaces) { String prefix = Text.getNamespacePrefix(jcrName); String uri = (Name.NS_EMPTY_PREFIX.equals(prefix)) ? Name.NS_DEFAULT_URI : namespaces.get(prefix); return NAME_FACTORY.create(uri, Text.getLocalName(jcrName)); }
/** * Write the name and updated the namespace declarations if needed. * * @param name name to write * @throws IOException if an I/O error occurs */ private void writeJcrName(String name) throws IOException { if (name == null) { return; } String prefix = Text.getNamespacePrefix(name); if (!prefix.equals(NamespaceRegistry.PREFIX_EMPTY)) { // update namespace declaration writeNamespaceDeclaration(prefix); prefix += ":"; } String localName = Text.getLocalName(name); String encLocalName = (ANY.equals(localName)) ? ANY : ISO9075.encode(Text.getLocalName(name)); String resolvedName = prefix + encLocalName; // check for '-' and '+' boolean quotesNeeded = (name.indexOf('-') >= 0 || name.indexOf('+') >= 0); if (quotesNeeded) { out.write("'"); out.write(resolvedName); out.write("'"); } else { out.write(resolvedName); } }
/** * Write the name and updated the namespace declarations if needed. * * @param name name to write * @throws IOException if an I/O error occurs */ private void writeJcrName(String name) throws IOException { if (name == null) { return; } String prefix = Text.getNamespacePrefix(name); if (!prefix.equals(NamespaceRegistry.PREFIX_EMPTY)) { // update namespace declaration writeNamespaceDeclaration(prefix); prefix += ":"; } String localName = Text.getLocalName(name); String encLocalName = (ANY.equals(localName)) ? ANY : ISO9075.encode(Text.getLocalName(name)); String resolvedName = prefix + encLocalName; // check for '-' and '+' boolean quotesNeeded = (name.indexOf('-') >= 0 || name.indexOf('+') >= 0); if (quotesNeeded) { out.write("'"); out.write(resolvedName); out.write("'"); } else { out.write(resolvedName); } }
/** * Write the name and updated the namespace declarations if needed. * * @param name name to write * @throws IOException if an I/O error occurs */ private void writeJcrName(String name) throws IOException { if (name == null) { return; } String prefix = Text.getNamespacePrefix(name); if (!prefix.equals(NamespaceRegistry.PREFIX_EMPTY)) { // update namespace declaration writeNamespaceDeclaration(prefix); prefix += ":"; } String localName = Text.getLocalName(name); String encLocalName = (ANY.equals(localName)) ? ANY : ISO9075.encode(Text.getLocalName(name)); String resolvedName = prefix + encLocalName; // check for '-' and '+' boolean quotesNeeded = (name.indexOf('-') >= 0 || name.indexOf('+') >= 0); if (quotesNeeded) { out.write("'"); out.write(resolvedName); out.write("'"); } else { out.write(resolvedName); } }
public CurrentUserPrivilegeSetProperty asDavProperty() throws RepositoryException { List<Privilege> davPrivs = new ArrayList<Privilege>(); for (javax.jcr.security.Privilege privilege : session.getAccessControlManager().getPrivileges(absPath)) { String privilegeName = privilege.getName(); String prefix = Text.getNamespacePrefix(privilegeName); Namespace ns = (prefix.isEmpty()) ? Namespace.EMPTY_NAMESPACE : Namespace.getNamespace(prefix, session.getNamespaceURI(prefix)); davPrivs.add(Privilege.getPrivilege(Text.getLocalName(privilegeName), ns)); } return new CurrentUserPrivilegeSetProperty(davPrivs.toArray(new Privilege[davPrivs.size()])); } }
private SupportedPrivilege createSupportedPrivilege(Privilege privilege) throws RepositoryException { String privilegeName = privilege.getName(); String localName = Text.getLocalName(privilegeName); String prefix = Text.getNamespacePrefix(privilegeName); Namespace ns = (prefix.isEmpty()) ? Namespace.EMPTY_NAMESPACE : Namespace.getNamespace(prefix, session.getNamespaceURI(prefix)); org.apache.jackrabbit.webdav.security.Privilege davPrivilege = org.apache.jackrabbit.webdav.security.Privilege.getPrivilege(localName, ns); SupportedPrivilege[] aggregates = (privilege.isAggregate()) ? getDeclaredAggregates(privilege) : null; SupportedPrivilege sp = new SupportedPrivilege(davPrivilege, null, null, privilege.isAbstract(), aggregates); if (!aggregated.contains(privilegeName)) { supportedPrivileges.put(privilegeName, sp); } return sp; }
String prefix = Text.getNamespacePrefix(priv.getName()); if (lookup.containsKey(prefix)) { Name n = NAME_FACTORY.create(lookup.get(prefix), Text.getLocalName(priv.getName())); if (PRIVILEGE_NAMES.containsKey(n)) { bits |= PRIVILEGE_NAMES.get(n);
String prefix = Text.getNamespacePrefix(priv.getName()); if (lookup.containsKey(prefix)) { Name n = NAME_FACTORY.create(lookup.get(prefix), Text.getLocalName(priv.getName())); if (PRIVILEGE_NAMES.containsKey(n)) { bits |= PRIVILEGE_NAMES.get(n);
/** * 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; }
/** * Returns the local name of the node denoted by the given score node * <code>sn</code>. * * @param sn the score node. * @param context the evaluation context. * @return the local node name. * @throws RepositoryException if an error occurs while reading the local * name. */ public Value[] getValues(ScoreNode sn, EvaluationContext context) throws RepositoryException { SessionImpl session = context.getSession(); try { String name = session.getNodeById(sn.getNodeId()).getName(); return new Value[]{session.getValueFactory().createValue( Text.getLocalName(name))}; } catch (ItemNotFoundException e) { // access denied to score node return new Value[0]; } } }
/** * Returns the local name of the node denoted by the given score node * <code>sn</code>. * * @param sn the score node. * @param context the evaluation context. * @return the local node name. * @throws RepositoryException if an error occurs while reading the local * name. */ public Value[] getValues(ScoreNode sn, EvaluationContext context) throws RepositoryException { SessionImpl session = context.getSession(); try { String name = session.getNodeById(sn.getNodeId()).getName(); return new Value[]{session.getValueFactory().createValue( Text.getLocalName(name))}; } catch (ItemNotFoundException e) { // access denied to score node return new Value[0]; } } }