public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getNamespace()); if (!getNamespace().endsWith(":")) { sb.append(":"); } sb.append(getName()); return sb.toString(); }
protected LivePropertySpecification findLiveProperty(DAVElement property) { String nameSpace = property.getNamespace(); if (!DAVElement.DAV_NAMESPACE.equals(nameSpace) && !DAVElement.SVN_DAV_PROPERTY_NAMESPACE.equals(nameSpace)) { return null; } LivePropertySpecification lps = (LivePropertySpecification) OUR_LIVE_PROPS.get(property); if (lps == null) { //search in core props lps = (LivePropertySpecification) OUR_CORE_LIVE_PROPS.get(property); } return lps; }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getNamespace()); if (!getNamespace().endsWith(":")) { sb.append(":"); } sb.append(getName()); return sb.toString(); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getNamespace()); if (!getNamespace().endsWith(":")) { sb.append(":"); } sb.append(getName()); return sb.toString(); }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getNamespace()); if (!getNamespace().endsWith(":")) { sb.append(":"); } sb.append(getName()); return sb.toString(); }
private boolean useStringProperty(DAVElement element, String propertyName) { String namespace = element == null ? null : element.getNamespace(); return SVNProperty.isSVNProperty(propertyName) || DAVElement.SVN_DAV_PROPERTY_NAMESPACE.equals(namespace) || DAVElement.SVN_SVN_PROPERTY_NAMESPACE.equals(namespace) || DAVElement.SVN_NAMESPACE.equals(namespace) || DAVElement.DAV_NAMESPACE.equals(namespace); }
private String getReposPropName(DAVElement propName) { if (DAVElement.SVN_SVN_PROPERTY_NAMESPACE.equals(propName.getNamespace())) { return SVNProperty.SVN_PREFIX + propName.getName(); } else if (DAVElement.SVN_CUSTOM_PROPERTY_NAMESPACE.equals(propName.getNamespace())) { return propName.getName(); } return null; }
private int outputPropName(DAVElement propName, Map namespacesToPrefixes, int ind, StringBuffer buffer) { if ("".equals(propName.getNamespace())) { SVNXMLUtil.openXMLTag(null, propName.getName(), SVNXMLUtil.XML_STYLE_SELF_CLOSING, null, buffer); } else { String prefix = namespacesToPrefixes != null ? (String) namespacesToPrefixes.get(propName.getNamespace()) : null; if (prefix == null) { prefix = "g" + ind; namespacesToPrefixes.put(propName.getNamespace(), prefix); } SVNXMLUtil.openXMLTag((String) namespacesToPrefixes.get(propName.getNamespace()), propName.getName(), SVNXMLUtil.XML_STYLE_SELF_CLOSING, null, buffer); } return ++ind; }
public static StringBuffer addEmptyElement(List namespaces, DAVElement element, StringBuffer target) { if (element.getNamespace() == null || "".equals(element.getNamespace())) { target.append("<"); target.append(element.getName()); target.append("/>"); target.append('\n'); return target; } int index = namespaces.indexOf(element.getNamespace()); target.append("<ns"); target.append(index); target.append(":"); target.append(element.getName()); target.append("/>"); return target; }
public static String getPropertyNameByElement(DAVElement element) { if (element == null) { return null; } String namespace = element.getNamespace(); String name = element.getName(); if (namespace.equals(DAVElement.SVN_CUSTOM_PROPERTY_NAMESPACE)) { // hack! if (name.startsWith("svk_")) { name = name.substring(0, "svk".length()) + ":" + name.substring("svk".length() + 1); } return name; } else if (namespace.equals(DAVElement.SVN_SVN_PROPERTY_NAMESPACE)) { return "svn:" + name; } else if (element == DAVElement.CHECKED_IN) { return SVNProperty.WC_URL;//"svn:wc:ra_dav:version-url"; } return null; }
public static StringBuffer generatePropertiesRequest(StringBuffer body, DAVElement[] properties) { body = body == null ? new StringBuffer() : body; body.append("<?xml version=\"1.0\" encoding=\"utf-8\"?><propfind xmlns=\"DAV:\">"); if (properties != null) { body.append("<prop>"); for (int i = 0; i < properties.length; i++) { body.append("<"); body.append(properties[i].getName()); body.append(" xmlns=\""); body.append(properties[i].getNamespace()); body.append("\"/>"); } body.append("</prop></propfind>"); } else { body.append("<allprop/></propfind>"); } return body; }
public static String getPropertyNameByElement(DAVElement element) { if (element == null) { return null; } String namespace = element.getNamespace(); String name = element.getName(); if (namespace.equals(DAVElement.SVN_CUSTOM_PROPERTY_NAMESPACE)) { // hack! if (name.startsWith("svk_")) { name = name.substring(0, "svk".length()) + ":" + name.substring("svk".length() + 1); } return name; } else if (namespace.equals(DAVElement.SVN_SVN_PROPERTY_NAMESPACE)) { return "svn:" + name; } else if (element == DAVElement.CHECKED_IN) { return SVNProperty.WC_URL;//"svn:wc:ra_dav:version-url"; } return null; }
protected void startElement(DAVElement parent, DAVElement element, Attributes attrs) throws SVNException { if (parent == DAVElement.PROP) { getPropertyName().setLength(0); if (DAVElement.SVN_DAV_PROPERTY_NAMESPACE.equals(element.getNamespace())) { getPropertyName().append(SVNProperty.SVN_PREFIX); } else if (DAVElement.DAV_NAMESPACE.equals(element.getNamespace())) { getPropertyName().append(DAVElement.DAV_NAMESPACE); } getPropertyName().append(element.getName()); } else if (element == DAVElement.PROPSTAT) { myPropstatContainsError = false; } }
protected void startElement(DAVElement parent, DAVElement element, Attributes attrs) throws SVNException { if (parent == DAVElement.PROP) { getPropertyName().setLength(0); if (DAVElement.SVN_DAV_PROPERTY_NAMESPACE.equals(element.getNamespace())) { getPropertyName().append(SVNProperty.SVN_PREFIX); } else if (DAVElement.DAV_NAMESPACE.equals(element.getNamespace())) { getPropertyName().append(DAVElement.DAV_NAMESPACE); } getPropertyName().append(element.getName()); } else if (element == DAVElement.PROPSTAT) { myPropstatContainsError = false; } }
protected void startElement(DAVElement parent, DAVElement element, Attributes attrs) throws SVNException { if (parent == DAVElement.PROP) { getPropertyName().setLength(0); if (DAVElement.SVN_DAV_PROPERTY_NAMESPACE.equals(element.getNamespace())) { getPropertyName().append(SVNProperty.SVN_PREFIX); } else if (DAVElement.DAV_NAMESPACE.equals(element.getNamespace())) { getPropertyName().append(DAVElement.DAV_NAMESPACE); } getPropertyName().append(element.getName()); } else if (element == DAVElement.PROPSTAT) { myPropstatContainsError = false; } }
private void generateSupportedElementSet(String prefix, String tagName, Collection supportedElements, Collection requestedElements, StringBuffer xmlBuffer) { for (Iterator iterator = supportedElements.iterator(); iterator.hasNext();) { Object item = iterator.next(); if (requestedElements.isEmpty() || requestedElements.contains(item)) { Map attrs = new SVNHashMap(); if (item instanceof DAVElement) { DAVElement currentElement = (DAVElement) item; attrs.put(NAME_ATTR, currentElement.getNamespace()); attrs.put(NAMESPACE_ATTR, currentElement.getName()); } else if (item instanceof String) { String currentName = (String) item; attrs.put(NAME_ATTR, currentName); } SVNXMLUtil.openXMLTag(prefix, tagName, SVNXMLUtil.XML_STYLE_SELF_CLOSING, attrs, xmlBuffer); } } } }
public static Map filterProperties(DAVProperties source, Map target) { target = target == null ? new HashMap() : target; for(Iterator props = source.getProperties().keySet().iterator(); props.hasNext();) { DAVElement property = (DAVElement) props.next(); String namespace = property.getNamespace(); if (namespace.equals(DAVElement.SVN_CUSTOM_PROPERTY_NAMESPACE)) { String name = property.getName(); // hack! if (name.startsWith("svk_")) { name = name.substring(0, "svk".length()) + ":" + name.substring("svk".length() + 1); } target.put(name, source.getPropertyValue(property)); } else if (namespace.equals(DAVElement.SVN_SVN_PROPERTY_NAMESPACE)) { target.put("svn:" + property.getName(), source.getPropertyValue(property)); } else if (property == DAVElement.CHECKED_IN) { target.put("svn:wc:ra_dav:version-url", source.getPropertyValue(property)); } } return target; } }
public static StringBuffer generatePropertiesRequest(StringBuffer xmlBuffer, DAVElement[] properties) { xmlBuffer = xmlBuffer == null ? new StringBuffer() : xmlBuffer; SVNXMLUtil.addXMLHeader(xmlBuffer); SVNXMLUtil.openNamespaceDeclarationTag(null, "propfind", DAV_NAMESPACES_LIST, null, xmlBuffer); if (properties != null) { xmlBuffer.append("<prop>"); for (int i = 0; i < properties.length; i++) { SVNXMLUtil.openXMLTag(null, properties[i].getName(), SVNXMLUtil.XML_STYLE_SELF_CLOSING, "xmlns", properties[i].getNamespace(), xmlBuffer); } SVNXMLUtil.closeXMLTag(null, "prop", xmlBuffer); } else { SVNXMLUtil.openXMLTag(null, "allprop", SVNXMLUtil.XML_STYLE_SELF_CLOSING, null, xmlBuffer); } SVNXMLUtil.addXMLFooter(null, "propfind", xmlBuffer); return xmlBuffer; }
public static StringBuffer generatePropertiesRequest(StringBuffer xmlBuffer, DAVElement[] properties) { xmlBuffer = xmlBuffer == null ? new StringBuffer() : xmlBuffer; SVNXMLUtil.addXMLHeader(xmlBuffer); SVNXMLUtil.openNamespaceDeclarationTag(null, "propfind", DAV_NAMESPACES_LIST, null, xmlBuffer); if (properties != null) { xmlBuffer.append("<prop>"); for (int i = 0; i < properties.length; i++) { SVNXMLUtil.openXMLTag(null, properties[i].getName(), SVNXMLUtil.XML_STYLE_SELF_CLOSING, "xmlns", properties[i].getNamespace(), xmlBuffer); } SVNXMLUtil.closeXMLTag(null, "prop", xmlBuffer); } else { SVNXMLUtil.openXMLTag(null, "allprop", SVNXMLUtil.XML_STYLE_SELF_CLOSING, null, xmlBuffer); } SVNXMLUtil.addXMLFooter(null, "propfind", xmlBuffer); return xmlBuffer; }
public static StringBuffer generatePropertiesRequest(StringBuffer xmlBuffer, DAVElement[] properties) { xmlBuffer = xmlBuffer == null ? new StringBuffer() : xmlBuffer; SVNXMLUtil.addXMLHeader(xmlBuffer); SVNXMLUtil.openNamespaceDeclarationTag(null, "propfind", DAV_NAMESPACES_LIST, null, xmlBuffer); if (properties != null) { xmlBuffer.append("<prop>"); for (int i = 0; i < properties.length; i++) { SVNXMLUtil.openXMLTag(null, properties[i].getName(), SVNXMLUtil.XML_STYLE_SELF_CLOSING, "xmlns", properties[i].getNamespace(), xmlBuffer); } SVNXMLUtil.closeXMLTag(null, "prop", xmlBuffer); } else { SVNXMLUtil.openXMLTag(null, "allprop", SVNXMLUtil.XML_STYLE_SELF_CLOSING, null, xmlBuffer); } SVNXMLUtil.addXMLFooter(null, "propfind", xmlBuffer); return xmlBuffer; }