pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gbaill...@apache.org
Subject svn commit: r1376996 - 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 Fri, 24 Aug 2012 17:19:17 GMT
Author: gbailleul
Date: Fri Aug 24 17:19:16 2012
New Revision: 1376996

URL: http://svn.apache.org/viewvc?rev=1376996&view=rev
Log:
PDFBOX-1343: remove cyclic references between xmp object representation and parsing

Added:
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/DateConverter.java
      - copied, changed from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/DateConverter.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/CreateXMPMetadataException.java
      - copied, changed from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/CreateXMPMetadataException.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/TransformException.java
      - copied, changed from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/TransformException.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
      - copied, changed from r1374728, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpSerializer.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java
      - copied, changed from r1370356, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchemaFactory.java
      - copied, changed from r1376944, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XmpSchemaException.java
      - copied, changed from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java
Removed:
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/CreateXMPMetadataException.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/TransformException.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpSerializer.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/DateConverter.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.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/parser/StructuredPropertyParser.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.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/AbstractStructuredType.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/DateType.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.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/SaveMetadataHelperTest.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/schema/AbstractSchemaTester.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/XMPSchemaTest.java
    pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java

Copied: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/DateConverter.java (from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/DateConverter.java)
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/DateConverter.java?p2=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/DateConverter.java&p1=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/DateConverter.java&r1=1370327&r2=1376996&rev=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/DateConverter.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/DateConverter.java Fri Aug 24 17:19:16 2012
@@ -19,7 +19,7 @@
  * 
  ****************************************************************************/
 
-package org.apache.padaf.xmpbox.parser;
+package org.apache.padaf.xmpbox;
 
 import java.io.IOException;
 import java.text.ParseException;

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -25,18 +25,21 @@ 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.parser.CreateXMPMetadataException;
 import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
 import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
+import org.apache.padaf.xmpbox.schema.NSMapping;
 import org.apache.padaf.xmpbox.schema.PDFAExtensionSchema;
 import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.padaf.xmpbox.schema.PhotoshopSchema;
+import org.apache.padaf.xmpbox.schema.SchemaMapping;
 import org.apache.padaf.xmpbox.schema.XMPBasicJobTicketSchema;
 import org.apache.padaf.xmpbox.schema.XMPBasicSchema;
 import org.apache.padaf.xmpbox.schema.XMPMediaManagementSchema;
 import org.apache.padaf.xmpbox.schema.XMPRightsManagementSchema;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
+import org.apache.padaf.xmpbox.schema.XmpSchemaException;
+import org.apache.padaf.xmpbox.type.TypeMapping;
 
 /**
  * Object representation of XMPMetaData Be CAREFUL: typically, metadata should
@@ -63,8 +66,14 @@ public class XMPMetadata {
     private String xpacketEndData = "end=\"w\"";
 
     private SchemasContainer schemas;
+    
+    private TypeMapping typeMapping;
+    
+    private NSMapping nsMapping;
+    
+    private SchemaMapping schemaMapping;
 
-    private XMPDocumentBuilder builder;
+//    private XMPDocumentBuilder builder;
 
     /**
      * Contructor of an empty default XMPMetaData
@@ -72,9 +81,13 @@ public class XMPMetadata {
      * @throws CreateXMPMetadataException
      *             If DOM Document associated could not be created
      */
