/*
 * Copyright
 *   2007 axYus - www.axyus.com
 *   2010 C.Marchand - christophe.marchand@axyus.com
 *
 * This file is part of XEMELIOS.
 *
 * XEMELIOS 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 3 of the License, or
 * (at your option) any later version.
 *
 * XEMELIOS 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 XEMELIOS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package fr.gouv.finances.cp.xemelios.controls.processors;

import fr.gouv.finances.cp.xemelios.controls.models.ParamModel;
import fr.gouv.finances.dgfip.utils.xml.XmlAttributesImpl;

import java.util.Hashtable;
import java.util.List;
import javax.xml.namespace.NamespaceContext;
import org.xml.sax.Attributes;


/**
 * A processor, used by control engines
 * @author cmarchand
 */
public abstract class AbstractProcessor implements Processor {
    private Hashtable<String,ParamModel> parameters;
    private NamespaceContext nsCtx;

    public void setParameters(List<ParamModel> params) {
        parameters = new Hashtable<String, ParamModel>();
        for(ParamModel p:params) {
            parameters.put(p.getName(), p);
        }
    }
    public ParamModel getParamByName(String name) {
        if(parameters==null) return null;
        return parameters.get(name);
    }

    public void setNamespaceContext(NamespaceContext nsCtx) {
        this.nsCtx = nsCtx;
    }
    public NamespaceContext getNamespaceContext() { return nsCtx; }


    /**
     * By default, does nothing
     * @param evt
     */
    public void process(EVENT evt) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * By default, does nothing
     * @param evt
     * @param uri
     * @param localName
     * @param qName
     */
    public void process(EVENT evt, String uri, String localName, String qName) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * By default does nothing
     * @param evt
     * @param uri
     * @param localName
     * @param qName
     * @param atts
     */
    public void process(EVENT evt, String uri, String localName, String qName, Attributes atts) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * By default does nothing
     * @param evt
     * @param uri
     * @param localName
     * @param qName
     * @param atts
     */
    public void process(EVENT evt, String uri, String localName, String qName, XmlAttributesImpl atts) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }
}
