KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > publication > DublinCoreProxy


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: DublinCoreProxy.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.publication;
21
22 /**
23  * A proxy to the dublin core meta implementation so that meta data is
24  * only read from file when it is actually requested.
25  */

26 public class DublinCoreProxy implements DublinCore {
27
28     private DublinCoreImpl dcCore;
29     private Document cmsDocument;
30
31
32     /**
33      * Creates a new instance of Dublin Core
34      *
35      * @param aDocument the document for which the Dublin Core instance is created.
36      */

37     public DublinCoreProxy(Document aDocument) {
38         this.cmsDocument = aDocument;
39     }
40
41     /**
42      * Instanciate a dublin core implementation object
43      *
44      * @return a real dublin core object
45      * @throws DocumentException when an error occurs.
46      */

47     protected DublinCoreImpl instance() throws DocumentException {
48         if (dcCore == null) {
49             dcCore = new DublinCoreImpl(this.cmsDocument);
50         }
51         return dcCore;
52     }
53
54     /**
55      * @see org.apache.lenya.cms.publication.DublinCore#getCreator()
56      */

57     public String JavaDoc getCreator() throws DocumentException {
58         return instance().getFirstValue(DublinCore.ELEMENT_CREATOR);
59     }
60
61     /**
62      * @see org.apache.lenya.cms.publication.DublinCore#getDateCreated()
63      */

64     public String JavaDoc getDateCreated() throws DocumentException {
65         return instance().getFirstValue(DublinCore.TERM_CREATED);
66     }
67
68     /**
69      * @see org.apache.lenya.cms.publication.DublinCore#getDateIssued()
70      */

71     public String JavaDoc getDateIssued() throws DocumentException {
72         return instance().getFirstValue(DublinCore.TERM_ISSUED);
73     }
74
75     /**
76      * @see org.apache.lenya.cms.publication.DublinCore#getDescription()
77      */

78     public String JavaDoc getDescription() throws DocumentException {
79         return instance().getFirstValue(DublinCore.ELEMENT_DESCRIPTION);
80     }
81
82     /**
83      * @see org.apache.lenya.cms.publication.DublinCore#getIdentifier()
84      */

85     public String JavaDoc getIdentifier() throws DocumentException {
86         return instance().getFirstValue(DublinCore.ELEMENT_IDENTIFIER);
87     }
88
89     /**
90      * @see org.apache.lenya.cms.publication.DublinCore#getPublisher()
91      */

92     public String JavaDoc getPublisher() throws DocumentException {
93         return instance().getFirstValue(DublinCore.ELEMENT_PUBLISHER);
94     }
95
96     /**
97      * @see org.apache.lenya.cms.publication.DublinCore#getRights()
98      */

99     public String JavaDoc getRights() throws DocumentException {
100         return instance().getFirstValue(DublinCore.ELEMENT_RIGHTS);
101     }
102
103     /**
104      * @see org.apache.lenya.cms.publication.DublinCore#getIsReferencedBy()
105      */

106     public String JavaDoc getIsReferencedBy() throws DocumentException {
107         return instance().getFirstValue(DublinCore.TERM_ISREFERENCEDBY);
108     }
109
110     /**
111      * @see org.apache.lenya.cms.publication.DublinCore#getSubject()
112      */

113     public String JavaDoc getSubject() throws DocumentException {
114         return instance().getFirstValue(DublinCore.ELEMENT_SUBJECT);
115     }
116
117     /**
118      * @see org.apache.lenya.cms.publication.DublinCore#getTitle()
119      */

120     public String JavaDoc getTitle() throws DocumentException {
121         return instance().getFirstValue(DublinCore.ELEMENT_TITLE);
122     }
123
124     /**
125      * @see org.apache.lenya.cms.publication.DublinCore#setCreator(java.lang.String)
126      */

127     public void setCreator(String JavaDoc creator) throws DocumentException {
128         instance().setValue(DublinCore.ELEMENT_CREATOR, creator);
129     }
130
131     /**
132      * @see org.apache.lenya.cms.publication.DublinCore#setDateCreated(java.lang.String)
133      */

134     public void setDateCreated(String JavaDoc dateCreated) throws DocumentException {
135         instance().setValue(DublinCore.TERM_CREATED, dateCreated);
136     }
137
138     /**
139      * @see org.apache.lenya.cms.publication.DublinCore#setDateIssued(java.lang.String)
140      */

141     public void setDateIssued(String JavaDoc dateIssued) throws DocumentException {
142         instance().setValue(DublinCore.TERM_ISSUED, dateIssued);
143     }
144
145     /**
146      * @see org.apache.lenya.cms.publication.DublinCore#setDescription(java.lang.String)
147      */

148     public void setDescription(String JavaDoc description) throws DocumentException {
149         instance().setValue(DublinCore.ELEMENT_DESCRIPTION, description);
150     }
151
152     /**
153      * @see org.apache.lenya.cms.publication.DublinCore#setIdentifier(java.lang.String)
154      */

155     public void setIdentifier(String JavaDoc identifier) throws DocumentException {
156         instance().setValue(DublinCore.ELEMENT_IDENTIFIER, identifier);
157     }
158
159     /**
160      * @see org.apache.lenya.cms.publication.DublinCore#setPublisher(java.lang.String)
161      */

162     public void setPublisher(String JavaDoc publisher) throws DocumentException {
163         instance().setValue(DublinCore.ELEMENT_PUBLISHER, publisher);
164     }
165
166     /**
167      * @see org.apache.lenya.cms.publication.DublinCore#setRights(java.lang.String)
168      */

169     public void setRights(String JavaDoc rights) throws DocumentException {
170         instance().setValue(DublinCore.ELEMENT_RIGHTS, rights);
171     }
172
173     /**
174      * @see org.apache.lenya.cms.publication.DublinCore#setIsReferencedBy(java.lang.String)
175      */

176     public void setIsReferencedBy(String JavaDoc isReferencedBy) throws DocumentException {
177         instance().setValue(DublinCore.TERM_ISREFERENCEDBY, isReferencedBy);
178     }
179
180     /**
181      * @see org.apache.lenya.cms.publication.DublinCore#setSubject(java.lang.String)
182      */

183     public void setSubject(String JavaDoc subject) throws DocumentException {
184         instance().setValue(DublinCore.ELEMENT_SUBJECT, subject);
185     }
186
187     /**
188      * @see org.apache.lenya.cms.publication.DublinCore#setTitle(java.lang.String)
189      */

190     public void setTitle(String JavaDoc title) throws DocumentException {
191         instance().setValue(DublinCore.ELEMENT_TITLE, title);
192     }
193
194     /**
195      * @see org.apache.lenya.cms.publication.DublinCore#save()
196      */

197     public void save() throws DocumentException {
198         instance().save();
199     }
200
201     /**
202      * @see org.apache.lenya.cms.publication.DublinCore#getValues(java.lang.String)
203      */

204     public String JavaDoc[] getValues(String JavaDoc key) throws DocumentException {
205         return instance().getValues(key);
206     }
207
208     /**
209      * @see org.apache.lenya.cms.publication.DublinCore#getFirstValue(java.lang.String)
210      */

211     public String JavaDoc getFirstValue(String JavaDoc key) throws DocumentException {
212         return instance().getFirstValue(key);
213     }
214
215     /**
216      * @see org.apache.lenya.cms.publication.DublinCore#addValue(java.lang.String, java.lang.String)
217      */

218     public void addValue(String JavaDoc key, String JavaDoc value) throws DocumentException {
219         instance().addValue(key, value);
220
221     }
222
223     /**
224      * @see org.apache.lenya.cms.publication.DublinCore#removeValue(java.lang.String, java.lang.String)
225      */

226     public void removeValue(String JavaDoc key, String JavaDoc value) throws DocumentException {
227         instance().removeValue(key, value);
228     }
229
230     /**
231      * @see org.apache.lenya.cms.publication.DublinCore#removeAllValues(java.lang.String)
232      */

233     public void removeAllValues(String JavaDoc key) throws DocumentException {
234         instance().removeAllValues(key);
235     }
236     
237     /**
238      * @see org.apache.lenya.cms.publication.DublinCore#replaceBy(org.apache.lenya.cms.publication.DublinCore)
239      */

240     public void replaceBy(DublinCore other) throws DocumentException {
241         instance().replaceBy(other);
242
243     }
244
245     /**
246      * @see org.apache.lenya.cms.publication.DublinCore#addValues(java.lang.String, java.lang.String[])
247      */

248     public void addValues(String JavaDoc key, String JavaDoc[] values) throws DocumentException {
249         instance().addValues(key, values);
250         
251     }
252
253     /**
254      * @see org.apache.lenya.cms.publication.DublinCore#setValue(java.lang.String, java.lang.String)
255      */

256     public void setValue(String JavaDoc key, String JavaDoc value) throws DocumentException {
257         instance().setValue(key, value);
258     }
259
260 }
261
Popular Tags