~ubuntu-branches/ubuntu/raring/libitext-java/raring-proposed

« back to all changes in this revision

Viewing changes to core/com/lowagie/text/xml/xmp/DublinCoreSchema.java

  • Committer: Bazaar Package Importer
  • Author(s): Adriaan Peeters
  • Date: 2008-11-23 12:26:51 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20081123122651-ab7juwjz41q1123k
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: DublinCoreSchema.java 3596 2008-10-10 11:37:58Z psoares33 $
 
3
 *
 
4
 * Copyright 2005 by Bruno Lowagie.
 
5
 *
 
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 
7
 * (the "License"); you may not use this file except in compliance with the License.
 
8
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the License.
 
13
 *
 
14
 * The Original Code is 'iText, a free JAVA-PDF library'.
 
15
 *
 
16
 * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
 
17
 * the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
 
18
 * All Rights Reserved.
 
19
 * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
 
20
 * are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
 
21
 *
 
22
 * Contributor(s): all the names of the contributors are added in the source code
 
23
 * where applicable.
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of the
 
26
 * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
 
27
 * provisions of LGPL are applicable instead of those above.  If you wish to
 
28
 * allow use of your version of this file only under the terms of the LGPL
 
29
 * License and not to allow others to use your version of this file under
 
30
 * the MPL, indicate your decision by deleting the provisions above and
 
31
 * replace them with the notice and other provisions required by the LGPL.
 
32
 * If you do not delete the provisions above, a recipient may use your version
 
33
 * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE 
 
34
 *
 
35
 * This library is free software; you can redistribute it and/or modify it
 
36
 * under the terms of the MPL as stated above or under the terms of the GNU
 
37
 * Library General Public License as published by the Free Software Foundation;
 
38
 * either version 2 of the License, or any later version.
 
39
 *
 
40
 * This library is distributed in the hope that it will be useful, but WITHOUT
 
41
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
42
 * FOR A PARTICULAR PURPOSE. See the GNU LIBRARY GENERAL PUBLIC LICENSE for more
 
43
 * details.
 
44
 *
 
45
 * If you didn't download this code from the following link, you should check if
 
46
 * you aren't using an obsolete version:
 
47
 * http://www.lowagie.com/iText/
 
48
 */
 
49
 
 
50
package com.lowagie.text.xml.xmp;
 
51
 
 
52
 
 
53
/**
 
54
 * An implementation of an XmpSchema.
 
55
 */
 
