KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > text > xml > xmp > DublinCoreSchema


1 /*
2  * $Id: DublinCoreSchema.java 2366 2006-09-14 23:10:58Z xlv $
3  * $Name$
4  *
5  * Copyright 2005 by Bruno Lowagie.
6  *
7  * The contents of this file are subject to the Mozilla Public License Version 1.1
8  * (the "License"); you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the License.
14  *
15  * The Original Code is 'iText, a free JAVA-PDF library'.
16  *
17  * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
18  * the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
19  * All Rights Reserved.
20  * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
21  * are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
22  *
23  * Contributor(s): all the names of the contributors are added in the source code
24  * where applicable.
25  *
26  * Alternatively, the contents of this file may be used under the terms of the
27  * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
28  * provisions of LGPL are applicable instead of those above. If you wish to
29  * allow use of your version of this file only under the terms of the LGPL
30  * License and not to allow others to use your version of this file under
31  * the MPL, indicate your decision by deleting the provisions above and
32  * replace them with the notice and other provisions required by the LGPL.
33  * If you do not delete the provisions above, a recipient may use your version
34  * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Library General Public License as published by the Free Software Foundation;
39  * either version 2 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
43  * FOR A PARTICULAR PURPOSE. See the GNU LIBRARY GENERAL PUBLIC LICENSE for more
44  * details.
45  *
46  * If you didn't download this code from the following link, you should check if
47  * you aren't using an obsolete version:
48  * http://www.lowagie.com/iText/
49  */

50
51 package com.lowagie.text.xml.xmp;
52
53
54 /**
55  * An implementation of an XmpSchema.
56  */

57 public class DublinCoreSchema extends XmpSchema {
58
59     private static final long serialVersionUID = -4551741356374797330L;
60     /** default namespace identifier*/
61     public static final String JavaDoc DEFAULT_XPATH_ID = "dc";
62     /** default namespace uri*/
63     public static final String JavaDoc DEFAULT_XPATH_URI = "http://purl.org/dc/elements/1.1/";
64     
65     /** External Contributors to the resource (other than the authors). */
66     public static final String JavaDoc CONTRIBUTOR = "dc:contributor";
67     /** The extent or scope of the resource. */
68     public static final String JavaDoc COVERAGE = "dc:coverage";
69     /** The authors of the resource (listed in order of precedence, if significant). */
70     public static final String JavaDoc CREATOR = "dc:creator";
71     /** Date(s) that something interesting happened to the resource. */
72     public static final String JavaDoc DATE = "dc:date";
73     /** A textual description of the content of the resource. Multiple values may be present for different languages. */
74     public static final String JavaDoc DESCRIPTION = "dc:description";
75     /** The file format used when saving the resource. Tools and applications should set this property to the save format of the data. It may include appropriate qualifiers. */
76     public static final String JavaDoc FORMAT = "dc:format";
77     /** Unique identifier of the resource. */
78     public static final String JavaDoc IDENTIFIER = "dc:identifier";
79     /** An unordered array specifying the languages used in the resource. */
80     public static final String JavaDoc LANGUAGE = "dc:language";
81     /** Publishers. */
82     public static final String JavaDoc PUBLISHER = "dc:publisher";
83     /** Relationships to other documents. */
84     public static final String JavaDoc RELATION = "dc:relation";
85     /** Informal rights statement, selected by language. */
86     public static final String JavaDoc RIGHTS = "dc:rights";
87     /** Unique identifier of the work from which this resource was derived. */
88     public static final String JavaDoc SOURCE = "dc:source";
89     /** An unordered array of descriptive phrases or keywords that specify the topic of the content of the resource. */
90     public static final String JavaDoc SUBJECT = "dc:subject";
91     /** The title of the document, or the name given to the resource. Typically, it will be a name by which the resource is formally known. */
92     public static final String JavaDoc TITLE = "dc:title";
93     /** A document type; for example, novel, poem, or working paper. */
94     public static final String JavaDoc TYPE = "dc:type";
95
96     
97     public DublinCoreSchema() {
98         super("xmlns:" + DEFAULT_XPATH_ID + "=\"" + DEFAULT_XPATH_URI + "\"");
99         setProperty(FORMAT, "application/pdf");
100     }
101     
102     /**
103      * Adds a title.
104      * @param title
105      */

106     public void addTitle(String JavaDoc title) {
107         setProperty(TITLE, title);
108     }
109
110     /**
111      * Adds a description.
112      * @param desc
113      */

114     public void addDescription(String JavaDoc desc) {
115         setProperty(DESCRIPTION, desc);
116     }
117
118     /**
119      * Adds a subject.
120      * @param subject
121      */

122     public void addSubject(String JavaDoc subject) {
123         XmpArray array = new XmpArray(XmpArray.UNORDERED);
124         array.add(subject);
125         setProperty(SUBJECT, array);
126     }
127
128     
129     /**
130      * Adds a subject.
131      * @param subject array of subjects
132      */

133     public void addSubject(String JavaDoc[] subject) {
134         XmpArray array = new XmpArray(XmpArray.UNORDERED);
135         for (int i = 0; i < subject.length; i++) {
136             array.add(subject[i]);
137         }
138         setProperty(SUBJECT, array);
139     }
140     
141     /**
142      * Adds a single author.
143      * @param author
144      */

145     public void addAuthor(String JavaDoc author) {
146         XmpArray array = new XmpArray(XmpArray.ORDERED);
147         array.add(author);
148         setProperty(CREATOR, array);
149     }
150
151     /**
152      * Adds an array of authors.
153      * @param author
154      */

155     public void addAuthor(String JavaDoc[] author) {
156         XmpArray array = new XmpArray(XmpArray.ORDERED);
157         for (int i = 0; i < author.length; i++) {
158             array.add(author[i]);
159         }
160         setProperty(CREATOR, array);
161     }
162
163     /**
164      * Adds a single publisher.
165      * @param publisher
166      */

167     public void addPublisher(String JavaDoc publisher) {
168         XmpArray array = new XmpArray(XmpArray.ORDERED);
169         array.add(publisher);
170         setProperty(PUBLISHER, array);
171     }
172
173     /**
174      * Adds an array of publishers.
175      * @param publisher
176      */

177     public void addPublisher(String JavaDoc[] publisher) {
178         XmpArray array = new XmpArray(XmpArray.ORDERED);
179         for (int i = 0; i < publisher.length; i++) {
180             array.add(publisher[i]);
181         }
182         setProperty(PUBLISHER, array);
183     }
184 }
185
Popular Tags