pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gbaill...@apache.org
Subject svn commit: r1368710 - in /pdfbox/trunk: preflight/src/test/java/org/apache/padaf/preflight/xmp/ xmpbox/src/main/java/org/apache/padaf/xmpbox/ xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/ xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/ xmp...
Date Thu, 02 Aug 2012 21:25:12 GMT
Author: gbailleul
Date: Thu Aug  2 21:25:10 2012
New Revision: 1368710

URL: http://svn.apache.org/viewvc?rev=1368710&view=rev
Log:
PDFBOX-1377: TypeMapping and SchemaMapping are no more static, XMPMetadata has no constructor and a factory has to be used.

Modified:
    pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/xmp/TestSynchronizedMetadataValidation.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/PDFAExtentionSchemaPreprocessor.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/BuildPDFAExtensionSchemaDescriptionTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java
    pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java

Modified: pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/xmp/TestSynchronizedMetadataValidation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/xmp/TestSynchronizedMetadataValidation.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/xmp/TestSynchronizedMetadataValidation.java (original)
+++ pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/xmp/TestSynchronizedMetadataValidation.java Thu Aug  2 21:25:10 2012
@@ -33,6 +33,7 @@ import org.apache.padaf.preflight.Valida
 import org.apache.padaf.preflight.ValidationResult.ValidationError;
 import org.apache.padaf.preflight.xmp.SynchronizedMetaDataValidation;
 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.DublinCoreSchema;
 import org.apache.padaf.xmpbox.schema.XMPBasicSchema;
@@ -70,7 +71,7 @@ public class TestSynchronizedMetadataVal
     try {
       doc = new PDDocument();
       dico = doc.getDocumentInformation();
-      metadata = new XMPMetadata();
+      metadata = new XMPDocumentBuilder().createXMPMetadata();
     } catch (IOException e) {
       throw new Exception("Failed to create temporary test PDF/XMP Document");
     }

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java Thu Aug  2 21:25:10 2012
@@ -26,6 +26,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.parser.XmpSchemaException;
 import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
 import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
