001/*
002 * $Id: XmpBasicSchema.java 4784 2011-03-15 08:33:00Z blowagie $
003 *
004 * This file is part of the iText (R) project.
005 * Copyright (c) 1998-2011 1T3XT BVBA
006 * Authors: Bruno Lowagie, Paulo Soares, et al.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU Affero General Public License version 3
010 * as published by the Free Software Foundation with the addition of the
011 * following permission added to Section 15 as permitted in Section 7(a):
012 * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY 1T3XT,
013 * 1T3XT DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
014 *
015 * This program is distributed in the hope that it will be useful, but
016 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
017 * or FITNESS FOR A PARTICULAR PURPOSE.
018 * See the GNU Affero General Public License for more details.
019 * You should have received a copy of the GNU Affero General Public License
020 * along with this program; if not, see http://www.gnu.org/licenses or write to
021 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
022 * Boston, MA, 02110-1301 USA, or download the license from the following URL:
023 * http://itextpdf.com/terms-of-use/
024 *
025 * The interactive user interfaces in modified source and object code versions
026 * of this program must display Appropriate Legal Notices, as required under
027 * Section 5 of the GNU Affero General Public License.
028 *
029 * In accordance with Section 7(b) of the GNU Affero General Public License,
030 * a covered work must retain the producer line in every PDF that is created
031 * or manipulated using iText.
032 *
033 * You can be released from the requirements of the license by purchasing
034 * a commercial license. Buying such a license is mandatory as soon as you
035 * develop commercial activities involving the iText software without
036 * disclosing the source code of your own applications.
037 * These activities include: offering paid services to customers as an ASP,
038 * serving PDFs on the fly in a web application, shipping iText with a closed
039 * source product.
040 *
041 * For more information, please contact iText Software Corp. at this
042 * address: sales@itextpdf.com
043 */
044package com.itextpdf.text.xml.xmp;
045
046
047/**
048 * An implementation of an XmpSchema.
049 */
050public class XmpBasicSchema extends XmpSchema {
051
052        private static final long serialVersionUID = -2416613941622479298L;
053        /** default namespace identifier*/
054        public static final String DEFAULT_XPATH_ID = "xmp";
055        /** default namespace uri*/
056        public static final String DEFAULT_XPATH_URI = "http://ns.adobe.com/xap/1.0/";
057        
058        /** An unordered array specifying properties that were edited outside the authoring application. Each item should contain a single namespace and XPath separated by one ASCII space (U+0020). */
059        public static final String ADVISORY = "xmp:Advisory";
060        /** The base URL for relative URLs in the document content. If this document contains Internet links, and those links are relative, they are relative to this base URL. This property provides a standard way for embedded relative URLs to be interpreted by tools. Web authoring tools should set the value based on their notion of where URLs will be interpreted. */
061        public static final String BASEURL = "xmp:BaseURL";
062        /** The date and time the resource was originally created. */
063        public static final String CREATEDATE = "xmp:CreateDate";
064        /** The name of the first known tool used to create the resource. If history is present in the metadata, this value should be equivalent to that of xmpMM:History's softwareAgent property. */
065        public static final String CREATORTOOL = "xmp:CreatorTool";
066        /** An unordered array of text strings that unambiguously identify the resource within a given context. */
067        public static final String IDENTIFIER = "xmp:Identifier";
068        /** The date and time that any metadata for this resource was last changed. */
069        public static final String METADATADATE = "xmp:MetadataDate";
070        /** The date and time the resource was last modified. */
071        public static final String MODIFYDATE = "xmp:ModifyDate";
072        /** A short informal name for the resource. */
073        public static final String NICKNAME = "xmp:Nickname";
074        /** An alternative array of thumbnail images for a file, which can differ in characteristics such as size or image encoding. */
075        public static final String THUMBNAILS = "xmp:Thumbnails";
076
077        
078        public XmpBasicSchema() {
079                super("xmlns:" + DEFAULT_XPATH_ID + "=\"" + DEFAULT_XPATH_URI + "\"");
080        }
081        
082        /**
083         * Adds the creatortool.
084         * @param creator
085         */
086        public void addCreatorTool(String creator) {
087                setProperty(CREATORTOOL, creator);
088        }
089        
090        /**
091         * Adds the creation date.
092         * @param date
093         */
094        public void addCreateDate(String date) {
095                setProperty(CREATEDATE, date);
096        }
097        
098        /**
099         * Adds the modification date.
100         * @param date
101         */
102        public void addModDate(String date) {
103                setProperty(MODIFYDATE, date);
104        }
105
106        /**
107         * Adds the meta data date.
108         * @param date
109         */
110        public void addMetaDataDate(String date) {
111                setProperty(METADATADATE, date);
112        }
113
114        /** Adds the identifier.
115         * @param id
116         */
117        public void addIdentifiers(String[] id) {
118                XmpArray array = new XmpArray(XmpArray.UNORDERED);
119                for (int i = 0; i < id.length; i++) {
120                        array.add(id[i]);
121                }
122                setProperty(IDENTIFIER, array);
123        }
124
125        /** Adds the nickname.
126         * @param name
127         */
128        public void addNickname(String name) {
129                setProperty(NICKNAME, name);
130        }
131}