pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gbaill...@apache.org
Subject svn commit: r1377229 - in /pdfbox/branches/xmpbox-refactoring/xmpbox/src: main/java/org/apache/padaf/xmpbox/ main/java/org/apache/padaf/xmpbox/parser/ main/java/org/apache/padaf/xmpbox/schema/ main/java/org/apache/padaf/xmpbox/type/ test/java/org/apach...
Date Sat, 25 Aug 2012 07:27:41 GMT
Author: gbailleul
Date: Sat Aug 25 07:27:39 2012
New Revision: 1377229

URL: http://svn.apache.org/viewvc?rev=1377229&view=rev
Log:
PDFBOX-1343: Reduced duplicate code on PI parsing

Removed:
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMLUtil.java
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/XmpConstants.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMLPropertiesDescriptionManager.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/parser/XmpSerializer.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/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/XMPRightsManagementSchema.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ReflectHelper.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeDescription.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/TestXMPWithDefinedSchemas.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.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=1377229&r1=1377228&r2=1377229&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 Sat Aug 25 07:27:39 2012
@@ -25,7 +25,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-//import org.apache.padaf.xmpbox.parser.CreateXMPMetadataException;
+import org.apache.padaf.xmpbox.parser.CreateXMPMetadataException;
 import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
 import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
 import org.apache.padaf.xmpbox.schema.NSMapping;
