1:
30:
31: package ;
32:
33: import ;
34: import ;
35: import ;
36:
37: import ;
38: import ;
39: import ;
40: import ;
41: import ;
42:
43:
48: public class ZipContentItem implements ContentItem
49: {
50: private boolean newItem;
51: private String name;
52: private String contentId;
53: private ZipRepository repository;
54: private ZipContentLocation parent;
55:
56: public ZipContentItem(final String name,
57: final ZipRepository repository,
58: final ZipContentLocation parent)
59: {
60: this.name = name;
61: this.repository = repository;
62: this.parent = parent;
63: this.contentId = RepositoryUtilities.buildName(this, "/");
64: this.newItem = true;
65: }
66:
67: public String getMimeType() throws ContentIOException
68: {
69: return getRepository().getMimeRegistry().getMimeType(this);
70: }
71:
72: public OutputStream getOutputStream() throws ContentIOException, IOException
73: {
74: if (newItem == false)
75: {
76: throw new ContentIOException("This item is no longer writeable.");
77: }
78: newItem = false;
79: return new ZipEntryOutputStream(this);
80: }
81:
82: public InputStream getInputStream() throws ContentIOException, IOException
83: {
84: throw new ContentIOException("This item is not readable.");
85: }
86:
87: public boolean isReadable()
88: {
89: return false;
90: }
91:
92: public boolean isWriteable()
93: {
94: return newItem;
95: }
96:
97: public String getName()
98: {
99: return name;
100: }
101:
102: public Object getContentId()
103: {
104: return contentId;
105: }
106:
107: public Object getAttribute(final String domain, final String key)
108: {
109: return null;
110: }
111:
112: public boolean setAttribute(final String domain, final String key, final Object value)
113: {
114: return false;
115: }
116:
117: public Repository getRepository()
118: {
119: return repository;
120: }
121:
122: public ContentLocation getParent()
123: {
124: return parent;
125: }
126:
127: public boolean delete()
128: {
129: return false;
130: }
131: }