1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  package org.abstracthorizon.danube.webdav.xml.dav.request;
14  
15  import org.abstracthorizon.danube.webdav.xml.XMLParserHandler;
16  import org.abstracthorizon.danube.webdav.xml.dav.HRef;
17  
18  import org.xml.sax.Attributes;
19  import org.xml.sax.SAXException;
20  
21  
22  
23  
24  
25  
26  public class Owner extends AbstractSimpleXMLHandler {
27  
28      
29      protected Object owner;
30  
31      
32  
33  
34  
35      public Owner(XMLParserHandler parent) {
36          super(parent);
37      }
38  
39      @Override
40      public Object start(Object current, String tag, Attributes attributes) throws SAXException {
41          if ("href".equals(tag)) {
42              owner = new HRef(this);
43              return owner;
44          } else {
45              return super.start(current, tag, attributes);
46          }
47      }
48  
49      @Override
50      public Object end(Object current, String tag, String value) throws SAXException {
51          if (this.owner == null) {
52              this.owner = value;
53          }
54          return super.end(current, tag, value);
55      }
56  
57      
58  
59  
60  
61      public Object getOwner() {
62          return owner;
63      }
64  
65      @Override
66      public String toString() {
67          if (owner != null) {
68              return "Owner[" + owner + "]";
69          } else {
70              return "Owner[]";
71          }
72      }
73  
74  }