You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by gb...@apache.org on 2011/12/07 20:14:06 UTC

svn commit: r1211604 [2/4] - in /pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox: ./ parser/ schema/ type/

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java?rev=1211604&r1=1211603&r2=1211604&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java Wed Dec  7 19:14:05 2011
@@ -64,12 +64,21 @@ import org.apache.padaf.xmpbox.type.Thum
  * 
  */
 public class XMPDocumentBuilder {
+    
     protected NSMapping nsMap;
 
     protected ThreadLocal<XMLStreamReader> reader = new ThreadLocal<XMLStreamReader>();
 
     protected List<XMPDocumentPreprocessor> preprocessors = new ArrayList<XMPDocumentPreprocessor>();
+    
+    public static final String BAG_NAME = "Bag";
+    
+    public static final String SEQ_NAME = "Seq";
 
+    public static final String ALT_NAME = "Alt";
+
+    public static final String VALUE_TYPE_NAME = "valueType";
+    
     /**
      * Constructor of a XMPDocumentBuilder
      * 
@@ -660,7 +669,7 @@ public class XMPDocumentBuilder {
         expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "schemas",
         "Cannot find container declaration of schemas descriptions ");
         // <rdf:Bag>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Bag",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, BAG_NAME,
         "Cannot find bag declaration for container of schemas descriptions");
         // now work on each rdf:li corresponding to each schema description
         int type = reader.get().nextTag();
@@ -716,7 +725,7 @@ public class XMPDocumentBuilder {
                 }
             } else if (reader.get().getLocalName().equals("property")) {
                 parsePropertyDefinition(desc);
-            } else if (reader.get().getLocalName().equals("valueType")) {
+            } else if (reader.get().getLocalName().equals(VALUE_TYPE_NAME)) {
                 parseValueTypeDefinition(desc, metadata);
 
             } else {
@@ -746,7 +755,7 @@ public class XMPDocumentBuilder {
             XMPMetadata metadata) throws XmpParsingException,
             XMLStreamException {
         // <rdf:Seq>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Seq",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, SEQ_NAME,
         "Expected Seq Declaration");
         int elmtType = reader.get().nextTag();
         String type, namespaceURI, prefix, description;
@@ -787,7 +796,7 @@ public class XMPDocumentBuilder {
             }
             elmtType = reader.get().nextTag();
         }
-        expectNextSpecificTag(XMLStreamReader.END_ELEMENT, "valueType",
+        expectNextSpecificTag(XMLStreamReader.END_ELEMENT, VALUE_TYPE_NAME,
         "Expected End of ValueType Declaration");
 
     }
@@ -808,7 +817,7 @@ public class XMPDocumentBuilder {
             XMLStreamException {
         List<PDFAFieldDescription> fields = new ArrayList<PDFAFieldDescription>();
         // <rdf:Seq>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Seq",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, SEQ_NAME,
         "Expected Seq Declaration");
         int elmtType = reader.get().nextTag();
         String name, type, description;
@@ -822,7 +831,7 @@ public class XMPDocumentBuilder {
             while (elmtType == XMLStreamReader.START_ELEMENT) {
                 if (reader.get().getLocalName().equals("name")) {
                     name = reader.get().getElementText();
-                } else if (reader.get().getLocalName().equals("valueType")) {
+                } else if (reader.get().getLocalName().equals(VALUE_TYPE_NAME)) {
                     type = reader.get().getElementText();
                 } else if (reader.get().getLocalName().equals("description")) {
                     description = reader.get().getElementText();
@@ -869,7 +878,7 @@ public class XMPDocumentBuilder {
     throws XmpParsingException, XMLStreamException,
     BadFieldValueException {
         // <rdf:Seq>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Seq",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, SEQ_NAME,
         "Expected Seq Declaration");
         // Each property definition
         int elmtType = reader.get().nextTag();
@@ -885,7 +894,7 @@ public class XMPDocumentBuilder {
             while (elmtType == XMLStreamReader.START_ELEMENT) {
                 if (reader.get().getLocalName().equals("name")) {
                     name = reader.get().getElementText();
-                } else if (reader.get().getLocalName().equals("valueType")) {
+                } else if (reader.get().getLocalName().equals(VALUE_TYPE_NAME)) {
                     type = reader.get().getElementText();
                 } else if (reader.get().getLocalName().equals("category")) {
                     category = reader.get().getElementText();
@@ -1070,12 +1079,12 @@ public class XMPDocumentBuilder {
                 ComplexProperty.UNORDERED_ARRAY);
         container.addProperty(bag);
         // <rdf:Bag>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Bag",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, BAG_NAME,
         "Expected Bag Declaration");
         // Each property definition
         int elmtType = reader.get().nextTag();
         while ((elmtType != XMLStreamReader.END_ELEMENT)
-                && !reader.get().getName().getLocalPart().equals("Bag")) {
+                && !reader.get().getName().getLocalPart().equals(BAG_NAME)) {
             parseXmpSimpleProperty(metadata, reader.get().getName(), stype, bag
                     .getContainer());
             elmtType = reader.get().nextTag();
@@ -1096,12 +1105,12 @@ public class XMPDocumentBuilder {
                 ComplexProperty.UNORDERED_ARRAY);
         container.addProperty(bag);
         // <rdf:Bag>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Bag",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, BAG_NAME,
         "Expected Bag Declaration");
         // Each property definition
         int elmtType = reader.get().nextTag();
         while ((elmtType != XMLStreamReader.END_ELEMENT)
-                && !reader.get().getName().getLocalPart().equals("Bag")) {
+                && !reader.get().getName().getLocalPart().equals(BAG_NAME)) {
             complexParser.parse(metadata, reader.get().getName(), bag.getContainer());
             elmtType = reader.get().nextTag();
 
@@ -1146,12 +1155,12 @@ public class XMPDocumentBuilder {
                 ComplexProperty.ORDERED_ARRAY);
         container.addProperty(seq);
         // <rdf:Bag>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Seq",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, SEQ_NAME,
         "Expected Seq Declaration");
         // Each property definition
         int elmtType = reader.get().nextTag();
         while ((elmtType != XMLStreamReader.END_ELEMENT)
-                && !reader.get().getName().getLocalPart().equals("Seq")) {
+                && !reader.get().getName().getLocalPart().equals(SEQ_NAME)) {
             parseXmpSimpleProperty(metadata, reader.get().getName(), stype, seq
                     .getContainer());
             elmtType = reader.get().nextTag();
@@ -1196,11 +1205,11 @@ public class XMPDocumentBuilder {
                 ComplexProperty.ALTERNATIVE_ARRAY);
         container.addProperty(alt);
         // <rdf:Alt>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Alt",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, ALT_NAME,
         "Expected Alt Declaration");
         int elmtType = reader.get().nextTag();
         while (!((elmtType == XMLStreamReader.END_ELEMENT) && reader.get()
-                .getName().getLocalPart().equals("Alt"))) {
+                .getName().getLocalPart().equals(ALT_NAME))) {
             parseXmpSimpleProperty(metadata, reader.get().getName(), stype, alt
                     .getContainer());
             elmtType = reader.get().nextTag();
@@ -1326,7 +1335,7 @@ public class XMPDocumentBuilder {
         String type;
         int elmtType = reader.get().nextTag();
         while ((elmtType != XMLStreamReader.END_ELEMENT)
-                && !reader.get().getName().getLocalPart().equals("Seq")) {
+                && !reader.get().getName().getLocalPart().equals(SEQ_NAME)) {
 
             type = getPropertyDeclarationInNamespaces(schema, reader.get()
                     .getName());
@@ -1450,8 +1459,6 @@ public class XMPDocumentBuilder {
             parseAltThumbnailProperty(metadata, propertyName, schema
                     .getContent());
         } else {
-            System.out.println(reader.get().getName().getLocalPart()
-                    + " de type " + type);
             throw new XmpUnknownPropertyTypeException("Unknown type : " + type);
         }
 
@@ -1488,11 +1495,11 @@ public class XMPDocumentBuilder {
                 ComplexProperty.ALTERNATIVE_ARRAY);
         container.addProperty(alt);
         // <rdf:Alt>
-        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, "Alt",
+        expectNextSpecificTag(XMLStreamReader.START_ELEMENT, ALT_NAME,
         "Expected Alt Declaration");
         int elmtType = reader.get().nextTag();
         while (!((elmtType == XMLStreamReader.END_ELEMENT) && reader.get()
-                .getName().getLocalPart().equals("Alt"))) {
+                .getName().getLocalPart().equals(ALT_NAME))) {
             parseThumbnailProperty(metadata, reader.get().getName(), alt
                     .getContainer());
             elmtType = reader.get().nextTag();

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java?rev=1211604&r1=1211603&r2=1211604&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java Wed Dec  7 19:14:05 2011
@@ -43,282 +43,281 @@ import org.w3c.dom.Element;
  */
 public class PDFAExtensionSchema extends XMPSchema {
 
-	public static final String PDFAEXTENSION = "pdfaExtension";
-	public static final String PDFAEXTENSIONURI = "http://www.aiim.org/pdfa/ns/extension/";
+    public static final String PDFAEXTENSION = "pdfaExtension";
+    public static final String PDFAEXTENSIONURI = "http://www.aiim.org/pdfa/ns/extension/";
 
-	public static final String PDFASCHEMA = "pdfaSchema";
-	public static final String PDFASCHEMASEP = "pdfaSchema:";
-	public static final String PDFASCHEMAURI = "http://www.aiim.org/pdfa/ns/schema#";
-
-	public static final String PDFAPROPERTY = "pdfaProperty";
-	public static final String PDFAPROPERTYSEP = "pdfaProperty:";	
-	public static final String PDFAPROPERTYURI = "http://www.aiim.org/pdfa/ns/property#";
-
-	public static final String PDFATYPE = "pdfaType";
-	public static final String PDFATYPESEP = "pdfaType:";
-	public static final String PDFATYPEURI = "http://www.aiim.org/pdfa/ns/type#";
-
-	public static final String PDFAFIELD = "pdfaField";
-	public static final String PDFAFIELDSEP = "pdfaField:";
-	public static final String PDFAFIELDURI = "http://www.aiim.org/pdfa/ns/field#";
-
-	@PropertyType(propertyType = "Text")
-	public static final String SCHEMA = "schema";
-
-	@PropertyType(propertyType = "URI")
-	public static final String NS_URI = "namespaceURI";
-
-	@PropertyType(propertyType = "Text")
-	public static final String PREFIX = "prefix";
-
-	@PropertyType(propertyType = "Seq Property")
-	public static final String PROPERTY = "property";
-
-	@PropertyType(propertyType = "Seq ValueType")
-	public static final String VALUETYPE = "valueType";
-
-	private SchemaDescriptionContainer descriptions;
-
-	/**
-	 * Build a new PDFExtension schema
-	 * 
-	 * @param metadata
-	 *            The metadata to attach this schema XMPMetadata
-	 */
-	public PDFAExtensionSchema(XMPMetadata metadata) {
-		this(metadata,PDFAEXTENSION);
-	}
-
-	public PDFAExtensionSchema(XMPMetadata metadata, String prefix) {
-		super(metadata, prefix, PDFAEXTENSIONURI);
-		setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFASCHEMA,
-				PDFASCHEMAURI));
-		setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFAPROPERTY,
-				PDFAPROPERTYURI));
-		setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFATYPE, PDFATYPEURI));
-		setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFAFIELD,
-				PDFAFIELDURI));
-
-		descriptions = new SchemaDescriptionContainer();
-		getElement().appendChild(descriptions.getElement());
-
-	}
-	/**
-	 * Build a new PDFExtension schema with specified namespaces declaration
-	 * 
-	 * @param metadata
-	 *            The metadata to attach this schema
-	 * @param namespaces
-	 *            List of namespaces to define
-	 * @throws XmpSchemaException
-	 *             The namespace URI of PDF/A Extension schema missing
-	 */
-	public PDFAExtensionSchema(XMPMetadata metadata,
-			Map<String, String> namespaces) throws XmpSchemaException {
-		super(metadata, PDFAEXTENSION, PDFAEXTENSIONURI);
-		if (!namespaces.containsKey(PDFAEXTENSION)) {
-			throw new XmpSchemaException(
-					"Extension schema is declared without the pdfaSchema namespace specification");
-		}
-		namespaces.remove(PDFAEXTENSION);
-
-		for (Entry<String, String> entry : namespaces.entrySet()) {
-			setAttribute(new Attribute(NS_NAMESPACE, "xmlns", entry.getKey(),
-					entry.getValue()));
-		}
-		descriptions = new SchemaDescriptionContainer();
-		getElement().appendChild(descriptions.getElement());
-
-	}
-
-	/**
-	 * Give the prefix of the PDF/A Extension schema
-	 * 
-	 * @return prefix value
-	 */
-	public String getPrefixValue() {
-		return PDFAEXTENSION;
-
-	}
-
-	/**
-	 * Give the namespace URI of the PDF/A Extension schema
-	 * 
-	 * @return namespace URI
-	 */
-	public String getNamespaceValue() {
-		return PDFAEXTENSIONURI;
-	}
-
-	/**
-	 * Add to the Extension Schema a new description schema param desc the
-	 * schema description
-	 * 
-	 * @param desc
-	 *            the new schema description
-	 * @return the previous schema with same prefix, null otherwise
-	 */
-	public SchemaDescription addSchemaDescription(SchemaDescription desc) {
-		return descriptions.addSchemaDescription(desc);
-	}
-
-	/**
-	 * create Extension Schema a new description schema
-	 * 
-	 * @return a new empty description schema
-	 */
-	public SchemaDescription createSchemaDescription() {
-		SchemaDescription desc = new SchemaDescription(metadata);
-		return desc;
-	}
-
-	/**
-	 * Give a list of all description declared
-	 * 
-	 * @return List of all schemaDescriptions declared
-	 */
-	public List<SchemaDescription> getDescriptionSchema() {
-		return Collections.unmodifiableList(descriptions.schemaDescriptions);
-	}
-
-	/**
-	 * Give an iterator of all description declared
-	 * 
-	 * @return a SchemaDescription Iterator
-	 */
-	public Iterator<SchemaDescription> getIteratorOfDescriptions() {
-		return descriptions.getAllSchemasDescription();
-	}
-
-	/**
-	 * Container of Description Schema embedded in PDF/A Extension Schema
-	 * 
-	 * @author a183132
-	 * 
-	 */
-	public class SchemaDescriptionContainer implements Elementable {
-
-		protected Element element, content;
-		protected List<SchemaDescription> schemaDescriptions;
-
-		/**
-		 * 
-		 * SchemasDescription Container constructor
-		 */
-		public SchemaDescriptionContainer() {
-			element = metadata.getFuturOwner().createElement(
-					PDFAEXTENSION + ":schemas");
-			content = metadata.getFuturOwner().createElement("rdf:Bag");
-			element.appendChild(content);
-
-			schemaDescriptions = new ArrayList<SchemaDescription>();
-		}
-
-		/**
-		 * Add a SchemaDescription to the current structure
-		 * 
-		 * @param obj
-		 *            the property to add
-		 * @return the old SchemaDescription corresponding to the same namespace
-		 *         prefix if exist, else null
-		 */
-		public SchemaDescription addSchemaDescription(SchemaDescription obj) {
-			SchemaDescription sd = getSameSchemaDescription(obj);
-			if (sd != null) {
-				schemaDescriptions.remove(sd);
-				content.removeChild(sd.content.getElement());
-			}
-			// if(containsSchemaDescription(obj)){
-			// removeSchemaDescription(obj);
-			// }
-			schemaDescriptions.add(obj);
-			content.appendChild(obj.content.getElement());
-			return sd;
-		}
-
-		/**
-		 * Get Schema Description embedded with the same prefix as that given in
-		 * parameters
-		 * 
-		 * @param obj
-		 *            Schema Description with same prefix
-		 * @return The schema Description contained
-		 */
-		protected SchemaDescription getSameSchemaDescription(
-				SchemaDescription obj) {
-			String oPrefix = obj.getPrefix();
-			for (SchemaDescription existing : schemaDescriptions) {
-				if (oPrefix.equals(existing.getPrefix())) {
-					return existing;
-				}
-			}
-			// else not found
-			return null;
-		}
-
-		/**
-		 * Return all SchemaDescription
-		 * 
-		 * @return SchemaDescriptions Iterator in order to be use in PDF/A
-		 *         Extension Schema class
-		 */
-		public Iterator<SchemaDescription> getAllSchemasDescription() {
-			return schemaDescriptions.iterator();
-		}
-
-		// /**
-		// * Check if two SchemaDescription are similar
-		// * @param prop1
-		// * @param prop2
-		// * @return
-		// */
-		// public boolean isSameSchemaDescription(SchemaDescription prop1,
-		// SchemaDescription prop2){
-		// if(prop1.getClass().equals(prop2.getClass()) ){
-		// if(prop1.content.getElement().getTextContent().equals(prop2.content.getElement().getTextContent())){
-		// return true;
-		// }
-		// }
-		// return false;
-		// }
-
-		// /**
-		// * Check if a specified SchemaDescription is embedded
-		// * @param schema
-		// * @return
-		// */
-		// public boolean containsSchemaDescription(SchemaDescription schema){
-		// Iterator<SchemaDescription> it=getAllSchemasDescription();
-		// SchemaDescription tmp;
-		// while(it.hasNext()){
-		// tmp=it.next();
-		// if(isSameSchemaDescription(tmp, schema) ){
-		// return true;
-		// }
-		// }
-		// return false;
-		// }
-
-		// /**
-		// * Remove a schema
-		// * @param schema
-		// */
-		// public void removeSchemaDescription(SchemaDescription schema){
-		// if(containsSchemaDescription(schema)){
-		// schemaDescriptions.remove(schema);
-		// content.removeChild(schema.content.getElement());
-		// }
-		// }
-
-		/**
-		 * Get Dom Element for xml/rdf serialization
-		 * 
-		 * @return the DOM Element
-		 */
-		public Element getElement() {
-			return element;
-		}
+    public static final String PDFASCHEMA = "pdfaSchema";
+    public static final String PDFASCHEMASEP = "pdfaSchema:";
+    public static final String PDFASCHEMAURI = "http://www.aiim.org/pdfa/ns/schema#";
+
+    public static final String PDFAPROPERTY = "pdfaProperty";
+    public static final String PDFAPROPERTYSEP = "pdfaProperty:";	
+    public static final String PDFAPROPERTYURI = "http://www.aiim.org/pdfa/ns/property#";
+
+    public static final String PDFATYPE = "pdfaType";
+    public static final String PDFATYPESEP = "pdfaType:";
+    public static final String PDFATYPEURI = "http://www.aiim.org/pdfa/ns/type#";
+
+    public static final String PDFAFIELD = "pdfaField";
+    public static final String PDFAFIELDSEP = "pdfaField:";
+    public static final String PDFAFIELDURI = "http://www.aiim.org/pdfa/ns/field#";
+
+    @PropertyType(propertyType = "Text")
+    public static final String SCHEMA = "schema";
+
+    @PropertyType(propertyType = "URI")
+    public static final String NS_URI = "namespaceURI";
+
+    @PropertyType(propertyType = "Text")
+    public static final String PREFIX = "prefix";
+
+    @PropertyType(propertyType = "Seq Property")
+    public static final String PROPERTY = "property";
+
+    @PropertyType(propertyType = "Seq ValueType")
+    public static final String VALUETYPE = "valueType";
+
+    private SchemaDescriptionContainer descriptions;
+
+    /**
+     * Build a new PDFExtension schema
+     * 
+     * @param metadata
+     *            The metadata to attach this schema XMPMetadata
+     */
+    public PDFAExtensionSchema(XMPMetadata metadata) {
+        this(metadata,PDFAEXTENSION);
+    }
+
+    public PDFAExtensionSchema(XMPMetadata metadata, String prefix) {
+        super(metadata, prefix, PDFAEXTENSIONURI);
+        setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFASCHEMA,
+                PDFASCHEMAURI));
+        setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFAPROPERTY,
+                PDFAPROPERTYURI));
+        setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFATYPE, PDFATYPEURI));
+        setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFAFIELD,
+                PDFAFIELDURI));
+
+        descriptions = new SchemaDescriptionContainer();
+        getElement().appendChild(descriptions.getElement());
+
+    }
+    /**
+     * Build a new PDFExtension schema with specified namespaces declaration
+     * 
+     * @param metadata
+     *            The metadata to attach this schema
+     * @param namespaces
+     *            List of namespaces to define
+     * @throws XmpSchemaException
+     *             The namespace URI of PDF/A Extension schema missing
+     */
+    public PDFAExtensionSchema(XMPMetadata metadata,
+            Map<String, String> namespaces) throws XmpSchemaException {
+        super(metadata, PDFAEXTENSION, PDFAEXTENSIONURI);
+        if (!namespaces.containsKey(PDFAEXTENSION)) {
+            throw new XmpSchemaException(
+            "Extension schema is declared without the pdfaSchema namespace specification");
+        }
+        namespaces.remove(PDFAEXTENSION);
+
+        for (Entry<String, String> entry : namespaces.entrySet()) {
+            setAttribute(new Attribute(NS_NAMESPACE, "xmlns", entry.getKey(),
+                    entry.getValue()));
+        }
+        descriptions = new SchemaDescriptionContainer();
+        getElement().appendChild(descriptions.getElement());
+
+    }
+
+    /**
+     * Give the prefix of the PDF/A Extension schema
+     * 
+     * @return prefix value
+     */
+    public String getPrefixValue() {
+        return PDFAEXTENSION;
+
+    }
+
+    /**
+     * Give the namespace URI of the PDF/A Extension schema
+     * 
+     * @return namespace URI
+     */
+    public String getNamespaceValue() {
+        return PDFAEXTENSIONURI;
+    }
+
+    /**
+     * Add to the Extension Schema a new description schema param desc the
+     * schema description
+     * 
+     * @param desc
+     *            the new schema description
+     * @return the previous schema with same prefix, null otherwise
+     */
+    public SchemaDescription addSchemaDescription(SchemaDescription desc) {
+        return descriptions.addSchemaDescription(desc);
+    }
+
+    /**
+     * create Extension Schema a new description schema
+     * 
+     * @return a new empty description schema
+     */
+    public SchemaDescription createSchemaDescription() {
+        return new SchemaDescription(metadata);
+    }
+
+    /**
+     * Give a list of all description declared
+     * 
+     * @return List of all schemaDescriptions declared
+     */
+    public List<SchemaDescription> getDescriptionSchema() {
+        return Collections.unmodifiableList(descriptions.schemaDescriptions);
+    }
+
+    /**
+     * Give an iterator of all description declared
+     * 
+     * @return a SchemaDescription Iterator
+     */
+    public Iterator<SchemaDescription> getIteratorOfDescriptions() {
+        return descriptions.getAllSchemasDescription();
+    }
+
+    /**
+     * Container of Description Schema embedded in PDF/A Extension Schema
+     * 
+     * @author a183132
+     * 
+     */
+    public class SchemaDescriptionContainer implements Elementable {
+
+        protected Element element, content;
+        protected List<SchemaDescription> schemaDescriptions;
+
+        /**
+         * 
+         * SchemasDescription Container constructor
+         */
+        public SchemaDescriptionContainer() {
+            element = metadata.getFuturOwner().createElement(
+                    PDFAEXTENSION + ":schemas");
+            content = metadata.getFuturOwner().createElement("rdf:Bag");
+            element.appendChild(content);
+
+            schemaDescriptions = new ArrayList<SchemaDescription>();
+        }
+
+        /**
+         * Add a SchemaDescription to the current structure
+         * 
+         * @param obj
+         *            the property to add
+         * @return the old SchemaDescription corresponding to the same namespace
+         *         prefix if exist, else null
+         */
+        public SchemaDescription addSchemaDescription(SchemaDescription obj) {
+            SchemaDescription sd = getSameSchemaDescription(obj);
+            if (sd != null) {
+                schemaDescriptions.remove(sd);
+                content.removeChild(sd.content.getElement());
+            }
+            // if(containsSchemaDescription(obj)){
+            // removeSchemaDescription(obj);
+            // }
+            schemaDescriptions.add(obj);
+            content.appendChild(obj.content.getElement());
+            return sd;
+        }
+
+        /**
+         * Get Schema Description embedded with the same prefix as that given in
+         * parameters
+         * 
+         * @param obj
+         *            Schema Description with same prefix
+         * @return The schema Description contained
+         */
+        protected SchemaDescription getSameSchemaDescription(
+                SchemaDescription obj) {
+            String oPrefix = obj.getPrefix();
+            for (SchemaDescription existing : schemaDescriptions) {
+                if (oPrefix.equals(existing.getPrefix())) {
+                    return existing;
+                }
+            }
+            // else not found
+            return null;
+        }
+
+        /**
+         * Return all SchemaDescription
+         * 
+         * @return SchemaDescriptions Iterator in order to be use in PDF/A
+         *         Extension Schema class
+         */
+        public Iterator<SchemaDescription> getAllSchemasDescription() {
+            return schemaDescriptions.iterator();
+        }
+
+        // /**
+        // * Check if two SchemaDescription are similar
+        // * @param prop1
+        // * @param prop2
+        // * @return
+        // */
+        // public boolean isSameSchemaDescription(SchemaDescription prop1,
+        // SchemaDescription prop2){
+        // if(prop1.getClass().equals(prop2.getClass()) ){
+        // if(prop1.content.getElement().getTextContent().equals(prop2.content.getElement().getTextContent())){
+        // return true;
+        // }
+        // }
+        // return false;
+        // }
+
+        // /**
+        // * Check if a specified SchemaDescription is embedded
+        // * @param schema
+        // * @return
+        // */
+        // public boolean containsSchemaDescription(SchemaDescription schema){
+        // Iterator<SchemaDescription> it=getAllSchemasDescription();
+        // SchemaDescription tmp;
+        // while(it.hasNext()){
+        // tmp=it.next();
+        // if(isSameSchemaDescription(tmp, schema) ){
+        // return true;
+        // }
+        // }
+        // return false;
+        // }
+
+        // /**
+        // * Remove a schema
+        // * @param schema
+        // */
+        // public void removeSchemaDescription(SchemaDescription schema){
+        // if(containsSchemaDescription(schema)){
+        // schemaDescriptions.remove(schema);
+        // content.removeChild(schema.content.getElement());
+        // }
+        // }
+
+        /**
+         * Get Dom Element for xml/rdf serialization
+         * 
+         * @return the DOM Element
+         */
+        public Element getElement() {
+            return element;
+        }
 
-	}
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java?rev=1211604&r1=1211603&r2=1211604&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationSchema.java Wed Dec  7 19:14:05 2011
@@ -21,8 +21,6 @@
 
 package org.apache.padaf.xmpbox.schema;
 
