001/*
002 * Copyright 2002 - 2008 JEuclid, http://jeuclid.sf.net
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017/* $Id$ */
018
019package net.sourceforge.jeuclid.xmlgraphics;
020
021import net.sourceforge.jeuclid.Constants;
022
023import org.apache.xmlgraphics.image.loader.ImageFlavor;
024import org.apache.xmlgraphics.image.loader.impl.AbstractImageLoaderFactory;
025import org.apache.xmlgraphics.image.loader.spi.ImageLoader;
026
027/**
028 * @version $Revision$
029 */
030public class ImageLoaderFactoryMathML extends AbstractImageLoaderFactory {
031
032    private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { ImageFlavor.XML_DOM };
033
034    private static final String[] MIMES = new String[] { Constants.MATHML_MIMETYPE };
035
036    /**
037     * Default Constructor.
038     */
039    public ImageLoaderFactoryMathML() {
040        // Empty on purpose
041    }
042
043    /** {@inheritDoc} */
044    public String[] getSupportedMIMETypes() {
045        return ImageLoaderFactoryMathML.MIMES.clone();
046    }
047
048    /** {@inheritDoc} */
049    public ImageFlavor[] getSupportedFlavors(final String mime) {
050        return ImageLoaderFactoryMathML.FLAVORS.clone();
051    }
052
053    /** {@inheritDoc} */
054    public ImageLoader newImageLoader(final ImageFlavor targetFlavor) {
055        return new ImageLoaderMathML(targetFlavor);
056    }
057
058    /** {@inheritDoc} */
059    public int getUsagePenalty(final String mime, final ImageFlavor flavor) {
060        return 0;
061    }
062
063    /** {@inheritDoc} */
064    public boolean isAvailable() {
065        return true;
066    }
067
068}