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 [3/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/parser/XMPSchemaFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,158 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.XMPSchema;
+
+
+/**
+ * A factory for each kind of schemas
+ *
+ * @author a183132
+ *
+ */
+public class XMPSchemaFactory {
+
+ protected String namespace;
+ protected Class<? extends XMPSchema> schemaClass;
+ protected PropMapping propDef;
+ protected String nsName;
+ protected boolean isDeclarative;
+
+ /**
+ * Factory Constructor for basic known schemas
+ *
+ * @param namespace
+ * namespace URI to treat
+ * @param schemaClass
+ * Class representation associated to this URI
+ * @param propDef
+ * Properties Types list associated
+ */
+ public XMPSchemaFactory(String namespace,
+ Class<? extends XMPSchema> schemaClass, PropMapping propDef) {
+ this.isDeclarative = false;
+ this.namespace = namespace;
+ this.schemaClass = schemaClass;
+ this.propDef = propDef;
+ }
+
+ /**
+ * Factory constructor for declarative XMP Schemas
+ *
+ * @param nsName
+ * namespace name to treat
+ * @param namespace
+ * namespace URI to treat
+ * @param schemaClass
+ * Class representation associated to this URI
+ * @param propDef
+ * Properties Types list associated
+ */
+ public XMPSchemaFactory(String nsName, String namespace,
+ Class<? extends XMPSchema> schemaClass, PropMapping propDef) {
+ this.isDeclarative = true;
+ this.namespace = namespace;
+ this.schemaClass = schemaClass;
+ this.propDef = propDef;
+ this.nsName = nsName;
+ }
+
+ /**
+ * Get namespace URI treated by this factory
+ *
+ * @return The namespace URI
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * Get type declared for the name property given
+ *
+ * @param name
+ * The property name
+ * @return null if propery name is unknown
+ */
+ public String getPropertyType(String name) {
+ return propDef.getPropertyType(name);
+ }
+
+ /**
+ * Get attributes declared for a property (NOT USED YET)
+ *
+ * @param name
+ * The property Name
+ * @return List of all attributes defined for this property
+ */
+ public List<String> getPropertyAttributes(String name) {
+ return propDef.getPropertyAttributes(name);
+ }
+
+ /**
+ * Create a schema that corresponding to this factory and add it to metadata
+ *
+ * @param metadata
+ * Metadata to attach the Schema created
+ * @param prefix
+ * The namespace prefix (optional)
+ * @return the schema created and added to metadata
+ * @throws XmpSchemaException
+ * When Instancing specified Object Schema failed
+ */
+ @SuppressWarnings("unchecked")
+ public XMPSchema createXMPSchema(XMPMetadata metadata, String prefix)
+ throws XmpSchemaException {
+ XMPSchema schema = null;
+ Class[] argsClass;
+ Object[] schemaArgs;
+
+ if (isDeclarative) {
+ argsClass = new Class[] { XMPMetadata.class, String.class, String.class };
+ schemaArgs = new Object[] { metadata, nsName, namespace };
+ } else if (prefix != null && !"".equals(prefix)) {
+ argsClass = new Class[] { XMPMetadata.class, String.class };
+ schemaArgs = new Object[] { metadata, prefix };
+ } else {
+ argsClass = new Class[] { XMPMetadata.class };
+ schemaArgs = new Object[] { metadata };
+ }
+
+ Constructor<? extends XMPSchema> schemaConstructor;
+ try {
+ schemaConstructor = schemaClass.getConstructor(argsClass);
+ schema = schemaConstructor.newInstance(schemaArgs);
+ if (schema != null) {
+ metadata.addSchema(schema);
+ }
+ return schema;
+ } catch (Exception e) {
+ throw new XmpSchemaException(
+ "Cannot Instanciate specified Object Schema", e);
+ }
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPSchemaFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpExpectedRdfAboutAttribute.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpExpectedRdfAboutAttribute.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpExpectedRdfAboutAttribute.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpExpectedRdfAboutAttribute.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a rdf:Description not contains attribute
+ * rdf:about
+ *
+ * @author a183132
+ *
+ */
+public class XmpExpectedRdfAboutAttribute extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 737516114298078255L;
+
+ /**
+ * Build This exception with specified error message
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpExpectedRdfAboutAttribute(String message) {
+ super(message);
+
+ }
+
+ /**
+ * Build This exception with specified error message and the original cause
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * Original Cause of this exception
+ */
+ public XmpExpectedRdfAboutAttribute(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpExpectedRdfAboutAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpInitialXPacketParsingException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpInitialXPacketParsingException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpInitialXPacketParsingException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpInitialXPacketParsingException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a problem is encountered during the initial
+ * Xpacket parsing
+ *
+ * @author a183132
+ *
+ */
+public class XmpInitialXPacketParsingException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of InitialXPacketParsingException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpInitialXPacketParsingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of InitialXPacketParsingException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpInitialXPacketParsingException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpInitialXPacketParsingException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpParsingException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpParsingException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpParsingException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpParsingException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * Exception thrown when Parsing failed
+ *
+ * @author a183132
+ *
+ */
+public class XmpParsingException extends Exception {
+
+ /**
+ * serial version uid
+ */
+ private static final long serialVersionUID = -8843096358184702908L;
+
+ /**
+ * Create an instance of XmpParsingException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpParsingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpParsingException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpParsingException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpParsingException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyFormatException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyFormatException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyFormatException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyFormatException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a property is found in xmp block and is not
+ * existing in predefined schema.
+ *
+ * @author gbailleul
+ *
+ */
+public class XmpPropertyFormatException extends XmpParsingException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpPropertyFormatException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpPropertyFormatException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpPropertyFormatException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpPropertyFormatException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyFormatException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyType.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyType.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyType.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * List the basic types of xmp properties
+ */
+public enum XmpPropertyType {
+ Text, Date, Integer, Boolean, Real
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpPropertyType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpRequiredPropertyException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpRequiredPropertyException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpRequiredPropertyException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpRequiredPropertyException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a property is required and not found
+ *
+ * @author a183132
+ *
+ */
+public class XmpRequiredPropertyException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpRequiredPropertyException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpRequiredPropertyException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpRequiredPropertyException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpRequiredPropertyException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpRequiredPropertyException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * Exception thrown when problems occurs in Schema Treatment
+ *
+ * @author a183132
+ *
+ */
+public class XmpSchemaException extends Exception {
+
+ /**
+ * serial version uid
+ */
+ private static final long serialVersionUID = -980712488563404867L;
+
+ /**
+ * Create an instance of XmpSchemaException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpSchemaException(String message) {
+ super(message);
+ }
+
+ /**
+ * Create an instance of XmpSchemaException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpSchemaException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSchemaException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a element not equals with what is expected
+ *
+ * @author a183132
+ *
+ */
+public class XmpUnexpectedElementException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpUnexpectedElementValue
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnexpectedElementException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpUnexpectedElementValue
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnexpectedElementException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementQualifiedNameException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementQualifiedNameException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementQualifiedNameException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementQualifiedNameException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a element qualified name not equals with what
+ * is expected
+ *
+ * @author a183132
+ *
+ */
+public class XmpUnexpectedElementQualifiedNameException extends
+ XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of UnexpectedElementQualifiedNameException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnexpectedElementQualifiedNameException(String message,
+ Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of UnexpectedElementQualifiedNameException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnexpectedElementQualifiedNameException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedElementQualifiedNameException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespacePrefixException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespacePrefixException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespacePrefixException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespacePrefixException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a predefined schema have a wrong namespace URI
+ *
+ * @author a183132
+ *
+ */
+public class XmpUnexpectedNamespacePrefixException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpUnexpectedNamespaceURI
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnexpectedNamespacePrefixException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpUnexpectedNamespaceURI
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnexpectedNamespacePrefixException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespacePrefixException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespaceURIException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespaceURIException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespaceURIException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespaceURIException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a predefined schema have a wrong namespace URI
+ *
+ * @author a183132
+ *
+ */
+public class XmpUnexpectedNamespaceURIException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpUnexpectedNamespaceURI
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnexpectedNamespaceURIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpUnexpectedNamespaceURI
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnexpectedNamespaceURIException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedNamespaceURIException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedTypeException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedTypeException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedTypeException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedTypeException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when element read has not the type expected
+ *
+ * @author a183132
+ *
+ */
+public class XmpUnexpectedTypeException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of UnexpectedTypeException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnexpectedTypeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of UnexpectedTypeException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnexpectedTypeException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnexpectedTypeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a property is found in xmp block and is not
+ * existing in predefined schema.
+ *
+ * @author gbailleul
+ *
+ */
+public class XmpUnknownPropertyException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpUnknownPropertyException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnknownPropertyException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpUnknownPropertyException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnknownPropertyException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyTypeException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyTypeException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyTypeException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyTypeException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a property is found with a type unknown
+ *
+ * @author a183132
+ *
+ */
+public class XmpUnknownPropertyTypeException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpUnknownPropertyTypeException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnknownPropertyTypeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpUnknownPropertyTypeException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnknownPropertyTypeException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownPropertyTypeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownSchemaException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownSchemaException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownSchemaException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownSchemaException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a schema is unknown (NameSpace Mapping) in
+ * predefined schema.
+ *
+ * @author gbailleul
+ *
+ */
+public class XmpUnknownSchemaException extends XmpParsingException {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpUnknownSchemaException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnknownSchemaException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpUnknownSchemaException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnknownSchemaException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownSchemaException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownValueTypeException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownValueTypeException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownValueTypeException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownValueTypeException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a property use a value type which is not
+ * declared
+ *
+ * @author a183132
+ *
+ */
+public class XmpUnknownValueTypeException extends Exception {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create an instance of XmpUnknownValueTypeException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpUnknownValueTypeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create an instance of XmpUnknownValueTypeException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpUnknownValueTypeException(String message) {
+ super(message);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpUnknownValueTypeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpXpacketEndException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpXpacketEndException.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpXpacketEndException.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpXpacketEndException.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ *
+ * 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.parser;
+
+/**
+ * This exception is thrown when a xpacket end is malformed
+ *
+ * @author a183132
+ *
+ */
+public class XmpXpacketEndException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 737516114298078255L;
+
+ /**
+ * Create an instance of XmpXpacketEndException
+ *
+ * @param message
+ * a description of the encountered problem
+ */
+ public XmpXpacketEndException(String message) {
+ super(message);
+
+ }
+
+ /**
+ * Create an instance of XmpXpacketEndException
+ *
+ * @param message
+ * a description of the encountered problem
+ * @param cause
+ * the cause of the exception
+ */
+ public XmpXpacketEndException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpXpacketEndException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,228 @@
+/*****************************************************************************
+ *
+ * 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 org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.TextType;
+
+/**
+ * Representation of Adobe PDF Schema
+ *
+ * @author a183132
+ *
+ */
+public class AdobePDFSchema extends XMPSchema {
+
+ public static final String PREFERRED_PDF_PREFIX = "pdf";
+
+ public static final String PDFURI = "http://ns.adobe.com/pdf/1.3/";
+
+ @PropertyType(propertyType = "Text")
+ public static final String KEYWORDS = "Keywords";
+
+ @PropertyType(propertyType = "Text")
+ public static final String PDF_VERSION = "PDFVersion";
+
+ @PropertyType(propertyType = "Text")
+ public static final String PRODUCER = "Producer";
+
+ /**
+ * Constructor of an Adobe PDF schema with preferred prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public AdobePDFSchema(XMPMetadata metadata) {
+ super(metadata, PREFERRED_PDF_PREFIX, PDFURI);
+ }
+
+ /**
+ * Constructor of an Adobe PDF schema with specified prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ * @param ownPrefix
+ * The prefix to assign
+ */
+ public AdobePDFSchema(XMPMetadata metadata, String ownPrefix) {
+ super(metadata, ownPrefix, PDFURI);
+ }
+
+ /**
+ * Set the PDF keywords
+ *
+ * @param value
+ * Value to set
+ */
+ public void setKeywordsValue(String value) {
+ TextType keywords;
+ keywords = new TextType(metadata, localPrefix, KEYWORDS, value);
+ addProperty(keywords);
+ }
+
+ /**
+ * Set the PDF keywords
+ *
+ * @param keywords
+ * Property to set
+ */
+ public void setKeywords(TextType keywords) {
+ addProperty(keywords);
+ }
+
+ /**
+ * Set the PDFVersion
+ *
+ * @param value
+ * Value to set
+ */
+ public void setPDFVersionValue(String value) {
+ TextType version;
+ version = new TextType(metadata, localPrefix, PDF_VERSION, value);
+ addProperty(version);
+
+ }
+
+ /**
+ * Set the PDFVersion
+ *
+ * @param version
+ * Property to set
+ */
+ public void setPDFVersion(TextType version) {
+ addProperty(version);
+ }
+
+ /**
+ * Set the PDFProducer
+ *
+ * @param value
+ * Value to set
+ */
+ public void setProducerValue(String value) {
+ TextType producer;
+ producer = new TextType(metadata, localPrefix, PRODUCER, value);
+ addProperty(producer);
+ }
+
+ /**
+ * Set the PDFProducer
+ *
+ * @param producer
+ * Property to set
+ */
+ public void setProducer(TextType producer) {
+ addProperty(producer);
+ }
+
+ /**
+ * Give the PDF Keywords property
+ *
+ * @return The property object
+ */
+ public TextType getKeywords() {
+ AbstractField tmp = getProperty(localPrefixSep + KEYWORDS);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the PDF Keywords property value (string)
+ *
+ * @return The property value
+ */
+ public String getKeywordsValue() {
+ AbstractField tmp = getProperty(localPrefixSep + KEYWORDS);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the PDFVersion property
+ *
+ * @return The property object
+ */
+ public TextType getPDFVersion() {
+ AbstractField tmp = getProperty(localPrefixSep + PDF_VERSION);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the PDFVersion property value (string)
+ *
+ * @return The property value
+ */
+ public String getPDFVersionValue() {
+ AbstractField tmp = getProperty(localPrefixSep + PDF_VERSION);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the producer property
+ *
+ * @return The property object
+ */
+ public TextType getProducer() {
+ AbstractField tmp = getProperty(localPrefixSep + PRODUCER);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Give the producer property value (string)
+ *
+ * @return The property value
+ */
+ public String getProducerValue() {
+ AbstractField tmp = getProperty(localPrefixSep + PRODUCER);
+ if (tmp != null) {
+ if (tmp instanceof TextType) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/AdobePDFSchema.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,619 @@
+/*****************************************************************************
+ *
+ * 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.Calendar;
+import java.util.List;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.ComplexProperty;
+import org.apache.padaf.xmpbox.type.TextType;
+
+
+/**
+ * Representation of a DublinCore Schema
+ *
+ * @author a183132
+ *
+ */
+public class DublinCoreSchema extends XMPSchema {
+
+ public static final String PREFERRED_DC_PREFIX = "dc";
+
+ public static final String DCURI = "http://purl.org/dc/elements/1.1/";
+
+ @PropertyType(propertyType = "bag Text")
+ public static final String CONTRIBUTOR = "contributor";
+
+ @PropertyType(propertyType = "Text")
+ public static final String COVERAGE = "coverage";
+
+ @PropertyType(propertyType = "seq Text")
+ public static final String CREATOR = "creator";
+
+ @PropertyType(propertyType = "seq Date")
+ public static final String DATE = "date";
+
+ @PropertyType(propertyType = "Lang Alt")
+ public static final String DESCRIPTION = "description";
+
+ @PropertyType(propertyType = "Text")
+ public static final String FORMAT = "format";
+
+ @PropertyType(propertyType = "Text")
+ public static final String IDENTIFIER = "identifier";
+
+ @PropertyType(propertyType = "bag Text")
+ public static final String LANGUAGE = "language";
+
+ @PropertyType(propertyType = "bag Text")
+ public static final String PUBLISHER = "publisher";
+
+ @PropertyType(propertyType = "bag Text")
+ public static final String RELATION = "relation";
+
+ @PropertyType(propertyType = "Lang Alt")
+ public static final String RIGHTS = "rights";
+
+ @PropertyType(propertyType = "Text")
+ public static final String SOURCE = "source";
+
+ @PropertyType(propertyType = "bag Text")
+ public static final String SUBJECT = "subject";
+
+ @PropertyType(propertyType = "Lang Alt")
+ public static final String TITLE = "title";
+
+ @PropertyType(propertyType = "Text")
+ public static final String TYPE = "type";
+
+ /**
+ * Constructor of a Dublin Core schema with preferred prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ */
+ public DublinCoreSchema(XMPMetadata metadata) {
+ super(metadata, PREFERRED_DC_PREFIX, DCURI);
+ }
+
+ /**
+ * Constructor of a Dublin Core schema with specified prefix
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ * @param ownPrefix
+ * The prefix to assign
+ */
+ public DublinCoreSchema(XMPMetadata metadata, String ownPrefix) {
+ super(metadata, ownPrefix, DCURI);
+ }
+
+ /**
+ * set contributor(s) to the resource (other than the authors)
+ *
+ * @param properName
+ * Value to set
+ */
+ public void addToContributorValue(String properName) {
+ addBagValue(localPrefixSep + CONTRIBUTOR, properName);
+ }
+
+ /**
+ * set the extent or scope of the resource
+ *
+ * @param text
+ * Value to set
+ */
+ public void setCoverageValue(String text) {
+ addProperty(new TextType(metadata, localPrefix, COVERAGE, text));
+ }
+
+ /**
+ * set the extent or scope of the resource
+ *
+ * @param text
+ * Property to set
+ */
+ public void setCoverage(TextType text) {
+ addProperty(text);
+ }
+
+ /**
+ * set the autor(s) of the resource
+ *
+ * @param properName
+ * Value to add
+ * @throws InappropriateTypeException
+ */
+ public void addToCreatorValue(String properName) {
+ addSequenceValue(localPrefixSep + CREATOR, properName);
+ }
+
+ /**
+ * Set date(s) that something interesting happened to the resource
+ *
+ * @param date
+ * Value to add
+ */
+ public void addToDateValue(Calendar date) {
+ addSequenceDateValue(localPrefixSep + DATE, date);
+ }
+
+ /**
+ * add a textual description of the content of the resource (multiple values
+ * may be present for different languages)
+ *
+ * @param lang
+ * language concerned
+ * @param value
+ * Value to add
+ */
+ public void addToDescriptionValue(String lang, String value) {
+ setLanguagePropertyValue(localPrefixSep + DESCRIPTION, lang, value);
+ }
+
+ /**
+ * set the file format used when saving the resource.
+ *
+ * @param mimeType
+ * Value to set
+ */
+ public void setFormatValue(String mimeType) {
+ addProperty(new TextType(metadata, localPrefix, FORMAT, mimeType));
+ }
+
+ /**
+ * Set the unique identifier of the resource
+ *
+ * @param text
+ * Value to set
+ */
+ public void setIdentifierValue(String text) {
+ addProperty(new TextType(metadata, localPrefix, IDENTIFIER, text));
+ }
+
+ /**
+ * Set the unique identifier of the resource
+ *
+ * @param text
+ * Property to set
+ */
+ public void setIdentifier(TextType text) {
+ addProperty(text);
+ }
+
+ /**
+ * Add language(s) used in this resource
+ *
+ * @param locale
+ * Value to set
+ */
+ public void addToLanguageValue(String locale) {
+ addBagValue(localPrefixSep + LANGUAGE, locale);
+ }
+
+ /**
+ * add publisher(s)
+ *
+ * @param properName
+ * Value to add
+ */
+ public void addToPublisherValue(String properName) {
+ addBagValue(localPrefixSep + PUBLISHER, properName);
+ }
+
+ /**
+ * Add relationships to other documents
+ *
+ * @param text
+ * Value to set
+ */
+ public void addToRelationValue(String text) {
+ addBagValue(localPrefixSep + RELATION, text);
+ }
+
+ /**
+ * add informal rights statement, by language.
+ *
+ * @param lang
+ * Language concerned
+ * @param value
+ * Value to set
+ */
+ public void addToRightsValue(String lang, String value) {
+ setLanguagePropertyValue(localPrefixSep + RIGHTS, lang, value);
+ }
+
+ /**
+ * Set the unique identifer of the work from which this resource was derived
+ *
+ * @param text
+ * Value to set
+ */
+ public void setSourceValue(String text) {
+ addProperty(new TextType(metadata, localPrefix, SOURCE, text));
+ }
+
+ /**
+ * Set the unique identifer of the work from which this resource was derived
+ *
+ * @param text
+ * Property to set
+ */
+ public void setSource(TextType text) {
+ addProperty(text);
+ }
+
+ /**
+ * Set the unique identifer of the work from which this resource was derived
+ *
+ * @param text
+ * Property to set
+ */
+ public void setFormat(TextType text) {
+ addProperty(text);
+ }
+
+ /**
+ * add descriptive phrases or keywords that specify the topic of the content
+ * of the resource
+ *
+ * @param text
+ * Value to add
+ */
+ public void addToSubjectValue(String text) {
+ addBagValue(localPrefixSep + SUBJECT, text);
+ }
+
+ /**
+ * set the title of the document, or the name given to the resource (by
+ * language)
+ *
+ * @param lang
+ * Language concerned
+ * @param value
+ * Value to set
+ */
+ public void addToTitleValue(String lang, String value) {
+ setLanguagePropertyValue(localPrefixSep + TITLE, lang, value);
+ }
+
+ /**
+ * set the document type (novel, poem, ...)
+ *
+ * @param type
+ * Value to set
+ */
+ public void addToTypeValue(String type) {
+ addBagValue(localPrefixSep + TYPE, type);
+ }
+
+ /**
+ * Return the Bag of contributor(s)
+ *
+ * @return Contributor property
+ */
+ public ComplexProperty getContributor() {
+ return (ComplexProperty) getProperty(localPrefixSep + CONTRIBUTOR);
+ }
+
+ /**
+ * Return a String list of contributor(s)
+ *
+ * @return List of contributors values
+ */
+ public List<String> getContributorValue() {
+ return getBagValueList(localPrefixSep + CONTRIBUTOR);
+
+ }
+
+ /**
+ * Return the Coverage TextType Property
+ *
+ * @return Coverage property
+ */
+ public TextType getCoverage() {
+ return (TextType) getProperty(localPrefixSep + COVERAGE);
+ }
+
+ /**
+ * Return the value of the coverage
+ *
+ * @return Coverage value
+ */
+ public String getCoverageValue() {
+ TextType tt = (TextType) getProperty(localPrefixSep + COVERAGE);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the Sequence of contributor(s)
+ *
+ * @return Creator property
+ */
+ public ComplexProperty getCreator() {
+ return (ComplexProperty) getProperty(localPrefixSep + CREATOR);
+ }
+
+ /**
+ * Return the creator(s) string value
+ *
+ * @return List of creators values
+ */
+ public List<String> getCreatorValue() {
+ return getSequenceValueList(localPrefixSep + CREATOR);
+ }
+
+ /**
+ * Return the sequence of date(s)
+ *
+ * @return date property
+ */
+ public ComplexProperty getDate() {
+ return (ComplexProperty) getProperty(localPrefixSep + DATE);
+ }
+
+ /**
+ * Return a calendar list of date
+ *
+ * @return List of dates values
+ */
+ public List<Calendar> getDateValue() {
+ return getSequenceDateValueList(localPrefixSep + DATE);
+ }
+
+ /**
+ * Return the Lang alt Description
+ *
+ * @return Description property
+ */
+ public ComplexProperty getDescription() {
+ return (ComplexProperty) getProperty(localPrefixSep + DESCRIPTION);
+ }
+
+ /**
+ * Return a list of languages defined in description property
+ *
+ * @return get List of languages defined for description property
+ */
+ public List<String> getDescriptionLanguages() {
+ return getLanguagePropertyLanguagesValue(localPrefixSep + DESCRIPTION);
+ }
+
+ /**
+ * Return a language value for description property
+ *
+ * @param lang
+ * The language wanted
+ * @return Desription value for specified language
+ */
+ public String getDescriptionValue(String lang) {
+ return getLanguagePropertyValue(localPrefixSep + DESCRIPTION, lang);
+ }
+
+ /**
+ * Return the file format property
+ *
+ * @return the format property
+ */
+ public TextType getFormat() {
+ return (TextType) getProperty(localPrefixSep + FORMAT);
+ }
+
+ /**
+ * return the file format value
+ *
+ * @return the format value
+ */
+ public String getFormatValue() {
+ TextType tt = (TextType) getProperty(localPrefixSep + FORMAT);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the unique identifier property of this resource
+ *
+ * @return the identifier property
+ */
+ public TextType getIdentifier() {
+ return (TextType) getProperty(localPrefixSep + IDENTIFIER);
+ }
+
+ /**
+ * return the unique identifier value of this resource
+ *
+ * @return the unique identifier value
+ */
+ public String getIdentifierValue() {
+ TextType tt = (TextType) getProperty(localPrefixSep + IDENTIFIER);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the bag DC language
+ *
+ * @return language property
+ */
+ public ComplexProperty getLanguage() {
+ return (ComplexProperty) getProperty(localPrefixSep + LANGUAGE);
+ }
+
+ /**
+ * Return the list of values defined in the DC language
+ *
+ * @return list of languages defined for language property
+ */
+ public List<String> getLanguageValue() {
+ return getBagValueList(localPrefixSep + LANGUAGE);
+ }
+
+ /**
+ * Return the bag DC publisher
+ *
+ * @return publisher property
+ */
+ public ComplexProperty getPublisher() {
+ return (ComplexProperty) getProperty(localPrefixSep + PUBLISHER);
+ }
+
+ /**
+ * Return the list of values defined in the DC publisher
+ *
+ * @return list of values for publisher property
+ */
+ public List<String> getPublisherValue() {
+ return getBagValueList(localPrefixSep + PUBLISHER);
+ }
+
+ /**
+ * Return the bag DC relation
+ *
+ * @return relation property
+ */
+ public ComplexProperty getRelation() {
+ return (ComplexProperty) getProperty(localPrefixSep + RELATION);
+ }
+
+ /**
+ * Return the list of values defined in the DC relation
+ *
+ * @return list of values for relation property
+ */
+ public List<String> getRelationValue() {
+ return getBagValueList(localPrefixSep + RELATION);
+ }
+
+ /**
+ * Return the Lang alt Rights
+ *
+ * @return rights property
+ */
+ public ComplexProperty getRights() {
+ return (ComplexProperty) getProperty(localPrefixSep + RIGHTS);
+ }
+
+ /**
+ * Return a list of languages defined in Right property
+ *
+ * @return list of rights languages values defined
+ */
+ public List<String> getRightsLanguages() {
+ return getLanguagePropertyLanguagesValue(localPrefixSep + RIGHTS);
+ }
+
+ /**
+ * Return a language value for Right property
+ *
+ * @param lang
+ * language concerned
+ * @return the rights value for specified language
+ */
+ public String getRightsValue(String lang) {
+ return getLanguagePropertyValue(localPrefixSep + RIGHTS, lang);
+ }
+
+ /**
+ * Return the source property of this resource
+ *
+ * @return source property
+ */
+ public TextType getSource() {
+ return (TextType) getProperty(localPrefixSep + SOURCE);
+ }
+
+ /**
+ * return the source value of this resource
+ *
+ * @return value of source property
+ */
+ public String getSourceValue() {
+ TextType tt = (TextType) getProperty(localPrefixSep + SOURCE);
+ return tt == null ? null : tt.getStringValue();
+ }
+
+ /**
+ * Return the bag DC Subject
+ *
+ * @return the subject property
+ */
+ public ComplexProperty getSubject() {
+ return (ComplexProperty) getProperty(localPrefixSep + SUBJECT);
+ }
+
+ /**
+ * Return the list of values defined in the DC Subject
+ *
+ * @return the list of subject values
+ */
+ public List<String> getSubjectValue() {
+ return getBagValueList(localPrefixSep + SUBJECT);
+ }
+
+ /**
+ * Return the Lang alt Title
+ *
+ * @return the title property
+ */
+ public ComplexProperty getTitle() {
+ return (ComplexProperty) getProperty(localPrefixSep + TITLE);
+ }
+
+ /**
+ * Return a list of languages defined in Title property
+ *
+ * @return list of languages defined for title property
+ */
+ public List<String> getTitleLanguages() {
+ return getLanguagePropertyLanguagesValue(localPrefixSep + TITLE);
+ }
+
+ /**
+ * Return a language value for Title property
+ *
+ * @param lang
+ * the language concerned
+ * @return the title value for specified language
+ */
+ public String getTitleValue(String lang) {
+ return getLanguagePropertyValue(localPrefixSep + TITLE, lang);
+ }
+
+ /**
+ * Return the bag DC Type
+ *
+ * @return the type property
+ */
+ public ComplexProperty getType() {
+ return (ComplexProperty) getProperty(localPrefixSep + TYPE);
+ }
+
+ /**
+ * Return the list of values defined in the DC Type
+ *
+ * @return the value of type property
+ */
+ public List<String> getTypeValue() {
+ return getBagValueList(localPrefixSep + TYPE);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/DublinCoreSchema.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,324 @@
+/*****************************************************************************
+ *
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.parser.XmpSchemaException;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.Elementable;
+import org.w3c.dom.Element;
+
+/**
+ * Representation of a PDF/A Extension schema description schema
+ *
+ * @author a183132
+ *
+ */
+public class PDFAExtensionSchema extends XMPSchema {
+
+ public static final String PDFAEXTENSION = "pdfaExtension";
+ public static final String PDFAEXTENSIONURI = "http://www.aiim.org/pdfa/ns/extension/";
+
+ public static final String PDFASCHEMA = "pdfaSchema";
+ public static final String PDFASCHEMASEP = "pdfaSchema:";
+ public static final String PDFASCHEMAURI = "http://www.aiim.org/pdfa/ns/schema#";
+
+ public static final String PDFAPROPERTY = "pdfaProperty";
+ public static final String PDFAPROPERTYSEP = "pdfaProperty:";
+ public static final String PDFAPROPERTYURI = "http://www.aiim.org/pdfa/ns/property#";
+
+ public static final String PDFATYPE = "pdfaType";
+ public static final String PDFATYPESEP = "pdfaType:";
+ public static final String PDFATYPEURI = "http://www.aiim.org/pdfa/ns/type#";
+
+ public static final String PDFAFIELD = "pdfaField";
+ public static final String PDFAFIELDSEP = "pdfaField:";
+ public static final String PDFAFIELDURI = "http://www.aiim.org/pdfa/ns/field#";
+
+ @PropertyType(propertyType = "Text")
+ public static final String SCHEMA = "schema";
+
+ @PropertyType(propertyType = "URI")
+ public static final String NS_URI = "namespaceURI";
+
+ @PropertyType(propertyType = "Text")
+ public static final String PREFIX = "prefix";
+
+ @PropertyType(propertyType = "Seq Property")
+ public static final String PROPERTY = "property";
+
+ @PropertyType(propertyType = "Seq ValueType")
+ public static final String VALUETYPE = "valueType";
+
+ private SchemaDescriptionContainer descriptions;
+
+ /**
+ * Build a new PDFExtension schema
+ *
+ * @param metadata
+ * The metadata to attach this schema XMPMetadata
+ */
+ public PDFAExtensionSchema(XMPMetadata metadata) {
+ this(metadata,PDFAEXTENSION);
+ }
+
+ public PDFAExtensionSchema(XMPMetadata metadata, String prefix) {
+ super(metadata, prefix, PDFAEXTENSIONURI);
+ setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFASCHEMA,
+ PDFASCHEMAURI));
+ setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFAPROPERTY,
+ PDFAPROPERTYURI));
+ setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFATYPE, PDFATYPEURI));
+ setAttribute(new Attribute(NS_NAMESPACE, "xmlns", PDFAFIELD,
+ PDFAFIELDURI));
+
+ descriptions = new SchemaDescriptionContainer();
+ getElement().appendChild(descriptions.getElement());
+
+ }
+ /**
+ * Build a new PDFExtension schema with specified namespaces declaration
+ *
+ * @param metadata
+ * The metadata to attach this schema
+ * @param namespaces
+ * List of namespaces to define
+ * @throws XmpSchemaException
+ * The namespace URI of PDF/A Extension schema missing
+ */
+ public PDFAExtensionSchema(XMPMetadata metadata,
+ Map<String, String> namespaces) throws XmpSchemaException {
+ super(metadata, PDFAEXTENSION, PDFAEXTENSIONURI);
+ if (!namespaces.containsKey(PDFAEXTENSION)) {
+ throw new XmpSchemaException(
+ "Extension schema is declared without the pdfaSchema namespace specification");
+ }
+ namespaces.remove(PDFAEXTENSION);
+
+ for (Entry<String, String> entry : namespaces.entrySet()) {
+ setAttribute(new Attribute(NS_NAMESPACE, "xmlns", entry.getKey(),
+ entry.getValue()));
+ }
+ descriptions = new SchemaDescriptionContainer();
+ getElement().appendChild(descriptions.getElement());
+
+ }
+
+ /**
+ * Give the prefix of the PDF/A Extension schema
+ *
+ * @return prefix value
+ */
+ public String getPrefixValue() {
+ return PDFAEXTENSION;
+
+ }
+
+ /**
+ * Give the namespace URI of the PDF/A Extension schema
+ *
+ * @return namespace URI
+ */
+ public String getNamespaceValue() {
+ return PDFAEXTENSIONURI;
+ }
+
+ /**
+ * Add to the Extension Schema a new description schema param desc the
+ * schema description
+ *
+ * @param desc
+ * the new schema description
+ * @return the previous schema with same prefix, null otherwise
+ */
+ public SchemaDescription addSchemaDescription(SchemaDescription desc) {
+ return descriptions.addSchemaDescription(desc);
+ }
+
+ /**
+ * create Extension Schema a new description schema
+ *
+ * @return a new empty description schema
+ */
+ public SchemaDescription createSchemaDescription() {
+ SchemaDescription desc = new SchemaDescription(metadata);
+ return desc;
+ }
+
+ /**
+ * Give a list of all description declared
+ *
+ * @return List of all schemaDescriptions declared
+ */
+ public List<SchemaDescription> getDescriptionSchema() {
+ return Collections.unmodifiableList(descriptions.schemaDescriptions);
+ }
+
+ /**
+ * Give an iterator of all description declared
+ *
+ * @return a SchemaDescription Iterator
+ */
+ public Iterator<SchemaDescription> getIteratorOfDescriptions() {
+ return descriptions.getAllSchemasDescription();
+ }
+
+ /**
+ * Container of Description Schema embedded in PDF/A Extension Schema
+ *
+ * @author a183132
+ *
+ */
+ public class SchemaDescriptionContainer implements Elementable {
+
+ protected Element element, content;
+ protected List<SchemaDescription> schemaDescriptions;
+
+ /**
+ *
+ * SchemasDescription Container constructor
+ */
+ public SchemaDescriptionContainer() {
+ element = metadata.getFuturOwner().createElement(
+ PDFAEXTENSION + ":schemas");
+ content = metadata.getFuturOwner().createElement("rdf:Bag");
+ element.appendChild(content);
+
+ schemaDescriptions = new ArrayList<SchemaDescription>();
+ }
+
+ /**
+ * Add a SchemaDescription to the current structure
+ *
+ * @param obj
+ * the property to add
+ * @return the old SchemaDescription corresponding to the same namespace
+ * prefix if exist, else null
+ */
+ public SchemaDescription addSchemaDescription(SchemaDescription obj) {
+ SchemaDescription sd = getSameSchemaDescription(obj);
+ if (sd != null) {
+ schemaDescriptions.remove(sd);
+ content.removeChild(sd.content.getElement());
+ }
+ // if(containsSchemaDescription(obj)){
+ // removeSchemaDescription(obj);
+ // }
+ schemaDescriptions.add(obj);
+ content.appendChild(obj.content.getElement());
+ return sd;
+ }
+
+ /**
+ * Get Schema Description embedded with the same prefix as that given in
+ * parameters
+ *
+ * @param obj
+ * Schema Description with same prefix
+ * @return The schema Description contained
+ */
+ protected SchemaDescription getSameSchemaDescription(
+ SchemaDescription obj) {
+ String oPrefix = obj.getPrefix();
+ for (SchemaDescription existing : schemaDescriptions) {
+ if (oPrefix.equals(existing.getPrefix())) {
+ return existing;
+ }
+ }
+ // else not found
+ return null;
+ }
+
+ /**
+ * Return all SchemaDescription
+ *
+ * @return SchemaDescriptions Iterator in order to be use in PDF/A
+ * Extension Schema class
+ */
+ public Iterator<SchemaDescription> getAllSchemasDescription() {
+ return schemaDescriptions.iterator();
+ }
+
+ // /**
+ // * Check if two SchemaDescription are similar
+ // * @param prop1
+ // * @param prop2
+ // * @return
+ // */
+ // public boolean isSameSchemaDescription(SchemaDescription prop1,
+ // SchemaDescription prop2){
+ // if(prop1.getClass().equals(prop2.getClass()) ){
+ // if(prop1.content.getElement().getTextContent().equals(prop2.content.getElement().getTextContent())){
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
+
+ // /**
+ // * Check if a specified SchemaDescription is embedded
+ // * @param schema
+ // * @return
+ // */
+ // public boolean containsSchemaDescription(SchemaDescription schema){
+ // Iterator<SchemaDescription> it=getAllSchemasDescription();
+ // SchemaDescription tmp;
+ // while(it.hasNext()){
+ // tmp=it.next();
+ // if(isSameSchemaDescription(tmp, schema) ){
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
+
+ // /**
+ // * Remove a schema
+ // * @param schema
+ // */
+ // public void removeSchemaDescription(SchemaDescription schema){
+ // if(containsSchemaDescription(schema)){
+ // schemaDescriptions.remove(schema);
+ // content.removeChild(schema.content.getElement());
+ // }
+ // }
+
+ /**
+ * Get Dom Element for xml/rdf serialization
+ *
+ * @return the DOM Element
+ */
+ public Element getElement() {
+ return element;
+ }
+
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAExtensionSchema.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAFieldDescription.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAFieldDescription.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAFieldDescription.java (added)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAFieldDescription.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,195 @@
+/*****************************************************************************
+ *
+ * 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.Iterator;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
+import org.apache.padaf.xmpbox.type.TextType;
+
+
+/**
+ * Representation of a PDF/A Field schema (used in PDFAValueTypeDescription)
+ *
+ * @author a183132
+ *
+ */
+public class PDFAFieldDescription {
+
+ public static final String PDFAFIELDPREFIX = "pdfaField";
+ public static final String PDFAFIELDPREFIXSEP = "pdfaField:";
+
+ @PropertyType(propertyType = "Text")
+ public static final String NAME = "name";
+
+ @PropertyType(propertyType = "Text")
+ public static final String VALUETYPE = "valueType";
+
+ @PropertyType(propertyType = "Text")
+ public static final String DESCRIPTION = "description";
+
+ protected XMPMetadata metadata;
+ protected ComplexPropertyContainer content;
+
+ /**
+ * Build a new PDF/A field description
+ *
+ * @param metadata
+ * The metadata to attach this description
+ */
+ public PDFAFieldDescription(XMPMetadata metadata) {
+ this.metadata = metadata;
+ content = new ComplexPropertyContainer(metadata, "rdf", "li");
+ content
+ .setAttribute(new Attribute(null, "rdf", "parseType",
+ "Resource"));
+ }
+
+ /**
+ * set the name of this field
+ *
+ * @param name
+ * The value to set
+ */
+ public void setNameValue(String name) {
+ content
+ .addProperty(new TextType(metadata, PDFAFIELDPREFIX, NAME, name));
+ }
+
+ /**
+ * set the valueType of this field
+ *
+ * @param valueType
+ * The value to set
+ */
+ public void setValueTypeValue(String valueType) {
+ content.addProperty(new TextType(metadata, PDFAFIELDPREFIX, VALUETYPE,
+ valueType));
+ }
+
+ /**
+ * set the description of this field
+ *
+ * @param description
+ * The value to set
+ */
+ public void setDescriptionValue(String description) {
+ content.addProperty(new TextType(metadata, PDFAFIELDPREFIX,
+ DESCRIPTION, description));
+ }
+
+ /**
+ * Get value of a specified property field
+ *
+ * @param qualifiedName
+ * The value to get
+ * @return the Value Type of specified field
+ */
+ private String getFieldPropertyValue(String qualifiedName) {
+ Iterator<AbstractField> it = content.getAllProperties().iterator();
+ AbstractField tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getQualifiedName().equals(qualifiedName)) {
+ return ((TextType) tmp).getStringValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the current defined field name (in a string)
+ *
+ * @return The declared name of this field
+ */
+ public String getNameValue() {
+ return getFieldPropertyValue(PDFAFIELDPREFIXSEP + NAME);
+ }
+
+ /**
+ * Return the current defined field valueType (in a string)
+ *
+ * @return the value Type of this field
+ */
+ public String getValueTypeValue() {
+ return getFieldPropertyValue(PDFAFIELDPREFIXSEP + VALUETYPE);
+ }
+
+ /**
+ * Return the current field description (in a string)
+ *
+ * @return the description of this field
+ */
+ public String getDescriptionValue() {
+ return getFieldPropertyValue(PDFAFIELDPREFIXSEP + DESCRIPTION);
+ }
+
+ /**
+ * Get one Property which describes the field
+ *
+ * @param qualifiedName
+ * the nameproperty
+ * @return the property wanted
+ */
+ private TextType getFieldProperty(String qualifiedName) {
+ Iterator<AbstractField> it = content.getAllProperties().iterator();
+ AbstractField tmp;
+ while (it.hasNext()) {
+ tmp = it.next();
+ if (tmp.getQualifiedName().equals(qualifiedName)) {
+ return (TextType) tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the property corresponding to the field name definition
+ *
+ * @return the name property of this field
+ */
+ public TextType getName() {
+ return getFieldProperty(PDFAFIELDPREFIXSEP + NAME);
+ }
+
+ /**
+ * Return the property corresponding to the field namespaceURI definition
+ *
+ * @return the valuetype property of this field
+ */
+ public TextType getValueType() {
+ return getFieldProperty(PDFAFIELDPREFIXSEP + VALUETYPE);
+ }
+
+ /**
+ * Return the property corresponding to the field description definition
+ *
+ * @return the description property of this field
+ */
+ public TextType getDescription() {
+ return getFieldProperty(PDFAFIELDPREFIXSEP + DESCRIPTION);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/PDFAFieldDescription.java
------------------------------------------------------------------------------
svn:eol-style = native