@@ -68,6 +69,8 @@ public class XMPMetadata {
     private SchemasContainer schemas;
 
     private Document xmpDocument;
+    
+    private XMPDocumentBuilder builder;
 
     /**
      * Contructor of an empty default XMPMetaData
@@ -75,8 +78,9 @@ public class XMPMetadata {
      * @throws CreateXMPMetadataException
      *             If DOM Document associated could not be created
      */
-    public XMPMetadata() throws CreateXMPMetadataException {
+    protected XMPMetadata(XMPDocumentBuilder builder) throws CreateXMPMetadataException {
         try {
+        	this.builder = builder;
             xmpDocument = org.apache.padaf.xmpbox.parser.XMLUtil.newDocument();
             schemas = new SchemasContainer();
         } catch (IOException e) {
@@ -101,9 +105,10 @@ public class XMPMetadata {
      * @throws CreateXMPMetadataException
      *             If DOM Document associated could not be created
      */
-    public XMPMetadata(String xpacketBegin, String xpacketId,
+    protected XMPMetadata(XMPDocumentBuilder builder, String xpacketBegin, String xpacketId,
             String xpacketBytes, String xpacketEncoding)
     throws CreateXMPMetadataException {
+    	this.builder = builder;
         this.xpacketBegin = xpacketBegin;
         this.xpacketId = xpacketId;
         this.xpacketBytes = xpacketBytes;
@@ -495,7 +500,14 @@ public class XMPMetadata {
         return (AdobePDFSchema) getSchema(AdobePDFSchema.PDFURI);
     }
 
-    /**
+    public XMPDocumentBuilder getBuilder() {
+		return builder;
+	}
+
+
+
+
+	/**
      * Class which represent a container for schemas associated to a metadata
      * representation
      * 

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/PDFAExtentionSchemaPreprocessor.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/PDFAExtentionSchemaPreprocessor.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/PDFAExtentionSchemaPreprocessor.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/PDFAExtentionSchemaPreprocessor.java Thu Aug  2 21:25:10 2012
@@ -56,7 +56,7 @@ public class PDFAExtentionSchemaPreproce
 		HashMap<String, String> namespaces = new HashMap<String, String>();
 		for (int i = 0; i < cptNS; i++) {
 			namespaces.put(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
-			if (TypeMapping.isStructuredTypeNamespace(reader.getNamespaceURI(i))) {
+			if (getTypeMapping().isStructuredTypeNamespace(reader.getNamespaceURI(i))) {
 				nsMap.setComplexBasicTypesDeclarationForLevelSchema(reader
 						.getNamespaceURI(i), reader.getNamespacePrefix(i));
 			}

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java Thu Aug  2 21:25:10 2012
@@ -222,19 +222,19 @@ public class StructuredPropertyParser {
 				}
 
 				if (reader.getEventType()==XMLStreamConstants.START_ELEMENT) {
-					TypeDescription td = TypeMapping.getStructuredTypeName(eltName.getNamespaceURI());
+					TypeDescription td = builder.getTypeMapping().getStructuredTypeName(eltName.getNamespaceURI());
 					String ptype = td.getProperties().getPropertyType(eltName.getLocalPart());
-					if (TypeMapping.isStructuredType(ptype)) {
-						TypeDescription tclass = TypeMapping.getTypeDescription(ptype);
+					if (builder.getTypeMapping().isStructuredType(ptype)) {
+						TypeDescription tclass = builder.getTypeMapping().getTypeDescription(ptype);
 						Class<? extends AbstractStructuredType> tcn = (Class<? extends AbstractStructuredType>)tclass.getTypeClass();
 						StructuredPropertyParser sp = new StructuredPropertyParser(builder, tcn);
 						sp.parseSimple(metadata, reader.getName(), property.getContainer(),isSubSkipDescription,subExpected);// TODO
-					} else if (TypeMapping.getArrayType(ptype)!=null) {
+					} else if (builder.getTypeMapping().getArrayType(ptype)!=null) {
 						int pos = ptype.indexOf(' ');
-						String arrayType = TypeMapping.getArrayType(ptype);
+						String arrayType = builder.getTypeMapping().getArrayType(ptype);
 						String typeInArray = ptype.substring(pos+1);
 
-						TypeDescription tclass = TypeMapping.getTypeDescription(typeInArray);
+						TypeDescription tclass = builder.getTypeMapping().getTypeDescription(typeInArray);
 						Class<? extends AbstractStructuredType> tcn = (Class<? extends AbstractStructuredType>)tclass.getTypeClass();
 						// array element starting
 						builder.expectCurrentLocalName(arrayType);
@@ -278,7 +278,7 @@ public class StructuredPropertyParser {
 			String propertyName,
 			String valueAsString) 
 					throws XmpParsingException {
-		TypeDescription description = TypeMapping.getTypeDescription(type);
+		TypeDescription description = builder.getTypeMapping().getTypeDescription(type);
 		Object value = null;
 		switch (description.getBasic()) {
 		case Boolean : 
@@ -309,7 +309,7 @@ public class StructuredPropertyParser {
 			value = valueAsString;
 		}
 
-		return TypeMapping.instanciateSimpleProperty(metadata, null, prefix, propertyName, value, type);
+		return builder.getTypeMapping().instanciateSimpleProperty(metadata, null, prefix, propertyName, value, 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=1368710&r1=1368709&r2=1368710&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 Thu Aug  2 21:25:10 2012
@@ -46,6 +46,7 @@ import org.apache.padaf.xmpbox.schema.NS
 import org.apache.padaf.xmpbox.schema.PDFAExtensionSchema;
 import org.apache.padaf.xmpbox.schema.PDFAFieldDescription;
 import org.apache.padaf.xmpbox.schema.SchemaDescription;
+import org.apache.padaf.xmpbox.schema.SchemaMapping;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
@@ -69,6 +70,10 @@ import org.apache.pdfbox.io.IOUtils;
 public class XMPDocumentBuilder {
 
 	private NSMapping nsMap;
+	
+	private TypeMapping typeMapping = null;
+	
+	private SchemaMapping schemaMapping = null;
 
 	private ThreadLocal<XMLStreamReader> reader = new ThreadLocal<XMLStreamReader>();
 
@@ -88,9 +93,36 @@ public class XMPDocumentBuilder {
 	 *             case, if its namespace miss
 	 */
 	public XMPDocumentBuilder() throws XmpSchemaException {
-		nsMap = new NSMapping();
+		nsMap = new NSMapping(this);
+		this.typeMapping = new TypeMapping();
+		this.schemaMapping = new SchemaMapping();
 	}
 
+	public XMPMetadata createXMPMetadata () throws CreateXMPMetadataException {
+		return new WrappedXMPMetadata(this);
+	}
+	
+	public XMPMetadata createXMPMetadata (String begin, String id, String bytes, String encoding) throws CreateXMPMetadataException {
+		return new WrappedXMPMetadata(this,begin, id, bytes, encoding);
+
+	}
+	protected class WrappedXMPMetadata extends XMPMetadata {
+
+		public WrappedXMPMetadata(XMPDocumentBuilder builder) throws CreateXMPMetadataException {
+			super(builder);
+		}
+
+		public WrappedXMPMetadata(XMPDocumentBuilder builder, String xpacketBegin, String xpacketId,
+				String xpacketBytes, String xpacketEncoding)
+				throws CreateXMPMetadataException {
+			super(builder, xpacketBegin, xpacketId, xpacketBytes, xpacketEncoding);
+			// TODO Auto-generated constructor stub
+		}
+		
+		
+	}
+	
+	
 	/**
 	 * Parsing method. Return a XMPMetadata object with all elements read
 	 * 
@@ -152,7 +184,7 @@ public class XMPDocumentBuilder {
 			// all others declarations are ignored
 			int nsCount = reader.get().getNamespaceCount();
 			for (int i = 0; i < nsCount; i++) {
-				if (TypeMapping.isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
+				if (typeMapping.isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
 					nsMap.setComplexBasicTypesDeclarationForLevelXMP(
 							reader.get().getNamespaceURI(i), 
 							reader.get().getNamespacePrefix(i));
@@ -308,7 +340,7 @@ public class XMPDocumentBuilder {
 						"Unknown attribute in xpacket PI : '" + token + "'");
 			}
 		}
-		return new XMPMetadata(begin, id, bytes, encoding);
+		return new WrappedXMPMetadata(this,begin, id, bytes, encoding);
 	}
 
 	/**
@@ -488,7 +520,7 @@ public class XMPDocumentBuilder {
 		String type = this.nsMap.getSpecifiedPropertyType(schemaNamespace, new QName(schemaNamespace, attr.getLocalName(), prefix));
 		
 		if (type != null) {
-			AbstractSimpleProperty prop = TypeMapping.instanciateSimpleProperty(metadata, null, prefix, attr.getLocalName(), attr.getValue(), type);
+			AbstractSimpleProperty prop = typeMapping.instanciateSimpleProperty(metadata, null, prefix, attr.getLocalName(), attr.getValue(), type);
 			schema.getContent().addProperty(prop);
 			added = true;
 		}
@@ -526,7 +558,7 @@ public class XMPDocumentBuilder {
 		for (int i = 0; i < cptNS; i++) {
 			namespaces.put(reader.get().getNamespacePrefix(i), reader.get()
 					.getNamespaceURI(i));
-			if (TypeMapping.isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
+			if (typeMapping.isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
 				// System.out.println("in parseDesc method: prefix:"+reader.get().getNamespacePrefix(i)+", nsURI:"+reader.get().getNamespaceURI(i));
 				nsMap.setComplexBasicTypesDeclarationForLevelSchema(reader
 						.get().getNamespaceURI(i), reader.get()
@@ -1092,28 +1124,28 @@ public class XMPDocumentBuilder {
 					throws XmpParsingException, XmpUnexpectedTypeException,
 					XmpUnknownPropertyTypeException, XmpPropertyFormatException,
 					XMLStreamException {
-		TypeDescription typeDesc = TypeMapping.getTypeDescription(type);
+		TypeDescription typeDesc = typeMapping.getTypeDescription(type);
 		
 		if (type.equals("Lang alt")) {
 			parseSimplePropertyArray(metadata, reader.get().getName(),
 					ArrayProperty.ALTERNATIVE_ARRAY, TextType.class, container);
-		} else if (TypeMapping.isSimpleType(typeDesc.getType())) {
+		} else if (typeMapping.isSimpleType(typeDesc.getType())) {
 			Class<? extends AbstractSimpleProperty> tcn = (Class<? extends AbstractSimpleProperty>)typeDesc.getTypeClass();
 			parseSimpleProperty(metadata, reader.get().getName(),
 					tcn, container);
-		} else if (TypeMapping.isStructuredType(type)) {
+		} else if (typeMapping.isStructuredType(type)) {
 			QName propertyName = reader.get().getName();
-			TypeDescription tclass = TypeMapping.getTypeDescription(type);
+			TypeDescription tclass = typeMapping.getTypeDescription(type);
 			StructuredPropertyParser parser = new StructuredPropertyParser(
 					this, (Class<? extends AbstractStructuredType>)tclass.getTypeClass());
 			parseStructuredProperty(metadata, parser, container);
-		} else if (TypeMapping.getArrayType(type)!=null) {
+		} else if (typeMapping.getArrayType(type)!=null) {
 			QName propertyName = reader.get().getName();
 			// retrieve array type and content type
 			int pos = type.indexOf(' ');
-			String arrayType = TypeMapping.getArrayType(type);
+			String arrayType = typeMapping.getArrayType(type);
 			String typeInArray = type.substring(pos+1);
-			TypeDescription tclass = TypeMapping.getTypeDescription(typeInArray);
+			TypeDescription tclass = typeMapping.getTypeDescription(typeInArray);
 			Class<? extends AbstractField> tcn = tclass.getTypeClass();
 			
 			if (AbstractSimpleProperty.class.isAssignableFrom(tcn)) {
@@ -1223,7 +1255,7 @@ public class XMPDocumentBuilder {
 		nsMap.resetComplexBasicTypesDeclarationInPropertyLevel();
 		int cptNs = reader.get().getNamespaceCount();
 		for (int i = 0; i < cptNs; i++) {
-			if (TypeMapping.isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
+			if (typeMapping.isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
 				nsMap.setComplexBasicTypesDeclarationForLevelSchema(reader
 						.get().getNamespaceURI(i), reader.get()
 						.getNamespacePrefix(i));
@@ -1234,21 +1266,21 @@ public class XMPDocumentBuilder {
 			// found type, manage it
 			if (type.equals("Lang Alt")) {
 				parseSimplePropertyArray(metadata, propertyName, ArrayProperty.ALTERNATIVE_ARRAY, TextType.class, schema.getContent());
-			} else if (TypeMapping.isSimpleType(type)) {
-				TypeDescription tclass = TypeMapping.getTypeDescription(type);
+			} else if (typeMapping.isSimpleType(type)) {
+				TypeDescription tclass = typeMapping.getTypeDescription(type);
 				Class<? extends AbstractSimpleProperty> tcn = (Class<? extends AbstractSimpleProperty>)tclass.getTypeClass();
 				parseSimpleProperty(metadata, propertyName, tcn, schema.getContent());
-			} else if (TypeMapping.isStructuredType(type)) {
-				TypeDescription tclass = TypeMapping.getTypeDescription(type);
+			} else if (typeMapping.isStructuredType(type)) {
+				TypeDescription tclass = typeMapping.getTypeDescription(type);
 				StructuredPropertyParser parser = new StructuredPropertyParser(
 						this, (Class<? extends AbstractStructuredType>)tclass.getTypeClass());
 				parseStructuredProperty(metadata, parser, schema.getContent());
-			} else if (TypeMapping.getArrayType(type)!=null) {
+			} else if (typeMapping.getArrayType(type)!=null) {
 				// retrieve array type and content type
 				int pos = type.indexOf(' ');
-				String arrayType = TypeMapping.getArrayType(type);
+				String arrayType = typeMapping.getArrayType(type);
 				String typeInArray = type.substring(pos+1);
-				TypeDescription tclass = TypeMapping.getTypeDescription(typeInArray);
+				TypeDescription tclass = typeMapping.getTypeDescription(typeInArray);
 				Class<? extends AbstractField> tcn = tclass.getTypeClass();
 				
 				if (AbstractSimpleProperty.class.isAssignableFrom(tcn)) {
@@ -1314,6 +1346,13 @@ public class XMPDocumentBuilder {
 		return reader.get();
 	}
 
+	public TypeMapping getTypeMapping () {
+		return this.typeMapping;
+	}
 
+	public SchemaMapping getSchemaMapping() {
+		return schemaMapping;
+	}
 
+	
 }

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java Thu Aug  2 21:25:10 2012
@@ -30,10 +30,10 @@ import javax.xml.namespace.QName;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.parser.PropMapping;
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.parser.XMPSchemaFactory;
 import org.apache.padaf.xmpbox.parser.XmpSchemaException;
 import org.apache.padaf.xmpbox.parser.XmpUnknownValueTypeException;
-import org.apache.padaf.xmpbox.type.TypeMapping;
 
 
 /**
@@ -44,6 +44,8 @@ import org.apache.padaf.xmpbox.type.Type
  */
 public class NSMapping {
 
+	private XMPDocumentBuilder builder = null;
+	
 	private Map<String, XMPSchemaFactory> definedNamespaces;
 
 
@@ -59,7 +61,8 @@ public class NSMapping {
 	 * @throws XmpSchemaException
 	 *             When could not read a property data in a Schema Class given
 	 */
-	public NSMapping() throws XmpSchemaException {
+	public NSMapping(XMPDocumentBuilder builder) throws XmpSchemaException {
+		this.builder = builder;
 		complexBasicTypesDeclarationEntireXMPLevel = new HashMap<String, String>();
 		complexBasicTypesDeclarationSchemaLevel = new HashMap<String, String>();
 		complexBasicTypesDeclarationPropertyLevel = new HashMap<String, String>();
@@ -110,7 +113,7 @@ public class NSMapping {
 	 * @return True if namespace URI is known
 	 */
 	public boolean isContainedNamespace(String namespace) {
-		boolean found = SchemaMapping.isContainedNamespace(namespace);
+		boolean found = builder.getSchemaMapping().isContainedNamespace(namespace);
 		if (!found) {
 			found = definedNamespaces.containsKey(namespace);
 		}
@@ -128,7 +131,7 @@ public class NSMapping {
 	 * @return Property type declared for namespace specified, null if unknown
 	 */
 	public String getSpecifiedPropertyType(String namespace, QName prop) {
-		XMPSchemaFactory factory = SchemaMapping.getSchemaFactory(namespace);
+		XMPSchemaFactory factory = builder.getSchemaMapping().getSchemaFactory(namespace);
 		if (factory==null) {
 			factory = definedNamespaces.get(namespace);
 		}
@@ -185,7 +188,7 @@ public class NSMapping {
 	 */
 	private String getValueTypeEquivalence(SchemaDescription desc,
 			String definedValueType) throws XmpUnknownValueTypeException {
-		if (TypeMapping.isSimpleType(definedValueType) || TypeMapping.isArrayOfSimpleType(definedValueType)) {
+		if (builder.getTypeMapping().isSimpleType(definedValueType) || builder.getTypeMapping().isArrayOfSimpleType(definedValueType)) {
 			return definedValueType;
 		}
 		PDFAValueTypeDescription val = findValueTypeDescription(desc,
@@ -249,7 +252,7 @@ public class NSMapping {
 	 */
 	public void setComplexBasicTypesDeclarationForLevelXMP(String namespace,
 			String prefix) {
-		if (TypeMapping.isStructuredTypeNamespace(namespace)) {
+		if (builder.getTypeMapping().isStructuredTypeNamespace(namespace)) {
 			complexBasicTypesDeclarationEntireXMPLevel.put(prefix, namespace);
 		}
 	}
@@ -266,7 +269,7 @@ public class NSMapping {
 	 */
 	public void setComplexBasicTypesDeclarationForLevelSchema(String namespace,
 			String prefix) {
-		if (TypeMapping.isStructuredTypeNamespace(namespace)) {
+		if (builder.getTypeMapping().isStructuredTypeNamespace(namespace)) {
 			complexBasicTypesDeclarationSchemaLevel.put(prefix, namespace);
 		}
 
@@ -283,7 +286,7 @@ public class NSMapping {
 	 */
 	public void setComplexBasicTypesDeclarationForLevelProperty(
 			String namespace, String prefix) {
-		if (TypeMapping.isStructuredTypeNamespace(namespace)) {
+		if (builder.getTypeMapping().isStructuredTypeNamespace(namespace)) {
 			complexBasicTypesDeclarationPropertyLevel.put(prefix, namespace);
 		}
 	}
@@ -330,7 +333,7 @@ public class NSMapping {
 		}
 		// return complex basic type
 		if (tmp!=null) {
-			return TypeMapping.getStructuredTypeName(tmp).getType();
+			return builder.getTypeMapping().getStructuredTypeName(tmp).getType();
 		} else {
 			// 
 			return null;
@@ -350,7 +353,7 @@ public class NSMapping {
 	 *             When Instancing specified Object Schema failed
 	 */
 	public XMPSchema getAssociatedSchemaObject(XMPMetadata metadata, String namespace, String prefix) throws XmpSchemaException {
-		XMPSchema found = SchemaMapping.getAssociatedSchemaObject(metadata, namespace, prefix);
+		XMPSchema found = builder.getSchemaMapping().getAssociatedSchemaObject(metadata, namespace, prefix);
 		if (found!=null) {
 			return found;
 		} else {

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java Thu Aug  2 21:25:10 2012
@@ -51,7 +51,7 @@ public final class SchemaMapping {
 
 	}
 
-	private SchemaMapping () {
+	public SchemaMapping () {
 		// hide constructor
 	}
 	
@@ -136,7 +136,7 @@ public final class SchemaMapping {
 	 * @throws XmpSchemaException
 	 *             When Instancing specified Object Schema failed
 	 */
-	public static XMPSchema getAssociatedSchemaObject(XMPMetadata metadata, String namespace, String prefix) throws XmpSchemaException {
+	public XMPSchema getAssociatedSchemaObject(XMPMetadata metadata, String namespace, String prefix) throws XmpSchemaException {
 		if (!nsMaps.containsKey(namespace)) {
 			return null;
 		}
@@ -144,12 +144,12 @@ public final class SchemaMapping {
 		return factory.createXMPSchema(metadata, prefix);
 	}
 
-	public static XMPSchemaFactory getSchemaFactory(String namespace) {
+	public XMPSchemaFactory getSchemaFactory(String namespace) {
 		return nsMaps.get(namespace);
 	}
 
 	
-	public static boolean isContainedNamespace(String namespace) {
+	public boolean isContainedNamespace(String namespace) {
 		return nsMaps.containsKey(namespace);
 	}
 

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java Thu Aug  2 21:25:10 2012
@@ -220,10 +220,11 @@ public class XMPSchema implements Elemen
 		} else {
 			AbstractSimpleProperty specifiedTypeProperty;
 			try {
-				specifiedTypeProperty = TypeMapping.instanciateSimpleProperty(
+				TypeMapping tm = metadata.getBuilder().getTypeMapping();
+				specifiedTypeProperty = tm.instanciateSimpleProperty(
 						metadata, null, 
 						splittedQualifiedName[0], splittedQualifiedName[1], propertyValue,
-						TypeMapping.getType(type));
+						tm.getType(type));
 			} catch (Exception e) {
 				throw new IllegalArgumentException(
 						"Failed to create property with the specified type given in parameters",
@@ -1421,7 +1422,8 @@ public class XMPSchema implements Elemen
 	}
 
 	protected AbstractSimpleProperty instanciateSimple (String param, Object value) {
-		return TypeMapping.instanciateSimpleField(
+		TypeMapping tm = metadata.getBuilder().getTypeMapping();
+		return tm.instanciateSimpleField(
 				getClass(), 
 				metadata, 
 				null, 

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java Thu Aug  2 21:25:10 2012
@@ -69,7 +69,8 @@ public abstract class AbstractStructured
 
 	
 	protected void addSimpleProperty (String propertyName, Object value) {
-		AbstractSimpleProperty asp = TypeMapping.instanciateSimpleField(getClass(), getMetadata(),null,fieldPrefix,propertyName, value);
+		TypeMapping tm = getMetadata().getBuilder().getTypeMapping();
+		AbstractSimpleProperty asp = tm.instanciateSimpleField(getClass(), getMetadata(),null,fieldPrefix,propertyName, value);
 		addProperty(asp);
 	}
 

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java Thu Aug  2 21:25:10 2012
@@ -300,7 +300,8 @@ public class ResourceRefType extends Abs
                     ArrayProperty.ORDERED_ARRAY);
         	addProperty(seq);
         }
-        TextType tt = (TextType)TypeMapping.instanciateSimpleProperty(getMetadata(), null, "rdf", "li", value, "Text");
+		TypeMapping tm = getMetadata().getBuilder().getTypeMapping();
+        TextType tt = (TextType)tm.instanciateSimpleProperty(getMetadata(), null, "rdf", "li", value, "Text");
         seq.getContainer().addProperty(tt);
 	}
 

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java Thu Aug  2 21:25:10 2012
@@ -57,7 +57,7 @@ public final class TypeMapping {
 
     
 	// no public constructor
-	private TypeMapping() {
+	public TypeMapping() {
 		
 	}
     
@@ -143,7 +143,7 @@ public final class TypeMapping {
 		}  
     }
 
-    public static String getType (Class<?> clz) {
+    public String getType (Class<?> clz) {
     	// search in basic
     	TypeDescription td = BASIC_CLASSES.get(clz);
     	// search in derived
@@ -166,7 +166,7 @@ public final class TypeMapping {
      * @param type
      * @return
      */
-    public static 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)) {
@@ -184,7 +184,7 @@ public final class TypeMapping {
     	}
     }
     
-    public static AbstractSimpleProperty instanciateSimpleProperty (XMPMetadata xmp,String nsuri, String prefix, String name, Object value, String type) {
+    public AbstractSimpleProperty instanciateSimpleProperty (XMPMetadata xmp,String nsuri, String prefix, String name, Object value, String type) {
     	// constructor parameters
     	Object [] params = new Object [] {
     		xmp,	
@@ -216,14 +216,14 @@ public final class TypeMapping {
 		}
     }
    
-	public static AbstractSimpleProperty instanciateSimpleField (Class<?> clz, XMPMetadata xmp, String nsuri, String prefix,String propertyName, Object value) {
+	public  AbstractSimpleProperty instanciateSimpleField (Class<?> clz, XMPMetadata xmp, String nsuri, String prefix,String propertyName, Object value) {
 		Map<String, String> fields = getStructuredTypeFields(clz);
 		String fieldName = fields.get(propertyName);
 		try {
 			Field f= clz.getField(fieldName);
 			PropertyType pt = f.getAnnotation(PropertyType.class);
 			String simpleType = pt.propertyType();
-			return TypeMapping.instanciateSimpleProperty(xmp, nsuri, prefix, propertyName, value, simpleType);
+			return instanciateSimpleProperty(xmp, nsuri, prefix, propertyName, value, simpleType);
 		} catch (SecurityException e) {
 			throw new IllegalArgumentException("Failed to instanciate",e);
 		} catch (NoSuchFieldException e) {
@@ -259,7 +259,7 @@ public final class TypeMapping {
     
 
     
-    public static TypeDescription getStructuredTypeName (String namespace) {
+    public TypeDescription getStructuredTypeName (String namespace) {
     	return STRUCTURED_NAMESPACES.get(namespace);
     }
   
@@ -271,14 +271,14 @@ public final class TypeMapping {
      *            The namespace URI to check
      * @return True if namespace URI is a reference for a complex basic type
      */
-    public static boolean isStructuredTypeNamespace(String namespace) {
+    public boolean isStructuredTypeNamespace(String namespace) {
 //        return STRUCTURED_TYPES.containsKey(namespace);
     	// TODO why was STRUCTURED_TYPE
     	return STRUCTURED_NAMESPACES.containsKey(namespace);
     }
 
 
-    public static boolean isArrayOfSimpleType (String type) {
+    public boolean isArrayOfSimpleType (String type) {
     	int pos = type.indexOf(' ');
     	if (pos<0) {
     		// not array
@@ -290,7 +290,7 @@ public final class TypeMapping {
     	
     }
     
-    public static String  getArrayType (String type) {
+    public String  getArrayType (String type) {
     	int pos = type.indexOf(' ');
     	if (pos<0) {
     		// not array
@@ -310,11 +310,11 @@ public final class TypeMapping {
     	}
     }
     
-    public static boolean isSimpleType(String type) {
+    public boolean isSimpleType(String type) {
     	return (BASIC_TYPES.containsKey(type) || DERIVED_TYPES.containsKey(type));
     }
 
-    public static boolean isStructuredType(String type) {
+    public boolean isStructuredType(String type) {
     	return STRUCTURED_TYPES.containsKey(type);
     }
 

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/BuildPDFAExtensionSchemaDescriptionTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/BuildPDFAExtensionSchemaDescriptionTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/BuildPDFAExtensionSchemaDescriptionTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/BuildPDFAExtensionSchemaDescriptionTest.java Thu Aug  2 21:25:10 2012
@@ -25,6 +25,7 @@ package org.apache.padaf.xmpbox;
 import org.apache.padaf.xmpbox.BuildPDFExtensionSchemaHelper;
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.parser.DateConverter;
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.schema.PDFAExtensionSchema;
 import org.apache.padaf.xmpbox.schema.SchemaDescription;
 import org.junit.Assert;
@@ -37,8 +38,7 @@ public class BuildPDFAExtensionSchemaDes
 
 	@Before
 	public void init() throws Exception {
-		metadata = new XMPMetadata();
-
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/DoubleSameTypeSchemaTest.java Thu Aug  2 21:25:10 2012
@@ -27,6 +27,7 @@ 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;
@@ -45,7 +46,7 @@ public class DoubleSameTypeSchemaTest {
 
 	@Before
 	public void testInit() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/SaveMetadataHelperTest.java Thu Aug  2 21:25:10 2012
@@ -23,6 +23,7 @@ package org.apache.padaf.xmpbox;
 
 import java.io.ByteArrayOutputStream;
 
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
 import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
 import org.junit.Assert;
@@ -32,7 +33,7 @@ public class SaveMetadataHelperTest {
 
 	@Test
 	public void testSchemaParsing() throws Exception {
-		DublinCoreSchema dc = new DublinCoreSchema(new XMPMetadata());
+		DublinCoreSchema dc = new DublinCoreSchema(new XMPDocumentBuilder().createXMPMetadata());
 		dc.setCoverage("coverage");
 		dc.addContributor("contributor1");
 		dc.addContributor("contributor2");
@@ -45,7 +46,8 @@ public class SaveMetadataHelperTest {
 
 	@Test
 	public void testMetadataParsing() throws Exception {
-		XMPMetadata meta = new XMPMetadata();
+		XMPMetadata meta = new XMPDocumentBuilder().createXMPMetadata();
+
 		DublinCoreSchema dc = meta.createAndAddDublinCoreSchema();
 		dc.setCoverage("coverage");
 		dc.addContributor("contributor1");

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/XMPMetaDataTest.java Thu Aug  2 21:25:10 2012
@@ -27,6 +27,7 @@ import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.TransformException;
 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.TextType;
 import org.junit.Before;
@@ -47,7 +48,7 @@ public class XMPMetaDataTest {
 
 	@Before
 	public void init() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 		String tmpNsURI = "http://www.test.org/schem/";
 		tmp = new XMPSchema(metadata, "test", tmpNsURI);
 		tmp.addQualifiedBagValue("BagContainer", "Value1");
@@ -107,7 +108,7 @@ public class XMPMetaDataTest {
 	@Test
 	public void testInitMetaDataWithInfo() throws Exception {
 		String xpacketBegin = "TESTBEG", xpacketId = "TESTID", xpacketBytes = "TESTBYTES", xpacketEncoding = "TESTENCOD";
-		metadata = new XMPMetadata(xpacketBegin, xpacketId, xpacketBytes,
+		metadata = new XMPDocumentBuilder().createXMPMetadata(xpacketBegin, xpacketId, xpacketBytes,
 				xpacketEncoding);
 		Assert.assertEquals(xpacketBegin, metadata.getXpacketBegin());
 		Assert.assertEquals(xpacketId, metadata.getXpacketId());

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java Thu Aug  2 21:25:10 2012
@@ -27,6 +27,7 @@ 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.type.AbstractSimpleProperty;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.TypeDescription;
@@ -45,11 +46,16 @@ public abstract class AbstractSchemaTest
 	
 	protected Cardinality cardinality;
 
+	protected TypeMapping typeMapping = null;
+	
+	protected XMPDocumentBuilder builder;
 	
 	protected enum Cardinality {Simple, Bag, Seq, Alt}
 	
 	public void before () throws Exception {
-		xmp = new XMPMetadata();
+		builder = new XMPDocumentBuilder();
+		xmp = builder.createXMPMetadata();
+		typeMapping = builder.getTypeMapping();
 	}
 
 	protected abstract XMPSchema getSchema ();
@@ -88,7 +94,7 @@ public abstract class AbstractSchemaTest
 	public void testSettingValue() throws Exception {
 		if (cardinality!=Cardinality.Simple) return;
 		// only test simple properties
-		TypeDescription td =TypeMapping.getTypeDescription(type);
+		TypeDescription td =typeMapping.getTypeDescription(type);
 		Object value = TypeTestingHelper.getJavaValue(td);
 		AbstractSimpleProperty property = getSchema().instanciateSimple(fieldName, value);
 		getSchema().addProperty(property);
@@ -109,7 +115,7 @@ public abstract class AbstractSchemaTest
 	public void testSettingValueInArray() throws Exception {
 		if (cardinality==Cardinality.Simple) return;
 		// only test array properties
-		TypeDescription td =TypeMapping.getTypeDescription(type);
+		TypeDescription td =typeMapping.getTypeDescription(type);
 		Object value = TypeTestingHelper.getJavaValue(td);
 		AbstractSimpleProperty property = getSchema().instanciateSimple(fieldName, value);
 		switch (cardinality) {
@@ -140,9 +146,9 @@ public abstract class AbstractSchemaTest
     public void testPropertySetterSimple () throws Exception {
 		if (cardinality!=Cardinality.Simple) return;
     	String setter = TypeTestingHelper.calculateSimpleSetter(fieldName)+"Property";
-    	TypeDescription td = TypeMapping.getTypeDescription(type);
+    	TypeDescription td = typeMapping.getTypeDescription(type);
     	Object value = TypeTestingHelper.getJavaValue(td);
-    	AbstractSimpleProperty asp = TypeMapping.instanciateSimpleProperty(
+    	AbstractSimpleProperty asp = typeMapping.instanciateSimpleProperty(
     			xmp, getSchema().getNamespaceValue(), 
     			getSchema().getLocalPrefix(), fieldName, value, type);
     	Method set = getSchemaClass().getMethod(setter, new Class<?>[] {td.getTypeClass()} );
@@ -163,7 +169,7 @@ public abstract class AbstractSchemaTest
 		if (cardinality==Cardinality.Simple) return;
 		// add value
     	String setter = "add"+TypeTestingHelper.calculateFieldNameForMethod(fieldName);
-    	TypeDescription td = TypeMapping.getTypeDescription(type);
+    	TypeDescription td = typeMapping.getTypeDescription(type);
     	Object value1 = TypeTestingHelper.getJavaValue(td);
     	Method set = getSchemaClass().getMethod(setter, new Class<?>[] {TypeTestingHelper.getJavaType(td)} );
     	set.invoke(getSchema(), new Object [] {value1});

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java Thu Aug  2 21:25:10 2012
@@ -24,6 +24,7 @@ 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.AdobePDFSchema;
 import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
@@ -34,10 +35,12 @@ public class AdobePDFErrorsTest {
 
 	protected XMPMetadata metadata;
 
+	protected XMPDocumentBuilder builder;
+	
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
-
+		builder = new XMPDocumentBuilder();
+		metadata = builder.createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java Thu Aug  2 21:25:10 2012
@@ -27,6 +27,7 @@ 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;
@@ -38,7 +39,7 @@ public class AdobePDFTest extends Abstra
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 		schema = metadata.createAndAddAdobePDFSchema();
 		schemaClass = AdobePDFSchema.class;
 	}

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/BasicJobTicketSchemaTest.java Thu Aug  2 21:25:10 2012
@@ -37,18 +37,27 @@ import org.apache.padaf.xmpbox.parser.Xm
 import org.apache.padaf.xmpbox.parser.XmpXpacketEndException;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.JobType;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class BasicJobTicketSchemaTest {
 
 	protected static XMPDocumentBuilder builder;
+
+	protected XMPMetadata metadata;
+
 	
 	@BeforeClass
 	public static void bc () throws Exception {
 		builder = new XMPDocumentBuilder();
 	}
 	
+	@Before
+	public void initTempMetaData() throws Exception {
+		metadata = builder.createXMPMetadata();
+	}
+
 	private InputStream transfer(ByteArrayOutputStream out) {
 		IOUtils.closeQuietly(out);
 		ByteArrayInputStream bis = new ByteArrayInputStream(out.toByteArray());
@@ -68,8 +77,7 @@ public class BasicJobTicketSchemaTest {
 	@Test
 	public void testAddTwoJobs() throws Exception {
 		
-		XMPMetadata xmpMetadata = new XMPMetadata();
-		XMPBasicJobTicketSchema basic = xmpMetadata.createAndAddBasicJobTicketSchema();
+		XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
 
 		basic.addJob("zeid1", "zename1", "zeurl1","aaa");
 		basic.addJob("zeid2", "zename2", "zeurl2");
@@ -77,7 +85,7 @@ public class BasicJobTicketSchemaTest {
 //		SaveMetadataHelper.serialize(xmpMetadata, System.out);
 		
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		SaveMetadataHelper.serialize(xmpMetadata, bos);
+		SaveMetadataHelper.serialize(metadata, bos);
 		XMPMetadata rxmp = parse(bos);
 
 		XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
@@ -89,13 +97,12 @@ public class BasicJobTicketSchemaTest {
 	@Test
 	public void testAddWithDefaultPrefix() throws Exception {
 		
-		XMPMetadata xmpMetadata = new XMPMetadata();
-		XMPBasicJobTicketSchema basic = xmpMetadata.createAndAddBasicJobTicketSchema();
+		XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
 
 		basic.addJob("zeid2", "zename2", "zeurl2");
 		
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		SaveMetadataHelper.serialize(xmpMetadata, bos);
+		SaveMetadataHelper.serialize(metadata, bos);
 		XMPMetadata rxmp = parse(bos);
 
 		XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
@@ -114,15 +121,14 @@ public class BasicJobTicketSchemaTest {
 //	@Test
 	public void testAddWithDefinedPrefix() throws Exception {
 		
-		XMPMetadata xmpMetadata = new XMPMetadata();
-		XMPBasicJobTicketSchema basic = xmpMetadata.createAndAddBasicJobTicketSchema();
+		XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
 
 		basic.addJob("zeid2", "zename2", "zeurl2","aaa");
 		
-		SaveMetadataHelper.serialize(xmpMetadata, System.out);
+		SaveMetadataHelper.serialize(metadata, System.out);
 		
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		SaveMetadataHelper.serialize(xmpMetadata, bos);
+		SaveMetadataHelper.serialize(metadata, bos);
 		XMPMetadata rxmp = parse(bos);
 
 		XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java Thu Aug  2 21:25:10 2012
@@ -29,6 +29,7 @@ import java.util.Map;
 import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.parser.XmpSchemaException;
 import org.apache.padaf.xmpbox.schema.PDFAExtensionSchema;
 import org.apache.padaf.xmpbox.schema.PDFAPropertyDescription;
@@ -44,7 +45,7 @@ public class PDFAExtensionTest {
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java Thu Aug  2 21:25:10 2012
@@ -24,6 +24,7 @@ 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;
@@ -35,8 +36,7 @@ public class PDFAIdentificationOthersTes
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
-
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java Thu Aug  2 21:25:10 2012
@@ -27,6 +27,7 @@ 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;
@@ -38,7 +39,7 @@ public class PDFAIdentificationTest exte
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 		schema = metadata.createAndAddPFAIdentificationSchema();
 		schemaClass = PDFAIdentificationSchema.class;
 	}

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java Thu Aug  2 21:25:10 2012
@@ -23,6 +23,7 @@ package org.apache.padaf.xmpbox.schema;
 
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.schema.PDFAPropertyDescription;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.junit.Assert;
@@ -36,7 +37,7 @@ public class PDFAPropertyDescriptionTest
 
 	@Before
 	public void resetDocument() throws Exception {
-		parent = new XMPMetadata();
+		parent = new XMPDocumentBuilder().createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java Thu Aug  2 21:25:10 2012
@@ -25,6 +25,7 @@ import javax.xml.transform.TransformerEx
 
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.apache.padaf.xmpbox.schema.PDFAFieldDescription;
 import org.apache.padaf.xmpbox.schema.PDFAValueTypeDescription;
 import org.junit.Assert;
@@ -37,7 +38,7 @@ public class PDFAValueTypeDescriptionTes
 
 	@Before
 	public void resetDocument() throws Exception {
-		parent = new XMPMetadata();
+		parent = new XMPDocumentBuilder().createXMPMetadata();
 	}
 
 	@Test

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java Thu Aug  2 21:25:10 2012
@@ -28,6 +28,7 @@ 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;
@@ -43,7 +44,7 @@ public class XMPBasicTest extends Abstra
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 		schema = metadata.createAndAddXMPBasicSchema();
 		schemaClass = XMPBasicSchema.class;
 	}

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java Thu Aug  2 21:25:10 2012
@@ -27,6 +27,7 @@ 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;
@@ -38,7 +39,7 @@ public class XMPMediaManagementTest exte
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 		schema = metadata.createAndAddXMPMediaManagementSchema();
 		schemaClass = XMPMediaManagementSchema.class;
 	}

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java Thu Aug  2 21:25:10 2012
@@ -29,6 +29,7 @@ import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.parser.DateConverter;
+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.Attribute;
@@ -48,7 +49,7 @@ public class XMPSchemaTest {
 
 	@Before
 	public void resetDocument() throws Exception {
-		parent = new XMPMetadata();
+		parent = new XMPDocumentBuilder().createXMPMetadata();
 		schem = new XMPSchema(parent, "nsSchem", "nsURI");
 
 	}

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java Thu Aug  2 21:25:10 2012
@@ -29,6 +29,7 @@ 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;
@@ -44,7 +45,7 @@ public class XmpRightsSchemaTest extends
 
 	@Before
 	public void initTempMetaData() throws Exception {
-		metadata = new XMPMetadata();
+		metadata = new XMPDocumentBuilder().createXMPMetadata();
 		schema = metadata.createAndAddXMPRightsManagementSchema();
 		schemaClass = XMPRightsManagementSchema.class;
 	}

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java Thu Aug  2 21:25:10 2012
@@ -31,6 +31,7 @@ import java.util.UUID;
 import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
 import org.junit.Test;
 
 public abstract class AbstractStructuredTypeTester {
@@ -43,9 +44,14 @@ public abstract class AbstractStructured
 	
 	protected Class<? extends AbstractStructuredType> clz;
 	
+	protected TypeMapping typeMapping = null;
+	
+	protected XMPDocumentBuilder builder;
 	
 	public void before () throws Exception {
-		xmp = new XMPMetadata();
+		builder = new XMPDocumentBuilder();
+		xmp = builder.createXMPMetadata();
+		typeMapping = builder.getTypeMapping();
 	}
 	
 	public AbstractStructuredTypeTester (Class<? extends AbstractStructuredType> clz, String fieldName, String type) {
@@ -69,7 +75,7 @@ public abstract class AbstractStructured
 	
 	@Test
 	public void testSettingValue() throws Exception {
-		TypeDescription td =TypeMapping.getTypeDescription(type);
+		TypeDescription td =typeMapping.getTypeDescription(type);
 		Object value = TypeTestingHelper.getJavaValue(td);
 		getStructured().addSimpleProperty(fieldName, value);
 		Assert.assertNotNull(getStructured().getProperty(fieldName));
@@ -86,7 +92,7 @@ public abstract class AbstractStructured
 
 	@Test
 	public void testPropertyType() throws Exception {
-		TypeDescription td =TypeMapping.getTypeDescription(type);
+		TypeDescription td =typeMapping.getTypeDescription(type);
 		Object value = TypeTestingHelper.getJavaValue(td);
 		getStructured().addSimpleProperty(fieldName, value);
 		Assert.assertNotNull(getStructured().getProperty(fieldName));
@@ -110,7 +116,7 @@ public abstract class AbstractStructured
     @Test
     public void testSetter () throws Exception {
     	String setter = TypeTestingHelper.calculateSimpleSetter(fieldName);
-    	TypeDescription td = TypeMapping.getTypeDescription(type);
+    	TypeDescription td = 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/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java Thu Aug  2 21:25:10 2012
@@ -26,6 +26,7 @@ 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;
 
@@ -61,7 +62,7 @@ public class TestAbstractStructuredType 
 	
 	@Before
 	public void before () throws Exception {
-		XMPMetadata xmp = new XMPMetadata();
+		XMPMetadata xmp = new XMPDocumentBuilder().createXMPMetadata();
 		st = new MyStructuredType(xmp, MY_NS, MY_PREFIX);
 	}
 	

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestDerivedType.java Thu Aug  2 21:25:10 2012
@@ -25,6 +25,7 @@ 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;
@@ -80,7 +81,7 @@ public class TestDerivedType {
 
     @Before
     public void before () throws Exception {
-		xmp = new XMPMetadata();
+		xmp =new XMPDocumentBuilder().createXMPMetadata();
 		constructor = clz.getConstructor(new Class [] {
 				XMPMetadata.class,
 				String.class,

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java?rev=1368710&r1=1368709&r2=1368710&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java Thu Aug  2 21:25:10 2012
@@ -26,6 +26,7 @@ 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;
@@ -49,7 +50,7 @@ public class TestSimpleMetadataPropertie
 
 	@Before
 	public void resetDocument() throws Exception {
-		parent = new XMPMetadata();
+		parent = new XMPDocumentBuilder().createXMPMetadata();
 	}
 
 	/**



Mime
View raw message