01: /*
02: * (C) Copyright IBM Corp. 2000 All rights reserved.
03: *
04: * The program is provided "AS IS" without any warranty express or
05: * implied, including the warranty of non-infringement and the implied
06: * warranties of merchantibility and fitness for a particular purpose.
07: * IBM will not be liable for any damages suffered by you as a result
08: * of using the Program. In no event will IBM be liable for any
09: * special, indirect or consequential damages or lost profits even if
10: * IBM has been advised of the possibility of their occurrence. IBM
11: * will not be liable for any third party claims against you.
12: *
13: * Portions Copyright (C) Simulacra Media Ltd, 2004.
14: */
15:
16: package com.ibm.webdav.impl;
17:
18: import org.w3c.dom.*;
19:
20: import com.ibm.webdav.*;
21:
22: /** A LockDiscovery is a LiveProperty corresponding to the DAV:lockdiscovery property.
23: * @author Jim Amsden <jamsden@us.ibm.com>
24: * @see com.ibm.webdav.PropertyValue
25: * @see com.ibm.webdav.impl.ResourceImpl#updateLiveProperties
26: * @see com.ibm.webdav.impl.ResourceImpl#removeLiveProperties
27: * @see com.ibm.webdav.impl.PropertiesManager#updateLiveProperties
28: * @see com.ibm.webdav.impl.PropertiesManager#removeLiveProperties
29: */
30: public class LockDiscovery extends LiveProperty {
31: /**
32: * Get the name of this live property.
33: * @return the live property name (XML namespace+localpart)
34: */
35: public String getName() {
36: return "DAV:lockdiscovery";
37: }
38:
39: /**
40: * Get the XML tag name (without a prefix) of this live property.
41: * @return the live property tag name without a prefix
42: */
43: public String getNSLocalName() {
44: return "lockdiscovery";
45: }
46:
47: /**
48: * Get the preferred namespace prefix for this live property.
49: * @return the XML namespace prefix for this property
50: */
51: public String getPreferredPrefix() {
52: return "D";
53: }
54:
55: /**
56: * Get the value of this live property.
57: * @return the live property value
58: */
59: public PropertyValue getValueFor(ResourceImpl resource) {
60: Element lockdiscovery = null;
61: int status = WebDAVStatus.SC_OK;
62: try {
63: lockdiscovery = (Element) ((Element) resource
64: .getLockManager().getLockDiscovery())
65: .cloneNode(true);
66: } catch (WebDAVException exc) {
67: status = exc.getStatusCode();
68: } catch (Exception exc) {
69: status = WebDAVStatus.SC_INTERNAL_SERVER_ERROR;
70: }
71: PropertyValue result = new PropertyValue(lockdiscovery, status);
72: return result;
73: }
74:
75: /**
76: * Is this live property updatable by the user?
77: * @return true if the use can update this live property, false if only
78: * the server can update the property.
79: */
80: public boolean isUserUpdatable() {
81: return false;
82: }
83: }
|