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.DAVAbstractXMLParser;
17  import org.abstracthorizon.danube.webdav.xml.dav.DAVFactory;
18  
19  import org.xml.sax.Attributes;
20  import org.xml.sax.SAXException;
21  
22  
23  
24  
25  
26  
27  public class PropertyBehavior extends DAVAbstractXMLParser {
28  
29      
30      protected boolean omit;
31  
32      
33      protected KeepAlive keepAlive;
34  
35      
36  
37  
38  
39  
40      public PropertyBehavior(XMLParserHandler parent, DAVFactory factory) {
41          super(parent, factory);
42      }
43  
44      @Override
45      public Object start(Object current, String tag, Attributes attributes) throws SAXException {
46          if ("omit".equals(tag)) {
47              omit = true;
48              return this;
49          } else if ("keepalive".equals(tag)) {
50              keepAlive = davFactory.newKeepAlive(this);
51              return keepAlive;
52          }
53          return super.start(current, tag, attributes);
54      }
55  
56      @Override
57      public Object end(Object current, String tag, String value) throws SAXException {
58          return this;
59      }
60  
61      @Override
62      public String toString() {
63          if (keepAlive != null) {
64              return "PropertyBehavior[" + keepAlive + "]";
65          } else {
66              return "PropertyBehavior[omit]";
67          }
68      }
69  }