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: ImageLoaderFactoryMathML.java,v cca61eec2241 2008/05/23 09:53:47 maxberger $ */
018    
019    package net.sourceforge.jeuclid.xmlgraphics;
020    
021    import net.sourceforge.jeuclid.Constants;
022    
023    import org.apache.xmlgraphics.image.loader.ImageFlavor;
024    import org.apache.xmlgraphics.image.loader.impl.AbstractImageLoaderFactory;
025    import org.apache.xmlgraphics.image.loader.spi.ImageLoader;
026    
027    /**
028     * @version $Revision: cca61eec2241 $
029     */
030    public 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    }