FOP-2456: PDF VT support

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/commons/trunk@1666114 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java b/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java
index c051bbc..34e08d4 100644
--- a/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java
+++ b/src/java/org/apache/xmlgraphics/xmp/XMPConstants.java
@@ -47,6 +47,15 @@
     /** Namespace URI for the Adobe PDF Schema */
     String ADOBE_PDF_NAMESPACE = "http://ns.adobe.com/pdf/1.3/";
 
+    /** Namespace URI for PDF X */
+    String PDF_X_IDENTIFICATION = "http://www.npes.org/pdfx/ns/id/";
+
+    /** Namespace URI for PDF VT */
+    String PDF_VT_IDENTIFICATION = "http://www.npes.org/pdfvt/ns/id/";
+
+    /** Namespace URI for XMP Media Management */
+    String XAP_MM_NAMESPACE  = "http://ns.adobe.com/xap/1.0/mm/";
+
     /**
      * Namespace URI for the PDF/A Identification Schema
      * (from the technical corrigendum 1 of ISO 19005-1:2005, note that the trailing slash
diff --git a/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java b/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java
index 6bd2192..57253a8 100644
--- a/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java
+++ b/src/java/org/apache/xmlgraphics/xmp/XMPSchemaRegistry.java
@@ -25,6 +25,9 @@
 import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema;
 import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFSchema;
 import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAXMPSchema;
+import org.apache.xmlgraphics.xmp.schemas.pdf.PDFVTXMPSchema;
+import org.apache.xmlgraphics.xmp.schemas.pdf.PDFXXMPSchema;
+import org.apache.xmlgraphics.xmp.schemas.pdf.XAPMMXMPSchema;
 
 /**
  * This class is a registry of XMP schemas. It's implemented as a singleton.
@@ -52,6 +55,9 @@
         addSchema(new PDFAXMPSchema());
         addSchema(new XMPBasicSchema());
         addSchema(new AdobePDFSchema());
+        addSchema(new PDFXXMPSchema());
+        addSchema(new PDFVTXMPSchema());
+        addSchema(new XAPMMXMPSchema());
     }
 
     /**
diff --git a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
index 6219286..788fe98 100644
--- a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
+++ b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
@@ -31,6 +31,7 @@
     private static final String KEYWORDS = "Keywords";
     private static final String PDFVERSION = "PDFVersion";
     private static final String PRODUCER = "Producer";
+    private static final String TRAPPED = "Trapped";
 
     /**
      * Constructs a new adapter for Adobe PDF around the given metadata object.
@@ -79,4 +80,12 @@
         setValue(PRODUCER, value);
     }
 
+    /**
+     * Sets if the pdf has trapping information True or False
+     * @param v the value
+     */
+    public void setTrapped(String v) {
+        setValue(TRAPPED, v);
+    }
+
 }
