View Javadoc

1   /*
2    * Copyright (c) 2006-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.danube.webdav.xml.dav.request.properties;
14  
15  import org.abstracthorizon.danube.webdav.ResourceAdapter;
16  import org.abstracthorizon.danube.webdav.xml.XMLParserHandler;
17  import org.abstracthorizon.danube.webdav.xml.dav.response.properties.ResponseProperty;
18  
19  import org.xml.sax.SAXException;
20  
21  /**
22   * This class models WebDAV's request property creationdate
23   *
24   * @author Daniel Sendula
25   */
26  public class CreationDate extends RequestProperty {
27  
28      /** Requested date string */
29      protected String dateString;
30  
31      /**
32       * Cosntructor
33       * @param parent parent parser handler
34       */
35      public CreationDate(XMLParserHandler parent) {
36          super(parent);
37      }
38  
39      @Override
40      public Object end(Object current, String tag, String value) throws SAXException {
41          dateString = value;
42          return super.end(current, tag, value);
43      }
44  
45      /**
46       * Returns date string
47       * @return date string
48       */
49      public String asString() {
50          return dateString;
51      }
52  
53      /**
54       * Returns {@link org.abstracthorizon.danube.webdav.xml.dav.response.properties.CreationDate}
55       * @param adapater adapter
56       * @param resource resource
57       * @return {@link org.abstracthorizon.danube.webdav.xml.dav.response.properties.CreationDate}
58       */
59      public ResponseProperty processResponse(ResourceAdapter adapter, Object resource) {
60          return new org.abstracthorizon.danube.webdav.xml.dav.response.properties.CreationDate(adapter.resourceCreated(resource));
61      }
62  
63      @Override
64      public String toString() {
65          return "CreationDate[" + dateString + "]";
66      }
67  }