You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2011/07/24 15:57:54 UTC

svn commit: r1150371 [5/8] - in /pdfbox/trunk/xmpbox: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/padaf/ src/main/java/org/apache/padaf/xmpbox/ src/main/java/org/apache/padaf/xmpbox/parser/ src...

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,265 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.util.List;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.BooleanType;
+import org.apache.padaf.xmpbox.type.ComplexProperty;
+import org.apache.padaf.xmpbox.type.TextType;
+
+
+/**
+ * Representation of XMP Rights Management Schema
+ * 
+ * @author a183132
+ * 
+ */
+public class XMPRightsManagementSchema extends XMPSchema {
+	public static final String PREFERRED_XMPRIGHTS_PREFIX = "xmpRights";
+
+	public static final String XMPRIGHTSURI = "http://ns.adobe.com/xap/1.0/rights/";
+
+	@PropertyType(propertyType = "URL")
+	public static final String CERTIFICATE = "Certificate";
+
+	@PropertyType(propertyType = "Boolean")
+	public static final String MARKED = "Marked";
+
+	@PropertyType(propertyType = "bag ProperName")
+	public static final String OWNER = "Owner";
+
+	@PropertyType(propertyType = "Lang Alt")
+	public static final String USAGETERMS = "UsageTerms";
+
+	@PropertyType(propertyType = "URL")
+	public static final String WEBSTATEMENT = "WebStatement";
+
+	/**
+	 * Constructor of XMPRightsManagement Schema with preferred prefix
+	 * 
+	 * @param metadata
+	 *            The metadata to attach this schema
+	 */
+	public XMPRightsManagementSchema(XMPMetadata metadata) {
+		super(metadata, PREFERRED_XMPRIGHTS_PREFIX, XMPRIGHTSURI);
+	}
+
+	/**
+	 * Constructor of XMPRightsManagement schema with specified prefix
+	 * 
+	 * @param metadata
+	 *            The metadata to attach this schema
+	 * @param ownPrefix
+	 *            The prefix to assign
+	 */
+	public XMPRightsManagementSchema(XMPMetadata metadata, String ownPrefix) {
+		super(metadata, ownPrefix, XMPRIGHTSURI);
+	}
+
+	/**
+	 * Add a legal owner for the described resource.
+	 * 
+	 * @param value
+	 *            value to add
+	 */
+	public void addToOwnerValue(String value) {
+		addBagValue(localPrefixSep + OWNER, value);
+	}
+
+	/**
+	 * Return the Bag of owner(s)
+	 * 
+	 * @return owners property
+	 */
+	public ComplexProperty getOwner() {
+		return (ComplexProperty) getProperty(localPrefixSep + OWNER);
+	}
+
+	/**
+	 * Return a String list of owner(s)
+	 * 
+	 * @return list of defined owners
+	 */
+	public List<String> getOwnerValue() {
+		return getBagValueList(localPrefixSep + OWNER);
+	}
+
+	/**
+	 * Set Marked value
+	 * 
+	 * @param marked
+	 *            value to add
+	 */
+	public void setMarkedValue(Boolean marked) {
+		addProperty(new BooleanType(metadata, localPrefix, MARKED, marked));
+	}
+
+	/**
+	 * Set Marked property
+	 * 
+	 * @param marked
+	 *            Marked property to set
+	 */
+	public void setMarked(BooleanType marked) {
+		addProperty(marked);
+	}
+
+	/**
+	 * Get Marked property
+	 * 
+	 * @return Marked property
+	 */
+	public BooleanType getMarked() {
+		return (BooleanType) getProperty(localPrefixSep + MARKED);
+	}
+
+	/**
+	 * Get Marked value
+	 * 
+	 * @return marked value
+	 */
+	public Boolean getMarkedValue() {
+		BooleanType bt = ((BooleanType) getProperty(localPrefixSep + MARKED));
+		return bt == null ? null : bt.getValue();
+	}
+
+	/**
+	 * Add an usageTerms value
+	 * 
+	 * @param lang
+	 *            concerned language
+	 * @param value
+	 *            value to set
+	 */
+	public void addToUsageTermsValue(String lang, String value) {
+		setLanguagePropertyValue(localPrefixSep + USAGETERMS, lang, value);
+	}
+
+	/**
+	 * Return the Lang alt UsageTerms
+	 * 
+	 * @return usageterms property
+	 */
+	public ComplexProperty getUsageTerms() {
+		return (ComplexProperty) getProperty(localPrefixSep + USAGETERMS);
+	}
+
+	/**
+	 * Return a list of languages defined in description property
+	 * 
+	 * @return list of languages defined for usageterms
+	 */
+	public List<String> getUsageTermsLanguages() {
+		return getLanguagePropertyLanguagesValue(localPrefixSep + USAGETERMS);
+	}
+
+	/**
+	 * Return a language value for description property
+	 * 
+	 * @param lang
+	 *            concerned language
+	 * @return value of specified language
+	 */
+	public String getUsageTermsValue(String lang) {
+		return getLanguagePropertyValue(localPrefixSep + USAGETERMS, lang);
+	}
+
+	/**
+	 * Return the WebStatement URL as TextType.
+	 * 
+	 * @return Webstatement URL property
+	 */
+	public TextType getWebStatement() {
+		return ((TextType) getProperty(localPrefixSep + WEBSTATEMENT));
+	}
+
+	/**
+	 * Return the WebStatement URL as String.
+	 * 
+	 * @return webStatement URL value
+	 */
+	public String getWebStatementValue() {
+		TextType tt = ((TextType) getProperty(localPrefixSep + WEBSTATEMENT));
+		return tt == null ? null : tt.getStringValue();
+	}
+
+	/**
+	 * Set the WebStatement url
+	 * 
+	 * @param url
+	 *            WebStatemen url value to set
+	 */
+	public void setWebStatementValue(String url) {
+		addProperty(new TextType(metadata, localPrefix, WEBSTATEMENT, url));
+	}
+
+	/**
+	 * Set the WebStatement url
+	 * 
+	 * @param url
+	 *            WebStatemen url property to set
+	 */
+	public void setWebStatement(TextType url) {
+		addProperty(url);
+	}
+
+	/**
+	 * Return the Certificate URL as TextType.
+	 * 
+	 * @return certificate url property
+	 */
+	public TextType getCertificate() {
+		return ((TextType) getProperty(localPrefixSep + CERTIFICATE));
+	}
+
+	/**
+	 * Return the Certificate URL as String.
+	 * 
+	 * @return certificate URL value
+	 */
+	public String getCertificateValue() {
+		TextType tt = ((TextType) getProperty(localPrefixSep + CERTIFICATE));
+		return tt == null ? null : tt.getStringValue();
+	}
+
+	/**
+	 * Set the Certificate URL.
+	 * 
+	 * @param url
+	 *            certficate url value to set
+	 */
+	public void setCertificateValue(String url) {
+		addProperty(new TextType(metadata, localPrefix, CERTIFICATE, url));
+	}
+
+	/**
+	 * Set the Certificate URL.
+	 * 
+	 * @param url
+	 *            certificate url property to set
+	 */
+	public void setCertificate(TextType url) {
+		addProperty(url);
+	}
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPRightsManagementSchema.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,1519 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.schema;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.BooleanType;
+import org.apache.padaf.xmpbox.type.ComplexProperty;
+import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
+import org.apache.padaf.xmpbox.type.DateType;
+import org.apache.padaf.xmpbox.type.Elementable;
+import org.apache.padaf.xmpbox.type.IntegerType;
+import org.apache.padaf.xmpbox.type.TextType;
+import org.w3c.dom.Element;
+
+/**
+ * This class represents a metadata schema that can be stored in an XMP
+ * document. It handles all generic properties that are available. See
+ * subclasses for access to specific properties. MODIFIED TO INCLUDE OBJECT
+ * REPRESENTATION
+ * 
+ */
+public class XMPSchema implements Elementable {
+	/**
+	 * The standard xmlns namespace.
+	 */
+	public static final String NS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
+
+	public static final String RDFABOUT = "rdf:about";
+
+	protected String localPrefix, localNSUri;
+	protected String localPrefixSep;
+	protected XMPMetadata metadata;
+	protected ComplexPropertyContainer content;
+
+	/**
+	 * Create a new blank schema that can be populated.
+	 * 
+	 * @param metadata
+	 *            The parent XMP metadata that this schema will be part of.
+	 * @param namespaceName
+	 *            The name of the namespace, ie pdf,dc,...
+	 * @param namespaceURI
+	 *            The URI of the namespace, ie "http://ns.adobe.com/pdf/1.3/"
+	 * 
+	 */
+	public XMPSchema(XMPMetadata metadata, String namespaceName, String namespaceURI) {
+		this.metadata = metadata;
+		content = new ComplexPropertyContainer(metadata,
+				"http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf",
+				"Description");
+
+		localPrefix = namespaceName;
+		localPrefixSep = localPrefix + ":";
+		localNSUri = namespaceURI;
+		content.setAttribute(new Attribute(NS_NAMESPACE, "xmlns",
+				namespaceName, namespaceURI));
+
+	}
+
+	/**
+	 * Get the schema prefix
+	 * 
+	 * @return Prefix fixed for the schema
+	 */
+	public String getPrefix() {
+		return localPrefix;
+
+	}
+
+	/**
+	 * Get the namespace URI of this schema
+	 * 
+	 * @return the namespace URI of this schema
+	 */
+	public String getNamespaceValue() {
+		return localNSUri;
+	}
+
+	/**
+	 * Retrieve a generic simple type property
+	 * 
+	 * @param qualifiedName
+	 *            Full qualified name of proeprty wanted
+	 * @return The generic simple type property according to its qualified Name
+	 */
+	public AbstractField getAbstractProperty(String qualifiedName) {
+		Iterator<AbstractField> it = content.getAllProperties().iterator();
+		AbstractField tmp;
+		while (it.hasNext()) {
+			tmp = it.next();
+			if (tmp.getQualifiedName().equals(qualifiedName)) {
+				return tmp;
+			}
+		}
+		return null;
+
+	}
+
+	/**
+	 * Get the RDF about attribute
+	 * 
+	 * @return The RDF 'about' attribute.
+	 */
+	public Attribute getAboutAttribute() {
+		return content.getAttribute(RDFABOUT);
+	}
+
+	/**
+	 * Get the RDF about value.
+	 * 
+	 * @return The RDF 'about' value.
+	 */
+	public String getAboutValue() {
+		Attribute prop = content.getAttribute(RDFABOUT);
+		if (prop != null) {
+			return prop.getValue();
+		}
+		return null;
+	}
+
+	/**
+	 * Set the RDF 'about' attribute
+	 * 
+	 * @param about
+	 *            the well-formed attribute
+	 * @throws BadFieldValueException
+	 *             Bad Attribute name (not corresponding to about attribute)
+	 */
+	public void setAbout(Attribute about) throws BadFieldValueException {
+		if (about.getQualifiedName().equals(RDFABOUT)
+				|| about.getQualifiedName().equals("about")) {
+			content.setAttribute(about);
+		} else {
+			throw new BadFieldValueException(
+					"Attribute 'about' must be named 'rdf:about' or 'about'");
+		}
+	}
+
+	/**
+	 * Set the RDF 'about' attribute. Passing in null will clear this attribute.
+	 * 
+	 * @param about
+	 *            The new RFD about value.
+	 */
+	public void setAboutAsSimple(String about) {
+		if (about == null) {
+			content.removeAttribute(RDFABOUT);
+		} else {
+			content.setAttribute(new Attribute(null, "rdf", "about", about));
+
+		}
+	}
+
+	/**
+	 * Set a simple specified type property on the schema.
+	 * 
+	 * @param type
+	 *            the property type
+	 * @param qualifiedName
+	 *            the qualified name to specify for the new property
+	 * @param propertyValue
+	 *            The value (must be an object understandable by specified type)
+	 */
+	@SuppressWarnings("unchecked")
+	private void setSpecifiedSimpleTypeProperty(
+			Class<? extends AbstractSimpleProperty> type, String qualifiedName,
+			Object propertyValue) {
+		String[] splittedQualifiedName = qualifiedName.split(":");
+
+		Class[] propertyArgsClass = new Class[] { XMPMetadata.class,
+				String.class, String.class, Object.class };
+		Object[] propertyArgs = new Object[] { metadata,
+				splittedQualifiedName[0], splittedQualifiedName[1],
+				propertyValue };
+		Constructor<? extends AbstractSimpleProperty> propertyConstructor;
+
+		AbstractSimpleProperty specifiedTypeProperty;
+		if (propertyValue == null) {
+			// Search in properties to erase
+			Iterator<AbstractField> it = content.getAllProperties().iterator();
+			AbstractField tmp;
+			while (it.hasNext()) {
+				tmp = it.next();
+				if (tmp.getQualifiedName().equals(qualifiedName)) {
+					content.removeProperty(tmp);
+					return;
+				}
+			}
+		} else {
+			try {
+				propertyConstructor = type.getConstructor(propertyArgsClass);
+				specifiedTypeProperty = (AbstractSimpleProperty) propertyConstructor
+						.newInstance(propertyArgs);
+			} catch (Exception e) {
+				throw new IllegalArgumentException(
+						"Failed to create property with the specified type given in parameters");
+			}
+			// attribute placement for simple property has been removed
+			// Search in properties to erase
+			Iterator<AbstractField> it = content.getAllProperties().iterator();
+			AbstractField tmp;
+			while (it.hasNext()) {
+				tmp = it.next();
+				if (tmp.getQualifiedName().equals(qualifiedName)) {
+					content.removeProperty(tmp);
+					content.addProperty(specifiedTypeProperty);
+					return;
+				}
+			}
+			content.addProperty(specifiedTypeProperty);
+		}
+	}
+
+	/**
+	 * Add a SimpleProperty to this schema
+	 * 
+	 * @param prop
+	 *            The Property to add
+	 */
+	private void setSpecifiedSimpleTypeProperty(AbstractSimpleProperty prop) {
+		// attribute placement for simple property has been removed
+		// Search in properties to erase
+		Iterator<AbstractField> it = content.getAllProperties().iterator();
+		AbstractField tmp;
+		while (it.hasNext()) {
+			tmp = it.next();
+			if (tmp.getQualifiedName().equals(prop.getQualifiedName())) {
+				content.removeProperty(tmp);
+				content.addProperty(prop);
+				return;
+			}
+		}
+		content.addProperty(prop);
+	}
+
+	/**
+	 * Set TextType property
+	 * 
+	 * @param prop
+	 *            The text property to add
+	 */
+	public void setTextProperty(TextType prop) {
+		setSpecifiedSimpleTypeProperty(prop);
+	}
+
+	/**
+	 * Set a simple text property on the schema.
+	 * 
+	 * @param qualifiedName
+	 *            The name of the property, it must contain the namespace
+	 *            prefix, ie "pdf:Keywords"
+	 * @param propertyValue
+	 *            The value for the property, can be any string. Passing null
+	 *            will remove the property.
+	 */
+	public void setTextPropertyValue(String qualifiedName, String propertyValue) {
+		setSpecifiedSimpleTypeProperty(TextType.class, qualifiedName,
+				propertyValue);
+	}
+
+	/**
+	 * Set a simple text property on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the name of the property without prefix
+	 * @param propertyValue
+	 *            The value for the property, can be any string. Passing null
+	 *            will remove the property.
+	 */
+	public void setTextPropertyValueAsSimple(String simpleName,
+			String propertyValue) {
+		this.setTextPropertyValue(localPrefixSep + simpleName, propertyValue);
+	}
+
+	/**
+	 * Get a TextProperty Type from its name
+	 * 
+	 * @param qualifiedName
+	 *            The full qualified name of the property wanted
+	 * @return The Text Type property wanted
+	 */
+	public TextType getTextProperty(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof TextType) {
+				return (TextType) prop;
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not a Text Property");
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Get a simple text property value on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            The local name of the property wanted
+	 * @return The value of the text property or the null if there is no value.
+	 * 
+	 */
+	public String getTextPropertyValueAsSimple(String simpleName) {
+		return this.getTextPropertyValue(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * Get the value of a simple text property.
+	 * 
+	 * @param qualifiedName
+	 *            The name of the property to get, it must include the namespace
+	 *            prefix. ie "pdf:Keywords".
+	 * 
+	 * @return The value of the text property or the null if there is no value.
+	 * 
+	 */
+	public String getTextPropertyValue(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof TextType) {
+				return ((TextType) prop).getStringValue();
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not a Text Property");
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Get the Date property with its name
+	 * 
+	 * @param qualifiedName
+	 *            The name of the property to get, it must include the namespace
+	 *            prefix. ie "pdf:Keywords".
+	 * @return Date Type property
+	 * 
+	 */
+	public DateType getDateProperty(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof DateType) {
+				return (DateType) prop;
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not a Date Property");
+			}
+
+		}
+		return null;
+	}
+
+	/**
+	 * Get a simple date property value on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of the property to get
+	 * @return The value of the property as a calendar.
+	 * 
+	 */
+	public Calendar getDatePropertyValueAsSimple(String simpleName) {
+		return this.getDatePropertyValue(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * Get the value of the property as a date.
+	 * 
+	 * @param qualifiedName
+	 *            The fully qualified property name for the date.
+	 * 
+	 * @return The value of the property as a date.
+	 * 
+	 */
+	public Calendar getDatePropertyValue(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof DateType) {
+				return ((DateType) prop).getValue();
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not a Date Property");
+			}
+
+		}
+		return null;
+	}
+
+	/**
+	 * Set a new DateProperty
+	 * 
+	 * @param date
+	 *            The DateType Property
+	 */
+	public void setDateProperty(DateType date) {
+		setSpecifiedSimpleTypeProperty(date);
+	}
+
+	/**
+	 * Set a simple Date property on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the name of the property without prefix
+	 * @param date
+	 *            The calendar value for the property, can be any string.
+	 *            Passing null will remove the property.
+	 */
+	public void setDatePropertyValueAsSimple(String simpleName, Calendar date) {
+		this.setDatePropertyValue(localPrefixSep + simpleName, date);
+	}
+
+	/**
+	 * Set the value of the property as a date.
+	 * 
+	 * @param qualifiedName
+	 *            The fully qualified property name for the date.
+	 * @param date
+	 *            The date to set, or null to clear.
+	 */
+	public void setDatePropertyValue(String qualifiedName, Calendar date) {
+		setSpecifiedSimpleTypeProperty(DateType.class, qualifiedName, date);
+
+	}
+
+	/**
+	 * Get a BooleanType property with its name
+	 * 
+	 * @param qualifiedName
+	 *            the full qualified name of property wanted
+	 * @return boolean Type property
+	 */
+	public BooleanType getBooleanProperty(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof BooleanType) {
+				return (BooleanType) prop;
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not a Boolean Property");
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Get a simple boolean property value on the schema, using the current
+	 * prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of property wanted
+	 * @return The value of the property as a boolean.
+	 */
+	public Boolean getBooleanPropertyValueAsSimple(String simpleName) {
+		return this.getBooleanPropertyValue(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * Get the value of the property as a boolean.
+	 * 
+	 * @param qualifiedName
+	 *            The fully qualified property name for the boolean.
+	 * 
+	 * @return The value of the property as a boolean. Return null if property
+	 *         not exist
+	 */
+	public Boolean getBooleanPropertyValue(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof BooleanType) {
+				return ((BooleanType) prop).getValue();
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not a Boolean Property");
+			}
+		}
+		// Return null if property not exist. This method give the property
+		// value so treat this return in this way.
+		// If you want to use this value like a condition, you must check this
+		// return before
+		return null;
+	}
+
+	/**
+	 * Set a BooleanType property
+	 * 
+	 * @param bool
+	 *            the booleanType property
+	 */
+	public void setBooleanProperty(BooleanType bool) {
+		setSpecifiedSimpleTypeProperty(bool);
+	}
+
+	/**
+	 * Set a simple Boolean property on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the name of the property without prefix
+	 * @param bool
+	 *            The value for the property, can be any string. Passing null
+	 *            will remove the property.
+	 */
+	public void setBooleanPropertyValueAsSimple(String simpleName, Boolean bool) {
+		this.setBooleanPropertyValue(localPrefixSep + simpleName, bool);
+	}
+
+	/**
+	 * Set the value of the property as a boolean.
+	 * 
+	 * @param qualifiedName
+	 *            The fully qualified property name for the boolean.
+	 * @param bool
+	 *            The boolean to set, or null to clear.
+	 */
+	public void setBooleanPropertyValue(String qualifiedName, Boolean bool) {
+		setSpecifiedSimpleTypeProperty(BooleanType.class, qualifiedName, bool);
+	}
+
+	/**
+	 * Get the Integer property with its name
+	 * 
+	 * @param qualifiedName
+	 *            the full qualified name of property wanted
+	 * @return Integer Type property
+	 */
+	public IntegerType getIntegerProperty(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof IntegerType) {
+				return ((IntegerType) prop);
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not an Integer Property");
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Get a simple integer property value on the schema, using the current
+	 * prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of property wanted
+	 * @return The value of the property as an integer.
+	 */
+	public Integer getIntegerPropertyValueAsSimple(String simpleName) {
+		return this.getIntegerPropertyValue(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * Get the value of the property as an integer.
+	 * 
+	 * @param qualifiedName
+	 *            The fully qualified property name for the integer.
+	 * 
+	 * @return The value of the property as an integer.
+	 */
+	public Integer getIntegerPropertyValue(String qualifiedName) {
+		AbstractField prop = getAbstractProperty(qualifiedName);
+		if (prop != null) {
+			if (prop instanceof IntegerType) {
+				return ((IntegerType) prop).getValue();
+			} else {
+				throw new IllegalArgumentException(
+						"Property asked is not an Integer Property");
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Add an integerProperty
+	 * 
+	 * @param prop
+	 *            The Integer Type property
+	 */
+	public void setIntegerProperty(IntegerType prop) {
+		setSpecifiedSimpleTypeProperty(prop);
+	}
+
+	/**
+	 * Set a simple Integer property on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the name of the property without prefix
+	 * @param intValue
+	 *            The value for the property, can be any string. Passing null
+	 *            will remove the property.
+	 */
+	public void setIntegerPropertyValueAsSimple(String simpleName,
+			Integer intValue) {
+		this.setIntegerPropertyValue(localPrefixSep + simpleName, intValue);
+	}
+
+	/**
+	 * Set the value of the property as an integer.
+	 * 
+	 * @param qualifiedName
+	 *            The fully qualified property name for the integer.
+	 * @param intValue
+	 *            The int to set, or null to clear.
+	 */
+	public void setIntegerPropertyValue(String qualifiedName, Integer intValue) {
+		setSpecifiedSimpleTypeProperty(IntegerType.class, qualifiedName,
+				intValue);
+	}
+
+	/**
+	 * Generic array property removing
+	 * 
+	 * @param qualifiedArrayName
+	 *            the full qualified name of property wanted
+	 * @param fieldValue
+	 *            the field value
+	 */
+	private void removeArrayValue(String qualifiedArrayName, String fieldValue) {
+		ComplexProperty array = (ComplexProperty) getAbstractProperty(qualifiedArrayName);
+		if (array != null) {
+			ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
+			Iterator<AbstractField> it = array.getContainer()
+					.getAllProperties().iterator();
+			AbstractSimpleProperty tmp;
+			while (it.hasNext()) {
+				tmp = (AbstractSimpleProperty) it.next();
+				if (tmp.getStringValue().equals(fieldValue)) {
+					toDelete.add(tmp);
+				}
+			}
+			Iterator<AbstractField> eraseProperties = toDelete.iterator();
+			while (eraseProperties.hasNext()) {
+				array.getContainer().removeProperty(eraseProperties.next());
+			}
+		}
+
+	}
+
+	/**
+	 * Remove all matching entries with the given value from the bag.
+	 * 
+	 * @param qualifiedBagName
+	 *            The name of the bag, it must include the namespace prefix. ie
+	 *            "pdf:Keywords".
+	 * @param bagValue
+	 *            The value to remove from the bagList.
+	 */
+	public void removeBagValue(String qualifiedBagName, String bagValue) {
+		removeArrayValue(qualifiedBagName, bagValue);
+	}
+
+	/**
+	 * add a bag value property on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of property
+	 * @param bagValue
+	 *            the string value to add
+	 */
+	public void addBagValueAsSimple(String simpleName, String bagValue) {
+		this.addBagValue(localPrefixSep + simpleName, bagValue);
+	}
+
+	/**
+	 * Add an entry to a bag property.
+	 * 
+	 * @param qualifiedBagName
+	 *            The name of the bag, it must include the namespace prefix. ie
+	 *            "pdf:Keywords".
+	 * @param bagValue
+	 *            The value to add to the bagList.
+	 */
+	public void addBagValue(String qualifiedBagName, String bagValue) {
+		String[] splittedQualifiedName = qualifiedBagName.split(":");
+		ComplexProperty bag = (ComplexProperty) getAbstractProperty(qualifiedBagName);
+		TextType li = new TextType(metadata, "rdf", "li", bagValue);
+		if (bag != null) {
+			bag.getContainer().addProperty(li);
+		} else {
+			ComplexProperty newBag = new ComplexProperty(metadata,
+					splittedQualifiedName[0], splittedQualifiedName[1],
+					ComplexProperty.UNORDERED_ARRAY);
+			newBag.getContainer().addProperty(li);
+			content.addProperty(newBag);
+		}
+	}
+
+	/**
+	 * Generic String List Builder for arrays contents
+	 * 
+	 * @param qualifiedArrayName
+	 *            the full qualified name of property concerned
+	 * @return String list which represents content of array property
+	 */
+	private List<String> getArrayListToString(String qualifiedArrayName) {
+		List<String> retval = null;
+		ComplexProperty array = (ComplexProperty) getAbstractProperty(qualifiedArrayName);
+		if (array != null) {
+			retval = new ArrayList<String>();
+			Iterator<AbstractField> it = array.getContainer()
+					.getAllProperties().iterator();
+			AbstractSimpleProperty tmp;
+			while (it.hasNext()) {
+				tmp = (AbstractSimpleProperty) it.next();
+				retval.add(tmp.getStringValue());
+			}
+			retval = Collections.unmodifiableList(retval);
+		}
+		return retval;
+	}
+
+	/**
+	 * Get all the values of the bag property, using the current prefix. This
+	 * will return a list of java.lang.String objects, this is a read-only list.
+	 * 
+	 * @param simpleName
+	 *            the local name of property concerned
+	 * 
+	 * 
+	 * @return All values of the bag property in a list.
+	 */
+	public List<String> getBagValueListAsSimple(String simpleName) {
+		return getBagValueList(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * Get all the values of the bag property. This will return a list of
+	 * java.lang.String objects, this is a read-only list.
+	 * 
+	 * @param qualifiedBagName
+	 *            The name of the bag property to get, it must include the
+	 *            namespace prefix. ie "pdf:Keywords"
+	 * 
+	 * @return All values of the bag property in a list.
+	 */
+	public List<String> getBagValueList(String qualifiedBagName) {
+		return getArrayListToString(qualifiedBagName);
+	}
+
+	/**
+	 * Remove all matching values from a sequence property.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property. It must include the
+	 *            namespace prefix. ie "pdf:Keywords".
+	 * @param seqValue
+	 *            The value to remove from the list.
+	 */
+	public void removeSequenceValue(String qualifiedSeqName, String seqValue) {
+		removeArrayValue(qualifiedSeqName, seqValue);
+	}
+
+	/**
+	 * Generic method to remove a field from an array with an Elementable Object
+	 * 
+	 * @param qualifiedArrayName
+	 *            the full qualified name of the property concerned
+	 * @param fieldValue
+	 *            the elementable field value
+	 */
+	public void removeArrayValue(String qualifiedArrayName,
+			Elementable fieldValue) {
+		ComplexProperty array = (ComplexProperty) getAbstractProperty(qualifiedArrayName);
+		if (array != null) {
+			ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
+			Iterator<AbstractField> it = array.getContainer()
+					.getAllProperties().iterator();
+			AbstractSimpleProperty tmp;
+			while (it.hasNext()) {
+				tmp = (AbstractSimpleProperty) it.next();
+				if (tmp.equals(fieldValue)) {
+					toDelete.add(tmp);
+				}
+			}
+			Iterator<AbstractField> eraseProperties = toDelete.iterator();
+			while (eraseProperties.hasNext()) {
+				array.getContainer().removeProperty(eraseProperties.next());
+			}
+		}
+	}
+
+	/**
+	 * Remove a value from a sequence property. This will remove all entries
+	 * from the list.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property. It must include the
+	 *            namespace prefix. ie "pdf:Keywords".
+	 * @param seqValue
+	 *            The value to remove from the list.
+	 */
+	public void removeSequenceValue(String qualifiedSeqName,
+			Elementable seqValue) {
+		removeArrayValue(qualifiedSeqName, seqValue);
+	}
+
+	/**
+	 * Add a new value to a sequence property.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property, it must include the
+	 *            namespace prefix. ie "pdf:Keywords"
+	 * @param seqValue
+	 *            The value to add to the sequence.
+	 */
+	public void addSequenceValue(String qualifiedSeqName, String seqValue) {
+		String[] splittedQualifiedName = qualifiedSeqName.split(":");
+		ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
+		TextType li = new TextType(metadata, "rdf", "li", seqValue);
+		if (seq != null) {
+			seq.getContainer().addProperty(li);
+		} else {
+			ComplexProperty newSeq = new ComplexProperty(metadata,
+					splittedQualifiedName[0], splittedQualifiedName[1],
+					ComplexProperty.ORDERED_ARRAY);
+			newSeq.getContainer().addProperty(li);
+			content.addProperty(newSeq);
+		}
+
+	}
+
+	/**
+	 * Add a new value to a bag property.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property, it must include the
+	 *            namespace prefix. ie "pdf:Keywords"
+	 * @param seqValue
+	 *            The value to add to the bag.
+	 */
+	public void addBagValue(String qualifiedSeqName, AbstractField seqValue) {
+
+		String[] splittedQualifiedName = qualifiedSeqName.split(":");
+		ComplexProperty bag = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
+		if (bag != null) {
+			bag.getContainer().addProperty(seqValue);
+		} else {
+			ComplexProperty newBag = new ComplexProperty(metadata,
+					splittedQualifiedName[0], splittedQualifiedName[1],
+					ComplexProperty.UNORDERED_ARRAY);
+			newBag.getContainer().addProperty(seqValue);
+			content.addProperty(newBag);
+		}
+	}
+
+	/**
+	 * add a new value to a sequence property using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of the property
+	 * @param seqValue
+	 *            the string value to add
+	 */
+	public void addSequenceValueAsSimple(String simpleName, String seqValue) {
+		this.addSequenceValue(localPrefixSep + simpleName, seqValue);
+	}
+
+	/**
+	 * Add a new value to a sequence property.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property, it must include the
+	 *            namespace prefix. ie "pdf:Keywords"
+	 * @param seqValue
+	 *            The value to add to the sequence.
+	 */
+	public void addSequenceValue(String qualifiedSeqName, AbstractField seqValue) {
+
+		String[] splittedQualifiedName = qualifiedSeqName.split(":");
+		ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
+		if (seq != null) {
+			seq.getContainer().addProperty(seqValue);
+		} else {
+			ComplexProperty newSeq = new ComplexProperty(metadata,
+					splittedQualifiedName[0], splittedQualifiedName[1],
+					ComplexProperty.ORDERED_ARRAY);
+			newSeq.getContainer().addProperty(seqValue);
+			content.addProperty(newSeq);
+		}
+	}
+
+	/**
+	 * Get all the values in a sequence property, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of the property
+	 * @return A read-only list of java.lang.String objects or null if the
+	 *         property does not exist.
+	 */
+	public List<String> getSequenceValueListAsSimple(String simpleName) {
+		return this.getSequenceValueList(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * Get all the values in a sequence property.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property, it must include the
+	 *            namespace prefix. ie "pdf:Keywords".
+	 * 
+	 * @return A read-only list of java.lang.String objects or null if the
+	 *         property does not exist.
+	 */
+	public List<String> getSequenceValueList(String qualifiedSeqName) {
+		return getArrayListToString(qualifiedSeqName);
+	}
+
+	/**
+	 * Remove a date sequence value from the list.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property, it must include the
+	 *            namespace prefix. ie "pdf:Keywords"
+	 * @param date
+	 *            The date to remove from the sequence property.
+	 */
+	public void removeSequenceDateValue(String qualifiedSeqName, Calendar date) {
+		ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
+		if (seq != null) {
+			ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
+			Iterator<AbstractField> it = seq.getContainer().getAllProperties()
+					.iterator();
+			AbstractField tmp;
+			while (it.hasNext()) {
+				tmp = it.next();
+				if (tmp instanceof DateType) {
+					if (((DateType) tmp).getValue().equals(date)) {
+						toDelete.add(tmp);
+
+					}
+				}
+			}
+			Iterator<AbstractField> eraseProperties = toDelete.iterator();
+			while (eraseProperties.hasNext()) {
+				seq.getContainer().removeProperty(eraseProperties.next());
+			}
+		}
+	}
+
+	/**
+	 * Add a date sequence value to the list using the current prefix
+	 * 
+	 * @param simpleName
+	 *            the local name of the property
+	 * @param date
+	 *            the value to add
+	 */
+	public void addSequenceDateValueAsSimple(String simpleName, Calendar date) {
+		addSequenceDateValue(localPrefixSep + simpleName, date);
+	}
+
+	/**
+	 * Add a date sequence value to the list.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property, it must include the
+	 *            namespace prefix. ie "pdf:Keywords"
+	 * @param date
+	 *            The date to add to the sequence property.
+	 */
+	public void addSequenceDateValue(String qualifiedSeqName, Calendar date) {
+		addSequenceValue(qualifiedSeqName, new DateType(metadata, "rdf", "li",
+				date));
+	}
+
+	/**
+	 * Get all the date values in a sequence property, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of property concerned
+	 * @return A read-only list of java.util.Calendar objects or null if the
+	 *         property does not exist.
+	 */
+	public List<Calendar> getSequenceDateValueListAsSimple(String simpleName) {
+		return this.getSequenceDateValueList(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * Get all the date values in a sequence property.
+	 * 
+	 * @param qualifiedSeqName
+	 *            The name of the sequence property, it must include the
+	 *            namespace prefix. ie "pdf:Keywords".
+	 * 
+	 * @return A read-only list of java.util.Calendar objects or null if the
+	 *         property does not exist.
+	 * 
+	 */
+	public List<Calendar> getSequenceDateValueList(String qualifiedSeqName) {
+		List<Calendar> retval = null;
+		ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
+		if (seq != null) {
+			retval = new ArrayList<Calendar>();
+			Iterator<AbstractField> it = seq.getContainer().getAllProperties()
+					.iterator();
+			AbstractField tmp;
+			while (it.hasNext()) {
+				tmp = it.next();
+				if (tmp instanceof DateType) {
+					retval.add(((DateType) tmp).getValue());
+				}
+			}
+		}
+		return retval;
+	}
+
+	/**
+	 * Method used to place the 'x-default' value in first in Language
+	 * alternatives as said in xmp spec
+	 * 
+	 * @param alt
+	 *            The property to reorganize
+	 */
+	public void reorganizeAltOrder(ComplexPropertyContainer alt) {
+		Iterator<AbstractField> it = alt.getAllProperties().iterator();
+		AbstractField xdefault = null;
+		boolean xdefaultFound = false;
+		// If alternatives contains x-default in first value
+		if (it.hasNext()) {
+			if (it.next().getAttribute("xml:lang").getValue().equals(
+					"x-default")) {
+				return;
+			}
+		}
+		// Find the xdefault definition
+		while (it.hasNext() && !xdefaultFound) {
+			xdefault = it.next();
+			if (xdefault.getAttribute("xml:lang").getValue()
+					.equals("x-default")) {
+				alt.removeProperty(xdefault);
+				xdefaultFound = true;
+			}
+		}
+		if (xdefaultFound) {
+			it = alt.getAllProperties().iterator();
+			ArrayList<AbstractField> reordered = new ArrayList<AbstractField>();
+			ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
+			reordered.add(xdefault);
+			AbstractField tmp;
+			while (it.hasNext()) {
+				tmp = it.next();
+				reordered.add(tmp);
+				toDelete.add(tmp);
+			}
+			Iterator<AbstractField> eraseProperties = toDelete.iterator();
+			while (eraseProperties.hasNext()) {
+				alt.removeProperty(eraseProperties.next());
+			}
+			it = reordered.iterator();
+			while (it.hasNext()) {
+				alt.addProperty(it.next());
+			}
+		}
+
+	}
+
+	/**
+	 * Set a multi-lingual property on the schema, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of the property
+	 * @param language
+	 *            the language concerned
+	 * @param value
+	 *            the value to set for the language specified
+	 */
+	public void setLanguagePropertyValueAsSimple(String simpleName,
+			String language, String value) {
+		this.setLanguagePropertyValue(localPrefixSep + simpleName, language,
+				value);
+	}
+
+	/**
+	 * Set the value of a multi-lingual property.
+	 * 
+	 * @param qualifiedName
+	 *            The name of the property, it must include the namespace
+	 *            prefix. ie "pdf:Keywords"
+	 * @param language
+	 *            The language code of the value. If null then "x-default" is
+	 *            assumed.
+	 * @param value
+	 *            The value of the property in the specified language.
+	 */
+	public void setLanguagePropertyValue(String qualifiedName, String language,
+			String value) {
+		AbstractField property = getAbstractProperty(qualifiedName);
+		ComplexProperty prop;
+		if (property != null) {
+			// Analyzing content of property
+			if (property instanceof ComplexProperty) {
+				prop = (ComplexProperty) property;
+				Iterator<AbstractField> itCplx = prop.getContainer()
+						.getAllProperties().iterator();
+				// try to find the same lang definition
+				AbstractField tmp;
+				// Try to find a definition
+				while (itCplx.hasNext()) {
+					tmp = itCplx.next();
+					// System.err.println(tmp.getAttribute("xml:lang").getStringValue());
+					if (tmp.getAttribute("xml:lang").getValue()
+							.equals(language)) {
+						// the same language has been found
+						if (value == null) {
+							// if value null, erase this definition
+							prop.getContainer().removeProperty(tmp);
+						} else {
+							prop.getContainer().removeProperty(tmp);
+							TextType langValue;
+							langValue = new TextType(metadata, "rdf", "li",
+									value);
+
+							langValue.setAttribute(new Attribute(null, "xml",
+									"lang", language));
+							prop.getContainer().addProperty(langValue);
+						}
+						reorganizeAltOrder(prop.getContainer());
+						return;
+					}
+				}
+				// if no definition found, we add a new one
+				TextType langValue;
+				langValue = new TextType(metadata, "rdf", "li", value);
+				langValue.setAttribute(new Attribute(null, "xml", "lang",
+						language));
+				prop.getContainer().addProperty(langValue);
+				reorganizeAltOrder(prop.getContainer());
+			}
+		} else {
+			String[] splittedQualifiedName = qualifiedName.split(":");
+			prop = new ComplexProperty(metadata, splittedQualifiedName[0],
+					splittedQualifiedName[1], ComplexProperty.ALTERNATIVE_ARRAY);
+			TextType langValue;
+			langValue = new TextType(metadata, "rdf", "li", value);
+			langValue
+					.setAttribute(new Attribute(null, "xml", "lang", language));
+			prop.getContainer().addProperty(langValue);
+			content.addProperty(prop);
+		}
+	}
+
+	/**
+	 * Get the value of a multi-lingual property, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of the property
+	 * @param language
+	 *            The language code of the value. If null then "x-default" is
+	 *            assumed.
+	 * 
+	 * @return The value of the language property.
+	 */
+	public String getLanguagePropertyValueAsSimple(String simpleName,
+			String language) {
+		return this.getLanguagePropertyValue(localPrefixSep + simpleName,
+				language);
+	}
+
+	/**
+	 * Get the value of a multi-lingual property.
+	 * 
+	 * @param qualifiedName
+	 *            The name of the property, it must include the namespace
+	 *            prefix. ie "pdf:Keywords"
+	 * @param language
+	 *            The language code of the value. If null then "x-default" is
+	 *            assumed.
+	 * 
+	 * @return The value of the language property.
+	 */
+	public String getLanguagePropertyValue(String qualifiedName, String language) {
+		if (language == null) {
+			language = "x-default";
+		}
+
+		AbstractField property = getAbstractProperty(qualifiedName);
+		if (property != null) {
+			if (property instanceof ComplexProperty) {
+				ComplexProperty prop = (ComplexProperty) property;
+				Iterator<AbstractField> langsDef = prop.getContainer()
+						.getAllProperties().iterator();
+				AbstractField tmp;
+				Attribute text;
+				while (langsDef.hasNext()) {
+					tmp = langsDef.next();
+					text = tmp.getAttribute("xml:lang");
+					if (text != null) {
+						if (text.getValue().equals(language)) {
+							return ((TextType) tmp).getStringValue();
+						}
+					}
+				}
+				return null;
+			} else {
+				throw new IllegalArgumentException("The property '"
+						+ qualifiedName + "' is not of Lang Alt type");
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Get a list of all languages that are currently defined for a specific
+	 * property, using the current prefix.
+	 * 
+	 * @param simpleName
+	 *            the local name of the property
+	 * @return A list of all languages, this will return an non-null empty list
+	 *         if none have been defined.
+	 */
+	public List<String> getLanguagePropertyLanguagesValueAsSimple(
+			String simpleName) {
+		return this.getLanguagePropertyLanguagesValue(localPrefixSep
+				+ simpleName);
+	}
+
+	/**
+	 * Get a list of all languages that are currently defined for a specific
+	 * property.
+	 * 
+	 * @param qualifiedName
+	 *            The name of the property, it must include the namespace
+	 *            prefix. ie "pdf:Keywords"
+	 * 
+	 * @return A list of all languages, this will return an non-null empty list
+	 *         if none have been defined.
+	 */
+	public List<String> getLanguagePropertyLanguagesValue(String qualifiedName) {
+		List<String> retval = new ArrayList<String>();
+
+		AbstractField property = getAbstractProperty(qualifiedName);
+		if (property != null) {
+			if (property instanceof ComplexProperty) {
+				ComplexProperty prop = (ComplexProperty) property;
+				Iterator<AbstractField> langsDef = prop.getContainer()
+						.getAllProperties().iterator();
+				AbstractField tmp;
+				Attribute text;
+				while (langsDef.hasNext()) {
+					tmp = langsDef.next();
+					text = tmp.getAttribute("xml:lang");
+					if (text != null) {
+						retval.add(text.getValue());
+					} else {
+						retval.add("x-default");
+					}
+				}
+				return retval;
+			} else {
+				throw new IllegalArgumentException("The property '"
+						+ qualifiedName + "' is not of Lang Alt type");
+			}
+		}
+		// no property with that name
+		return null;
+	}
+
+	/**
+	 * A basic schema merge, it merges bags and sequences and replace everything
+	 * else.
+	 * 
+	 * @param xmpSchema
+	 *            The schema to merge.
+	 * @throws IOException
+	 *             If there is an error during the merge.
+	 */
+	public void merge(XMPSchema xmpSchema) throws IOException {
+		if (!xmpSchema.getClass().equals(this.getClass())) {
+			throw new IOException("Can only merge schemas of the same type.");
+		}
+
+		Iterator<Attribute> itAtt = xmpSchema.content.getAllAttributes()
+				.iterator();
+		Attribute att;
+		while (itAtt.hasNext()) {
+			att = itAtt.next();
+			if (att.getPrefix().equals(getPrefix())) {
+				content.setAttribute(att);
+			}
+		}
+
+		String analyzedPropQualifiedName;
+		Iterator<AbstractField> itProp = xmpSchema.content.getAllProperties()
+				.iterator();
+		AbstractField prop;
+		while (itProp.hasNext()) {
+			prop = itProp.next();
+			if (prop.getPrefix().equals(getPrefix())) {
+				if (prop instanceof ComplexProperty) {
+					analyzedPropQualifiedName = prop.getQualifiedName();
+					Iterator<AbstractField> itActualEmbeddedProperties = content
+							.getAllProperties().iterator();
+					AbstractField tmpEmbeddedProperty;
+
+					Iterator<AbstractField> itNewValues;
+					TextType tmpNewValue;
+
+					Iterator<AbstractField> itOldValues;
+					TextType tmpOldValue;
+
+					boolean alreadyPresent = false;
+
+					while (itActualEmbeddedProperties.hasNext()) {
+						tmpEmbeddedProperty = itActualEmbeddedProperties.next();
+						if (tmpEmbeddedProperty instanceof ComplexProperty) {
+							if (tmpEmbeddedProperty.getQualifiedName().equals(
+									analyzedPropQualifiedName)) {
+								itNewValues = ((ComplexProperty) prop)
+										.getContainer().getAllProperties()
+										.iterator();
+								// Merge a complex property
+								while (itNewValues.hasNext()) {
+									tmpNewValue = (TextType) itNewValues.next();
+									itOldValues = ((ComplexProperty) tmpEmbeddedProperty)
+											.getContainer().getAllProperties()
+											.iterator();
+									while (itOldValues.hasNext()
+											&& !alreadyPresent) {
+										tmpOldValue = (TextType) itOldValues
+												.next();
+										if (tmpOldValue
+												.getStringValue()
+												.equals(
+														tmpNewValue
+																.getStringValue())) {
+											alreadyPresent = true;
+										}
+									}
+									if (!alreadyPresent) {
+										((ComplexProperty) tmpEmbeddedProperty)
+												.getContainer().addProperty(
+														tmpNewValue);
+									}
+								}
+
+							}
+						}
+					}
+				} else {
+					content.addProperty(prop);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Get an AbstractField list corresponding to the content of an array Return
+	 * null if the property is unknown
+	 * 
+	 * @param qualifiedName
+	 *            the full qualified name of the property concerned
+	 * @return List of property contained in the complex property
+	 * @throws BadFieldValueException
+	 *             Property not contains property (not complex property)
+	 */
+	public List<AbstractField> getArrayList(String qualifiedName)
+			throws BadFieldValueException {
+		ComplexProperty array = null;
+		Iterator<AbstractField> itProp = content.getAllProperties().iterator();
+		AbstractField tmp;
+		while (itProp.hasNext()) {
+			tmp = itProp.next();
+			if (tmp.getQualifiedName().equals(qualifiedName)) {
+				if (tmp instanceof ComplexProperty) {
+					array = (ComplexProperty) tmp;
+					break;
+				} else {
+					throw new BadFieldValueException(
+							"Property asked not seems to be an array");
+				}
+
+			}
+		}
+		if (array != null) {
+			Iterator<AbstractField> it = array.getContainer()
+					.getAllProperties().iterator();
+			List<AbstractField> list = new ArrayList<AbstractField>();
+			while (it.hasNext()) {
+				list.add(it.next());
+			}
+			return list;
+		}
+		return null;
+	}
+
+	/**
+	 * Get PropertyContainer of this Schema
+	 * 
+	 * @return the ComplexProperty which represents the schema content
+	 */
+	public ComplexPropertyContainer getContent() {
+		return content;
+	}
+
+	/**
+	 * Get All attributes defined for this schema
+	 * 
+	 * @return Attributes list defined for this schema
+	 */
+	public List<Attribute> getAllAttributes() {
+		return content.getAllAttributes();
+	}
+
+	/**
+	 * Get All properties defined in this schema
+	 * 
+	 * @return Properties list defined in this schema
+	 */
+	public List<AbstractField> getAllProperties() {
+		return content.getAllProperties();
+	}
+
+	/**
+	 * Set a new attribute for this schema
+	 * 
+	 * @param attr
+	 *            The new Attribute to set
+	 */
+	public void setAttribute(Attribute attr) {
+		content.setAttribute(attr);
+	}
+
+	/**
+	 * Add a new Property to this schema
+	 * 
+	 * @param obj
+	 *            The new property to add
+	 */
+	public void addProperty(AbstractField obj) {
+		content.addProperty(obj);
+	}
+
+	/**
+	 * Get DOM Element for rdf/xml serialization
+	 * 
+	 * @return the DOM Element
+	 */
+	public Element getElement() {
+		return content.getElement();
+	}
+
+	/**
+	 * get a Property with its name, using the current prefix
+	 * 
+	 * @param simpleName
+	 *            the local name of the property
+	 * @return The property wanted
+	 */
+	protected AbstractField getPropertyAsSimple(String simpleName) {
+		return getProperty(localPrefixSep + simpleName);
+	}
+
+	/**
+	 * get a Property with its qualified Name (with its prefix)
+	 * 
+	 * @param qualifiedName
+	 *            The full qualified name of the property wanted
+	 * @return the property wanted
+	 */
+	protected AbstractField getProperty(String qualifiedName) {
+		Iterator<AbstractField> it = getAllProperties().iterator();
+		AbstractField tmp;
+		while (it.hasNext()) {
+			tmp = it.next();
+			if (tmp.getQualifiedName().equals(qualifiedName)) {
+				return tmp;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Return local prefix
+	 * 
+	 * @return current prefix fixed for this schema
+	 */
+	public String getLocalPrefix() {
+		return this.localPrefix;
+	}
+
+	/**
+	 * Return local prefix with separator
+	 * 
+	 * @return current prefix fixed for this schema with ':' separator
+	 */
+	public String getLocalPrefixWithSeparator() {
+		return this.localPrefixSep;
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,213 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.type;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Astract Object representation of a XMP 'field' (-> Properties and specific
+ * Schemas)
+ * 
+ * @author a183132
+ * 
+ */
+public abstract class AbstractField implements Elementable {
+
+	/**
+	 * ALL PROPERTIES MUST NOT BE USED MORE THAN ONE TIME BECAUSE THE SAME
+	 * ELEMENT CANNOT BE MORE THAN ONE TIME IN THE SAME DOM DOCUMENT (if you
+	 * choose to use the same property in different places in the same document,
+	 * the element associated will not appear)
+	 */
+
+	protected Element element;
+	protected Document parent;
+
+	private String namespaceURI, prefix, propertyName;
+	private Map<String, Attribute> attributes;
+
+	/**
+	 * Constructor of a XMP field without namespaceURI
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this field
+	 * @param prefix
+	 *            the prefix to set for this field
+	 * @param propertyName
+	 *            the local name to set for this field
+	 */
+	public AbstractField(XMPMetadata metadata, String prefix,
+			String propertyName) {
+		String qualifiedName;
+		this.prefix = prefix;
+		qualifiedName = prefix + ":" + propertyName;
+		this.parent = metadata.getFuturOwner();
+		this.propertyName = propertyName;
+		element = parent.createElement(qualifiedName);
+		attributes = new HashMap<String, Attribute>();
+	}
+
+	/**
+	 * Constructor of a XMP Field
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this field
+	 * @param namespaceURI
+	 *            the namespace URI
+	 * @param prefix
+	 *            the prefix to set for this field
+	 * @param propertyName
+	 *            the local name to set for this field
+	 */
+	public AbstractField(XMPMetadata metadata, String namespaceURI,
+			String prefix, String propertyName) {
+		String qualifiedName;
+		this.prefix = prefix;
+		qualifiedName = prefix + ":" + propertyName;
+		this.parent = metadata.getFuturOwner();
+		this.namespaceURI = namespaceURI;
+		this.propertyName = propertyName;
+		element = parent.createElementNS(namespaceURI, qualifiedName);
+		attributes = new HashMap<String, Attribute>();
+	}
+
+	/**
+	 * Get the DOM element for rdf/xml serialization
+	 * 
+	 * @return The DOM Element
+	 */
+	public Element getElement() {
+		return element;
+	}
+
+	/**
+	 * Get the namespace URI of this entity
+	 * 
+	 * @return the namespace URI
+	 */
+	public String getNamespace() {
+		return namespaceURI;
+	}
+
+	/**
+	 * Get the prefix of this entity
+	 * 
+	 * @return the prefix specified
+	 */
+	public String getPrefix() {
+		return prefix;
+	}
+
+	/**
+	 * Get the qualified Name of this entity (prefix+localName)
+	 * 
+	 * @return the full qualified name
+	 */
+	public String getQualifiedName() {
+		return prefix + ":" + propertyName;
+
+	}
+
+	/**
+	 * Get the propertyName (or localName)
+	 * 
+	 * @return the local Name
+	 */
+	public String getPropertyName() {
+		return propertyName;
+	}
+
+	/**
+	 * Set a new attribute for this entity
+	 * 
+	 * @param value
+	 *            The Attribute property to add
+	 */
+	public void setAttribute(Attribute value) {
+		if (attributes.containsKey(value.getQualifiedName())) {
+			// if same name in element, attribute will be replaced
+			attributes.remove(value.getQualifiedName());
+		}
+		if (value.getNamespace() == null) {
+			attributes.put(value.getQualifiedName(), value);
+			element.setAttribute(value.getQualifiedName(), value.getValue());
+		} else {
+			attributes.put(value.getQualifiedName(), value);
+			element.setAttributeNS(value.getNamespace(), value
+					.getQualifiedName(), value.getValue());
+		}
+	}
+
+	/**
+	 * Check if an attribute is declared for this entity
+	 * 
+	 * @param qualifiedName
+	 *            the full qualified name of the attribute concerned
+	 * @return true if attribute is present
+	 */
+	public boolean containsAttribute(String qualifiedName) {
+		return attributes.containsKey(qualifiedName);
+	}
+
+	/**
+	 * Get an attribute with its name in this entity
+	 * 
+	 * @param qualifiedName
+	 *            the full qualified name of the attribute wanted
+	 * @return The attribute property
+	 */
+	public Attribute getAttribute(String qualifiedName) {
+		return attributes.get(qualifiedName);
+	}
+
+	/**
+	 * Get attributes list defined for this entity
+	 * 
+	 * @return Attributes list
+	 */
+	public List<Attribute> getAllAttributes() {
+		return new ArrayList<Attribute>(attributes.values());
+	}
+
+	/**
+	 * Remove an attribute of this entity
+	 * 
+	 * @param qualifiedName
+	 *            the full qualified name of the attribute wanted
+	 */
+	public void removeAttribute(String qualifiedName) {
+		if (containsAttribute(qualifiedName)) {
+			element.removeAttribute(qualifiedName);
+			attributes.remove(qualifiedName);
+		}
+
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractField.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractSimpleProperty.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractSimpleProperty.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractSimpleProperty.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractSimpleProperty.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.type;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+
+/**
+ * Abstract Class of an Simple XMP Property
+ * 
+ * @author a183132
+ * 
+ */
+public abstract class AbstractSimpleProperty extends AbstractField {
+
+	protected Object objValue;
+
+	/**
+	 * Property specific type constructor (namespaceURI is not given)
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 * @param value
+	 *            the value to give
+	 * 
+	 */
+	public AbstractSimpleProperty(XMPMetadata metadata, String prefix,
+			String propertyName, Object value) {
+		super(metadata, prefix, propertyName);
+		setValue(value);
+	}
+
+	/**
+	 * Property specific type constructor (namespaceURI is given)
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param namespaceURI
+	 *            the specified namespace URI associated to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 * @param value
+	 *            the value to give
+	 */
+	public AbstractSimpleProperty(XMPMetadata metadata, String namespaceURI,
+			String prefix, String propertyName, Object value) {
+		super(metadata, namespaceURI, prefix, propertyName);
+		setValue(value);
+
+	}
+
+	/**
+	 * Must be rewritten in each special XMP type Class to check if the value
+	 * type corresponding to the XMP Type
+	 * 
+	 * @param value
+	 *            Object to analyze
+	 * @return true if object type can be treat by the property type
+	 */
+	public abstract boolean isGoodType(Object value);
+
+	/**
+	 * Check and set new property value (in Element and in its Object
+	 * Representation)
+	 * 
+	 * @param value
+	 *            Object value to set
+	 */
+	public abstract void setValue(Object value);
+
+	/**
+	 * Return the property value
+	 * 
+	 * @return a string
+	 */
+	public String getStringValue() {
+		return element.getTextContent();
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractSimpleProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,150 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.type;
+
+/**
+ * Simple representation of an attribute
+ * 
+ * @author a183132
+ * 
+ */
+public class Attribute {
+
+	private String nsURI, prefix, localName, value;
+
+	/**
+	 * Constructor of a new Attribute
+	 * 
+	 * @param nsURI
+	 *            namespaceURI of this attribute (could be null)
+	 * @param prefix
+	 *            prefix of this attribute
+	 * @param localName
+	 *            localName of this attribute
+	 * @param value
+	 *            value given to this attribute
+	 */
+	public Attribute(String nsURI, String prefix, String localName, String value) {
+		this.nsURI = nsURI;
+		this.prefix = prefix;
+		this.localName = localName;
+		this.value = value;
+	}
+
+	/**
+	 * Get prefix defined for this attribute
+	 * 
+	 * @return prefix defined (could be null)
+	 */
+	public String getPrefix() {
+		if (prefix != null) {
+			if (prefix.equals("")) {
+				return null;
+			}
+			return prefix;
+		}
+		return null;
+	}
+
+	/**
+	 * Set prefix for this attribute
+	 * 
+	 * @param prefix
+	 *            the prefix defined for this attribute
+	 */
+	public void setPrefix(String prefix) {
+		this.prefix = prefix;
+	}
+
+	/**
+	 * Get the localName of this attribute
+	 * 
+	 * @return local name of this attribute
+	 */
+	public String getLocalName() {
+		return localName;
+	}
+
+	/**
+	 * Set the localName of this attribute
+	 * 
+	 * @param lname
+	 *            the local name to set
+	 */
+	public void setLocalName(String lname) {
+		localName = lname;
+	}
+
+	/**
+	 * Get the namespace URI of this attribute
+	 * 
+	 * @return the namespace URI associated to this attribute (could be null)
+	 */
+	public String getNamespace() {
+		return nsURI;
+	}
+
+	/**
+	 * Set the namespace URI of this attribute
+	 * 
+	 * @param nsURI
+	 *            the namespace URI to set
+	 */
+	public void setNsURI(String nsURI) {
+		this.nsURI = nsURI;
+	}
+
+	/**
+	 * Get the attribute qualified Name (prefix+localName)
+	 * 
+	 * @return the full qualified name of this attribute
+	 */
+	public String getQualifiedName() {
+		if (prefix == null) {
+			return localName;
+		}
+		if (prefix.equals("")) {
+			return localName;
+		}
+		return prefix + ":" + localName;
+	}
+
+	/**
+	 * Get value of this attribute
+	 * 
+	 * @return value of this attribute
+	 */
+	public String getValue() {
+		return value;
+	}
+
+	/**
+	 * Set value of this attribute
+	 * 
+	 * @param value
+	 *            the value to set for this attribute
+	 */
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BadFieldValueException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BadFieldValueException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BadFieldValueException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BadFieldValueException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.type;
+
+/**
+ * Exception thrown when Value found to set/get property content is not
+ * compatible with object specifications (typically when trying to have a
+ * property in a type that is not compatible with specified original type of
+ * property concerned)
+ * 
+ * @author a183132
+ * 
+ */
+public class BadFieldValueException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 8100277682314632644L;
+
+	/**
+	 * Create an instance of BadFieldValueException
+	 * 
+	 * @param message
+	 *            a description of the encountered problem
+	 */
+	public BadFieldValueException(String message) {
+		super(message);
+
+	}
+
+	/**
+	 * Create an instance of BadFieldValueException
+	 * 
+	 * @param message
+	 *            a description of the encountered problem
+	 * @param cause
+	 *            the cause of the exception
+	 */
+	public BadFieldValueException(String message, Throwable cause) {
+		super(message, cause);
+
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BadFieldValueException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BooleanType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BooleanType.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BooleanType.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BooleanType.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,151 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.type;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+
+/**
+ * Object representation of an Boolean XMP type
+ * 
+ * @author a183132
+ * 
+ */
+public class BooleanType extends AbstractSimpleProperty {
+
+	private static final String TRUE = "True";
+	private static final String FALSE = "False";
+
+	/**
+	 * Property Boolean type constructor (namespaceURI is not given)
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 * @param value
+	 *            the value to give
+	 */
+	public BooleanType(XMPMetadata metadata, String prefix,
+			String propertyName, Object value) {
+		super(metadata, prefix, propertyName, value);
+	}
+
+	/**
+	 * Property Boolean type constructor (namespaceURI is given)
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param namespaceURI
+	 *            the namespace URI to associate to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 * @param value
+	 *            the value to give
+	 */
+	public BooleanType(XMPMetadata metadata, String namespaceURI,
+			String prefix, String propertyName, Object value) {
+		super(metadata, namespaceURI, prefix, propertyName, value);
+	}
+
+	/**
+	 * Check if object value type is compatible with this property type
+	 * 
+	 * @param value
+	 *            Object value to check
+	 * @return true if types are compatibles
+	 */
+	public boolean isGoodType(Object value) {
+		if (value instanceof Boolean) {
+			return true;
+		} else if (value instanceof String) {
+			return value.equals(TRUE) || value.equals(FALSE);
+		}
+		return false;
+	}
+
+	/**
+	 * return the property value
+	 * 
+	 * @return boolean the property value
+	 */
+	public boolean getValue() {
+		return (Boolean) objValue;
+	}
+
+	/**
+	 * Set value of this property BooleanTypeObject accept String value or a
+	 * boolean
+	 * 
+	 * @param value
+	 *            The value to set
+	 * 
+	 */
+	public void setValue(Object value) {
+		if (!isGoodType(value)) {
+			throw new IllegalArgumentException(
+					"Value given is not allowed for the boolean type.");
+		} else {
+			// if string object
+			if (value instanceof String) {
+				setValueFromString((String) value);
+			} else {
+				// if boolean
+				setValueFromBool((Boolean) value);
+			}
+
+		}
+	}
+
+	/**
+	 * Set property value
+	 * 
+	 * @param value
+	 *            the new boolean element value
+	 */
+	private void setValueFromBool(boolean value) {
+		objValue = value;
+		if (value) {
+			element.setTextContent(TRUE);
+		} else {
+			element.setTextContent(FALSE);
+		}
+	}
+
+	/**
+	 * Set the value of this property
+	 * 
+	 * @param value
+	 *            The String value to set
+	 */
+	private void setValueFromString(String value) {
+		if (value.equals(TRUE)) {
+			setValueFromBool(true);
+		} else {
+			setValueFromBool(false);
+		}
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/BooleanType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexProperty.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexProperty.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexProperty.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexProperty.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.type;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+
+/**
+ * Object representation of a Complex XMP Property (Represents Ordered,
+ * Unordered and Alternative Arrays builder)
+ * 
+ * @author a183132
+ * 
+ */
+public class ComplexProperty extends AbstractField {
+
+	public static final String UNORDERED_ARRAY = "Bag";
+	public static final String ORDERED_ARRAY = "Seq";
+	public static final String ALTERNATIVE_ARRAY = "Alt";
+
+	protected ComplexPropertyContainer container;
+
+	/**
+	 * Contructor of a complex property
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 * @param type
+	 *            type of complexProperty (Bag, Seq, Alt)
+	 */
+	public ComplexProperty(XMPMetadata metadata, String prefix,
+			String propertyName, String type) {
+		super(metadata, prefix, propertyName);
+		container = new ComplexPropertyContainer(metadata, "rdf", type);
+		element.appendChild(container.getElement());
+	}
+
+	/**
+	 * Contructor of a complex property
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param namespace
+	 *            The namespace URI to associate to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 * @param type
+	 *            type of complexProperty (Bag, Seq, Alt)
+	 */
+	public ComplexProperty(XMPMetadata metadata, String namespace,
+			String prefix, String propertyName, String type) {
+		super(metadata, namespace, prefix, propertyName);
+		container = new ComplexPropertyContainer(metadata, "rdf", type);
+		element.appendChild(container.getElement());
+	}
+
+	/**
+	 * Return the container of this Array
+	 * 
+	 * @return The complex property container that represents content of this
+	 *         property
+	 */
+	public ComplexPropertyContainer getContainer() {
+		return container;
+	}
+
+	/**
+	 * Check if this complex property equals to another
+	 * 
+	 * @param prop2
+	 *            The Complex property to compare
+	 * @return True if properties are equals
+	 */
+	public boolean isSameProperty(AbstractField prop2) {
+		if (this.getQualifiedName().equals(prop2.getQualifiedName())) {
+			if (this.getElement().getTextContent().equals(
+					prop2.getElement().getTextContent())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,179 @@
+/*****************************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ****************************************************************************/
+
+package org.apache.padaf.xmpbox.type;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+
+
+/**
+ * Object representation for arrays content This Class could be used to define
+ * directly a property with more than one field (structure) and also schemas
+ * 
+ * @author a183132
+ * 
+ */
+public class ComplexPropertyContainer extends AbstractField {
+
+	protected List<AbstractField> properties;
+
+	/**
+	 * Complex Property type constructor (namespaceURI is not given)
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 */
+	public ComplexPropertyContainer(XMPMetadata metadata, String prefix,
+			String propertyName) {
+		super(metadata, prefix, propertyName);
+		properties = new ArrayList<AbstractField>();
+
+	}
+
+	/**
+	 * Complex Property type constructor (namespaceURI is given)
+	 * 
+	 * @param metadata
+	 *            The metadata to attach to this property
+	 * @param namespaceURI
+	 *            The namespace URI to associate to this property
+	 * @param prefix
+	 *            The prefix to set for this property
+	 * @param propertyName
+	 *            The local Name of this property
+	 */
+	public ComplexPropertyContainer(XMPMetadata metadata, String namespaceURI,
+			String prefix, String propertyName) {
+		super(metadata, namespaceURI, prefix, propertyName);
+		properties = new ArrayList<AbstractField>();
+	}
+
+	/**
+	 * Add a property to the current structure
+	 * 
+	 * @param obj
+	 *            the property to add
+	 */
+	public void addProperty(AbstractField obj) {
+		if (containsProperty(obj)) {
+			removeProperty(obj);
+		}
+		properties.add(obj);
+		// COMMENTS REPRESENTS CLUES TO USE SAME PROPERTY AT MORE THAN ONE PLACE
+		// BUT IT CREATE PROBLEM TO FIND AND ERASE CLONED ELEMENT
+		// Node cloned = obj.getElement().cloneNode(true);
+		// parent.adoptNode(cloned);
+		element.appendChild(obj.getElement());
+		// element.appendChild(cloned);
+	}
+
+	/**
+	 * Return all children associated to this property
+	 * 
+	 * @return All Properties contained in this container
+	 */
+	public List<AbstractField> getAllProperties() {
+		return properties;
+	}
+
+	/**
+	 * Return all properties with this specified localName
+	 * 
+	 * @param localName
+	 *            the local name wanted
+	 * @return All properties with local name which match with localName given
+	 */
+	public List<AbstractField> getPropertiesByLocalName(String localName) {
+		List<AbstractField> absFields = getAllProperties();
+		if (absFields != null) {
+			List<AbstractField> list = new ArrayList<AbstractField>();
+			for (AbstractField abstractField : absFields) {
+				if (abstractField.getPropertyName().equals(localName)) {
+					list.add(abstractField);
+				}
+			}
+			return list;
+		}
+		return null;
+
+	}
+
+	/**
+	 * Check if two property are similar
+	 * 
+	 * @param prop1
+	 *            First property
+	 * @param prop2
+	 *            Second property
+	 * @return True if these properties are equals
+	 */
+	public boolean isSameProperty(AbstractField prop1, AbstractField prop2) {
+		if (prop1.getClass().equals(prop2.getClass())
+				&& prop1.getQualifiedName().equals(prop2.getQualifiedName())) {
+			if (prop1.getElement().getTextContent().equals(
+					prop2.getElement().getTextContent())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Check if a XMPFieldObject is in the complex property
+	 * 
+	 * @param property
+	 *            The property to check
+	 * @return True if property is present in this container
+	 */
+	public boolean containsProperty(AbstractField property) {
+		Iterator<AbstractField> it = getAllProperties().iterator();
+		AbstractField tmp;
+		while (it.hasNext()) {
+			tmp = it.next();
+			if (isSameProperty(tmp, property)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Remove a property
+	 * 
+	 * @param property
+	 *            The property to remove
+	 */
+	public void removeProperty(AbstractField property) {
+		if (containsProperty(property)) {
+			properties.remove(property);
+			element.removeChild(property.getElement());
+		}
+	}
+
+}

Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ComplexPropertyContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native