@@ -54,16 +54,15 @@ import org.apache.padaf.xmpbox.type.Type
  */
 public class XMPMetadata {
 
-    private String xpacketId = "W5M0MpCehiHzreSzNTczkc9d";
+    private String xpacketId = null;
     
-    private String xpacketBegin = "\uFEFF";
+    private String xpacketBegin = null;
 
-    // TODO DEPRECATED (SHOULD STAY NULL (Default value))
-    private String xpacketBytes;
+    private String xpacketBytes = null;
     
-    private String xpacketEncoding;
+    private String xpacketEncoding = null;
 
-    private String xpacketEndData = "end=\"w\"";
+    private String xpacketEndData = XmpConstants.DEFAULT_XPACKET_END;
 
     private SchemasContainer schemas;
     
@@ -73,21 +72,20 @@ public class XMPMetadata {
     
     private SchemaMapping schemaMapping;
 
-//    private XMPDocumentBuilder builder;
-
     /**
      * Contructor of an empty default XMPMetaData
      * 
      * @throws CreateXMPMetadataException
      *             If DOM Document associated could not be created
      */
-    protected XMPMetadata(TypeMapping tm) {
-//      	this.builder = builder;
-        schemas = new SchemasContainer();
-        this.typeMapping = tm;
-        this.nsMapping = new NSMapping(this);
-        this.schemaMapping = new SchemaMapping();
-        
+    // TODO GBL GBA make protected
+    protected XMPMetadata() {
+    	this (
+    			XmpConstants.DEFAULT_XPACKET_BEGIN,
+    			XmpConstants.DEFAULT_XPACKET_ID,
+    			XmpConstants.DEFAULT_XPACKET_BYTES, 
+    			XmpConstants.DEFAULT_XPACKET_ENCODING
+    			);
     }
 
     /**
@@ -105,15 +103,28 @@ public class XMPMetadata {
      * @throws CreateXMPMetadataException
      *             If DOM Document associated could not be created
      */
-    protected XMPMetadata(TypeMapping tm, String xpacketBegin, String xpacketId,
+    // TODO GBL GBA make protected
+    protected XMPMetadata(String xpacketBegin, String xpacketId,
             String xpacketBytes, String xpacketEncoding) {
-    	this(tm);
-//    	this.builder = builder;
-        this.xpacketBegin = xpacketBegin;
+//    	this(tm);
+        this.schemas = new SchemasContainer();
+        this.typeMapping = new TypeMapping();
+        this.nsMapping = new NSMapping(this);
+        this.schemaMapping = new SchemaMapping();
+
+    	this.xpacketBegin = xpacketBegin;
         this.xpacketId = xpacketId;
         this.xpacketBytes = xpacketBytes;
         this.xpacketEncoding = xpacketEncoding;
-        schemas = new SchemasContainer();
+    }
+
+    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 () {

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpConstants.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpConstants.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpConstants.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpConstants.java Sat Aug 25 07:27:39 2012
@@ -23,6 +23,16 @@ package org.apache.padaf.xmpbox;
 public final class XmpConstants {
 
 	public static final String RDF_NAMESPACE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+	
+	public static final String DEFAULT_XPACKET_BEGIN = "\uFEFF";
+	
+	public static final String DEFAULT_XPACKET_ID = "W5M0MpCehiHzreSzNTczkc9d";
+	
+	public static final String DEFAULT_XPACKET_ENCODING = "UTF-8";
+	
+	public static final String DEFAULT_XPACKET_BYTES = null;
+	
+	public static final String DEFAULT_XPACKET_END = "w";
 
 	private XmpConstants () {
 		// hide constructor

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java Sat Aug 25 07:27:39 2012
@@ -45,14 +45,14 @@ public class StructuredPropertyParser {
 
 	private XMPDocumentBuilder builder = null;
 
-	private TypeDescription description = null;
+	private TypeDescription<AbstractStructuredType> description = null;
 
 	private PropMapping propDesc = null;
 	
 	private boolean isDefinedStructureType = false;
 	
 
-	public StructuredPropertyParser(XMPDocumentBuilder builder, TypeDescription td) 
+	public StructuredPropertyParser(XMPDocumentBuilder builder, TypeDescription<AbstractStructuredType> td) 
 			throws XmpPropertyFormatException {
 		this.builder = builder;
 		this.description = td;
@@ -183,21 +183,21 @@ public class StructuredPropertyParser {
 				}
 
 				if (reader.getEventType()==XMLStreamConstants.START_ELEMENT) {
-					TypeDescription td = metadata.getTypeMapping().getStructuredTypeName(eltName.getNamespaceURI());
+					TypeDescription<AbstractStructuredType> td = metadata.getTypeMapping().getStructuredTypeName(eltName.getNamespaceURI());
 					if (td==null) {
 						throw new XmpUnexpectedNamespaceURIException("No namespace defined with name "+eltName.getNamespaceURI());
 					}
 
 					String ptype = td.getProperties().getPropertyType(eltName.getLocalPart());
 					if (metadata.getTypeMapping().isStructuredType(ptype)) {
-						TypeDescription tclass = metadata.getTypeMapping().getTypeDescription(ptype);
+						TypeDescription<AbstractStructuredType> tclass = (TypeDescription<AbstractStructuredType>)metadata.getTypeMapping().getTypeDescription(ptype);
 						StructuredPropertyParser sp = new StructuredPropertyParser(builder, tclass);
 						sp.parseSimple(metadata, reader.getName(), property.getContainer(),isSubSkipDescription,subExpected);// TODO
 					} else if (metadata.getTypeMapping().getArrayType(ptype)!=null) {
 						int pos = ptype.indexOf(' ');
 						String arrayType = metadata.getTypeMapping().getArrayType(ptype);
 						String typeInArray = ptype.substring(pos+1);
-						TypeDescription tclass = metadata.getTypeMapping().getTypeDescription(typeInArray);
+						TypeDescription<AbstractStructuredType> tclass = (TypeDescription<AbstractStructuredType>)metadata.getTypeMapping().getTypeDescription(typeInArray);
 						ArrayProperty cp = new ArrayProperty(metadata,null,
 								eltName.getPrefix(), eltName.getLocalPart(),
 								arrayType);
@@ -247,7 +247,7 @@ public class StructuredPropertyParser {
 			String propertyName,
 			String valueAsString) 
 					throws XmpParsingException {
-		TypeDescription description = metadata.getTypeMapping().getTypeDescription(type);
+		TypeDescription<AbstractSimpleProperty> description = (TypeDescription<AbstractSimpleProperty>)metadata.getTypeMapping().getTypeDescription(type);
 		Object value = null;
 		switch (description.getBasic()) {
 		case Boolean : 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMLPropertiesDescriptionManager.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMLPropertiesDescriptionManager.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMLPropertiesDescriptionManager.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMLPropertiesDescriptionManager.java Sat Aug 25 07:27:39 2012
@@ -26,10 +26,10 @@ import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.pdfbox.io.IOUtils;
 import org.apache.padaf.xmpbox.BuildPDFAExtensionSchemaDescriptionException;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.apache.padaf.xmpbox.type.PropertyDescription;
+import org.apache.pdfbox.io.IOUtils;
 
 import com.thoughtworks.xstream.XStream;
 import com.thoughtworks.xstream.io.xml.DomDriver;

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=1377229&r1=1377228&r2=1377229&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 Sat Aug 25 07:27:39 2012
@@ -87,30 +87,6 @@ public class XMPDocumentBuilder {
 	public XMPDocumentBuilder() throws XmpSchemaException {
 	}
 
-	public XMPMetadata createXMPMetadata () throws CreateXMPMetadataException {
-		return new WrappedXMPMetadata(new TypeMapping());
-	}
-
-	public XMPMetadata createXMPMetadata (String begin, String id, String bytes, String encoding) throws CreateXMPMetadataException {
-		return new WrappedXMPMetadata(new TypeMapping(),begin, id, bytes, encoding);
-
-	}
-	protected class WrappedXMPMetadata extends XMPMetadata {
-
-		public WrappedXMPMetadata(TypeMapping tm) throws CreateXMPMetadataException {
-			super(tm);
-		}
-
-		public WrappedXMPMetadata(TypeMapping tm, String xpacketBegin, String xpacketId,
-				String xpacketBytes, String xpacketEncoding)
-						throws CreateXMPMetadataException {
-			super(tm, xpacketBegin, xpacketId, xpacketBytes, xpacketEncoding);
-		}
-
-
-	}
-
-
 	/**
 	 * Parsing method. Return a XMPMetadata object with all elements read
 	 * 
@@ -213,23 +189,7 @@ public class XMPDocumentBuilder {
 			if (!reader.get().getPITarget().equals("xpacket")) {
 				throw new XmpXpacketEndException("Excepted PI xpacket");
 			}
-			String xpackData = reader.get().getPIData();
-			// end attribute must be present and placed in first
-			// xmp spec says Other unrecognized attributes can follow, but
-			// should be ignored
-			if (xpackData.startsWith("end=")) {
-				// check value (5 for end='X')
-				if (xpackData.charAt(5)!='r' && xpackData.charAt(5)!='w') {
-					throw new XmpXpacketEndException(
-							"Excepted xpacket 'end' attribute with value 'r' or 'w' ");
-				}
-			} else {
-				// should find end='r/w'
-				throw new XmpXpacketEndException(
-						"Excepted xpacket 'end' attribute (must be present and placed in first)");
-			}
-
-			metadata.setEndXPacket(xpackData);
+			parseEndPacket(metadata);
 			// return constructed object
 			return metadata;
 		} catch (XMLStreamException e) {
@@ -295,6 +255,7 @@ public class XMPDocumentBuilder {
 													throw new XmpRequiredPropertyException("Missing field in field definition");
 												}
 												// create the type
+//												TypeDescription vtd = meta.getTypeMapping().getTypeDescription(fValueType);
 												TypeDescription vtd = meta.getTypeMapping().getTypeDescription(fValueType);
 												if (vtd!=null) {
 													// a type is found
@@ -327,6 +288,7 @@ public class XMPDocumentBuilder {
 									throw new XmpRequiredPropertyException("Missing field in property definition");
 								}
 								// check ptype existance
+//								TypeDescription td = meta.getTypeMapping().getTypeDescription(ptype);
 								TypeDescription td = meta.getTypeMapping().getTypeDescription(ptype);
 								if (td==null) {
 									// type not defined
@@ -436,9 +398,30 @@ public class XMPDocumentBuilder {
 						"Unknown attribute in xpacket PI : '" + token + "'");
 			}
 		}
-		return new WrappedXMPMetadata(new TypeMapping(),begin, id, bytes, encoding);
+		return XMPMetadata.createXMPMetadata(begin, id, bytes, encoding);
 	}
 
+	protected void parseEndPacket (XMPMetadata metadata) throws XmpXpacketEndException {
+		String xpackData = reader.get().getPIData();
+		// end attribute must be present and placed in first
+		// xmp spec says Other unrecognized attributes can follow, but
+		// should be ignored
+		if (xpackData.startsWith("end=")) {
+			char end = xpackData.charAt(5);
+			// check value (5 for end='X')
+			if (end!='r' && end!='w') {
+				throw new XmpXpacketEndException(
+						"Excepted xpacket 'end' attribute with value 'r' or 'w' ");
+			} else {
+				metadata.setEndXPacket(Character.toString(end));
+			}
+		} else {
+			// should find end='r/w'
+			throw new XmpXpacketEndException(
+					"Excepted xpacket 'end' attribute (must be present and placed in first)");
+		}
+	}
+	
 	/**
 	 * Check the next element type. all comments are ignored.
 	 * 
@@ -923,10 +906,10 @@ public class XMPDocumentBuilder {
 		if (type.equals("Lang Alt")) {
 			parseSimplePropertyArray(metadata, propertyName, ArrayProperty.ALTERNATIVE_ARRAY, typeMapping.getTypeDescription("Text"), schema.getContent());
 		} else if (typeMapping.isSimpleType(type)) {
-			TypeDescription tclass = typeMapping.getTypeDescription(type);
+			TypeDescription<?> tclass = typeMapping.getTypeDescription(type);
 			parseSimpleProperty(metadata, propertyName, tclass, schema.getContent());
 		} else if (typeMapping.isStructuredType(type)) {
-			TypeDescription tclass = typeMapping.getTypeDescription(type);
+			TypeDescription<AbstractStructuredType> tclass = (TypeDescription<AbstractStructuredType>)typeMapping.getTypeDescription(type);
 			StructuredPropertyParser parser = new StructuredPropertyParser(
 					this, tclass);
 			parseStructuredProperty(metadata, parser, schema.getContent());
@@ -935,21 +918,22 @@ public class XMPDocumentBuilder {
 			int pos = type.indexOf(' ');
 			String arrayType = typeMapping.getArrayType(type);
 			String typeInArray = type.substring(pos+1);
-			TypeDescription tclass = typeMapping.getTypeDescription(typeInArray);
-			Class<? extends AbstractField> tcn = tclass.getTypeClass();
+//			if (typeMapping.is)
+//		TypeDescription<AbstractStructuredType> tclass = typeMapping.getTypeDescription(typeInArray);
+//			Class<? extends AbstractField> tcn = tclass.getTypeClass();
 
-			if (AbstractSimpleProperty.class.isAssignableFrom(tcn)) {
+			if (typeMapping.isSimpleType(typeInArray)) {
 				// array of simple
 				parseSimplePropertyArray(
 						metadata, 
 						propertyName, 
 						arrayType, 
-						tclass,
+						typeMapping.getTypeDescription(typeInArray),
 						schema.getContent());
-			} else if (AbstractStructuredType.class.isAssignableFrom(tcn)) {
+			} else if (typeMapping.isStructuredType(typeInArray)) {
 				// array of structured
 				StructuredPropertyParser parser = new StructuredPropertyParser(
-						this, tclass);
+						this, (TypeDescription<AbstractStructuredType>)typeMapping.getTypeDescription(typeInArray));
 				parseStructuredPropertyArray(metadata, propertyName, arrayType, parser, schema.getContent());
 			} else {
 				// invalid case

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java Sat Aug 25 07:27:39 2012
@@ -20,13 +20,19 @@
 
 package org.apache.padaf.xmpbox.parser;
 
-import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.XmpConstants;
@@ -36,9 +42,9 @@ import org.apache.padaf.xmpbox.type.Abst
 import org.apache.padaf.xmpbox.type.AbstractStructuredType;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.Attribute;
-import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 import org.w3c.dom.ProcessingInstruction;
 
 public class XmpSerializer {
@@ -67,7 +73,7 @@ public class XmpSerializer {
 				rdf.appendChild(createSchemaElement(doc, schema));
 			}
 			// save
-			XMLUtil.save(doc, os, "UTF-8");
+			save(doc, os, "UTF-8");
 		} catch (Exception e) {
 			// TODO supprimer
 			throw new TransformException(
@@ -96,6 +102,7 @@ public class XmpSerializer {
 		return selem;
 	}
 
+	// TODO GBL rename method
 	public void xxxxxxx (Document doc, Element parent, List<AbstractField> fields) {
 		for (AbstractField field : fields) {
 			if (field instanceof AbstractSimpleProperty) {
@@ -155,8 +162,8 @@ public class XmpSerializer {
 		// ending xpacket
 		if (withXpacket) {
 			ProcessingInstruction endXPacket = doc
-					.createProcessingInstruction("xpacket", metadata
-							.getEndXPacket());
+					.createProcessingInstruction("xpacket", "end=\""+metadata
+							.getEndXPacket()+"\"");
 			doc.appendChild(endXPacket);
 		}
 		// rdf element
@@ -167,5 +174,35 @@ public class XmpSerializer {
 		return rdf;
 	}
   
-	
+    /**
+     * Save the XML document to an output stream.
+     * 
+     * @param doc
+     *            The XML document to save.
+     * @param outStream
+     *            The stream to save the document to.
+     * @param encoding
+     *            The encoding to save the file as.
+     * 
+     * @throws TransformerException
+     *             If there is an error while saving the XML.
+     */
+    private void save(Node doc, OutputStream outStream, String encoding)
+    throws TransformerException {
+        Transformer transformer = TransformerFactory.newInstance()
+        .newTransformer();
+        // human readable
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        // indent elements
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+        // encoding
+        transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
+        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
+        "yes");
+        // initialize StreamResult with File object to save to file
+        Result result = new StreamResult(outStream);
+        DOMSource source = new DOMSource(doc);
+        // save
+        transformer.transform(source, result);
+    }	
 }

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=1377229&r1=1377228&r2=1377229&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 Sat Aug 25 07:27:39 2012
@@ -26,8 +26,8 @@ import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.AbstractField;
-import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.DateType;
 import org.apache.padaf.xmpbox.type.IntegerType;
 import org.apache.padaf.xmpbox.type.LayerType;

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=1377229&r1=1377228&r2=1377229&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 Sat Aug 25 07:27:39 2012
@@ -26,9 +26,9 @@ import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.Attribute;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
-import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.JobType;
 import org.apache.padaf.xmpbox.type.PropertyType;
 

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=1377229&r1=1377228&r2=1377229&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 Sat Aug 25 07:27:39 2012
@@ -28,8 +28,8 @@ import java.util.List;
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.AgentNameType;
-import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.DateType;
 import org.apache.padaf.xmpbox.type.IntegerType;
 import org.apache.padaf.xmpbox.type.PropertyType;

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=1377229&r1=1377228&r2=1377229&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 Sat Aug 25 07:27:39 2012
@@ -24,8 +24,8 @@ package org.apache.padaf.xmpbox.schema;
 import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.type.BooleanType;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
+import org.apache.padaf.xmpbox.type.BooleanType;
 import org.apache.padaf.xmpbox.type.PropertyType;
 import org.apache.padaf.xmpbox.type.TextType;
 import org.apache.padaf.xmpbox.type.URLType;

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java Sat Aug 25 07:27:39 2012
@@ -30,10 +30,10 @@ import java.util.List;
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
+import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.Attribute;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.BooleanType;
-import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
 import org.apache.padaf.xmpbox.type.DateType;
 import org.apache.padaf.xmpbox.type.IntegerType;

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ReflectHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ReflectHelper.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ReflectHelper.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ReflectHelper.java Sat Aug 25 07:27:39 2012
@@ -23,6 +23,8 @@ package org.apache.padaf.xmpbox.type;
 
 import java.lang.reflect.Field;
 
+import org.apache.padaf.xmpbox.schema.XmpSchemaException;
+
 
 public final class ReflectHelper {
 
@@ -41,7 +43,7 @@ public final class ReflectHelper {
 	 *             When could not read property name in field with properties
 	 *             annotations
 	 */
-	public final static PropMapping initializePropMapping(String ns,
+	public static PropMapping initializePropMapping(String ns,
 			Class<?> classSchem) {
 		PropMapping propMap = new PropMapping(ns);
 		Field [] fields = classSchem.getFields();

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeDescription.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeDescription.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeDescription.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeDescription.java Sat Aug 25 07:27:39 2012
@@ -23,7 +23,7 @@ package org.apache.padaf.xmpbox.type;
 
 
 
-public class TypeDescription {
+public class TypeDescription<T> {
 
 	public enum BasicType {	Text, Date, Integer, Boolean, Real}
 
@@ -31,11 +31,11 @@ public class TypeDescription {
 	
 	private BasicType basic;
 	
-	private Class<? extends AbstractField> clz;
+	private Class<? extends T> clz;
 	
 	private PropMapping properties = null;
 
-	public TypeDescription(String type, BasicType basic,Class<? extends AbstractField> clz) {
+	public TypeDescription(String type, BasicType basic,Class<? extends T> clz) {
 		super();
 		this.type = type;
 		this.basic = basic;
@@ -46,7 +46,7 @@ public class TypeDescription {
 		return type;
 	}
 
-	public Class<? extends AbstractField> getTypeClass() {
+	public Class<? extends T> getTypeClass() {
 		return clz;
 	}
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java Sat Aug 25 07:27:39 2012
@@ -34,19 +34,19 @@ public final class TypeMapping {
 
 
 
-	private Map<String,TypeDescription> BASIC_TYPES;
+	private Map<String,TypeDescription<AbstractSimpleProperty>> BASIC_TYPES;
 
-	private Map<Class<? extends AbstractField>,TypeDescription> BASIC_CLASSES;
+	private Map<Class<? extends AbstractField>,TypeDescription<AbstractSimpleProperty>> BASIC_CLASSES;
 
-	private Map<String,TypeDescription> DERIVED_TYPES;
+	private Map<String,TypeDescription<AbstractSimpleProperty>> DERIVED_TYPES;
 
-	private Map<Class<? extends AbstractField>,TypeDescription> DERIVED_CLASSES;
+	private Map<Class<? extends AbstractField>,TypeDescription<AbstractSimpleProperty>> DERIVED_CLASSES;
 
-	private Map<String, TypeDescription> STRUCTURED_TYPES;
+	private Map<String, TypeDescription<AbstractStructuredType>> STRUCTURED_TYPES;
 
-	private Map<Class<? extends AbstractField>,TypeDescription> STRUCTURED_CLASSES;
+	private Map<Class<? extends AbstractField>,TypeDescription<AbstractStructuredType>> STRUCTURED_CLASSES;
 
-	private Map<String,TypeDescription> STRUCTURED_NAMESPACES;
+	private Map<String,TypeDescription<AbstractStructuredType>> STRUCTURED_NAMESPACES;
 
 	public TypeMapping() {
 		initialize();
@@ -63,61 +63,61 @@ public final class TypeMapping {
 
 	private void initialize () {
 		// basic
-		BASIC_TYPES = new HashMap<String,TypeDescription>();
-		BASIC_CLASSES = new HashMap<Class<? extends AbstractField>, TypeDescription>();
-		addToBasicMaps(new TypeDescription("Text",BasicType.Text,TextType.class));
-		addToBasicMaps(new TypeDescription("Date",BasicType.Date,DateType.class));
-		addToBasicMaps(new TypeDescription("Boolean",BasicType.Boolean,BooleanType.class));
-		addToBasicMaps(new TypeDescription("Integer",BasicType.Integer,IntegerType.class));
-		addToBasicMaps(new TypeDescription("Real",BasicType.Real,RealType.class));
+		BASIC_TYPES = new HashMap<String,TypeDescription<AbstractSimpleProperty>>();
+		BASIC_CLASSES = new HashMap<Class<? extends AbstractField>, TypeDescription<AbstractSimpleProperty>>();
+		addToBasicMaps(new TypeDescription<AbstractSimpleProperty>("Text",BasicType.Text,TextType.class));
+		addToBasicMaps(new TypeDescription<AbstractSimpleProperty>("Date",BasicType.Date,DateType.class));
+		addToBasicMaps(new TypeDescription<AbstractSimpleProperty>("Boolean",BasicType.Boolean,BooleanType.class));
+		addToBasicMaps(new TypeDescription<AbstractSimpleProperty>("Integer",BasicType.Integer,IntegerType.class));
+		addToBasicMaps(new TypeDescription<AbstractSimpleProperty>("Real",BasicType.Real,RealType.class));
 
 		// derived
-		DERIVED_TYPES = new HashMap<String,TypeDescription>();
-		DERIVED_CLASSES = new HashMap<Class<? extends AbstractField>, TypeDescription>();
-		addToDerivedMaps(new TypeDescription("AgentName",BasicType.Text,AgentNameType.class));
-		addToDerivedMaps(new TypeDescription("Choice",BasicType.Text,ChoiceType.class));
-		addToDerivedMaps(new TypeDescription("GUID",BasicType.Text,GUIDType.class));
-		addToDerivedMaps(new TypeDescription("Lang Alt",BasicType.Text,TextType.class));
-		addToDerivedMaps(new TypeDescription("Locale",BasicType.Text,LocaleType.class));
-		addToDerivedMaps(new TypeDescription("MIMEType",BasicType.Text,MIMEType.class));
-		addToDerivedMaps(new TypeDescription("ProperName",BasicType.Text,ProperNameType.class));
-		addToDerivedMaps(new TypeDescription("RenditionClass",BasicType.Text,RenditionClassType.class));
-		addToDerivedMaps(new TypeDescription("URL",BasicType.Text,URLType.class));
-		addToDerivedMaps(new TypeDescription("URI",BasicType.Text,URIType.class));
-		addToDerivedMaps(new TypeDescription("XPath",BasicType.Text,XPathType.class));
-		addToDerivedMaps(new TypeDescription("Part",BasicType.Text,PartType.class));
+		DERIVED_TYPES = new HashMap<String,TypeDescription<AbstractSimpleProperty>>();
+		DERIVED_CLASSES = new HashMap<Class<? extends AbstractField>, TypeDescription<AbstractSimpleProperty>>();
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("AgentName",BasicType.Text,AgentNameType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("Choice",BasicType.Text,ChoiceType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("GUID",BasicType.Text,GUIDType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("Lang Alt",BasicType.Text,TextType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("Locale",BasicType.Text,LocaleType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("MIMEType",BasicType.Text,MIMEType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("ProperName",BasicType.Text,ProperNameType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("RenditionClass",BasicType.Text,RenditionClassType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("URL",BasicType.Text,URLType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("URI",BasicType.Text,URIType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("XPath",BasicType.Text,XPathType.class));
+		addToDerivedMaps(new TypeDescription<AbstractSimpleProperty>("Part",BasicType.Text,PartType.class));
 
 		// structured types
-		STRUCTURED_TYPES = new HashMap<String, TypeDescription>();
-		STRUCTURED_CLASSES = new HashMap<Class<? extends AbstractField>, TypeDescription>();
-		STRUCTURED_NAMESPACES = new HashMap<String, TypeDescription>();
-		addToStructuredMaps(new TypeDescription("Thumbnail",null,ThumbnailType.class));
-		addToStructuredMaps(new TypeDescription("Layer",null,LayerType.class));
-		addToStructuredMaps(new TypeDescription("ResourceEvent",null,ResourceEventType.class));
-		addToStructuredMaps(new TypeDescription("Job",null,JobType.class));
-		addToStructuredMaps(new TypeDescription("ResourceRef",null,ResourceRefType.class));
-		addToStructuredMaps(new TypeDescription("Version",null,VersionType.class));
+		STRUCTURED_TYPES = new HashMap<String, TypeDescription<AbstractStructuredType>>();
+		STRUCTURED_CLASSES = new HashMap<Class<? extends AbstractField>, TypeDescription<AbstractStructuredType>>();
+		STRUCTURED_NAMESPACES = new HashMap<String, TypeDescription<AbstractStructuredType>>();
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("Thumbnail",null,ThumbnailType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("Layer",null,LayerType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("ResourceEvent",null,ResourceEventType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("Job",null,JobType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("ResourceRef",null,ResourceRefType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("Version",null,VersionType.class));
 		// PDF/A structured types
-		addToStructuredMaps(new TypeDescription("PDFAField",null,PDFAFieldType.class));
-		addToStructuredMaps(new TypeDescription("PDFAProperty",null,PDFAPropertyType.class));
-		addToStructuredMaps(new TypeDescription("PDFAType",null,PDFATypeType.class));
-		addToStructuredMaps(new TypeDescription("PDFASchema",null,PDFASchemaType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("PDFAField",null,PDFAFieldType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("PDFAProperty",null,PDFAPropertyType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("PDFAType",null,PDFATypeType.class));
+		addToStructuredMaps(new TypeDescription<AbstractStructuredType>("PDFASchema",null,PDFASchemaType.class));
 	}
 
-	private void addToBasicMaps (TypeDescription td) {
+	private void addToBasicMaps (TypeDescription<AbstractSimpleProperty> td) {
 		BASIC_TYPES.put(td.getType(),td);
 		BASIC_CLASSES.put(td.getTypeClass(), td);
 	}
 
-	public void addToDerivedMaps (TypeDescription td) {
+	public void addToDerivedMaps (TypeDescription<AbstractSimpleProperty> td) {
 		DERIVED_TYPES.put(td.getType(),td);
 		DERIVED_CLASSES.put(td.getTypeClass(), td);
 	}
 
-	public void addToStructuredMaps (TypeDescription td) {
+	public void addToStructuredMaps (TypeDescription<AbstractStructuredType> td) {
 		try {
 			String ns = (String)td.getTypeClass().getField("ELEMENT_NS").get(null);
-			Class<? extends AbstractStructuredType> clz = (Class<? extends AbstractStructuredType>)td.getTypeClass();
+			Class<? extends AbstractStructuredType> clz = td.getTypeClass();
 			if (clz!=null) {
 				PropMapping pm = ReflectHelper.initializePropMapping(ns, clz);
 				td.setProperties(pm);
@@ -137,7 +137,7 @@ public final class TypeMapping {
 		}
 	}
 
-	public void addToStructuredMaps (TypeDescription td, String ns) {
+	public void addToStructuredMaps (TypeDescription<AbstractStructuredType> td, String ns) {
 		STRUCTURED_TYPES.put(td.getType(),td);
 		STRUCTURED_CLASSES.put(td.getTypeClass(), td);
 		STRUCTURED_NAMESPACES.put(ns, td);
@@ -146,17 +146,20 @@ public final class TypeMapping {
 
 	public String getType (Class<?> clz) {
 		// search in basic
-		TypeDescription td = BASIC_CLASSES.get(clz);
+		TypeDescription<AbstractSimpleProperty> td = BASIC_CLASSES.get(clz);
 		// search in derived
 		if (td==null) {
 			td = DERIVED_CLASSES.get(clz);
 		}
-		// search in structured
-		if (td==null) {
-			td = STRUCTURED_CLASSES.get(clz);
+		// return simple
+		if (td!=null) {
+			return td.getType();
+		} else {
+			// search in structured
+			TypeDescription<AbstractStructuredType> td2 = STRUCTURED_CLASSES.get(clz);
+			// return type if exists
+			return (td2!=null)?td2.getType():null;
 		}
-		// return type if exists
-		return (td!=null)?td.getType():null;
 	}
 
 	/**
@@ -167,7 +170,7 @@ public final class TypeMapping {
 	 * @param type
 	 * @return
 	 */
-	public TypeDescription getTypeDescription (String type) {
+	public TypeDescription<?> getTypeDescription (String type) {
 		if (BASIC_TYPES.containsKey(type)) {
 			return BASIC_TYPES.get(type);
 		} else if (DERIVED_TYPES.containsKey(type)) {
@@ -185,9 +188,26 @@ public final class TypeMapping {
 		}
 	}
 
-	public AbstractStructuredType instanciateStructuredType (XMPMetadata metadata, TypeDescription td /*Class<? extends AbstractStructuredType> propertyTypeClass*/) throws BadFieldValueException {
+	// TODO ces deux methodes doivent remplacer la précédente
+//	public TypeDescription<AbstractSimpleProperty> getSimpleDescription (String type) {
+//		if (BASIC_TYPES.containsKey(type)) {
+//			return BASIC_TYPES.get(type);
+//		} else if (DERIVED_TYPES.containsKey(type)) {
+//			return DERIVED_TYPES.get(type);
+//		} else {
+//			return null;
+//		}
+//	}
+//
+//	
+//	public TypeDescription<AbstractStructuredType> getStructuredDescription (String type) {
+//		return STRUCTURED_TYPES.get(type);
+//	}
+
+	
+	public AbstractStructuredType instanciateStructuredType (XMPMetadata metadata, TypeDescription<AbstractStructuredType> td) throws BadFieldValueException {
 		try {
-			Class<? extends AbstractStructuredType> propertyTypeClass = (Class<? extends AbstractStructuredType>)td.getTypeClass();
+			Class<? extends AbstractStructuredType> propertyTypeClass = td.getTypeClass();
 			Constructor<? extends AbstractStructuredType> construct = propertyTypeClass.getConstructor(new Class<?> [] {XMPMetadata.class});
 			return construct.newInstance(metadata);
 		} catch (InvocationTargetException e) {
@@ -216,7 +236,7 @@ public final class TypeMapping {
 		};
 		// type 
 		try {
-			TypeDescription description = getTypeDescription(type);
+			TypeDescription<AbstractSimpleProperty> description = (TypeDescription<AbstractSimpleProperty>)getTypeDescription(type);
 			Class<? extends AbstractSimpleProperty> clz = (Class<? extends AbstractSimpleProperty>)description.getTypeClass();
 			Constructor<? extends AbstractSimpleProperty> cons = clz.getConstructor(simplePropertyConstParams);
 			return cons.newInstance(params);
@@ -243,7 +263,7 @@ public final class TypeMapping {
 		return instanciateSimpleProperty(xmp, nsuri, prefix, propertyName, value, simpleType);
 	}
 
-	public TypeDescription getStructuredTypeName (String namespace) {
+	public TypeDescription<AbstractStructuredType> getStructuredTypeName (String namespace) {
 		return STRUCTURED_NAMESPACES.get(namespace);
 	}
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java Sat Aug 25 07:27:39 2012
@@ -22,16 +22,12 @@
 package org.apache.padaf.xmpbox;
 
 import java.util.Calendar;
-import java.util.Iterator;
 
 import org.apache.padaf.xmpbox.schema.PropertyExtensionDefinition;
 import org.apache.padaf.xmpbox.schema.SchemaExtensionDefinition;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
-import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.Attribute;
-import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
 import org.apache.padaf.xmpbox.type.PropertyType;
-import org.apache.padaf.xmpbox.type.TextType;
 
 
 @SchemaExtensionDefinition(schema = "Birth-Certificate Schema", valueType_description = "/org/apache/padaf/xmpbox/valueTypeDescription.xml", property_descriptions = "propertiesDescription.xml")

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=1377229&r1=1377228&r2=1377229&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 Sat Aug 25 07:27:39 2012
@@ -26,8 +26,6 @@ import java.util.List;
 
 import junit.framework.Assert;
 
-import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.junit.Before;
@@ -46,7 +44,7 @@ public class DoubleSameTypeSchemaTest {
 
 	@Before
 	public void testInit() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java Sat Aug 25 07:27:39 2012
@@ -21,20 +21,16 @@
 
 package org.apache.padaf.xmpbox;
 
-import java.io.ByteArrayOutputStream;
-
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.parser.XmpSerializer;
 import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
 import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
-import org.junit.Assert;
 import org.junit.Test;
 
 public class SaveMetadataHelperTest {
 
 	@Test
 	public void testSchemaParsing() throws Exception {
-		DublinCoreSchema dc = new DublinCoreSchema(new XMPDocumentBuilder().createXMPMetadata());
+		DublinCoreSchema dc = new DublinCoreSchema(XMPMetadata.createXMPMetadata());
 		dc.setCoverage("coverage");
 		dc.addContributor("contributor1");
 		dc.addContributor("contributor2");
@@ -47,7 +43,7 @@ public class SaveMetadataHelperTest {
 
 	@Test
 	public void testMetadataParsing() throws Exception {
-		XMPMetadata meta = new XMPDocumentBuilder().createXMPMetadata();
+		XMPMetadata meta = XMPMetadata.createXMPMetadata();
 		XmpSerializer serializer = new XmpSerializer();
 
 		DublinCoreSchema dc = meta.createAndAddDublinCoreSchema();

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/TestXMPWithDefinedSchemas.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/TestXMPWithDefinedSchemas.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/TestXMPWithDefinedSchemas.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/TestXMPWithDefinedSchemas.java Sat Aug 25 07:27:39 2012
@@ -21,23 +21,12 @@
 
 package org.apache.padaf.xmpbox;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.XMPSchema;
-import org.apache.padaf.xmpbox.type.AbstractField;
-import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
-import org.apache.padaf.xmpbox.type.AbstractStructuredType;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java Sat Aug 25 07:27:39 2012
@@ -25,9 +25,7 @@ import java.util.List;
 
 import junit.framework.Assert;
 
-import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.parser.TransformException;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.apache.padaf.xmpbox.type.TextType;
 import org.junit.Before;
@@ -48,7 +46,7 @@ public class XMPMetaDataTest {
 
 	@Before
 	public void init() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 		String tmpNsURI = "http://www.test.org/schem/";
 		tmp = new XMPSchema(metadata, "test", tmpNsURI);
 		tmp.addQualifiedBagValue("BagContainer", "Value1");
@@ -108,7 +106,7 @@ public class XMPMetaDataTest {
 	@Test
 	public void testInitMetaDataWithInfo() throws Exception {
 		String xpacketBegin = "TESTBEG", xpacketId = "TESTID", xpacketBytes = "TESTBYTES", xpacketEncoding = "TESTENCOD";
-		metadata = new XMPDocumentBuilder().createXMPMetadata(xpacketBegin, xpacketId, xpacketBytes,
+		metadata = XMPMetadata.createXMPMetadata(xpacketBegin, xpacketId, xpacketBytes,
 				xpacketEncoding);
 		Assert.assertEquals(xpacketBegin, metadata.getXpacketBegin());
 		Assert.assertEquals(xpacketId, metadata.getXpacketId());

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java Sat Aug 25 07:27:39 2012
@@ -21,9 +21,6 @@
 
 package org.apache.padaf.xmpbox.parser;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.type.PropMapping;

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java Sat Aug 25 07:27:39 2012
@@ -54,7 +54,7 @@ public abstract class AbstractSchemaTest
 	
 	public void before () throws Exception {
 		builder = new XMPDocumentBuilder();
-		xmp = builder.createXMPMetadata();
+		xmp = XMPMetadata.createXMPMetadata();
 		typeMapping = xmp.getTypeMapping();
 	}
 
@@ -116,6 +116,9 @@ public abstract class AbstractSchemaTest
 		if (cardinality==Cardinality.Simple) return;
 		// only test array properties
 		TypeDescription td =typeMapping.getTypeDescription(type);
+		if (td==null) {
+			System.err.println(">>>>>>>>>>>>> "+type);
+		}
 		Object value = TypeTestingHelper.getJavaValue(td);
 		AbstractSimpleProperty property = getSchema().instanciateSimple(fieldName, value);
 		switch (cardinality) {

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java Sat Aug 25 07:27:39 2012
@@ -25,8 +25,6 @@ import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
-import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.junit.Before;
 import org.junit.Test;
@@ -40,7 +38,7 @@ public class AdobePDFErrorsTest {
 	@Before
 	public void initTempMetaData() throws Exception {
 		builder = new XMPDocumentBuilder();
-		metadata = builder.createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java Sat Aug 25 07:27:39 2012
@@ -25,10 +25,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -39,7 +36,7 @@ public class AdobePDFTest extends Abstra
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 		schema = metadata.createAndAddAdobePDFSchema();
 		schemaClass = AdobePDFSchema.class;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java Sat Aug 25 07:27:39 2012
@@ -51,7 +51,7 @@ public class BasicJobTicketSchemaTest {
 	
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = builder.createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 		serializer = new XmpSerializer();
 	}
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java Sat Aug 25 07:27:39 2012
@@ -24,8 +24,6 @@ package org.apache.padaf.xmpbox.schema;
 import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,7 +34,7 @@ public class PDFAIdentificationOthersTes
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java Sat Aug 25 07:27:39 2012
@@ -25,10 +25,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -39,7 +36,7 @@ public class PDFAIdentificationTest exte
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 		schema = metadata.createAndAddPFAIdentificationSchema();
 		schemaClass = PDFAIdentificationSchema.class;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java Sat Aug 25 07:27:39 2012
@@ -26,10 +26,7 @@ import java.util.Calendar;
 import java.util.Collection;
 import java.util.List;
 
-
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.XMPBasicSchema;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -44,7 +41,7 @@ public class XMPBasicTest extends Abstra
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 		schema = metadata.createAndAddXMPBasicSchema();
 		schemaClass = XMPBasicSchema.class;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java Sat Aug 25 07:27:39 2012
@@ -25,10 +25,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.XMPMediaManagementSchema;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -39,7 +36,7 @@ public class XMPMediaManagementTest exte
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 		schema = metadata.createAndAddXMPMediaManagementSchema();
 		schemaClass = XMPMediaManagementSchema.class;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java Sat Aug 25 07:27:39 2012
@@ -29,13 +29,11 @@ import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.DateConverter;
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.Attribute;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.BooleanType;
-import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.DateType;
 import org.apache.padaf.xmpbox.type.IntegerType;
 import org.apache.padaf.xmpbox.type.TextType;
@@ -49,7 +47,7 @@ public class XMPSchemaTest {
 
 	@Before
 	public void resetDocument() throws Exception {
-		parent = new XMPDocumentBuilder().createXMPMetadata();
+		parent = XMPMetadata.createXMPMetadata();
 		schem = new XMPSchema(parent, "nsSchem", "nsURI");
 
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java Sat Aug 25 07:27:39 2012
@@ -27,10 +27,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.schema.XMPRightsManagementSchema;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -45,7 +42,7 @@ public class XmpRightsSchemaTest extends
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPDocumentBuilder().createXMPMetadata();
+		metadata = XMPMetadata.createXMPMetadata();
 		schema = metadata.createAndAddXMPRightsManagementSchema();
 		schemaClass = XMPRightsManagementSchema.class;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java Sat Aug 25 07:27:39 2012
@@ -47,7 +47,7 @@ public abstract class AbstractStructured
 	
 	public void before () throws Exception {
 		builder = new XMPDocumentBuilder();
-		xmp = builder.createXMPMetadata();
+		xmp = XMPMetadata.createXMPMetadata();
 		typeMapping = xmp.getTypeMapping();
 	}
 	
@@ -72,7 +72,7 @@ public abstract class AbstractStructured
 	
 	@Test
 	public void testSettingValue() throws Exception {
-		TypeDescription td =typeMapping.getTypeDescription(type);
+		TypeDescription<AbstractSimpleProperty> td = (TypeDescription<AbstractSimpleProperty>)typeMapping.getTypeDescription(type);
 		Object value = TypeTestingHelper.getJavaValue(td);
 		getStructured().addSimpleProperty(fieldName, value);
 		Assert.assertNotNull(getStructured().getProperty(fieldName));
@@ -89,7 +89,7 @@ public abstract class AbstractStructured
 
 	@Test
 	public void testPropertyType() throws Exception {
-		TypeDescription td =typeMapping.getTypeDescription(type);
+		TypeDescription<AbstractSimpleProperty> td = (TypeDescription<AbstractSimpleProperty>)typeMapping.getTypeDescription(type);
 		Object value = TypeTestingHelper.getJavaValue(td);
 		getStructured().addSimpleProperty(fieldName, value);
 		Assert.assertNotNull(getStructured().getProperty(fieldName));
@@ -113,7 +113,7 @@ public abstract class AbstractStructured
     @Test
     public void testSetter () throws Exception {
     	String setter = TypeTestingHelper.calculateSimpleSetter(fieldName);
-    	TypeDescription td = typeMapping.getTypeDescription(type);
+    	TypeDescription<AbstractSimpleProperty> td = (TypeDescription<AbstractSimpleProperty>)typeMapping.getTypeDescription(type);
     	Object value = TypeTestingHelper.getJavaValue(td);
     	Method set = clz.getMethod(setter, new Class<?>[] {TypeTestingHelper.getJavaType(td)} );
     	set.invoke(getStructured(), new Object [] {value});

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java Sat Aug 25 07:27:39 2012
@@ -23,7 +23,6 @@ package org.apache.padaf.xmpbox.type;
 
 import junit.framework.Assert;
 
-import org.apache.padaf.xmpbox.type.Attribute;
 import org.junit.Test;
 
 public class AttributeTest {

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java Sat Aug 25 07:27:39 2012
@@ -26,7 +26,6 @@ import java.util.Calendar;
 import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -62,7 +61,7 @@ public class TestAbstractStructuredType 
 	
 	@Before
 	public void before () throws Exception {
-		XMPMetadata xmp = new XMPDocumentBuilder().createXMPMetadata();
+		XMPMetadata xmp = XMPMetadata.createXMPMetadata();
 		st = new MyStructuredType(xmp, MY_NS, MY_PREFIX);
 	}
 	

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java Sat Aug 25 07:27:39 2012
@@ -25,7 +25,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -81,7 +80,7 @@ public class TestDerivedType {
 
     @Before
     public void before () throws Exception {
-		xmp =new XMPDocumentBuilder().createXMPMetadata();
+		xmp = XMPMetadata.createXMPMetadata();
 		constructor = clz.getConstructor(new Class [] {
 				XMPMetadata.class,
 				String.class,

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java?rev=1377229&r1=1377228&r2=1377229&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java Sat Aug 25 07:27:39 2012
@@ -24,19 +24,10 @@ package org.apache.padaf.xmpbox.type;
 import java.util.Calendar;
 import java.util.List;
 
-
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
-import org.apache.padaf.xmpbox.type.Attribute;
-import org.apache.padaf.xmpbox.type.BooleanType;
-import org.apache.padaf.xmpbox.type.DateType;
-import org.apache.padaf.xmpbox.type.IntegerType;
-import org.apache.padaf.xmpbox.type.RealType;
-import org.apache.padaf.xmpbox.type.TextType;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.w3c.dom.Element;
 
 /**
  * Test MetaData Objects for simple properties
@@ -50,7 +41,7 @@ public class TestSimpleMetadataPropertie
 
 	@Before
 	public void resetDocument() throws Exception {
-		parent = new XMPDocumentBuilder().createXMPMetadata();
+		parent = XMPMetadata.createXMPMetadata();
 	}
 
 	/**



Mime
View raw message