diff --git a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFVTAdapter.java b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFVTAdapter.java
new file mode 100644
index 0000000..9f174cb
--- /dev/null
+++ b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFVTAdapter.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+package org.apache.xmlgraphics.xmp.schemas.pdf;
+
+import java.util.Date;
+
+import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.XMPSchemaAdapter;
+import org.apache.xmlgraphics.xmp.XMPSchemaRegistry;
+
+public class PDFVTAdapter extends XMPSchemaAdapter {
+    /**
+     * Constructs a new adapter for PDF/VT around the given metadata object.
+     * @param meta the underlying metadata
+     * @param namespace the namespace to access the schema (must be one of the PDF/VT schema
+     *                  namespaces)
+     */
+    public PDFVTAdapter(Metadata meta, String namespace) {
+        super(meta, XMPSchemaRegistry.getInstance().getSchema(namespace));
+    }
+
+    public void setVersion(String v) {
+        setValue("GTS_PDFVTVersion", v);
+    }
+
+    public void setModifyDate(Date modifyDate) {
+        setDateValue("GTS_PDFVTModDate", modifyDate);
+    }
+}
diff --git a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFVTXMPSchema.java b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFVTXMPSchema.java
new file mode 100644
index 0000000..d452468
--- /dev/null
+++ b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFVTXMPSchema.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+package org.apache.xmlgraphics.xmp.schemas.pdf;
+
+import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.XMPConstants;
+import org.apache.xmlgraphics.xmp.XMPSchema;
+
+public class PDFVTXMPSchema extends XMPSchema {
+    public static final String NAMESPACE = XMPConstants.PDF_VT_IDENTIFICATION;
+
+    /** Creates a new schema instance for Dublin Core. */
+    public PDFVTXMPSchema() {
+        super(NAMESPACE, "pdfvtid");
+    }
+
+    /**
+     * Creates and returns an adapter for this schema around the given metadata object.
+     * @param meta the metadata object
+     * @return the newly instantiated adapter
+     */
+    public static PDFVTAdapter getAdapter(Metadata meta) {
+        return new PDFVTAdapter(meta, NAMESPACE);
+    }
+}
diff --git a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFXAdapter.java b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFXAdapter.java
new file mode 100644
index 0000000..d8fe5f2
--- /dev/null
+++ b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFXAdapter.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+package org.apache.xmlgraphics.xmp.schemas.pdf;
+
+import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.XMPSchemaAdapter;
+import org.apache.xmlgraphics.xmp.XMPSchemaRegistry;
+
+public class PDFXAdapter extends XMPSchemaAdapter {
+    /**
+     * Constructs a new adapter for PDF/X around the given metadata object.
+     * @param meta the underlying metadata
+     * @param namespace the namespace to access the schema (must be one of the PDF/X schema
+     *                  namespaces)
+     */
+    public PDFXAdapter(Metadata meta, String namespace) {
+        super(meta, XMPSchemaRegistry.getInstance().getSchema(namespace));
+    }
+
+    public void setVersion(String v) {
+        setValue("GTS_PDFXVersion", v);
+    }
+}
diff --git a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFXXMPSchema.java b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFXXMPSchema.java
new file mode 100644
index 0000000..14f67c3
--- /dev/null
+++ b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFXXMPSchema.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+package org.apache.xmlgraphics.xmp.schemas.pdf;
+
+
+import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.XMPConstants;
+import org.apache.xmlgraphics.xmp.XMPSchema;
+
+public class PDFXXMPSchema extends XMPSchema {
+    public static final String NAMESPACE = XMPConstants.PDF_X_IDENTIFICATION;
+
+    /** Creates a new schema instance for Dublin Core. */
+    public PDFXXMPSchema() {
+        super(NAMESPACE, "pdfxid");
+    }
+
+    /**
+     * Creates and returns an adapter for this schema around the given metadata object.
+     * @param meta the metadata object
+     * @return the newly instantiated adapter
+     */
+    public static PDFXAdapter getAdapter(Metadata meta) {
+        return new PDFXAdapter(meta, NAMESPACE);
+    }
+}
diff --git a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/XAPMMAdapter.java b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/XAPMMAdapter.java
new file mode 100644
index 0000000..4619a01
--- /dev/null
+++ b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/XAPMMAdapter.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+package org.apache.xmlgraphics.xmp.schemas.pdf;
+
+import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.XMPSchemaAdapter;
+import org.apache.xmlgraphics.xmp.XMPSchemaRegistry;
+
+public class XAPMMAdapter extends XMPSchemaAdapter {
+    /**
+     * Constructs a new adapter for XAP MM around the given metadata object.
+     * @param meta the underlying metadata
+     * @param namespace the namespace to access the schema (must be one of the PDF/VT schema
+     *                  namespaces)
+     */
+    public XAPMMAdapter(Metadata meta, String namespace) {
+        super(meta, XMPSchemaRegistry.getInstance().getSchema(namespace));
+    }
+
+    public void setVersion(String v) {
+        setValue("VersionID", v);
+    }
+
+    /**
+     * The rendition class name for this resource.
+     * @param c the value
+     */
+    public void setRenditionClass(String c) {
+        setValue("RenditionClass", c);
+    }
+
+    public void setInstanceID(String v) {
+        setValue("InstanceID", v);
+    }
+
+    public void setDocumentID(String v) {
+        setValue("DocumentID", v);
+    }
+}
diff --git a/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/XAPMMXMPSchema.java b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/XAPMMXMPSchema.java
new file mode 100644
index 0000000..58052e0
--- /dev/null
+++ b/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/XAPMMXMPSchema.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+package org.apache.xmlgraphics.xmp.schemas.pdf;
+
+import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.XMPConstants;
+import org.apache.xmlgraphics.xmp.XMPSchema;
+
+public class XAPMMXMPSchema extends XMPSchema {
+    public static final String NAMESPACE = XMPConstants.XAP_MM_NAMESPACE;
+
+    /** Creates a new schema instance for Dublin Core. */
+    public XAPMMXMPSchema() {
+        super(NAMESPACE, "xmpMM");
+    }
+
+    /**
+     * Creates and returns an adapter for this schema around the given metadata object.
+     *
+     * @param meta the metadata object
+     * @return the newly instantiated adapter
+     */
+    public static XAPMMAdapter getAdapter(Metadata meta) {
+        return new XAPMMAdapter(meta, NAMESPACE);
+    }
+}