56
public class DublinCoreSchema extends XmpSchema {
 
57
 
 
58
        private static final long serialVersionUID = -4551741356374797330L;
 
59
        /** default namespace identifier*/
 
60
        public static final String DEFAULT_XPATH_ID = "dc";
 
61
        /** default namespace uri*/
 
62
        public static final String DEFAULT_XPATH_URI = "http://purl.org/dc/elements/1.1/";
 
63
        
 
64
        /** External Contributors to the resource (other than the authors). */
 
65
        public static final String CONTRIBUTOR = "dc:contributor";
 
66
        /** The extent or scope of the resource. */
 
67
        public static final String COVERAGE = "dc:coverage";
 
68
        /** The authors of the resource (listed in order of precedence, if significant). */
 
69
        public static final String CREATOR = "dc:creator";
 
70
        /** Date(s) that something interesting happened to the resource. */
 
71
        public static final String DATE = "dc:date";
 
72
        /** A textual description of the content of the resource. Multiple values may be present for different languages. */
 
73
        public static final String DESCRIPTION = "dc:description";
 
74
        /** 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. */
 
75
        public static final String FORMAT = "dc:format";
 
76
        /** Unique identifier of the resource. */
 
77
        public static final String IDENTIFIER = "dc:identifier";
 
78
        /** An unordered array specifying the languages used in the     resource. */
 
79
        public static final String LANGUAGE = "dc:language";
 
80
        /** Publishers. */
 
81
        public static final String PUBLISHER = "dc:publisher";
 
82
        /** Relationships to other documents. */
 
83
        public static final String RELATION = "dc:relation";
 
84
        /** Informal rights statement, selected by language. */
 
85
        public static final String RIGHTS = "dc:rights";
 
86
        /** Unique identifier of the work from which this resource was derived. */
 
87
        public static final String SOURCE = "dc:source";
 
88
        /** An unordered array of descriptive phrases or keywords that specify the topic of the content of the resource. */
 
89
        public static final String SUBJECT = "dc:subject";
 
90
        /** 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. */
 
91
        public static final String TITLE = "dc:title";
 
92
        /** A document type; for example, novel, poem, or working paper. */
 
93
        public static final String TYPE = "dc:type";
 
94
 
 
95
        
 
96
        public DublinCoreSchema() {
 
97
                super("xmlns:" + DEFAULT_XPATH_ID + "=\"" + DEFAULT_XPATH_URI + "\"");
 
98
                setProperty(FORMAT, "application/pdf");
 
99
        }
 
100
        
 
101
        /**
 
102
         * Adds a title.
 
103
         * @param title
 
104
         */
 
105
        public void addTitle(String title) {
 
106
                XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
 
107
                array.add(title);
 
108
                setProperty(TITLE, array);
 
109
        }
 
110
 
 
111
        /**
 
112
         * Adds a description.
 
113
         * @param desc
 
114
         */
 
115
        public void addDescription(String desc) {
 
116
                XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
 
117
                array.add(desc);
 
118
                setProperty(DESCRIPTION, array);
 
119
        }
 
120
 
 
121
        /**
 
122
         * Adds a subject.
 
123
         * @param subject
 
124
         */
 
125
        public void addSubject(String subject) {
 
126
                XmpArray array = new XmpArray(XmpArray.UNORDERED);
 
127
                array.add(subject);
 
128
                setProperty(SUBJECT, array);
 
129
        }
 
130
 
 
131
        
 
132
        /**
 
133
         * Adds a subject.
 
134
         * @param subject array of subjects
 
135
         */
 
136
        public void addSubject(String[] subject) {
 
137
                XmpArray array = new XmpArray(XmpArray.UNORDERED);
 
138
                for (int i = 0; i < subject.length; i++) {
 
139
                        array.add(subject[i]);
 
140
                }
 
141
                setProperty(SUBJECT, array);
 
142
        }
 
143
        
 
144
        /**
 
145
         * Adds a single author.
 
146
         * @param author
 
147
         */
 
148
        public void addAuthor(String author) {
 
149
                XmpArray array = new XmpArray(XmpArray.ORDERED);
 
150
                array.add(author);
 
151
                setProperty(CREATOR, array);
 
152
        }
 
153
 
 
154
        /**
 
155
         * Adds an array of authors.
 
156
         * @param author
 
157
         */
 
158
        public void addAuthor(String[] author) {
 
159
                XmpArray array = new XmpArray(XmpArray.ORDERED);
 
160
                for (int i = 0; i < author.length; i++) {
 
161
                        array.add(author[i]);
 
162
                }
 
163
                setProperty(CREATOR, array);
 
164
        }
 
165
 
 
166
        /**
 
167
         * Adds a single publisher.
 
168
         * @param publisher
 
169
         */
 
170
        public void addPublisher(String publisher) {
 
171
                XmpArray array = new XmpArray(XmpArray.ORDERED);
 
172
                array.add(publisher);
 
173
                setProperty(PUBLISHER, array);
 
174
        }
 
175
 
 
176
        /**
 
177
         * Adds an array of publishers.
 
178
         * @param publisher
 
179
         */
 
180
        public void addPublisher(String[] publisher) {
 
181
                XmpArray array = new XmpArray(XmpArray.ORDERED);
 
182
                for (int i = 0; i < publisher.length; i++) {
 
183
                        array.add(publisher[i]);
 
184
                }
 
185
                setProperty(PUBLISHER, array);
 
186
        }
 
187
}