1 13 14 package com.ibm.webdav; 15 16 import java.util.logging.*; 17 import java.util.logging.Logger ; 18 19 import org.w3c.dom.Element ; 20 21 import javax.xml.parsers.*; 22 import org.w3c.dom.*; 23 24 30 public class SchemaResponse extends Response { 31 private SearchSchema m_schema = null; 32 33 36 private static final Logger m_logger = Logger 37 .getLogger(SchemaResponse.class.getName()); 38 39 public SchemaResponse(Document document, SearchSchema schema, 40 String resourceURL) throws ServerException { 41 super(document); 42 m_schema = schema; 43 this.setResource(resourceURL); 44 } 45 46 public boolean isOK() { 47 boolean isOk = true; 48 49 return isOk; 50 } 51 52 public Element asXML() { 53 Element response = document.createElementNS("DAV:", "D:response"); 54 55 Element href = document.createElementNS("DAV:", "D:href"); 56 57 href.appendChild(document.createTextNode(getResource())); 58 response.appendChild(href); 59 60 Element query_schema = document.createElementNS("DAV:", 61 "D:query-schema"); 62 63 query_schema.appendChild(document.importNode(m_schema.asXML(), true)); 64 65 response.appendChild(query_schema); 66 67 return response; 68 } 69 70 public PropertyResponse toPropertyResponse() { 71 PropertyResponse response = new PropertyResponse(this.getResource()); 72 response.setDescription(getDescription()); 73 try { 74 response.setDocument(DocumentBuilderFactory.newInstance() 75 .newDocumentBuilder().newDocument()); 76 } catch (Exception e) { 77 m_logger.log(Level.WARNING, e.getLocalizedMessage(), e); 78 } 79 return response; 80 } 81 } | Popular Tags |