Package org.w3c.www.webdav.xml

Examples of org.w3c.www.webdav.xml.DAVProperties


           "Missing namespace");
  }
  Document doc = (Document)getDeadPropertiesIndex().get(ns);
  if (doc != null) {
      Element       prop    = doc.getDocumentElement();
      DAVProperties dp      = DAVFactory.createProperties(prop);
      Element       props[] = dp.getProperties();
      int           len     = props.length;
      for (int i = 0 ; i < len ; i++) {
    Element p = props[i];
    if (p.getNamespaceURI().equals(ns) &&
        p.getLocalName().equals(el.getLocalName())) {
View Full Code Here


     */   
    protected DAVProperties getProperties(DAVRequest request,
               Document doc,
               DAVProperties dp)
    {
  DAVProperties props = DAVFactory.createProperties(doc);
  Element[]     els   = dp.getProperties();
  int           len   = els.length;
  for (int i = 0 ; i < len ; i++) {
      Element el       = els[i];
      String  ns       = el.getNamespaceURI();
      String  propname = el.getLocalName();
      if ((ns == null) || (ns.equals(WEBDAV.NAMESPACE_URI))) {
    // live property
    if (propname.equals(DAVNode.CREATIONDATE_NODE)) {
        addCreationDate(props);
    } else if (propname.equals(DAVNode.DISPLAYNAME_NODE)) {
        addDisplayName(props);
    } else if (propname.equals(DAVNode.GETCONTENTLANGUAGE_NODE)) {
        addContentLanguage(props);
    } else if (propname.equals(DAVNode.GETCONTENTTYPE_NODE)) {
        addContentType(props);
    } else if (propname.equals(DAVNode.GETCONTENTLENGTH_NODE)) {
        addContentLength(props);
    } else if (propname.equals(DAVNode.GETETAG_NODE)) {
        addETag(props);
    } else if (propname.equals(DAVNode.GETLASTMODIFIED_NODE)) {
        addLastModified(props);
    } else if (propname.equals(DAVNode.LOCKDISCOVERY_NODE)) {
        addLockDiscovery(request, props);
    } else if (propname.equals(DAVNode.RESOURCETYPE_NODE)) {
        addResourceType(props);
    } else if (propname.equals(DAVNode.SOURCE_NODE)) {
        // FIXME
    } else if (propname.equals(DAVNode.SUPPORTEDLOCK_NODE)) {
        addSupportedLock(props);
    } else { // property not found
        // FIXME add with 404 reply
    }
      } else {
    // dead property
    Document pdoc = (Document)getDeadPropertiesIndex().get(ns);
    if (pdoc != null) {
        Element       prop  = pdoc.getDocumentElement();
        DAVProperties dpns  = DAVFactory.createProperties(prop);
        Node          pnode = dpns.getNodeNS(propname, ns);
        if (pnode != null) {
      props.addNodeNS(doc.importNode(pnode, true));
        }
    }
      }
View Full Code Here

    protected DAVPropStat[] getPropStat(DAVRequest request,
          Document doc,
          DAVProperties dp)
    {
  DAVProperties props = DAVFactory.createProperties(doc);
  DAVProperties nfprops = null;
  Element[]     els   = dp.getProperties();
  int           len   = els.length;
  for (int i = 0 ; i < len ; i++) {
      Element el       = els[i];
      String  ns       = el.getNamespaceURI();
      String  propname = el.getLocalName();
      if ((ns == null) || (ns.equals(WEBDAV.NAMESPACE_URI))) {
    // live property
    if (propname.equals(DAVNode.CREATIONDATE_NODE)) {
        addCreationDate(props);
    } else if (propname.equals(DAVNode.DISPLAYNAME_NODE)) {
        addDisplayName(props);
    } else if (propname.equals(DAVNode.GETCONTENTLANGUAGE_NODE)) {
        addContentLanguage(props);
    } else if (propname.equals(DAVNode.GETCONTENTTYPE_NODE)) {
        addContentType(props);
    } else if (propname.equals(DAVNode.GETCONTENTLENGTH_NODE)) {
        addContentLength(props);
    } else if (propname.equals(DAVNode.GETETAG_NODE)) {
        addETag(props);
    } else if (propname.equals(DAVNode.GETLASTMODIFIED_NODE)) {
        addLastModified(props);
    } else if (propname.equals(DAVNode.LOCKDISCOVERY_NODE)) {
        addLockDiscovery(request, props);
    } else if (propname.equals(DAVNode.RESOURCETYPE_NODE)) {
        addResourceType(props);
    } else if (propname.equals(DAVNode.SOURCE_NODE)) {
        // FIXME
    } else if (propname.equals(DAVNode.SUPPORTEDLOCK_NODE)) {
        addSupportedLock(props);
    } else { // property not found
        if (nfprops == null) {
      nfprops = DAVFactory.createProperties(doc);
        }
        Element e;
        e = doc.createElementNS("http://www.w3.org/Jigsaw/Webdav/",
              propname);
        e.setPrefix("F");
        nfprops.addNodeNS(nfprops.getNode(), (Node) e);
    }
      } else {
    // dead property
    Document pdoc = (Document)getDeadPropertiesIndex().get(ns);
    if (pdoc != null) {
        Element       prop  = pdoc.getDocumentElement();
        DAVProperties dpns  = DAVFactory.createProperties(prop);
        Node          pnode = dpns.getNodeNS(propname, ns);
        if (pnode != null) {
      props.addNodeNS(doc.importNode(pnode, true));
        }
    }
      }
View Full Code Here

     * Get all the properties of our associated resource.
     * @param doc the response XML Document
     * @return a DAVProperties instance
     */   
    protected DAVProperties getProperties(DAVRequest request, Document doc) {
  DAVProperties props = DAVFactory.createProperties(doc);
  // creationdate
  addCreationDate(props);
  // displayname
  addDisplayName(props);
  // getcontentlanguage
  addContentLanguage(props);
  // getcontentlength
  addContentLength(props);
  // getetag
  addETag(props);
  // getlastmodified
  addLastModified(props);
  // getcontenttype
        if (isCollection()) {
      addCollectionContentType(props);
  } else {
      addContentType(props);
  }
  // lockdiscovery
  addLockDiscovery(request, props);
  // resourcetype
  addResourceType(props);
  // supportedlock
  addSupportedLock(props);
  // non std stuff
  addIsCollection(props);
  // Dead properties
  Hashtable   dp   = getDeadPropertiesIndex();
  Enumeration e    = dp.keys();
  while (e.hasMoreElements()) {
      String   ns = (String)e.nextElement();
      Document d  = (Document)dp.get(ns);
      Element  el = d.getDocumentElement(); // prop
      try {
    DAVNode.exportChildren(doc, props.getNode(), el, true);
      } catch (DOMException ex) {
    ex.printStackTrace();
      }
  }
  return props;
View Full Code Here

  }
  return props;
    }

    protected DAVProperties getPropertiesForCopy(Document doc) {
  DAVProperties props = DAVFactory.createProperties(doc);
  // displayname
  addDisplayName(props);
  // getcontentlanguage
  addContentLanguage(props);
  // getcontenttype
  addContentType(props);
  // source

  // Dead properties
  Hashtable   dp   = getDeadPropertiesIndex();
  Enumeration e    = dp.keys();
  while (e.hasMoreElements()) {
      String   ns = (String)e.nextElement();
      Document d  = (Document)dp.get(ns);
      Element  el = d.getDocumentElement(); // prop
      try {
    DAVNode.exportChildren(doc, props.getNode(), el, true);
      } catch (DOMException ex) {
    ex.printStackTrace();
      }
  }
  return props;
View Full Code Here

     * Get all the property names of our associated resource.
     * @param doc the response XML Document
     * @return a DAVProperties instance
     */   
    protected DAVProperties getPropNames(DAVRequest request, Document doc) {
  DAVProperties props = DAVFactory.createProperties(doc);
  // dead property
  Hashtable   dp   = getDeadPropertiesIndex();
  Enumeration e    = dp.keys();
  while (e.hasMoreElements()) {
      String   ns = (String)e.nextElement();
      Document d  = (Document)dp.get(ns);
      Element  el = d.getDocumentElement(); // prop
      try {
    DAVNode.exportChildren(doc, props.getNode(), el, false);
      } catch (DOMException ex) {
    ex.printStackTrace();
      }
  }
  // live properties
  if (hasStringProperty(ATTR_TITLE)) {
      props.addProperty(DAVNode.DISPLAYNAME_NODE);
  }
  if (hasStringProperty(ATTR_CONTENT_LANGUAGE)) {
      props.addProperty(DAVNode.GETCONTENTLANGUAGE_NODE);
  }
  if (getETag() != null) {
      props.addProperty(DAVNode.GETETAG_NODE);
  }
  if (hasProperty(ATTR_CONTENT_TYPE)) {
      props.addProperty(DAVNode.GETCONTENTTYPE_NODE);
  }
  if (hasIntProperty(ATTR_CONTENT_LENGTH)) {
      props.addProperty(DAVNode.GETCONTENTLENGTH_NODE);
  }
  if (hasLongProperty(ATTR_CREATION_DATE)) {
      props.addProperty(DAVNode.CREATIONDATE_NODE);
  }
  if (getCurrentLockToken(request) != null) {
      props.addProperty(DAVNode.LOCKDISCOVERY_NODE);
  }
  props.addProperty(DAVNode.GETLASTMODIFIED_NODE);
  props.addProperty(DAVNode.RESOURCETYPE_NODE);
  props.addProperty(DAVNode.SUPPORTEDLOCK_NODE);
  return props;
    }
View Full Code Here

  if (fresource != null) {
      fresource.checkContent();
  }
  updateCachedHeaders();

  DAVProperties props = null;
  if (dpf != null) {
      if (dpf.findPropNames()) {
    props = getPropNames(request, document);
      } else if(dpf.findAllProps()) {
    props = getProperties(request, document);
      } else {
    DAVProperties dp = dpf.getProperties();
//    props = getProperties(request, document, dp);
    DAVPropStat[] dps = getPropStat(request, document, dp);
    DAVResponse dr = DAVFactory.createResponse(
//        getURL(request).toExternalForm(),
        getURL(request).getFile(),
View Full Code Here

             Document document)
  throws DAVPropertyException
    {
  Element properties[] = props.getProperties();
  int           len    = properties.length;
  DAVProperties okdp   = DAVFactory.createProperties(document);
  try {
      for (int i = 0 ; i < len ; i++) {
    Element el = properties[i];
    String  ns = el.getNamespaceURI();
    if ((ns == null) || (ns.equals(WEBDAV.NAMESPACE_URI))) {
        // live property
        setLiveProperty(DAVFactory.createDAVNode(el),
            okdp,
            document);
    } else {
        // dead property
        setDeadProperty(DAVFactory.createDAVNode(el),
            okdp,
            document);
    }
      }
  } catch (DAVPropertyException ex) {
      // something failed
      DAVPropStat dps     = (DAVPropStat) ex.getReason();
      String      msg     = ex.getMessage();
      DAVPropStat stats[] = null;
      if (okdp.getNode().hasChildNodes()) {
    DAVPropStat okdps =
        DAVFactory.createPropStat(getStatusLine(HTTP.OK),
                okdp,
                document);
    stats = new DAVPropStat[2];
    stats[0] = okdps;
    stats[1] = dps;
      } else {
    stats = new DAVPropStat[1];
    stats[0] = dps;
      }
      // send ok properties and the one that failed
      throw new DAVPropertyException(msg, stats);
  }
  // everything is ok
  if (okdp.getNode().hasChildNodes()) {
      return DAVFactory.createPropStat(getStatusLine(HTTP.OK),
               okdp,
               document);
  }
  return null;
View Full Code Here

                Document document)
  throws DAVPropertyException
    {
  Element properties[] = props.getProperties();
  int           len    = properties.length;
  DAVProperties okdp   = DAVFactory.createProperties(document);
  try {
      for (int i = 0 ; i < len ; i++) {
    Element el = properties[i];
    String  ns = el.getNamespaceURI();
    if ((ns == null) || (ns.equals(WEBDAV.NAMESPACE_URI))) {
        // live property
        removeLiveProperty(DAVFactory.createDAVNode(el),
               okdp,
               document);
    } else {
        // dead property
        removeDeadProperty(DAVFactory.createDAVNode(el),
               okdp,
               document);
    }
      }
  } catch (DAVPropertyException ex) {
      // something failed
      DAVPropStat dps     = (DAVPropStat) ex.getReason();
      String      msg     = ex.getMessage();
      DAVPropStat stats[] = null;
      if (okdp.getNode().hasChildNodes()) {
    DAVPropStat okdps =
        DAVFactory.createPropStat(getStatusLine(HTTP.OK),
                okdp,
                document);
    stats = new DAVPropStat[2];
    stats[0] = okdps;
    stats[1] = dps;
      } else {
    stats = new DAVPropStat[1];
    stats[0] = dps;
      }
      // send ok properties and the one that failed
      throw new DAVPropertyException(msg, stats);
  }
  // everything is ok
  if (okdp.getNode().hasChildNodes()) {
      return DAVFactory.createPropStat(getStatusLine(HTTP.OK),
               okdp,
               document);
  }
  return null;
View Full Code Here

TOP

Related Classes of org.w3c.www.webdav.xml.DAVProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.