Author: gbailleul
Date: Thu Aug 30 20:03:39 2012
New Revision: 1379111

URL: http://svn.apache.org/viewvc?rev=1379111&view=rev
Log:
PDFBOX-1343: Removed static definition in schema mapping, reduced complexity in 
XMPSchema

Modified:
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
 Thu Aug 30 20:03:39 2012
@@ -54,497 +54,468 @@ import org.apache.padaf.xmpbox.type.Type
  */
 public class XMPMetadata {
 
-    private String xpacketId = null;
-    
-    private String xpacketBegin = null;
-
-    private String xpacketBytes = null;
-    
-    private String xpacketEncoding = null;
-
-    private String xpacketEndData = XmpConstants.DEFAULT_XPACKET_END;
-
-    private SchemasContainer schemas;
-    
-    private TypeMapping typeMapping;
-    
-    private NSMapping nsMapping;
-    
-    private SchemaMapping schemaMapping;
-
-    /**
-     * Contructor of an empty default XMPMetaData
-     * 
-     * @throws CreateXMPMetadataException
-     *             If DOM Document associated could not be created
-     */
-    // TODO GBL GBA make protected
-    protected XMPMetadata() {
-       this (
-                       XmpConstants.DEFAULT_XPACKET_BEGIN,
-                       XmpConstants.DEFAULT_XPACKET_ID,
-                       XmpConstants.DEFAULT_XPACKET_BYTES, 
-                       XmpConstants.DEFAULT_XPACKET_ENCODING
-                       );
-    }
-
-    /**
-     * creates blank XMP doc with specified parameters
-     * 
-     * @throws CreateXMPMetadataException
-     * @param xpacketBegin
-     *            Value of xpacketBegin
-     * @param xpacketId
-     *            Value of xpacketId
-     * @param xpacketBytes
-     *            Value of xpacketBytes
-     * @param xpacketEncoding
-     *            Value of xpacket encoding
-     * @throws CreateXMPMetadataException
-     *             If DOM Document associated could not be created
-     */
-    // TODO GBL GBA make protected
-    protected XMPMetadata(String xpacketBegin, String xpacketId,
-            String xpacketBytes, String xpacketEncoding) {
-//     this(tm);
-        this.schemas = new SchemasContainer();
-        this.typeMapping = new TypeMapping(this);
-        this.nsMapping = new NSMapping(this);
-        this.schemaMapping = new SchemaMapping();
-
-       this.xpacketBegin = xpacketBegin;
-        this.xpacketId = xpacketId;
-        this.xpacketBytes = xpacketBytes;
-        this.xpacketEncoding = xpacketEncoding;
-    }
-
-    public static XMPMetadata createXMPMetadata () {
-       return new XMPMetadata();
-    }
-
-    public static XMPMetadata createXMPMetadata (String xpacketBegin, String 
xpacketId,
-            String xpacketBytes, String xpacketEncoding) {
-       return new XMPMetadata(xpacketBegin, xpacketId, xpacketBytes, 
xpacketEncoding);
-    }
-
-    public TypeMapping getTypeMapping () {
-       return this.typeMapping;
-    }
-    
-    public NSMapping getNsMapping () {
-       return this.nsMapping;
-    }
-    
-    public SchemaMapping getSchemaMapping () {
-       return this.schemaMapping;
-    }
-    
-    /**
-     * Get xpacketBytes
-     * 
-     * @return value of xpacketBytes field
-     */
-    public String getXpacketBytes() {
-        return xpacketBytes;
-    }
-
-    /**
-     * Get xpacket encoding
-     * 
-     * @return value of xpacket Encoding field
-     */
-    public String getXpacketEncoding() {
-        return xpacketEncoding;
-    }
-
-    /**
-     * Get xpacket Begin
-     * 
-     * @return value of xpacket Begin field
-     */
-    public String getXpacketBegin() {
-        return xpacketBegin;
-    }
-
-    /**
-     * Get xpacket Id
-     * 
-     * @return value of xpacket Id field
-     */
-    public String getXpacketId() {
-        return xpacketId;
-    }
-
-    /**
-     * Add schema given to this metadata representation
-     * 
-     * @param schema
-     *            The Schema to add
-     */
-    public void addSchema(XMPSchema schema) {
-        schemas.addSchema(schema);
-    }
-
-    /**
-     * Get All Schemas declared in this metadata representation
-     * 
-     * @return List of declared schemas
-     */
-    public List<XMPSchema> getAllSchemas() {
-        ArrayList<XMPSchema> schem = new ArrayList<XMPSchema>();
-        Iterator<XMPSchema> it = schemas.schemas.iterator();
-        while (it.hasNext()) {
-            schem.add((XMPSchema) it.next());
-        }
-        return schem;
-    }
-
-    /**
-     * Set special XPACKET END PI
-     * 
-     * @param data
-     *            The XPacket End value
-     */
-    public void setEndXPacket(String data) {
-        xpacketEndData = data;
-    }
-
-    /**
-     * get XPACKET END PI
-     * 
-     * @return XPACKET END Value
-     */
-    public String getEndXPacket() {
-        return xpacketEndData;
-    }
-
-    /**
-     * Return the schema corresponding to this nsURI BE CAREFUL: typically,
-     * Metadata should contains one schema for each type this method return the
-     * first schema encountered corresponding to this NSURI Return null if
-     * unknown
-     * 
-     * @param nsURI
-     *            The namespace URI corresponding to the schema wanted
-     * @return The Class Schema representation
-     */
-    public XMPSchema getSchema(String nsURI) {
-        Iterator<XMPSchema> it = schemas.schemas.iterator();
-        XMPSchema tmp;
-        while (it.hasNext()) {
-            tmp = it.next();
-            if (tmp.getNamespace().equals(nsURI)) {
-                return tmp;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Return the schema corresponding to this nsURI and a prefix This method 
is
-     * here to treat metadata which embed more than one time the same schema It
-     * permit to retrieve a specific schema with its prefix
-     * 
-     * @param prefix
-     *            The prefix fixed in the schema wanted
-     * @param nsURI
-     *            The namespace URI corresponding to the schema wanted
-     * @return The Class Schema representation
-     */
-    public XMPSchema getSchema(String prefix, String nsURI) {
-        Iterator<XMPSchema> it = getAllSchemas().iterator();
-        XMPSchema tmp;
-        while (it.hasNext()) {
-            tmp = it.next();
-            if (tmp.getNamespace().equals(nsURI)
-                    && tmp.getPrefix().equals(prefix)) {
-                return tmp;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Set a unspecialized schema
-     * 
-     * @param nsPrefix
-     *            The prefix wanted for the schema
-     * @param nsURI
-     *            The namespace URI wanted for the schema
-     * @return The schema added in order to work on it
-     */
-    public XMPSchema createAndAddDefaultSchema(String nsPrefix, String nsURI) {
-        XMPSchema schem = new XMPSchema(this, nsPrefix, nsURI);
-        schem.setAboutAsSimple("");
-        addSchema(schem);
-        return schem;
-    }
-
-    /**
-     * Create and add a default PDFA Extension schema to this metadata This
-     * method return the created schema to enter information This PDFAExtension
-     * is created with all default namespaces used in PDFAExtensionSchema
-     * 
-     * @return PDFAExtension schema added in order to work on it
-     */
-    public PDFAExtensionSchema createAndAddPDFAExtensionSchemaWithDefaultNS() {
-        PDFAExtensionSchema pdfAExt = new PDFAExtensionSchema(this);
-        pdfAExt.setAboutAsSimple("");
-        addSchema(pdfAExt);
-        return pdfAExt;
-    }
-
-    /**
-     * Create and add a default XMPRights schema to this metadata This method
-     * return the created schema to enter information
-     * 
-     * @return schema added in order to work on it
-     */
-    public XMPRightsManagementSchema createAndAddXMPRightsManagementSchema() {
-        XMPRightsManagementSchema rights = new XMPRightsManagementSchema(this);
-        rights.setAboutAsSimple("");
-        addSchema(rights);
-        return rights;
-    }
-
-    /**
-     * Create and add a default PDFA Extension schema to this metadata This
-     * method return the created schema to enter information This PDFAExtension
-     * is created with specified list of namespaces
-     * 
-     * @param namespaces
-     *            Special namespaces list to use
-     * @return schema added in order to work on it
-     * @throws XmpSchemaException
-     *             If namespaces list not contains PDF/A Extension namespace 
URI
-     */
-    public PDFAExtensionSchema createAndAddPDFAExtensionSchemaWithNS(
-           Map<String, String> namespaces) throws XmpSchemaException {
-       PDFAExtensionSchema pdfAExt = new PDFAExtensionSchema(this);
-        pdfAExt.setAboutAsSimple("");
-        addSchema(pdfAExt);
-        return pdfAExt;
-    }
-
-    /**
-     * Get the PDFA Extension schema This method return null if not found
-     * 
-     * @return The PDFAExtension schema or null if not declared
-     */
-    public PDFAExtensionSchema getPDFExtensionSchema() {
-        return (PDFAExtensionSchema) 
getSchema(PDFAExtensionSchema.PDFAEXTENSIONURI);
-    }
-
-    /**
-     * Create and add a default PDFA Identification schema to this metadata 
This
-     * method return the created schema to enter information
-     * 
-     * @return schema added in order to work on it
-     */
-    public PDFAIdentificationSchema createAndAddPFAIdentificationSchema() {
-        PDFAIdentificationSchema pdfAId = new PDFAIdentificationSchema(this);
-        pdfAId.setAboutAsSimple("");
-        addSchema(pdfAId);
-        return pdfAId;
-    }
-
-    /**
-     * Get the PDFA Identification schema This method return null if not found
-     * 
-     * @return The PDFAIdentificationSchema schema or null if not declared
-     */
-    public PDFAIdentificationSchema getPDFIdentificationSchema() {
-        return (PDFAIdentificationSchema) 
getSchema(PDFAIdentificationSchema.IDURI);
-    }
-
-    /**
-     * Create and add a default Dublin Core schema to this metadata This method
-     * return the created schema to enter information
-     * 
-     * @return schema added in order to work on it
-     */
-    public DublinCoreSchema createAndAddDublinCoreSchema() {
-        DublinCoreSchema dc = new DublinCoreSchema(this);
-        dc.setAboutAsSimple("");
-        addSchema(dc);
-        return dc;
-    }
-    
-    /**
-     * Create and add a default Basic Job Ticket schema to this metadata This 
method
-     * return the created schema to enter information
-     * 
-     * @return schema added in order to work on it
-     */
-    public XMPBasicJobTicketSchema createAndAddBasicJobTicketSchema () {
-        XMPBasicJobTicketSchema sc = new XMPBasicJobTicketSchema(this);
-        sc.setAboutAsSimple("");
-        addSchema(sc);
-        return sc;
-    }
-    
-
-    /**
-     * Get the Dublin Core schema This method return null if not found
-     * 
-     * @return The DublinCoreSchema schema or null if not declared
-     */
-    public DublinCoreSchema getDublinCoreSchema() {
-        return (DublinCoreSchema) getSchema(DublinCoreSchema.DCURI);
-    }
-
-    /**
-     * Get the Basic JOb Ticket Schema schema This method return null if not 
found
-     * 
-     * @return The XMPBasicJobTicketSchema schema or null if not declared
-     */
-    public XMPBasicJobTicketSchema getBasicJobTicketSchema() {
-        return (XMPBasicJobTicketSchema) 
getSchema(XMPBasicJobTicketSchema.JOB_TICKET_URI);
-    }
-
-    
-    /**
-     * Get the XMPRights schema This method return null if not found
-     * 
-     * @return The XMPRightsManagementSchema schema or null if not declared
-     */
-    public XMPRightsManagementSchema getXMPRightsManagementSchema() {
-        return (XMPRightsManagementSchema) 
getSchema(XMPRightsManagementSchema.XMPRIGHTSURI);
-    }
-
-    /**
-     * Get the Photoshop schema This method return null if not found
-     * 
-     * @return The PhotoshopSchema schema or null if not declared
-     */
-    public PhotoshopSchema getPhotoshopSchema() {
-        return (PhotoshopSchema) getSchema(PhotoshopSchema.PHOTOSHOPURI);
-    }
-
-    /**
-     * Create and add a XMP Basic schema to this metadata This method return 
the
-     * created schema to enter information
-     * 
-     * @return schema added in order to work on it
-     */
-    public XMPBasicSchema createAndAddXMPBasicSchema() {
-        XMPBasicSchema xmpB = new XMPBasicSchema(this);
-        xmpB.setAboutAsSimple("");
-        addSchema(xmpB);
-        return xmpB;
-    }
-
-    /**
-     * Get the XMP Basic schema This method return null if not found
-     * 
-     * @return The XMPBasicSchema schema or null if not declared
-     */
-    public XMPBasicSchema getXMPBasicSchema() {
-        return (XMPBasicSchema) getSchema(XMPBasicSchema.XMPBASICURI);
-    }
-
-    /**
-     * Create and add a XMP Media Management schema to this metadata This 
method
-     * return the created schema to enter information
-     * 
-     * @return schema added in order to work on it
-     */
-    public XMPMediaManagementSchema createAndAddXMPMediaManagementSchema() {
-        XMPMediaManagementSchema xmpMM = new XMPMediaManagementSchema(this);
-        xmpMM.setAboutAsSimple("");
-        addSchema(xmpMM);
-        return xmpMM;
-    }
-
-    /***
-     * create and add Photoshop Schema to this metadata. This method return 
-     * the created schema to enter information
-     * @return
-     */
-    public PhotoshopSchema createAndAddPhotoshopSchema() {
-        PhotoshopSchema photoshop = new PhotoshopSchema(this);
-        photoshop.setAboutAsSimple("");
-        addSchema(photoshop);
-        return photoshop;
-    }
-
-    /**
-     * Get the XMP Media Management schema This method return null if not found
-     * 
-     * @return The XMPMediaManagementSchema schema or null if not declared
-     */
-    public XMPMediaManagementSchema getXMPMediaManagementSchema() {
-        return (XMPMediaManagementSchema) 
getSchema(XMPMediaManagementSchema.XMPMMURI);
-    }
-
-    /**
-     * Create and add an Adobe PDF schema to this metadata This method return
-     * the created schema to enter information
-     * 
-     * @return schema added in order to work on it
-     */
-    public AdobePDFSchema createAndAddAdobePDFSchema() {
-        AdobePDFSchema pdf = new AdobePDFSchema(this);
-        pdf.setAboutAsSimple("");
-        addSchema(pdf);
-        return pdf;
-    }
-
-    /**
-     * Get the Adobe PDF schema This method return null if not found
-     * 
-     * @return The AdobePDFSchema schema or null if not declared
-     */
-    public AdobePDFSchema getAdobePDFSchema() {
-        return (AdobePDFSchema) getSchema(AdobePDFSchema.PDFURI);
-    }
-
-//    public XMPDocumentBuilder getBuilder() {
-//             return builder;
-//     }
-
-
-
-
-       /**
-     * Class which represent a container for schemas associated to a metadata
-     * representation
-     * 
-     * @author a183132
-     * 
-     */
-    public class SchemasContainer {
-
-        private List<XMPSchema> schemas;
-
-        /**
-         * 
-         * Schemas Container constructor
-         */
-        public SchemasContainer() {
-            schemas = new ArrayList<XMPSchema>();
-        }
-
-        /**
-         * Add a schema to the current structure
-         * 
-         * @param obj
-         *            the schema to add
-         */
-        public void addSchema(XMPSchema obj) {
-            schemas.add(obj);
-        }
-
-        /**
-         * Remove a schema
-         * 
-         * @param schema
-         *            The schema to remove
-         */
-        public void removeSchema(XMPSchema schema) {
-               schemas.remove(schema);
-        }
+       private String xpacketId = null;
+
+       private String xpacketBegin = null;
+
+       private String xpacketBytes = null;
+
+       private String xpacketEncoding = null;
+
+       private String xpacketEndData = XmpConstants.DEFAULT_XPACKET_END;
+
+       private List<XMPSchema> schemas;
+
+
+       private TypeMapping typeMapping;
+
+       private NSMapping nsMapping;
+
+       private SchemaMapping schemaMapping;
+
+       /**
+        * Contructor of an empty default XMPMetaData
+        * 
+        * @throws CreateXMPMetadataException
+        *             If DOM Document associated could not be created
+        */
+       // TODO GBL GBA make protected
+       protected XMPMetadata() {
+               this (
+                               XmpConstants.DEFAULT_XPACKET_BEGIN,
+                               XmpConstants.DEFAULT_XPACKET_ID,
+                               XmpConstants.DEFAULT_XPACKET_BYTES, 
+                               XmpConstants.DEFAULT_XPACKET_ENCODING
+                               );
+       }
+
+       /**
+        * creates blank XMP doc with specified parameters
+        * 
+        * @throws CreateXMPMetadataException
+        * @param xpacketBegin
+        *            Value of xpacketBegin
+        * @param xpacketId
+        *            Value of xpacketId
+        * @param xpacketBytes
+        *            Value of xpacketBytes
+        * @param xpacketEncoding
+        *            Value of xpacket encoding
+        * @throws CreateXMPMetadataException
+        *             If DOM Document associated could not be created
+        */
+       protected XMPMetadata(String xpacketBegin, String xpacketId,
+                       String xpacketBytes, String xpacketEncoding) {
+               this.schemas = new ArrayList<XMPSchema>();
+               this.typeMapping = new TypeMapping(this);
+               this.nsMapping = new NSMapping(this);
+               this.schemaMapping = new SchemaMapping(this);
+
+               this.xpacketBegin = xpacketBegin;
+               this.xpacketId = xpacketId;
+               this.xpacketBytes = xpacketBytes;
+               this.xpacketEncoding = xpacketEncoding;
+       }
+
+       public static XMPMetadata createXMPMetadata () {
+               return new XMPMetadata();
+       }
+
+       public static XMPMetadata createXMPMetadata (String xpacketBegin, 
String xpacketId,
+                       String xpacketBytes, String xpacketEncoding) {
+               return new XMPMetadata(xpacketBegin, xpacketId, xpacketBytes, 
xpacketEncoding);
+       }
+
+       public TypeMapping getTypeMapping () {
+               return this.typeMapping;
+       }
+
+       public NSMapping getNsMapping () {
+               return this.nsMapping;
+       }
+
+       public SchemaMapping getSchemaMapping () {
+               return this.schemaMapping;
+       }
+
+       public void setSchemaMapping (SchemaMapping sm) {
+               this.schemaMapping = sm;
+       }
+
+       /**
+        * Get xpacketBytes
+        * 
+        * @return value of xpacketBytes field
+        */
+       public String getXpacketBytes() {
+               return xpacketBytes;
+       }
+
+       /**
+        * Get xpacket encoding
+        * 
+        * @return value of xpacket Encoding field
+        */
+       public String getXpacketEncoding() {
+               return xpacketEncoding;
+       }
+
+       /**
+        * Get xpacket Begin
+        * 
+        * @return value of xpacket Begin field
+        */
+       public String getXpacketBegin() {
+               return xpacketBegin;
+       }
+
+       /**
+        * Get xpacket Id
+        * 
+        * @return value of xpacket Id field
+        */
+       public String getXpacketId() {
+               return xpacketId;
+       }
+
+       /**
+        * Get All Schemas declared in this metadata representation
+        * 
+        * @return List of declared schemas
+        */
+       public List<XMPSchema> getAllSchemas() {
+               ArrayList<XMPSchema> schem = new ArrayList<XMPSchema>();
+               Iterator<XMPSchema> it = schemas.iterator();
+               while (it.hasNext()) {
+                       schem.add((XMPSchema) it.next());
+               }
+               return schem;
+       }
+
+       /**
+        * Set special XPACKET END PI
+        * 
+        * @param data
+        *            The XPacket End value
+        */
+       public void setEndXPacket(String data) {
+               xpacketEndData = data;
+       }
+
+       /**
+        * get XPACKET END PI
+        * 
+        * @return XPACKET END Value
+        */
+       public String getEndXPacket() {
+               return xpacketEndData;
+       }
+
+       /**
+        * Return the schema corresponding to this nsURI BE CAREFUL: typically,
+        * Metadata should contains one schema for each type this method return 
the
+        * first schema encountered corresponding to this NSURI Return null if
+        * unknown
+        * 
+        * @param nsURI
+        *            The namespace URI corresponding to the schema wanted
+        * @return The Class Schema representation
+        */
+       public XMPSchema getSchema(String nsURI) {
+               Iterator<XMPSchema> it = schemas.iterator();
+               XMPSchema tmp;
+               while (it.hasNext()) {
+                       tmp = it.next();
+                       if (tmp.getNamespace().equals(nsURI)) {
+                               return tmp;
+                       }
+               }
+               return null;
+       }
+
+       public void clearSchemas () {
+               schemas.clear();
+       }
+
+       /**
+        * Return the schema corresponding to this nsURI and a prefix This 
method is
+        * here to treat metadata which embed more than one time the same 
schema It
+        * permit to retrieve a specific schema with its prefix
+        * 
+        * @param prefix
+        *            The prefix fixed in the schema wanted
+        * @param nsURI
+        *            The namespace URI corresponding to the schema wanted
+        * @return The Class Schema representation
+        */
+       public XMPSchema getSchema(String prefix, String nsURI) {
+               Iterator<XMPSchema> it = getAllSchemas().iterator();
+               XMPSchema tmp;
+               while (it.hasNext()) {
+                       tmp = it.next();
+                       if (tmp.getNamespace().equals(nsURI)
+                                       && tmp.getPrefix().equals(prefix)) {
+                               return tmp;
+                       }
+               }
+               return null;
+       }
+
+       /**
+        * Set a unspecialized schema
+        * 
+        * @param nsPrefix
+        *            The prefix wanted for the schema
+        * @param nsURI
+        *            The namespace URI wanted for the schema
+        * @return The schema added in order to work on it
+        */
+       public XMPSchema createAndAddDefaultSchema(String nsPrefix, String 
nsURI) {
+               XMPSchema schem = new XMPSchema(this, nsPrefix, nsURI);
+               schem.setAboutAsSimple("");
+               addSchema(schem);
+               return schem;
+       }
+
+       /**
+        * Create and add a default PDFA Extension schema to this metadata This
+        * method return the created schema to enter information This 
PDFAExtension
+        * is created with all default namespaces used in PDFAExtensionSchema
+        * 
+        * @return PDFAExtension schema added in order to work on it
+        */
+       public PDFAExtensionSchema 
createAndAddPDFAExtensionSchemaWithDefaultNS() {
+               PDFAExtensionSchema pdfAExt = new PDFAExtensionSchema(this);
+               pdfAExt.setAboutAsSimple("");
+               addSchema(pdfAExt);
+               return pdfAExt;
+       }
+
+       /**
+        * Create and add a default XMPRights schema to this metadata This 
method
+        * return the created schema to enter information
+        * 
+        * @return schema added in order to work on it
+        */
+       public XMPRightsManagementSchema 
createAndAddXMPRightsManagementSchema() {
+               XMPRightsManagementSchema rights = new 
XMPRightsManagementSchema(this);
+               rights.setAboutAsSimple("");
+               addSchema(rights);
+               return rights;
+       }
+
+       /**
+        * Create and add a default PDFA Extension schema to this metadata This
+        * method return the created schema to enter information This 
PDFAExtension
+        * is created with specified list of namespaces
+        * 
+        * @param namespaces
+        *            Special namespaces list to use
+        * @return schema added in order to work on it
+        * @throws XmpSchemaException
+        *             If namespaces list not contains PDF/A Extension 
namespace URI
+        */
+       public PDFAExtensionSchema createAndAddPDFAExtensionSchemaWithNS(
+                       Map<String, String> namespaces) throws 
XmpSchemaException {
+               PDFAExtensionSchema pdfAExt = new PDFAExtensionSchema(this);
+               pdfAExt.setAboutAsSimple("");
+               addSchema(pdfAExt);
+               return pdfAExt;
+       }
+
+       /**
+        * Get the PDFA Extension schema This method return null if not found
+        * 
+        * @return The PDFAExtension schema or null if not declared
+        */
+       public PDFAExtensionSchema getPDFExtensionSchema() {
+               return (PDFAExtensionSchema) 
getSchema(PDFAExtensionSchema.PDFAEXTENSIONURI);
+       }
+
+       /**
+        * Create and add a default PDFA Identification schema to this metadata 
This
+        * method return the created schema to enter information
+        * 
+        * @return schema added in order to work on it
+        */
+       public PDFAIdentificationSchema createAndAddPFAIdentificationSchema() {
+               PDFAIdentificationSchema pdfAId = new 
PDFAIdentificationSchema(this);
+               pdfAId.setAboutAsSimple("");
+               addSchema(pdfAId);
+               return pdfAId;
+       }
+
+       /**
+        * Get the PDFA Identification schema This method return null if not 
found
+        * 
+        * @return The PDFAIdentificationSchema schema or null if not declared
+        */
+       public PDFAIdentificationSchema getPDFIdentificationSchema() {
+               return (PDFAIdentificationSchema) 
getSchema(PDFAIdentificationSchema.IDURI);
+       }
+
+       /**
+        * Create and add a default Dublin Core schema to this metadata This 
method
+        * return the created schema to enter information
+        * 
+        * @return schema added in order to work on it
+        */
+       public DublinCoreSchema createAndAddDublinCoreSchema() {
+               DublinCoreSchema dc = new DublinCoreSchema(this);
+               dc.setAboutAsSimple("");
+               addSchema(dc);
+               return dc;
+       }
+
+       /**
+        * Create and add a default Basic Job Ticket schema to this metadata 
This method
+        * return the created schema to enter information
+        * 
+        * @return schema added in order to work on it
+        */
+       public XMPBasicJobTicketSchema createAndAddBasicJobTicketSchema () {
+               XMPBasicJobTicketSchema sc = new XMPBasicJobTicketSchema(this);
+               sc.setAboutAsSimple("");
+               addSchema(sc);
+               return sc;
+       }
+
+
+       /**
+        * Get the Dublin Core schema This method return null if not found
+        * 
+        * @return The DublinCoreSchema schema or null if not declared
+        */
+       public DublinCoreSchema getDublinCoreSchema() {
+               return (DublinCoreSchema) getSchema(DublinCoreSchema.DCURI);
+       }
+
+       /**
+        * Get the Basic JOb Ticket Schema schema This method return null if 
not found
+        * 
+        * @return The XMPBasicJobTicketSchema schema or null if not declared
+        */
+       public XMPBasicJobTicketSchema getBasicJobTicketSchema() {
+               return (XMPBasicJobTicketSchema) 
getSchema(XMPBasicJobTicketSchema.JOB_TICKET_URI);
+       }
+
+
+       /**
+        * Get the XMPRights schema This method return null if not found
+        * 
+        * @return The XMPRightsManagementSchema schema or null if not declared
+        */
+       public XMPRightsManagementSchema getXMPRightsManagementSchema() {
+               return (XMPRightsManagementSchema) 
getSchema(XMPRightsManagementSchema.XMPRIGHTSURI);
+       }
+
+       /**
+        * Get the Photoshop schema This method return null if not found
+        * 
+        * @return The PhotoshopSchema schema or null if not declared
+        */
+       public PhotoshopSchema getPhotoshopSchema() {
+               return (PhotoshopSchema) 
getSchema(PhotoshopSchema.PHOTOSHOPURI);
+       }
+
+       /**
+        * Create and add a XMP Basic schema to this metadata This method 
return the
+        * created schema to enter information
+        * 
+        * @return schema added in order to work on it
+        */
+       public XMPBasicSchema createAndAddXMPBasicSchema() {
+               XMPBasicSchema xmpB = new XMPBasicSchema(this);
+               xmpB.setAboutAsSimple("");
+               addSchema(xmpB);
+               return xmpB;
+       }
+
+       /**
+        * Get the XMP Basic schema This method return null if not found
+        * 
+        * @return The XMPBasicSchema schema or null if not declared
+        */
+       public XMPBasicSchema getXMPBasicSchema() {
+               return (XMPBasicSchema) getSchema(XMPBasicSchema.XMPBASICURI);
+       }
+
+       /**
+        * Create and add a XMP Media Management schema to this metadata This 
method
+        * return the created schema to enter information
+        * 
+        * @return schema added in order to work on it
+        */
+       public XMPMediaManagementSchema createAndAddXMPMediaManagementSchema() {
+               XMPMediaManagementSchema xmpMM = new 
XMPMediaManagementSchema(this);
+               xmpMM.setAboutAsSimple("");
+               addSchema(xmpMM);
+               return xmpMM;
+       }
+
+       /***
+        * create and add Photoshop Schema to this metadata. This method return 
+        * the created schema to enter information
+        * @return
+        */
+       public PhotoshopSchema createAndAddPhotoshopSchema() {
+               PhotoshopSchema photoshop = new PhotoshopSchema(this);
+               photoshop.setAboutAsSimple("");
+               addSchema(photoshop);
+               return photoshop;
+       }
+
+       /**
+        * Get the XMP Media Management schema This method return null if not 
found
+        * 
+        * @return The XMPMediaManagementSchema schema or null if not declared
+        */
+       public XMPMediaManagementSchema getXMPMediaManagementSchema() {
+               return (XMPMediaManagementSchema) 
getSchema(XMPMediaManagementSchema.XMPMMURI);
+       }
+
+       /**
+        * Create and add an Adobe PDF schema to this metadata This method 
return
+        * the created schema to enter information
+        * 
+        * @return schema added in order to work on it
+        */
+       public AdobePDFSchema createAndAddAdobePDFSchema() {
+               AdobePDFSchema pdf = new AdobePDFSchema(this);
+               pdf.setAboutAsSimple("");
+               addSchema(pdf);
+               return pdf;
+       }
+
+       /**
+        * Get the Adobe PDF schema This method return null if not found
+        * 
+        * @return The AdobePDFSchema schema or null if not declared
+        */
+       public AdobePDFSchema getAdobePDFSchema() {
+               return (AdobePDFSchema) getSchema(AdobePDFSchema.PDFURI);
+       }
+
+       /**
+        * Add a schema to the current structure
+        * 
+        * @param obj
+        *            the schema to add
+        */
+       public void addSchema(XMPSchema obj) {
+               schemas.add(obj);
+       }
+
+       /**
+        * Remove a schema
+        * 
+        * @param schema
+        *            The schema to remove
+        */
+       public void removeSchema(XMPSchema schema) {
+               schemas.remove(schema);
+       }
+
 
-    }
 
 }

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
 Thu Aug 30 20:03:39 2012
@@ -118,14 +118,14 @@ public class XMPDocumentBuilder {
        BadFieldValueException {
 
                XMPDocumentBuilder preproc = new XMPDocumentBuilder();
-               XMPMetadata xmpPreproc = preproc.doParsingParsing(xmp,true);
+               XMPMetadata xmpPreproc = 
preproc.doParsingParsing(xmp,true,null);
                populateSchemaMapping(xmpPreproc);
 
 
-               return doParsingParsing(xmp,false);
+               return doParsingParsing(xmp,false,xmpPreproc);
        }
 
-       public XMPMetadata doParsingParsing(byte[] xmp, boolean parseExtension) 
throws XmpParsingException,
+       public XMPMetadata doParsingParsing(byte[] xmp, boolean parseExtension, 
XMPMetadata _metadata) throws XmpParsingException,
        XmpSchemaException, XmpUnknownValueTypeException,
        XmpExpectedRdfAboutAttribute, XmpXpacketEndException,
        BadFieldValueException {
@@ -139,7 +139,9 @@ public class XMPDocumentBuilder {
                        // expect xpacket processing instruction
                        expectNext(XMLStreamReader.PROCESSING_INSTRUCTION,
                                        "Did not find initial xpacket 
processing instruction");
-                       XMPMetadata metadata = 
parseInitialXpacket(reader.get().getPIData());
+                       XMPMetadata meta = 
parseInitialXpacket(reader.get().getPIData());
+                       XMPMetadata metadata = _metadata!=null?_metadata:meta;
+                       metadata.clearSchemas();
 
                        // expect x:xmpmeta
                        expectNextTag(XMLStreamReader.START_ELEMENT,
@@ -207,9 +209,9 @@ public class XMPDocumentBuilder {
                for (XMPSchema xmpSchema : schems) {
                        if 
(xmpSchema.getNamespace().equals(PDFAExtensionSchema.PDFAEXTENSIONURI)) {
                                // ensure the prefix is the preferred one 
(cannot use other definition)
-                               if 
(!xmpSchema.getPrefix().equals(PDFAExtensionSchema.PDFAEXTENSION)) {
+                               if 
(!xmpSchema.getPrefix().equals(PDFAExtensionSchema.PREFERED_PREFIX)) {
                                        throw new 
XmpUnexpectedNamespacePrefixException("Found invalid prefix for PDF/A 
extension, found '"+
-                                                       
xmpSchema.getPrefix()+"', should be '"+PDFAExtensionSchema.PDFAEXTENSION+"'"
+                                                       
xmpSchema.getPrefix()+"', should be '"+PDFAExtensionSchema.PREFERED_PREFIX+"'"
                                                        );
                                }
                                // create schema and types
@@ -219,13 +221,14 @@ public class XMPDocumentBuilder {
                                        if (af instanceof PDFASchemaType) {
                                                PDFASchemaType st = 
(PDFASchemaType)af;
                                                String namespaceUri = 
st.getNamespaceURI();
+                                               String prefix = st.getPrefix();
                                                ArrayProperty properties = 
st.getProperty();
                                                ArrayProperty valueTypes = 
st.getValueType();
                                                XMPSchemaFactory xsf = 
meta.getSchemaMapping().getSchemaFactory(namespaceUri);
                                                // retrieve namespaces
                                                if (xsf==null) {
                                                        // create namespace 
with no field
-                                                       
meta.getSchemaMapping().addNewNameSpace(namespaceUri);
+                                                       
meta.getSchemaMapping().addNewNameSpace(namespaceUri,prefix);
                                                        xsf = 
meta.getSchemaMapping().getSchemaFactory(namespaceUri);
                                                }
                                                // populate value type

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
 Thu Aug 30 20:03:39 2012
@@ -34,7 +34,7 @@ import org.apache.padaf.xmpbox.type.Text
  */
 public class AdobePDFSchema extends XMPSchema {
 
-       public static final String PREFERRED_PDF_PREFIX = "pdf";
+       public static final String PREFERED_PREFIX = "pdf";
 
        public static final String PDFURI = "http://ns.adobe.com/pdf/1.3/";;
 
@@ -54,7 +54,7 @@ public class AdobePDFSchema extends XMPS
         *            The metadata to attach this schema
         */
        public AdobePDFSchema(XMPMetadata metadata) {
-               super(metadata, PREFERRED_PDF_PREFIX, PDFURI);
+               super(metadata, PREFERED_PREFIX, PDFURI);
        }
 
        /**

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
 Thu Aug 30 20:03:39 2012
@@ -39,7 +39,7 @@ import org.apache.padaf.xmpbox.type.Text
  */
 public class DublinCoreSchema extends XMPSchema {
 
-       public static final String PREFERRED_DC_PREFIX = "dc";
+       public static final String PREFERED_PREFIX = "dc";
 
        public static final String DCURI = "http://purl.org/dc/elements/1.1/";;
 
@@ -95,7 +95,7 @@ public class DublinCoreSchema extends XM
         *            The metadata to attach this schema
         */
        public DublinCoreSchema(XMPMetadata metadata) {
-               super(metadata, PREFERRED_DC_PREFIX, DCURI);
+               super(metadata, PREFERED_PREFIX, DCURI);
        }
 
        /**

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
 Thu Aug 30 20:03:39 2012
@@ -33,7 +33,7 @@ import org.apache.padaf.xmpbox.type.Prop
  */
 public class PDFAExtensionSchema extends XMPSchema {
 
-    public static final String PDFAEXTENSION = "pdfaExtension";
+    public static final String PREFERED_PREFIX = "pdfaExtension";
     public static final String PDFAEXTENSIONURI = 
"http://www.aiim.org/pdfa/ns/extension/";;
 
 
@@ -49,7 +49,7 @@ public class PDFAExtensionSchema extends
      *            The metadata to attach this schema XMPMetadata
      */
     public PDFAExtensionSchema(XMPMetadata metadata) {
-        this(metadata,PDFAEXTENSION);
+        this(metadata,PREFERED_PREFIX);
     }
 
     public PDFAExtensionSchema(XMPMetadata metadata, String prefix) {
@@ -62,7 +62,7 @@ public class PDFAExtensionSchema extends
      * @return prefix value
      */
     public String getPrefixValue() {
-        return PDFAEXTENSION;
+        return PREFERED_PREFIX;
 
     }
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
 Thu Aug 30 20:03:39 2012
@@ -38,7 +38,7 @@ import org.apache.padaf.xmpbox.type.Text
  */
 public class PDFAIdentificationSchema extends XMPSchema {
 
-       public static final String IDPREFIX = "pdfaid";
+       public static final String PREFERED_PREFIX = "pdfaid";
 
        public static final String IDURI = "http://www.aiim.org/pdfa/ns/id/";;
 
@@ -65,7 +65,7 @@ public class PDFAIdentificationSchema ex
         *            The metadata to attach this schema
         */
        public PDFAIdentificationSchema(XMPMetadata metadata) {
-               super(metadata, IDPREFIX, IDURI);
+               super(metadata, PREFERED_PREFIX, IDURI);
        }
 
        public PDFAIdentificationSchema(XMPMetadata metadata, String prefix) {
@@ -122,7 +122,7 @@ public class PDFAIdentificationSchema ex
         *            The amendment identifier value to set
         */
        public void setAmd(String value) {
-               TextType amd = new TextType(getMetadata(), null, IDPREFIX, AMD, 
value);
+               TextType amd = new TextType(getMetadata(), null, 
PREFERED_PREFIX, AMD, value);
                addProperty(amd);
        }
 
@@ -146,7 +146,7 @@ public class PDFAIdentificationSchema ex
         */
        public void setConformance(String value) throws BadFieldValueException {
                if (value.equals("A") || value.equals("B")) {
-                       TextType conf = new TextType(getMetadata(), null, 
IDPREFIX, CONFORMANCE, value);
+                       TextType conf = new TextType(getMetadata(), null, 
PREFERED_PREFIX, CONFORMANCE, value);
                        addProperty(conf);
 
                } else {

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PhotoshopSchema.java
 Thu Aug 30 20:03:39 2012
@@ -39,14 +39,14 @@ import org.apache.padaf.xmpbox.type.URIT
 public class PhotoshopSchema extends XMPSchema {
 
        public PhotoshopSchema(XMPMetadata metadata) {
-               super(metadata, PREFERRED_PHOTOSHOP_PREFIX, PHOTOSHOPURI);
+               super(metadata, PREFERED_PREFIX, PHOTOSHOPURI);
        }
 
        public PhotoshopSchema(XMPMetadata metadata, String ownPrefix) {
                super(metadata, ownPrefix, PHOTOSHOPURI);
        }
                                
-       public static final String PREFERRED_PHOTOSHOP_PREFIX = "photoshop";
+       public static final String PREFERED_PREFIX = "photoshop";
 
        public static final String PHOTOSHOPURI = 
"http://ns.adobe.com/photoshop/1.0/";;
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java
 Thu Aug 30 20:03:39 2012
@@ -30,10 +30,15 @@ import org.apache.padaf.xmpbox.type.Refl
 
 public final class SchemaMapping {
 
-       private static Map<String, XMPSchemaFactory> nsMaps;
+       private Map<String, XMPSchemaFactory> nsMaps;
+       
+       private Map<String, String> uriToPrefered;
+       
+       private XMPMetadata metadata;
 
-       static {
+       private void initialize () {
                nsMaps = new HashMap<String, XMPSchemaFactory>();
+               uriToPrefered = new HashMap<String, String>();
                addNameSpace("http://ns.adobe.com/xap/1.0/";, 
XMPBasicSchema.class);
                addNameSpace(DublinCoreSchema.DCURI, DublinCoreSchema.class);
                addNameSpace("http://www.aiim.org/pdfa/ns/extension/";, 
PDFAExtensionSchema.class);
@@ -46,7 +51,9 @@ public final class SchemaMapping {
 
        }
 
-       public SchemaMapping () {
+       public SchemaMapping (XMPMetadata meta) {
+               this.metadata = meta;
+               this.initialize();
        }
        
        
@@ -60,13 +67,25 @@ public final class SchemaMapping {
         * @throws XmpSchemaException
         *             When could not read property name in Schema Class given
         */
-       private static void addNameSpace(String ns, Class<? extends XMPSchema> 
classSchem) {
+       private void addNameSpace(String ns, Class<? extends XMPSchema> 
classSchem) {
                nsMaps.put(ns, new XMPSchemaFactory(ns, classSchem,     
ReflectHelper.initializePropMapping(ns, classSchem)));
+               try {
+                       uriToPrefered.put(ns, 
classSchem.getField("PREFERED_PREFIX").get(null).toString());
+               } catch (IllegalArgumentException e) {
+                       throw new IllegalArgumentException("Failed to init 
'"+ns+"'", e);
+               } catch (SecurityException e) {
+                       throw new IllegalArgumentException("Failed to init 
'"+ns+"'", e);
+               } catch (IllegalAccessException e) {
+                       throw new IllegalArgumentException("Failed to init 
'"+ns+"'", e);
+               } catch (NoSuchFieldException e) {
+                       throw new IllegalArgumentException("Failed to init 
'"+ns+"'", e);
+               }
        }
 
-       public void addNewNameSpace(String ns) {
+       public void addNewNameSpace(String ns,String prefered) {
                PropMapping mapping = new PropMapping(ns);
                nsMaps.put(ns, new XMPSchemaFactory(ns, XMPSchema.class, 
mapping));
+               uriToPrefered.put(ns, prefered);
        }
        
        

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
 Thu Aug 30 20:03:39 2012
@@ -36,7 +36,7 @@ import org.apache.padaf.xmpbox.type.Prop
 
 public class XMPBasicJobTicketSchema extends XMPSchema {
 
-    public static final String PREFERED_JOB_TICKET_PREFIX = "xmpBJ";
+    public static final String PREFERED_PREFIX = "xmpBJ";
 
     public static final String JOB_TICKET_URI = 
"http://ns.adobe.com/xap/1.0/bj/";; 
 
@@ -47,7 +47,7 @@ public class XMPBasicJobTicketSchema ext
 
 
     public XMPBasicJobTicketSchema(XMPMetadata metadata) {
-        this(metadata, PREFERED_JOB_TICKET_PREFIX);
+        this(metadata, PREFERED_PREFIX);
     }
 
     public XMPBasicJobTicketSchema(XMPMetadata metadata, String ownPrefix) {

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicSchema.java
 Thu Aug 30 20:03:39 2012
@@ -46,7 +46,7 @@ import org.apache.padaf.xmpbox.type.URLT
  */
 public class XMPBasicSchema extends XMPSchema {
 
-       public static final String PREFERRED_XMP_PREFIX = "xmp";
+       public static final String PREFERED_PREFIX = "xmp";
 
        public static final String XMPBASICURI = "http://ns.adobe.com/xap/1.0/";;
 
@@ -92,7 +92,7 @@ public class XMPBasicSchema extends XMPS
         *            The metadata to attach this schema
         */
        public XMPBasicSchema(XMPMetadata metadata) {
-               super(metadata, PREFERRED_XMP_PREFIX, XMPBASICURI);
+               super(metadata, PREFERED_PREFIX, XMPBASICURI);
 
        }
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementSchema.java
 Thu Aug 30 20:03:39 2012
@@ -42,7 +42,7 @@ import org.apache.padaf.xmpbox.type.Vers
  */
 public class XMPMediaManagementSchema extends XMPSchema {
 
-       public static final String PREFERRED_XMPMM_PREFIX = "xmpMM";
+       public static final String PREFERED_PREFIX = "xmpMM";
 
        public static final String XMPMMURI = "http://ns.adobe.com/xap/1.0/mm/";;
 
@@ -53,7 +53,7 @@ public class XMPMediaManagementSchema ex
         *            The metadata to attach this schema
         */
        public XMPMediaManagementSchema(XMPMetadata metadata) {
-               super(metadata, PREFERRED_XMPMM_PREFIX, XMPMMURI);
+               super(metadata, PREFERED_PREFIX, XMPMMURI);
 
        }
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
 Thu Aug 30 20:03:39 2012
@@ -38,7 +38,7 @@ import org.apache.padaf.xmpbox.type.URLT
  * 
  */
 public class XMPRightsManagementSchema extends XMPSchema {
-       public static final String PREFERRED_XMPRIGHTS_PREFIX = "xmpRights";
+       public static final String PREFERED_PREFIX = "xmpRights";
 
        public static final String XMPRIGHTSURI = 
"http://ns.adobe.com/xap/1.0/rights/";;
 
@@ -64,7 +64,7 @@ public class XMPRightsManagementSchema e
         *            The metadata to attach this schema
         */
        public XMPRightsManagementSchema(XMPMetadata metadata) {
-               super(metadata, PREFERRED_XMPRIGHTS_PREFIX, XMPRIGHTSURI);
+               super(metadata, PREFERED_PREFIX, XMPRIGHTSURI);
        }
 
        /**

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java?rev=1379111&r1=1379110&r2=1379111&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java
 Thu Aug 30 20:03:39 2012
@@ -71,7 +71,7 @@ public class DoubleSameTypeSchemaTest {
                // We can't use metadata.getDublinCoreSchema() due to 
specification of
                // XMPBox (see Javadoc of XMPMetadata)
                Assert.assertEquals(format, ((DublinCoreSchema) 
metadata.getSchema(
-                               DublinCoreSchema.PREFERRED_DC_PREFIX, 
DublinCoreSchema.DCURI))
+                               DublinCoreSchema.PREFERED_PREFIX, 
DublinCoreSchema.DCURI))
                                .getFormat());
                Assert.assertEquals(coverage, ((DublinCoreSchema) 
metadata.getSchema(
                                ownPrefix, 
DublinCoreSchema.DCURI)).getCoverage());


Reply via email to