/** * Creates a new <code>DavPropertyName</code> with the given local name * and the default WebDAV {@link DavConstants#NAMESPACE namespace}. * * @param name The local name of the new property name * * @return The WebDAV property name */ public synchronized static DavPropertyName create(String name) { return create(name, NAMESPACE); }
/** * Wrap the specified <code>DavProperty</code> in a new <code>SearchResultProperty</code>. * * @param property * @param valueFactory factory used to deserialize the xml value to a JCR value. * @throws RepositoryException if an error occurs while build the property value * @throws IllegalArgumentException if the specified property does have the * required form. * @see #getValues() */ public SearchResultProperty(DavProperty<?> property, ValueFactory valueFactory) throws RepositoryException { super(property.getName(), true); if (!SEARCH_RESULT_PROPERTY.equals(getName())) { throw new IllegalArgumentException("SearchResultProperty may only be created from a property named " + SEARCH_RESULT_PROPERTY.toString()); } List<String> colList = new ArrayList<String>(); List<String> selList = new ArrayList<String>(); List<Value> valList = new ArrayList<Value>(); QueryUtil.parseResultPropertyValue(property.getValue(), colList, selList, valList, valueFactory); columnNames = colList.toArray(new String[colList.size()]); selectorNames = selList.toArray(new String[selList.size()]); values = valList.toArray(new Value[valList.size()]); }
private QName propNameToQName(DavPropertyName name) { if (name == null) { final String msg = "name cannot be null"; throw new IllegalArgumentException(msg); } Namespace ns = name.getNamespace(); String uri = ns != null ? ns.getURI() : ""; return entityFactory.createQName(uri, name.getName()); }
private boolean matchProperty(WebDavProperty prop, String match) { if (prop == null) { return false; } if (LOG.isDebugEnabled()) { LOG.debug("Matching " + prop.getName().toString() + " against " + match); } Object value = prop.getValue(); if (value instanceof Element) { return matchText((Element) value, match); } return matchText(value.toString(), match); }
while (iter.hasNext()) { final DavProperty property = iter.next(); attributes.put(property.getName().toString(), property.getValue()); while (iter2.hasNext()) { DavProperty property = iter2.next(); if (!attributes.containsKey(property.getName().getName())) { property = getProperty(fileName, property.getName()); if (property != null) {
protected Element principalXml(Document document) { Element root = DomUtil.createElement(document, "property", NAMESPACE); root.appendChild(property.toXml(document)); return root; } }
/** */ protected void removeLiveProperty(DavPropertyName name, boolean create) throws CosmoDavException { super.removeLiveProperty(name); ContentItem content = (ContentItem) getItem(); if (content == null) { return; } if (name.equals(DavPropertyName.GETCONTENTLENGTH) || name.equals(DavPropertyName.GETCONTENTTYPE)) { throw new ProtectedPropertyModificationException(name); } }
/** * Wrap the specified <code>DavProperty</code> in a new <code>ValuesProperty</code>. * * @param property * @param defaultType default type of the values to be deserialized. If however * the {@link #XML_VALUE 'value'} elements provide a {@link #ATTR_VALUE_TYPE 'type'} * attribute, the default value is ignored. * @param valueFactory Factory used to retrieve JCR values from the value * of the given <code>DavProperty</code>. */ public ValuesProperty(DavProperty<?> property, int defaultType, ValueFactory valueFactory) throws RepositoryException, DavException { super(property.getName(), false); if (!(JCR_VALUES.equals(property.getName()) || JCR_VALUE.equals(getName()))) { throw new DavException(DavServletResponse.SC_BAD_REQUEST, "ValuesProperty may only be created with a property that has name="+JCR_VALUES.getName()); } jcrValues = ValueUtil.valuesFromXml(property.getValue(), defaultType, valueFactory); }
/** * <p> * Returns an instance of <code>StandardDavProperty</code> representing * the given element. The element itself is provided as the property value. * If either the element or its parent element has the attribute * <code>xml:lang</code>, that attribute's value is provided as the * property's language. The resulting property is not "protected" (i.e. * it will not appear in "allprop" <code>PROPFIND</code> responses). * </p> */ public static StandardDavProperty createFromXml(Element e) { DavPropertyName name = DavPropertyName.createFromXml(e); String lang = DomUtil.getAttribute(e, XML_LANG, NAMESPACE_XML); if (lang == null && e.getParentNode() != null && e.getParentNode().getNodeType() == Node.ELEMENT_NODE) { lang = DomUtil.getAttribute((Element)e.getParentNode(), XML_LANG, NAMESPACE_XML); } return new StandardDavProperty(name, e, lang); }
/** * Seeks for the next valid property */ private void seek() { while (iterator.hasNext()) { next = iterator.next(); if (namespace == null || namespace.equals(next.getName().getNamespace())) { return; } } next = null; } }
private PrincipalSearchProperty(DavPropertyName propName, String description, String language) { if (propName == null) { throw new IllegalArgumentException("null is not a valid DavPropertyName for the DAV:principal-search-property."); } this.propName = propName; this.description = description; this.language = language; hashCode = propName.hashCode(); }
private boolean matchProperty(WebDavProperty prop, String match) { if (prop == null) { return false; } if (LOG.isDebugEnabled()) { LOG.debug("Matching " + prop.getName().toString() + " against " + match); } Object value = prop.getValue(); if (value instanceof Element) { return matchText((Element) value, match); } return matchText(value.toString(), match); }
while (iter.hasNext()) { final DavProperty property = iter.next(); attributes.put(property.getName().toString(), property.getValue()); while (iter2.hasNext()) { DavProperty property = iter2.next(); if (!attributes.containsKey(property.getName().getName())) { property = getProperty(fileName, property.getName()); if (property != null) {
protected Element principalXml(Document document) { Element root = DomUtil.createElement(document, "property", NAMESPACE); root.appendChild(property.toXml(document)); return root; } }
/** */ protected void removeLiveProperty(DavPropertyName name, boolean create) throws CosmoDavException { super.removeLiveProperty(name); ContentItem content = (ContentItem) getItem(); if (content == null) { return; } if (name.equals(DavPropertyName.GETCONTENTLENGTH) || name.equals(DavPropertyName.GETCONTENTTYPE)) { throw new ProtectedPropertyModificationException(name); } }
/** * <p> * Returns an instance of <code>StandardDavProperty</code> representing * the given element. The element itself is provided as the property value. * If either the element or its parent element has the attribute * <code>xml:lang</code>, that attribute's value is provided as the * property's language. The resulting property is not "protected" (i.e. * it will not appear in "allprop" <code>PROPFIND</code> responses). * </p> */ public static StandardDavProperty createFromXml(Element e) { DavPropertyName name = DavPropertyName.createFromXml(e); String lang = DomUtil.getAttribute(e, XML_LANG, NAMESPACE_XML); if (lang == null && e.getParentNode() != null && e.getParentNode().getNodeType() == Node.ELEMENT_NODE) { lang = DomUtil.getAttribute((Element)e.getParentNode(), XML_LANG, NAMESPACE_XML); } return new StandardDavProperty(name, e, lang); }
/** * Seeks for the next valid property */ private void seek() { while (iterator.hasNext()) { next = iterator.next(); if (namespace == null || namespace.equals(next.getName().getNamespace())) { return; } } next = null; } }
private PrincipalSearchProperty(DavPropertyName propName, String description, String language) { if (propName == null) { throw new IllegalArgumentException("null is not a valid DavPropertyName for the DAV:principal-search-property."); } this.propName = propName; this.description = description; this.language = language; hashCode = propName.hashCode(); }
private QName propNameToQName(DavPropertyName name) { if (name == null) { final String msg = "name cannot be null"; throw new IllegalArgumentException(msg); } Namespace ns = name.getNamespace(); String uri = ns != null ? ns.getURI() : ""; return entityFactory.createQName(uri, name.getName()); }
/** * Creates a new <code>DavPropertyName</code> with the given local name * and the default WebDAV {@link DavConstants#NAMESPACE namespace}. * * @param name The local name of the new property name * * @return The WebDAV property name */ public synchronized static DavPropertyName create(String name) { return create(name, NAMESPACE); }