001    /*
002     * File:    $HeadURL: https://jvoicexml.svn.sourceforge.net/svnroot/jvoicexml/core/trunk/org.jvoicexml.implementation.jsapi20/src/org/jvoicexml/implementation/jsapi20/Jsapi20SynthesizedOutputFactory.java $
003     * Version: $LastChangedRevision: 2355 $
004     * Date:    $Date: 2010-10-07 20:28:03 +0200 (Do, 07 Okt 2010) $
005     * Author:  $LastChangedBy: schnelle $
006     *
007     * JVoiceXML - A free VoiceXML implementation.
008     *
009     * Copyright (C) 2006-2010 JVoiceXML group - http://jvoicexml.sourceforge.net
010     * The JVoiceXML group hereby disclaims all copyright interest in the
011     * library `JVoiceXML' (a free VoiceXML implementation).
012     * JVoiceXML group, $Date: 2010-10-07 20:28:03 +0200 (Do, 07 Okt 2010) $, Dirk Schnelle-Walka, project lead
013     *
014     *  This library is free software; you can redistribute it and/or
015     *  modify it under the terms of the GNU Library General Public
016     *  License as published by the Free Software Foundation; either
017     *  version 2 of the License, or (at your option) any later version.
018     *
019     *  This library is distributed in the hope that it will be useful,
020     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
021     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
022     *  Library General Public License for more details.
023     *
024     *  You should have received a copy of the GNU Library General Public
025     *  License along with this library; if not, write to the Free Software
026     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
027     *
028     */
029    
030    package org.jvoicexml.implementation.red5;
031    
032    import org.jvoicexml.event.error.NoresourceError;
033    import org.jvoicexml.implementation.ResourceFactory;
034    import org.jvoicexml.implementation.SynthesizedOutput;
035    
036    /**
037     * Demo implementation of a {@link org.jvoicexml.implementation.ResourceFactory}
038     * for the {@link org.jvoicexml.implementation.SynthesizedOutput} based on
039     * JSAPI 2.0.
040     *
041     * @author Dirk Schnelle-Walka
042     * @version $Revision: 2355 $
043     * @since 0.5.5
044     */
045    public final class Red5SynthesizedOutputFactory
046            implements ResourceFactory<SynthesizedOutput> {
047        /** Number of instances that this factory will create. */
048        private int instances;
049    
050        /** Type of the created resources. */
051        private String type;
052    
053        /**
054         * Constructs a new object.
055         * @param engineFactory class name of the engine list factory.
056         */
057        public Red5SynthesizedOutputFactory() {
058            type = "red5";
059        }
060    
061        /**
062         * {@inheritDoc}
063         */
064        public SynthesizedOutput createResource() throws NoresourceError {
065            final Red5SynthesizedOutput output = new Red5SynthesizedOutput();
066            output.setType(type);
067            return output;
068        }
069    
070        /**
071         * Sets the number of instances that this factory will create.
072         *
073         * @param number
074         *                Number of instances to create.
075         */
076        public void setInstances(final int number) {
077            instances = number;
078        }
079    
080        /**
081         * {@inheritDoc}
082         */
083        public int getInstances() {
084            return instances;
085        }
086    
087    
088        /**
089         * {@inheritDoc}
090         */
091        public String getType() {
092            return type;
093        }
094    
095        /**
096         * Sets the type of the created resource.
097         * @param typeName
098         */
099        void setType(final String typeName) {
100            type = typeName;
101        }
102    
103        /**
104         * {@inheritDoc}
105         */
106        public Class<SynthesizedOutput> getResourceType() {
107            return SynthesizedOutput.class;
108        }
109    }