private NodeId getParentId(String baseUri, DavPropertySet propSet, SessionInfo sessionInfo) throws RepositoryException { NodeId parentId = null; DavProperty<?> p = propSet.get(JcrRemotingConstants.JCR_PARENT_LN, ItemResourceConstants.NAMESPACE); if (p != null) { HrefProperty parentProp = new HrefProperty(p); String parentHref = parentProp.getHrefs().get(0); if (parentHref != null && parentHref.length() > 0) { parentId = uriResolver.getNodeId(resolve(baseUri, parentHref), sessionInfo); } } return parentId; }
/** * Returns an Xml element with the following form: * <pre> * <Z:name> * <DAV:href>value</DAV:href/> * </Z:name> * </pre> * where Z: represents the prefix of the namespace defined with the initial * webdav property name. * * @return Xml representation * @see org.apache.jackrabbit.webdav.xml.DomUtil#hrefToXml(String,org.w3c.dom.Document) * @param document */ @Override public Element toXml(Document document) { Element elem = getName().toXml(document); String[] value = getValue(); if (value != null) { for (String href : value) { elem.appendChild(DomUtil.hrefToXml(href, document)); } } return elem; }
/** * Create a new <code>ExpandProperty</code>. * * @param hrefProperty * @param elementIter */ private ExpandProperty(DeltaVResource deltaVResource, HrefProperty hrefProperty, ElementIterator elementIter) { super(hrefProperty.getName(), hrefProperty.isInvisibleInAllprop()); try { DavResource[] refResource = deltaVResource.getReferenceResources(hrefProperty.getName()); for (DavResource res : refResource) { MultiStatusResponse resp = getResponse(res, elementIter); valueList.add(resp); } } catch (DavException e) { // invalid references or unknown property log.error(e.getMessage()); } }
/** * Create a new <code>ExpandProperty</code>. * * @param hrefProperty * @param elementIter */ private ExpandProperty(DeltaVResource deltaVResource, HrefProperty hrefProperty, ElementIterator elementIter) { super(hrefProperty.getName(), hrefProperty.isProtected()); try { DavResource[] refResource = deltaVResource.getReferenceResources(hrefProperty.getName()); for (int i = 0; i < refResource.length; i++) { MultiStatusResponse resp = getResponse(refResource[i], elementIter); valueList.add(resp); } } catch (DavException e) { // invalid references or unknown property log.error(e.getMessage()); } }
/** * Creates a new HrefProperty with the specified name using the given * array of items as value. * * @param name * @param values * @param isProtected * @return */ protected HrefProperty getHrefProperty(DavPropertyName name, Item[] values, boolean isProtected) { String[] pHref = new String[values.length]; for (int i = 0; i < values.length; i++) { pHref[i] = getLocatorFromItem(values[i]).getHref(true); } return new HrefProperty(name, pHref, isProtected); }
/** * Return an array of <code>DavResource</code> objects that are referenced * by the property with the specified name. * * @param hrefPropertyName * @return array of <code>DavResource</code>s * @throws DavException * @see DeltaVResource#getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName) */ @Override public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException { DavProperty<?> prop = getProperty(hrefPropertyName); if (prop == null || !(prop instanceof HrefProperty)) { throw new DavException(DavServletResponse.SC_CONFLICT, "Unknown Href-Property '" + hrefPropertyName + "' on resource " + getResourcePath()); } List<String> hrefs = ((HrefProperty)prop).getHrefs(); DavResource[] refResources = new DavResource[hrefs.size()]; Iterator<String> hrefIter = hrefs.iterator(); int i = 0; while (hrefIter.hasNext()) { refResources[i] = getResourceFromHref(hrefIter.next()); i++; } return refResources; }
log.warn("DAV: href element expected in the content of " + getName().toString());
/** * Returns a {@link org.apache.jackrabbit.webdav.property.HrefProperty} with the * specified property name and values. Each node present in the specified * array is referenced in the resulting property. * * @param name * @param values * @param isProtected * @return HrefProperty */ protected HrefProperty getHrefProperty(DavPropertyName name, Node[] values, boolean isProtected, boolean isCollection) { if (values == null) { return null; } String[] pHref = new String[values.length]; for (int i = 0; i < values.length; i++) { pHref[i] = getLocatorFromNode(values[i]).getHref(isCollection); } return new HrefProperty(name, pHref, isProtected); }
/** * Return an array of <code>DavResource</code> objects that are referenced * by the property with the specified name. * * @param hrefPropertyName * @return array of <code>DavResource</code>s * @throws DavException * @see DeltaVResource#getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName) */ public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException { DavProperty<?> prop = getProperty(hrefPropertyName); List<DavResource> resources = new ArrayList<DavResource>(); if (prop != null && prop instanceof HrefProperty) { HrefProperty hp = (HrefProperty)prop; // process list of hrefs for (String href : hp.getHrefs()) { DavResourceLocator locator = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), href); resources.add(createResourceFromLocator(locator)); } } else { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR); } return resources.toArray(new DavResource[resources.size()]); }
log.warn("DAV: href element expected in the content of " + getName().toString());
private NodeId getParentId(String baseUri, DavPropertySet propSet, SessionInfo sessionInfo) throws RepositoryException { NodeId parentId = null; DavProperty<?> p = propSet.get(JcrRemotingConstants.JCR_PARENT_LN, ItemResourceConstants.NAMESPACE); if (p != null) { HrefProperty parentProp = new HrefProperty(p); String parentHref = parentProp.getHrefs().get(0); if (parentHref != null && parentHref.length() > 0) { parentId = uriResolver.getNodeId(resolve(baseUri, parentHref), sessionInfo); } } return parentId; }
mergeFailedHref[i] = getItemUri(mergeFailedIds[i], sessionInfo); changeList.add(new HrefProperty(VersionControlledResource.AUTO_MERGE_SET, mergeFailedHref, false)); pdcHrefs[i] = getItemUri(predecessorIds[i], sessionInfo); changeList.add(new HrefProperty(VersionControlledResource.PREDECESSOR_SET, pdcHrefs, false));
/** * Returns an Xml element with the following form: * <pre> * <Z:name> * <DAV:href>value</DAV:href/> * </Z:name> * </pre> * where Z: represents the prefix of the namespace defined with the initial * webdav property name. * * @return Xml representation * @see org.apache.jackrabbit.webdav.xml.DomUtil#hrefToXml(String,org.w3c.dom.Document) * @param document */ @Override public Element toXml(Document document) { Element elem = getName().toXml(document); String[] value = getValue(); if (value != null) { for (String href : value) { elem.appendChild(DomUtil.hrefToXml(href, document)); } } return elem; }
/** * Create a new <code>ExpandProperty</code>. * * @param hrefProperty * @param elementIter */ private ExpandProperty(DeltaVResource deltaVResource, HrefProperty hrefProperty, ElementIterator elementIter) { super(hrefProperty.getName(), hrefProperty.isInvisibleInAllprop()); try { DavResource[] refResource = deltaVResource.getReferenceResources(hrefProperty.getName()); for (DavResource res : refResource) { MultiStatusResponse resp = getResponse(res, elementIter); valueList.add(resp); } } catch (DavException e) { // invalid references or unknown property log.error(e.getMessage()); } }
log.warn("DAV: href element expected in the content of " + getName().toString());
String latestVersionHref = ""; // not found (TODO: check if this valid according to the RFC) try { List<String> versionHrefs = new HrefProperty(activity.getProperty(ActivityResource.ACTIVITY_VERSION_SET)).getHrefs(); } else { List<String> predecessors = new HrefProperty(vr.getProperty(VersionResource.PREDECESSOR_SET)).getHrefs(); if (predecessors.contains(latestVersionHref)) {
mergeFailedHref[i] = getItemUri(mergeFailedIds[i], sessionInfo); changeList.add(new HrefProperty(VersionControlledResource.AUTO_MERGE_SET, mergeFailedHref, false)); pdcHrefs[i] = getItemUri(predecessorIds[i], sessionInfo); changeList.add(new HrefProperty(VersionControlledResource.PREDECESSOR_SET, pdcHrefs, false));
/** * Returns an Xml element with the following form: * <pre> * <Z:name> * <DAV:href>value</DAV:href/> * </Z:name> * </pre> * where Z: represents the prefix of the namespace defined with the initial * webdav property name. * * @return Xml representation * @see org.apache.jackrabbit.webdav.xml.DomUtil#hrefToXml(String,org.w3c.dom.Document) * @param document */ public Element toXml(Document document) { Element elem = getName().toXml(document); Object value = getValue(); if (value != null) { if (value instanceof String[]) { String[] hrefs = (String[]) value; for (int i = 0; i < hrefs.length; i++) { elem.appendChild(DomUtil.hrefToXml(hrefs[i], document)); } } else { elem.appendChild(DomUtil.hrefToXml(value.toString(), document)); } } return elem; }
String latestVersionHref = ""; // not found (TODO: check if this valid according to the RFC) try { List<String> versionHrefs = new HrefProperty(activity.getProperty(ActivityResource.ACTIVITY_VERSION_SET)).getHrefs(); } else { List<String> predecessors = new HrefProperty(vr.getProperty(VersionResource.PREDECESSOR_SET)).getHrefs(); if (predecessors.contains(latestVersionHref)) {
properties.add(new HrefProperty(VERSION_HISTORY, vhHref, true)); properties.add(new HrefProperty(CHECKED_OUT, baseVHref, true)); } else { properties.add(new HrefProperty(CHECKED_IN, baseVHref, true));