/*
 * Copyright 2011 Specto Technologies Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
package com.spectotechnologies.imageio.plugins.eps;

import javax.imageio.ImageTypeSpecifier;
import javax.imageio.metadata.IIOMetadataFormatImpl;

/**
 *
 * @author Specto Technologies Inc., Alexandre Lavoie
 */
public class EPSMetaDataFormat extends IIOMetadataFormatImpl
{
	// Create a single instance of this class (singleton pattern)
	private static EPSMetaDataFormat defaultInstance = new EPSMetaDataFormat();

	// Make constructor private to enforce the singleton pattern
	private EPSMetaDataFormat()
	{
		// Set the name of the root node
		// The root node has a single child node type that may repeat
		super("com.spectotechnologies.imageio.plugins.eps.EPSMetaData_1.0",CHILD_POLICY_REPEAT);

		// Set up the “KeywordValuePair” node, which has no children
		addElement("KeywordValuePair","com.spectotechnologies.imageio.plugins.eps.EPSMetaData_1.0",CHILD_POLICY_EMPTY);

		// Set up attribute “keyword” which is a String that is required
		// and has no default value
		addAttribute("KeywordValuePair","keyword",DATATYPE_STRING,true,null);

		// Set up attribute “value” which is a String that is required
		// and has no default value
		addAttribute("KeywordValuePair","value",DATATYPE_STRING,true,null);
	}

	// Check for legal element name
	@Override
	public boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType)
	{
		return elementName.equals("KeywordValuePair");
	}
	
	// Return the singleton instance
	public static EPSMetaDataFormat getDefaultInstance()
	{
		return defaultInstance;
	}
}
