Examples of XMPSchema


Examples of org.apache.padaf.xmpbox.schema.XMPSchema

    String langAltSchem1 = "x-default";

    String valAltSchem2 = "altvalSchem2";
    String langAltSchem2 = "fr-fr";

    XMPSchema schem1 = new XMPSchema(parent, "test",
        "http://www.test.org/schem/");
    schem1.addBagValue(bagName, valBagSchem1);
    schem1.addSequenceValue(seqName, valSeqSchem1);
    schem1.setLanguagePropertyValue(altName, langAltSchem1, valAltSchem1);

    XMPSchema schem2 = new XMPSchema(parent, "test",
        "http://www.test.org/schem/");
    schem2.addBagValue(bagName, valBagSchem2);
    schem2.addSequenceValue(seqName, valSeqSchem2);
    schem2.setLanguagePropertyValue(altName, langAltSchem2, valAltSchem2);

    schem1.merge(schem2);

    // Check if all values are present
    Assert.assertEquals(valAltSchem2, schem1.getLanguagePropertyValue(
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

    // Check ADOBE PDF Schema
    Assert.assertEquals("PDFlib Personalization Server 7.0.2p5 (Win32)",
        metadata.getAdobePDFSchema().getProducerValue());

    // Check Defined Schema
    XMPSchema schem = metadata.getSchema("http://www.acme.com/ns/email/1/");
    Assert.assertEquals(DateConverter
        .toCalendar("2007-11-09T09:55:36+01:00"), schem
        .getDatePropertyValue("acmeemail:Delivery-Date"));
    Assert.assertNotNull(schem.getAbstractProperty(("acmeemail:From")));

    // SaveMetadataHelper.serialize(metadata, true, System.out);

  }
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

    // Check ADOBE PDF Schema
    Assert.assertEquals("PDFlib Personalization Server 7.0.2p5 (Win32)",
        metadata.getAdobePDFSchema().getProducerValue());

    // Check Defined Schema
    XMPSchema schem = metadata.getSchema("http://www.acme.com/ns/email/1/");
    Assert.assertEquals(DateConverter
        .toCalendar("2007-11-09T09:55:36+01:00"), schem
        .getDatePropertyValue("acmeemail:Delivery-Date"));
    Assert.assertNotNull(schem.getAbstractProperty(("acmeemail:From")));

    // SaveMetadataHelper.serialize(metadata, true, System.out);

  }
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

     *            The namespace URI corresponding to the schema wanted
     * @return The Class Schema representation
     */
    public XMPSchema getSchema(String nsURI) {
        Iterator<XMPSchema> it = schemas.schemas.iterator();
        XMPSchema tmp;
        while (it.hasNext()) {
            tmp = it.next();
            if (tmp.getNamespaceValue().equals(nsURI)) {
                return tmp;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

     *            The namespace URI corresponding to the schema wanted
     * @return The Class Schema representation
     */
    public XMPSchema getSchema(String prefix, String nsURI) {
        Iterator<XMPSchema> it = getAllSchemas().iterator();
        XMPSchema tmp;
        while (it.hasNext()) {
            tmp = it.next();
            if (tmp.getNamespaceValue().equals(nsURI)
                    && tmp.getPrefix().equals(prefix)) {
                return tmp;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.apache.padaf.xmpbox.schema.XMPSchema

     * @param nsURI
     *            The namespace URI wanted for the schema
     * @return The schema added in order to work on it
     */
    public XMPSchema createAndAddDefaultSchema(String nsPrefix, String nsURI) {
        XMPSchema schem = new XMPSchema(this, nsPrefix, nsURI);
        schem.setAboutAsSimple("");
        addSchema(schem);
        return schem;
    }
View Full Code Here

Examples of org.apache.xmpbox.schema.XMPSchema

     * @return The Class Schema representation
     */
    public XMPSchema getSchema(String nsURI)
    {
        Iterator<XMPSchema> it = schemas.iterator();
        XMPSchema tmp;
        while (it.hasNext())
        {
            tmp = it.next();
            if (tmp.getNamespace().equals(nsURI))
            {
                return tmp;
            }
        }
        return null;
View Full Code Here

Examples of org.apache.xmpbox.schema.XMPSchema

     * @return The Class Schema representation
     */
    public XMPSchema getSchema(String prefix, String nsURI)
    {
        Iterator<XMPSchema> it = getAllSchemas().iterator();
        XMPSchema tmp;
        while (it.hasNext())
        {
            tmp = it.next();
            if (tmp.getNamespace().equals(nsURI) && tmp.getPrefix().equals(prefix))
            {
                return tmp;
            }
        }
        return null;
View Full Code Here

Examples of org.apache.xmpbox.schema.XMPSchema

     *            The namespace URI wanted for the schema
     * @return The schema added in order to work on it
     */
    public XMPSchema createAndAddDefaultSchema(String nsPrefix, String nsURI)
    {
        XMPSchema schem = new XMPSchema(this, nsURI, nsPrefix);
        schem.setAboutAsSimple("");
        addSchema(schem);
        return schem;
    }
View Full Code Here

Examples of org.apache.xmpbox.schema.XMPSchema

                    // do nothing
                }
                else
                {
                    String namespace = attr.getNamespaceURI();
                    XMPSchema schema = xmp.getSchema(namespace);
                    if (schema == null && tm.getSchemaFactory(namespace) != null)
                    {
                        schema = tm.getSchemaFactory(namespace).createXMPSchema(xmp, attr.getPrefix());
                        loadAttributes(schema, description);
                    }
                    // Only process when a schema was successfully found
                    if( schema != null )
                    {
                        ComplexPropertyContainer container = schema.getContainer();
                        PropertyType type = checkPropertyDefinition(xmp,
                                new QName(attr.getNamespaceURI(), attr.getLocalName()));
                       
                        //Default to text if no type is found
                        if( type == null)
                        {
                            type = TypeMapping.createPropertyType(Types.Text, Cardinality.Simple);
                        }
                                          
                        try
                        {
                            AbstractSimpleProperty sp = tm.instanciateSimpleProperty(namespace, schema.getPrefix(),
                                    attr.getLocalName(), attr.getValue(), type.type());
                            container.addProperty(sp);
                        }
                        catch( IllegalArgumentException exception)
                        {
                            //Swallow, and continue adding additional properties
                            LOG.warn("Unable to add property: "+ attr.getLocalName() + " value: "+attr.getValue(),exception);
                        }
                    }
                }
            }
            // parse children elements as properties
            for (Element property : properties)
            {
                String namespace = property.getNamespaceURI();
                PropertyType type = checkPropertyDefinition(xmp, DomHelper.getQName(property));
                // create the container
                if (!tm.isDefinedSchema(namespace))
                {
                    throw new XmpParsingException(ErrorType.NoSchema,
                            "This namespace is not a schema or a structured type : " + namespace);
                }
                XMPSchema schema = xmp.getSchema(namespace);
                if (schema == null)
                {
                    schema = tm.getSchemaFactory(namespace).createXMPSchema(xmp, property.getPrefix());
                    loadAttributes(schema, description);
                }
                ComplexPropertyContainer container = schema.getContainer();
                // create property
                createProperty(xmp, property, type, container);
            }
        }
        catch (XmpSchemaException e)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.