-    protected XMPMetadata(XMPDocumentBuilder builder) throws CreateXMPMetadataException {
-      	this.builder = builder;
+    protected XMPMetadata(TypeMapping tm) {
+//      	this.builder = builder;
         schemas = new SchemasContainer();
+        this.typeMapping = tm;
+        this.nsMapping = new NSMapping(this);
+        this.schemaMapping = new SchemaMapping();
+        
     }
 
     /**
@@ -92,10 +105,10 @@ public class XMPMetadata {
      * @throws CreateXMPMetadataException
      *             If DOM Document associated could not be created
      */
-    protected XMPMetadata(XMPDocumentBuilder builder, String xpacketBegin, String xpacketId,
-            String xpacketBytes, String xpacketEncoding)
-    throws CreateXMPMetadataException {
-    	this.builder = builder;
+    protected XMPMetadata(TypeMapping tm, String xpacketBegin, String xpacketId,
+            String xpacketBytes, String xpacketEncoding) {
+    	this(tm);
+//    	this.builder = builder;
         this.xpacketBegin = xpacketBegin;
         this.xpacketId = xpacketId;
         this.xpacketBytes = xpacketBytes;
@@ -103,6 +116,18 @@ public class XMPMetadata {
         schemas = new SchemasContainer();
     }
 
+    public TypeMapping getTypeMapping () {
+    	return this.typeMapping;
+    }
+    
+    public NSMapping getNsMapping () {
+    	return this.nsMapping;
+    }
+    
+    public SchemaMapping getSchemaMapping () {
+    	return this.schemaMapping;
+    }
+    
     /**
      * Get xpacketBytes
      * 
@@ -463,9 +488,9 @@ public class XMPMetadata {
         return (AdobePDFSchema) getSchema(AdobePDFSchema.PDFURI);
     }
 
-    public XMPDocumentBuilder getBuilder() {
-		return builder;
-	}
+//    public XMPDocumentBuilder getBuilder() {
+//		return builder;
+//	}
 
 
 

Copied: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/CreateXMPMetadataException.java (from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/CreateXMPMetadataException.java)
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/CreateXMPMetadataException.java?p2=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/CreateXMPMetadataException.java&p1=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/CreateXMPMetadataException.java&r1=1370327&r2=1376996&rev=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/CreateXMPMetadataException.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/CreateXMPMetadataException.java Fri Aug 24 17:19:16 2012
@@ -18,9 +18,8 @@
  * under the License.
  * 
  ****************************************************************************/
-package org.apache.padaf.xmpbox;
+package org.apache.padaf.xmpbox.parser;
 
-import org.apache.padaf.xmpbox.parser.XmpParsingException;
 
 /**
  * This exception is thrown when a problem is encountered during the creation of

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -28,11 +28,13 @@ import javax.xml.stream.XMLStreamConstan
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.padaf.xmpbox.DateConverter;
 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.AbstractStructuredType;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
 import org.apache.padaf.xmpbox.type.DefinedStructuredType;
 import org.apache.padaf.xmpbox.type.PropMapping;
@@ -48,18 +50,23 @@ public class StructuredPropertyParser {
 	private PropMapping propDesc = null;
 	
 	private boolean isDefinedStructureType = false;
+	
 
-	public StructuredPropertyParser(XMPDocumentBuilder builder,Class<? extends AbstractStructuredType> propertyTypeClass) 
+	public StructuredPropertyParser(XMPDocumentBuilder builder, Class<? extends AbstractStructuredType> propertyTypeClass) 
 			throws XmpPropertyFormatException {
 		this.builder = builder;
 		this.typeClass = propertyTypeClass;
 		// retrieve xmp properties
-		this.propDesc = ReflectHelper.initializePropMapping(null, propertyTypeClass); // TODO GBL GBA
+		this.propDesc = ReflectHelper.initializePropMapping(null, propertyTypeClass);
 		this.isDefinedStructureType = DefinedStructuredType.class.isAssignableFrom(typeClass); 
 	}
 
 	private AbstractStructuredType instanciateProperty (XMPMetadata metadata) throws XmpParsingException {
-		return builder.getTypeMapping().instanciateStructuredType(metadata, typeClass);
+		try {
+			return metadata.getTypeMapping().instanciateStructuredType(metadata, typeClass);
+		} catch (BadFieldValueException e) {
+			throw new XmpParsingException ("Failed to instanciate property",e);
+		}
 	}
 
 
@@ -177,23 +184,23 @@ public class StructuredPropertyParser {
 				}
 
 				if (reader.getEventType()==XMLStreamConstants.START_ELEMENT) {
-					TypeDescription td = builder.getTypeMapping().getStructuredTypeName(eltName.getNamespaceURI());
+					TypeDescription 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 (builder.getTypeMapping().isStructuredType(ptype)) {
-						TypeDescription tclass = builder.getTypeMapping().getTypeDescription(ptype);
+					if (metadata.getTypeMapping().isStructuredType(ptype)) {
+						TypeDescription tclass = metadata.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 (builder.getTypeMapping().getArrayType(ptype)!=null) {
+					} else if (metadata.getTypeMapping().getArrayType(ptype)!=null) {
 						int pos = ptype.indexOf(' ');
-						String arrayType = builder.getTypeMapping().getArrayType(ptype);
+						String arrayType = metadata.getTypeMapping().getArrayType(ptype);
 						String typeInArray = ptype.substring(pos+1);
 
-						TypeDescription tclass = builder.getTypeMapping().getTypeDescription(typeInArray);
+						TypeDescription tclass = metadata.getTypeMapping().getTypeDescription(typeInArray);
 						Class<? extends AbstractStructuredType> tcn = (Class<? extends AbstractStructuredType>)tclass.getTypeClass();
 
 						ArrayProperty cp = new ArrayProperty(metadata,null,
@@ -245,7 +252,7 @@ public class StructuredPropertyParser {
 			String propertyName,
 			String valueAsString) 
 					throws XmpParsingException {
-		TypeDescription description = builder.getTypeMapping().getTypeDescription(type);
+		TypeDescription description = metadata.getTypeMapping().getTypeDescription(type);
 		Object value = null;
 		switch (description.getBasic()) {
 		case Boolean : 
@@ -276,7 +283,7 @@ public class StructuredPropertyParser {
 			value = valueAsString;
 		}
 
-		return builder.getTypeMapping().instanciateSimpleProperty(metadata, null, prefix, propertyName, value, type);
+		return metadata.getTypeMapping().instanciateSimpleProperty(metadata, null, prefix, propertyName, value, type);
 	}
 
 }

Copied: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/TransformException.java (from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/TransformException.java)
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/TransformException.java?p2=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/TransformException.java&p1=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/TransformException.java&r1=1370327&r2=1376996&rev=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/TransformException.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/TransformException.java Fri Aug 24 17:19:16 2012
@@ -19,7 +19,7 @@
  * 
  ****************************************************************************/
 
-package org.apache.padaf.xmpbox;
+package org.apache.padaf.xmpbox.parser;
 
 /**
  * Exception when Parsing cannot be made

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -37,13 +37,13 @@ import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.padaf.xmpbox.CreateXMPMetadataException;
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.XmpConstants;
 import org.apache.padaf.xmpbox.schema.NSMapping;
 import org.apache.padaf.xmpbox.schema.PDFAExtensionSchema;
-import org.apache.padaf.xmpbox.schema.SchemaMapping;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
+import org.apache.padaf.xmpbox.schema.XMPSchemaFactory;
+import org.apache.padaf.xmpbox.schema.XmpSchemaException;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
 import org.apache.padaf.xmpbox.type.AbstractStructuredType;
@@ -70,12 +70,6 @@ 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>();
 
 	public static final String VALUE_TYPE_NAME = "valueType";
@@ -92,29 +86,26 @@ public class XMPDocumentBuilder {
 	 *             case, if its namespace miss
 	 */
 	public XMPDocumentBuilder() throws XmpSchemaException {
-		nsMap = new NSMapping(this);
-		this.typeMapping = new TypeMapping();
-		this.schemaMapping = new SchemaMapping();
 	}
 
 	public XMPMetadata createXMPMetadata () throws CreateXMPMetadataException {
-		return new WrappedXMPMetadata(this);
+		return new WrappedXMPMetadata(new TypeMapping());
 	}
 
 	public XMPMetadata createXMPMetadata (String begin, String id, String bytes, String encoding) throws CreateXMPMetadataException {
-		return new WrappedXMPMetadata(this,begin, id, bytes, encoding);
+		return new WrappedXMPMetadata(new TypeMapping(),begin, id, bytes, encoding);
 
 	}
 	protected class WrappedXMPMetadata extends XMPMetadata {
 
-		public WrappedXMPMetadata(XMPDocumentBuilder builder) throws CreateXMPMetadataException {
-			super(builder);
+		public WrappedXMPMetadata(TypeMapping tm) throws CreateXMPMetadataException {
+			super(tm);
 		}
 
-		public WrappedXMPMetadata(XMPDocumentBuilder builder, String xpacketBegin, String xpacketId,
+		public WrappedXMPMetadata(TypeMapping tm, String xpacketBegin, String xpacketId,
 				String xpacketBytes, String xpacketEncoding)
 						throws CreateXMPMetadataException {
-			super(builder, xpacketBegin, xpacketId, xpacketBytes, xpacketEncoding);
+			super(tm, xpacketBegin, xpacketId, xpacketBytes, xpacketEncoding);
 		}
 
 
@@ -184,14 +175,15 @@ public class XMPDocumentBuilder {
 					"Did not find initial rdf:RDF");
 			expectName(XmpConstants.RDF_NAMESPACE, "RDF");
 
-			nsMap.resetComplexBasicTypesDeclarationInEntireXMPLevel();
+			// TODO GBL GBA maybe not remove
+			metadata.getNsMapping().resetComplexBasicTypesDeclarationInEntireXMPLevel();
 			// add all namespaces which could declare nsURI of a basicValueType
 			// all others declarations are ignored
 			int nsCount = reader.get().getNamespaceCount();
 			// TODO MUTUALIZE namespace list loading
 			for (int i = 0; i < nsCount; i++) {
-				if (typeMapping.isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
-					nsMap.setComplexBasicTypesDeclarationForLevelXMP(
+				if (metadata.getTypeMapping().isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
+					metadata.getNsMapping().setComplexBasicTypesDeclarationForLevelXMP(
 							reader.get().getNamespaceURI(i), 
 							reader.get().getNamespacePrefix(i));
 				}
@@ -269,12 +261,12 @@ public class XMPDocumentBuilder {
 						String namespaceUri = st.getNamespaceURI();
 						ArrayProperty properties = st.getProperty();
 						ArrayProperty valueTypes = st.getValueType();
-						XMPSchemaFactory xsf = schemaMapping.getSchemaFactory(namespaceUri);
+						XMPSchemaFactory xsf = meta.getSchemaMapping().getSchemaFactory(namespaceUri);
 						// retrieve namespaces
 						if (xsf==null) {
 							// create namespace with no field
-							schemaMapping.addNewNameSpace(namespaceUri);
-							xsf = schemaMapping.getSchemaFactory(namespaceUri);
+							meta.getSchemaMapping().addNewNameSpace(namespaceUri);
+							xsf = meta.getSchemaMapping().getSchemaFactory(namespaceUri);
 						}
 						// populate value type
 						if (valueTypes!=null) {
@@ -304,7 +296,7 @@ public class XMPDocumentBuilder {
 													throw new XmpRequiredPropertyException("Missing field in field definition");
 												}
 												// create the type
-												TypeDescription vtd = typeMapping.getTypeDescription(fValueType);
+												TypeDescription vtd = meta.getTypeMapping().getTypeDescription(fValueType);
 												if (vtd!=null) {
 													// a type is found
 													String ftype = vtd.getType();
@@ -318,7 +310,7 @@ public class XMPDocumentBuilder {
 									}
 									// add the structured type to list
 									TypeDescription td = new TypeDescription(ttype, null, DefinedStructuredType.class);
-									typeMapping.addToStructuredMaps(td,tns);
+									meta.getTypeMapping().addToStructuredMaps(td,tns);
 								}
 							}	
 						}
@@ -336,7 +328,7 @@ public class XMPDocumentBuilder {
 									throw new XmpRequiredPropertyException("Missing field in property definition");
 								}
 								// check ptype existance
-								TypeDescription td = typeMapping.getTypeDescription(ptype);
+								TypeDescription td = meta.getTypeMapping().getTypeDescription(ptype);
 								if (td==null) {
 									// type not defined
 									throw new XmpUnknownValueTypeException("Type not defined : "+ptype);
@@ -445,7 +437,7 @@ public class XMPDocumentBuilder {
 						"Unknown attribute in xpacket PI : '" + token + "'");
 			}
 		}
-		return new WrappedXMPMetadata(this,begin, id, bytes, encoding);
+		return new WrappedXMPMetadata(new TypeMapping(),begin, id, bytes, encoding);
 	}
 
 	/**
@@ -622,10 +614,10 @@ public class XMPDocumentBuilder {
 		boolean added = false;
 		String schemaNamespace = schema.getNamespaceValue();
 		String prefix = attr.getPrefix() != null ? attr.getPrefix() : schema.getPrefix();
-		String type = this.nsMap.getSpecifiedPropertyType(schemaNamespace, new QName(schemaNamespace, attr.getLocalName(), prefix));
+		String type = metadata.getNsMapping().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 = metadata.getTypeMapping().instanciateSimpleProperty(metadata, null, prefix, attr.getLocalName(), attr.getValue(), type);
 			schema.getContent().addProperty(prop);
 			added = true;
 		}
@@ -657,6 +649,7 @@ public class XMPDocumentBuilder {
 			throws XmpParsingException, XMLStreamException, XmpSchemaException,
 			XmpUnknownValueTypeException, XmpExpectedRdfAboutAttribute,
 			BadFieldValueException {
+		NSMapping nsMap = metadata.getNsMapping();
 		nsMap.resetComplexBasicTypesDeclarationInSchemaLevel();
 		int cptNS = reader.get().getNamespaceCount();
 		HashMap<String, String> namespaces = new HashMap<String, String>();
@@ -664,7 +657,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 (metadata.getTypeMapping().isStructuredTypeNamespace(reader.get().getNamespaceURI(i))) {
 				nsMap.setComplexBasicTypesDeclarationForLevelSchema(reader
 						.get().getNamespaceURI(i), reader.get()
 						.getNamespacePrefix(i));
@@ -754,6 +747,7 @@ public class XMPDocumentBuilder {
 	 */
 	private String getPropertyDeclarationInNamespaces(XMPSchema schema,
 			QName prop) throws XmpParsingException {
+		NSMapping nsMap = schema.getMetadata().getNsMapping();
 		Iterator<Attribute> it = schema.getAllAttributes().iterator();
 		Attribute tmp;
 		ArrayList<Attribute> list = new ArrayList<Attribute>();
@@ -805,8 +799,8 @@ public class XMPDocumentBuilder {
 						.getAttributeLocalName(i), reader.get()
 						.getAttributeValue(i)));
 			}
-			prop = typeMapping.instanciateSimpleProperty(metadata, null, propertyName.getPrefix(), 
-					propertyName.getLocalPart(), reader.get().getElementText(),typeMapping.getType(tclass));
+			prop = metadata.getTypeMapping().instanciateSimpleProperty(metadata, null, propertyName.getPrefix(), 
+					propertyName.getLocalPart(), reader.get().getElementText(),metadata.getTypeMapping().getType(tclass));
 			if (prop != null) {
 				container.addProperty(prop);
 				// ADD ATTRIBUTES
@@ -905,6 +899,8 @@ public class XMPDocumentBuilder {
 			XmpUnexpectedTypeException, XMLStreamException,
 			XmpUnknownPropertyTypeException {
 		XMPMetadata metadata = schema.getMetadata();
+		NSMapping nsMap = metadata.getNsMapping();
+		TypeMapping typeMapping = metadata.getTypeMapping();
 		QName propertyName = reader.get().getName();
 		if (parsingExtension) {
 			if (!propertyName.getNamespaceURI().equals(PDFAExtensionSchema.PDFAEXTENSIONURI)) {
@@ -984,22 +980,10 @@ public class XMPDocumentBuilder {
 		}
 	}
 
-	public NSMapping getNsMap() {
-		return nsMap;
-	}
-
 	public XMLStreamReader getReader() {
 		return reader.get();
 	}
 
-	public TypeMapping getTypeMapping () {
-		return this.typeMapping;
-	}
-
-	public SchemaMapping getSchemaMapping() {
-		return schemaMapping;
-	}
-
 	public void skipCurrentElement () throws XmpParsingException,XMLStreamException {
 		if (!reader.get().isStartElement()) {
 			throw new XmpParsingException("SkipElement only start on Start element event");

Copied: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java (from r1374728, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpSerializer.java)
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java?p2=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java&p1=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpSerializer.java&r1=1374728&r2=1376996&rev=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XmpSerializer.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java Fri Aug 24 17:19:16 2012
@@ -18,7 +18,7 @@
  * 
  ****************************************************************************/
 
-package org.apache.padaf.xmpbox;
+package org.apache.padaf.xmpbox.parser;
 
 import java.io.IOException;
 import java.io.OutputStream;
@@ -28,7 +28,8 @@ import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.padaf.xmpbox.parser.XMLUtil;
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.XmpConstants;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;

Copied: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java (from r1370356, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java)
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java?p2=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java&p1=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java&r1=1370356&r2=1376996&rev=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/NSMapping.java Fri Aug 24 17:19:16 2012
@@ -28,9 +28,6 @@ import java.util.Map.Entry;
 import javax.xml.namespace.QName;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-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.type.TypeMapping;
 
 
@@ -42,7 +39,7 @@ import org.apache.padaf.xmpbox.type.Type
  */
 public class NSMapping {
 
-	private XMPDocumentBuilder builder = null;
+	private XMPMetadata metadata = null;
 	
 	private Map<String, String> complexBasicTypesDeclarationEntireXMPLevel;
 	
@@ -56,12 +53,11 @@ public class NSMapping {
 	 * @throws XmpSchemaException
 	 *             When could not read a property data in a Schema Class given
 	 */
-	public NSMapping(XMPDocumentBuilder builder) throws XmpSchemaException {
-		this.builder = builder;
+	public NSMapping(XMPMetadata metadata) {
+		this.metadata = metadata;
 		complexBasicTypesDeclarationEntireXMPLevel = new HashMap<String, String>();
 		complexBasicTypesDeclarationSchemaLevel = new HashMap<String, String>();
 		complexBasicTypesDeclarationPropertyLevel = new HashMap<String, String>();
-//		definedNamespaces = new HashMap<String, XMPSchemaFactory>();
 	}
 
 
@@ -101,10 +97,9 @@ public class NSMapping {
 	 * @return True if namespace URI is known
 	 */
 	public boolean isContainedNamespace(String namespace) {
-		boolean found = builder.getSchemaMapping().isContainedNamespace(namespace);
+		boolean found = metadata.getSchemaMapping().isContainedNamespace(namespace);
 		if (!found) {
-//			found = definedNamespaces.containsKey(namespace);
-			TypeMapping tm = builder.getTypeMapping();
+			TypeMapping tm = metadata.getTypeMapping();
 			found = tm.isStructuredTypeNamespace(namespace);
 		}
 		return found;
@@ -121,7 +116,7 @@ public class NSMapping {
 	 * @return Property type declared for namespace specified, null if unknown
 	 */
 	public String getSpecifiedPropertyType(String namespace, QName prop) {
-		XMPSchemaFactory factory = builder.getSchemaMapping().getSchemaFactory(namespace);
+		XMPSchemaFactory factory = metadata.getSchemaMapping().getSchemaFactory(namespace);
 		if (factory!=null) {
 			return factory.getPropertyType(prop.getLocalPart());
 		} else {
@@ -141,7 +136,7 @@ public class NSMapping {
 	 */
 	public void setComplexBasicTypesDeclarationForLevelXMP(String namespace,
 			String prefix) {
-		if (builder.getTypeMapping().isStructuredTypeNamespace(namespace)) {
+		if (metadata.getTypeMapping().isStructuredTypeNamespace(namespace)) {
 			complexBasicTypesDeclarationEntireXMPLevel.put(prefix, namespace);
 		}
 	}
@@ -158,7 +153,7 @@ public class NSMapping {
 	 */
 	public void setComplexBasicTypesDeclarationForLevelSchema(String namespace,
 			String prefix) {
-		if (builder.getTypeMapping().isStructuredTypeNamespace(namespace)) {
+		if (metadata.getTypeMapping().isStructuredTypeNamespace(namespace)) {
 			complexBasicTypesDeclarationSchemaLevel.put(prefix, namespace);
 		}
 
@@ -175,7 +170,7 @@ public class NSMapping {
 	 */
 	public void setComplexBasicTypesDeclarationForLevelProperty(
 			String namespace, String prefix) {
-		if (builder.getTypeMapping().isStructuredTypeNamespace(namespace)) {
+		if (metadata.getTypeMapping().isStructuredTypeNamespace(namespace)) {
 			complexBasicTypesDeclarationPropertyLevel.put(prefix, namespace);
 		}
 	}
@@ -222,7 +217,7 @@ public class NSMapping {
 		}
 		// return complex basic type
 		if (tmp!=null) {
-			return builder.getTypeMapping().getStructuredTypeName(tmp).getType();
+			return metadata.getTypeMapping().getStructuredTypeName(tmp).getType();
 		} else {
 			// 
 			return null;
@@ -242,12 +237,12 @@ public class NSMapping {
 	 *             When Instancing specified Object Schema failed
 	 */
 	public XMPSchema getAssociatedSchemaObject(XMPMetadata metadata, String namespace, String prefix) throws XmpSchemaException {
-		XMPSchema found = builder.getSchemaMapping().getAssociatedSchemaObject(metadata, namespace, prefix);
+		XMPSchema found = metadata.getSchemaMapping().getAssociatedSchemaObject(metadata, namespace, prefix);
 		if (found!=null) {
 			return found;
 		} else {
 			// look in local
-			XMPSchemaFactory factory = builder.getSchemaMapping().getSchemaFactory(namespace);
+			XMPSchemaFactory factory = metadata.getSchemaMapping().getSchemaFactory(namespace);
 			if (factory==null) {
 				return null;
 			}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java?rev=1376996&r1=1376995&r2=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/SchemaMapping.java Fri Aug 24 17:19:16 2012
@@ -25,8 +25,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XMPSchemaFactory;
-import org.apache.padaf.xmpbox.parser.XmpSchemaException;
 import org.apache.padaf.xmpbox.type.PropMapping;
 import org.apache.padaf.xmpbox.type.ReflectHelper;
 

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -28,7 +28,6 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
 import org.apache.padaf.xmpbox.type.Attribute;
@@ -214,7 +213,7 @@ public class XMPSchema {
 		} else {
 			AbstractSimpleProperty specifiedTypeProperty;
 			try {
-				TypeMapping tm = metadata.getBuilder().getTypeMapping();
+				TypeMapping tm = metadata.getTypeMapping();
 				specifiedTypeProperty = tm.instanciateSimpleProperty(
 						metadata, null, 
 						splittedQualifiedName[0], splittedQualifiedName[1], propertyValue,
@@ -1407,7 +1406,7 @@ public class XMPSchema {
 	}
 
 	protected AbstractSimpleProperty instanciateSimple (String param, Object value) {
-		TypeMapping tm = metadata.getBuilder().getTypeMapping();
+		TypeMapping tm = metadata.getTypeMapping();
 		return tm.instanciateSimpleField(
 				getClass(), 
 				metadata, 

Copied: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchemaFactory.java (from r1376944, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java)
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchemaFactory.java?p2=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchemaFactory.java&p1=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java&r1=1376944&r2=1376996&rev=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchemaFactory.java Fri Aug 24 17:19:16 2012
@@ -19,14 +19,13 @@
  * 
  ****************************************************************************/
 
-package org.apache.padaf.xmpbox.parser;
+package org.apache.padaf.xmpbox.schema;
 
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.apache.padaf.xmpbox.type.PropMapping;
 
 

Copied: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XmpSchemaException.java (from r1370327, pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java)
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XmpSchemaException.java?p2=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XmpSchemaException.java&p1=pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java&r1=1370327&r2=1376996&rev=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XmpSchemaException.java Fri Aug 24 17:19:16 2012
@@ -19,7 +19,7 @@
  * 
  ****************************************************************************/
 
-package org.apache.padaf.xmpbox.parser;
+package org.apache.padaf.xmpbox.schema;
 
 /**
  * Exception thrown when problems occurs in Schema Treatment

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java?rev=1376996&r1=1376995&r2=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java Fri Aug 24 17:19:16 2012
@@ -51,7 +51,7 @@ public abstract class AbstractStructured
 
 	
 	protected void addSimpleProperty (String propertyName, Object value) {
-		TypeMapping tm = getMetadata().getBuilder().getTypeMapping();
+		TypeMapping tm = getMetadata().getTypeMapping();
 		AbstractSimpleProperty asp = tm.instanciateSimpleField(getClass(), getMetadata(),null,fieldPrefix,propertyName, value);
 		addProperty(asp);
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/DateType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/DateType.java?rev=1376996&r1=1376995&r2=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/DateType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/DateType.java Fri Aug 24 17:19:16 2012
@@ -24,8 +24,8 @@ package org.apache.padaf.xmpbox.type;
 import java.io.IOException;
 import java.util.Calendar;
 
+import org.apache.padaf.xmpbox.DateConverter;
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.DateConverter;
 
 
 /**

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java?rev=1376996&r1=1376995&r2=1376996&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java Fri Aug 24 17:19:16 2012
@@ -300,7 +300,7 @@ public class ResourceRefType extends Abs
                     ArrayProperty.ORDERED_ARRAY);
         	addProperty(seq);
         }
-		TypeMapping tm = getMetadata().getBuilder().getTypeMapping();
+		TypeMapping tm = getMetadata().getTypeMapping();
         TextType tt = (TextType)tm.instanciateSimpleProperty(getMetadata(), null, "rdf", "li", value, "Text");
         seq.addProperty(tt);
 	}

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -28,7 +28,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.parser.XmpParsingException;
 import org.apache.padaf.xmpbox.type.TypeDescription.BasicType;
 
 public final class TypeMapping {
@@ -186,22 +185,22 @@ public final class TypeMapping {
 		}
 	}
 
-	public AbstractStructuredType instanciateStructuredType (XMPMetadata metadata, Class<? extends AbstractStructuredType> propertyTypeClass) throws XmpParsingException {
+	public AbstractStructuredType instanciateStructuredType (XMPMetadata metadata, Class<? extends AbstractStructuredType> propertyTypeClass) throws BadFieldValueException {
 		try {
 			Constructor<? extends AbstractStructuredType> construct = propertyTypeClass.getConstructor(new Class<?> [] {XMPMetadata.class});
 			return construct.newInstance(metadata);
 		} catch (InvocationTargetException e) {
-			throw new XmpParsingException("Failed to instanciate structured type : "+propertyTypeClass,e);
+			throw new BadFieldValueException("Failed to instanciate structured type : "+propertyTypeClass,e);
 		} catch (IllegalArgumentException e) {
-			throw new XmpParsingException("Failed to instanciate structured type : "+propertyTypeClass,e);
+			throw new BadFieldValueException("Failed to instanciate structured type : "+propertyTypeClass,e);
 		} catch (InstantiationException e) {
-			throw new XmpParsingException("Failed to instanciate structured type : "+propertyTypeClass,e);
+			throw new BadFieldValueException("Failed to instanciate structured type : "+propertyTypeClass,e);
 		} catch (IllegalAccessException e) {
-			throw new XmpParsingException("Failed to instanciate structured type : "+propertyTypeClass,e);
+			throw new BadFieldValueException("Failed to instanciate structured type : "+propertyTypeClass,e);
 		} catch (SecurityException e) {
-			throw new XmpParsingException("Failed to instanciate structured type : "+propertyTypeClass,e);
+			throw new BadFieldValueException("Failed to instanciate structured type : "+propertyTypeClass,e);
 		} catch (NoSuchMethodException e) {
-			throw new XmpParsingException("Failed to instanciate structured type : "+propertyTypeClass,e);
+			throw new BadFieldValueException("Failed to instanciate structured type : "+propertyTypeClass,e);
 		} 
 	}
 

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -24,6 +24,7 @@ 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;

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -25,8 +25,8 @@ import java.util.List;
 
 import junit.framework.Assert;
 
-import org.apache.padaf.xmpbox.TransformException;
 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;
@@ -95,12 +95,12 @@ public class XMPMetaDataTest {
 	 * }
 	 */
 
-	@Test(expected = org.apache.padaf.xmpbox.TransformException.class)
+	@Test(expected = org.apache.padaf.xmpbox.parser.TransformException.class)
 	public void testTransformerExceptionMessage() throws TransformException {
 		throw new TransformException("TEST");
 	}
 
-	@Test(expected = org.apache.padaf.xmpbox.TransformException.class)
+	@Test(expected = org.apache.padaf.xmpbox.parser.TransformException.class)
 	public void testTransformerExceptionWithCause() throws TransformException {
 		throw new TransformException("TEST", new Throwable());
 	}

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -55,7 +55,7 @@ public abstract class AbstractSchemaTest
 	public void before () throws Exception {
 		builder = new XMPDocumentBuilder();
 		xmp = builder.createXMPMetadata();
-		typeMapping = builder.getTypeMapping();
+		typeMapping = xmp.getTypeMapping();
 	}
 
 	protected abstract XMPSchema getSchema ();

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -28,8 +28,8 @@ import junit.framework.Assert;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpSerializer;
 import org.apache.padaf.xmpbox.parser.XMPDocumentBuilder;
+import org.apache.padaf.xmpbox.parser.XmpSerializer;
 import org.apache.padaf.xmpbox.type.JobType;
 import org.junit.Before;
 import org.junit.BeforeClass;

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -27,8 +27,8 @@ import java.util.List;
 
 import junit.framework.Assert;
 
+import org.apache.padaf.xmpbox.DateConverter;
 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;

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=1376996&r1=1376995&r2=1376996&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 Fri Aug 24 17:19:16 2012
@@ -23,10 +23,7 @@ package org.apache.padaf.xmpbox.type;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.List;
-import java.util.UUID;
 
 import junit.framework.Assert;
 
@@ -51,7 +48,7 @@ public abstract class AbstractStructured
 	public void before () throws Exception {
 		builder = new XMPDocumentBuilder();
 		xmp = builder.createXMPMetadata();
-		typeMapping = builder.getTypeMapping();
+		typeMapping = xmp.getTypeMapping();
 	}
 	
 	public AbstractStructuredTypeTester (Class<? extends AbstractStructuredType> clz, String fieldName, String type) {



Mime
View raw message