-import java.util.List;
-
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.Attribute;
@@ -190,7 +188,7 @@ public class PDFAIdentificationSchema ex
 		} else {
 			for (Attribute attribute : getAllAttributes()) {
 				if (attribute.getQualifiedName().equals(IDPREFIXSEP + PART)) {
-					return new Integer(attribute.getValue());
+					return Integer.valueOf(attribute.getValue());
 				}
 			}
 			return null;

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java?rev=1211604&r1=1211603&r2=1211604&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java Wed Dec  7 19:14:05 2011
@@ -30,13 +30,12 @@ import org.apache.padaf.xmpbox.type.Attr
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.ComplexProperty;
 import org.apache.padaf.xmpbox.type.JobType;
-import org.apache.padaf.xmpbox.type.LayerType;
 
 public class XMPBasicJobTicketSchema extends XMPSchema {
 
-    public static String PREFERED_JOB_TICKET_PREFIX = "xmpBJ";
+    public static final String PREFERED_JOB_TICKET_PREFIX = "xmpBJ";
 
-    public static String JOB_TICKET_URI = "http://ns.adobe.com/xap/1.0/bj/"; 
+    public static final String JOB_TICKET_URI = "http://ns.adobe.com/xap/1.0/bj/"; 
 
     @PropertyType(propertyType = "bag Job")
     public static final String JOB_REF = "JobRef";