01: /*
02: JSPWiki - a JSP-based WikiWiki clone.
03:
04: Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
05:
06: This program is free software; you can redistribute it and/or modify
07: it under the terms of the GNU Lesser General Public License as published by
08: the Free Software Foundation; either version 2.1 of the License, or
09: (at your option) any later version.
10:
11: This program is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU Lesser General Public License for more details.
15:
16: You should have received a copy of the GNU Lesser General Public License
17: along with this program; if not, write to the Free Software
18: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: package com.ecyrd.jspwiki.dav.items;
21:
22: import java.io.InputStream;
23: import java.util.ArrayList;
24: import java.util.Collection;
25: import java.util.Date;
26:
27: import org.apache.commons.lang.time.DateFormatUtils;
28: import org.jdom.Element;
29: import org.jdom.Namespace;
30:
31: import com.ecyrd.jspwiki.dav.DavPath;
32: import com.ecyrd.jspwiki.dav.DavProvider;
33:
34: /**
35: * @author jalkanen
36: *
37: * @since
38: */
39: public class DirectoryItem extends DavItem {
40: public DirectoryItem(DavProvider provider, DavPath path) {
41: super (provider, path);
42: }
43:
44: public String getContentType() {
45: return "text/plain; charset=UTF-8";
46: }
47:
48: public long getLength() {
49: return -1;
50: }
51:
52: public Collection getPropertySet() {
53: ArrayList ts = new ArrayList();
54: Namespace davns = Namespace.getNamespace("DAV:");
55:
56: ts.add(new Element("resourcetype", davns)
57: .addContent(new Element("collection", davns)));
58:
59: Element txt = new Element("displayname", davns);
60: txt.setText(m_path.getName());
61: ts.add(txt);
62:
63: ts.add(new Element("getcontentlength", davns).setText("0"));
64: ts.add(new Element("getlastmodified", davns)
65: .setText(DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT
66: .format(new Date())));
67:
68: return ts;
69: }
70:
71: public String getHref() {
72: return m_provider.getURL(m_path);
73: }
74:
75: public void addDavItem(DavItem di) {
76: m_items.add(di);
77: }
78:
79: public void addDavItems(Collection c) {
80: m_items.addAll(c);
81: }
82:
83: /* (non-Javadoc)
84: * @see com.ecyrd.jspwiki.dav.items.DavItem#getInputStream()
85: */
86: public InputStream getInputStream() {
87: // TODO Auto-generated method stub
88: return null;
89: }
90: }
|