//package org.etsi.its.tool.elvior;
//
//import java.lang.reflect.Constructor;
//import java.util.Map;
//import java.util.TreeMap;
//
//import org.elvior.ttcn.tritci.TriTciChannel;
//import org.etsi.its.codec.ItsCodecImpl;
//import org.etsi.its.codec.ttcn.LibItsBtp_TypesAndValues.LibItsBtp_TypesAndValuesCodec;
//import org.etsi.ttcn.tci.TciCDProvided;
//import org.etsi.ttcn.tci.TciCDRequired;
//
//public class CodecsProvider {
//
//    /**
//     * Unique instance of the factory
//     */
//    private static CodecsProvider instance = new CodecsProvider();
//    
//    /**
//     * List of the registered protocol port types 
//     */
//    protected Map<String, Class<? extends ItsCodecImpl>> codecs = new TreeMap<String, Class<? extends ItsCodecImpl>>();
//    
//    /**
//     * Private constructor (Singleton pattern)
//     */
//    private CodecsProvider() {
//        codecs.put("BtpReq", LibItsBtp_TypesAndValuesCodec.class);
//        codecs.put("BtpInd", LibItsBtp_TypesAndValuesCodec.class);
//        //codecs.put("FNTPPDU", CamPort.class);
//    }
//
//    /**
//     * Gets the unique factory instance
//     * @return ProtocolPortFactory instance
//     */
//    public static CodecsProvider getInstance(){
//        return instance;
//    }
//
//    /**
//     * Creates a new instance of the desired codec
//     * @param  codecName           Name of the codec to implement
//     * @return The codec instance
//     */
//    public TciCDProvided createInstance(final String codecName) {
//        TciCDProvided codec = null;
//        Class<?>[] ctorParams = { TriTciChannel.getInstance().getClass() };
//        
//        try {
//            Class<? extends ItsCodecImpl> cls = codecs.get(codecName);
//            
//            if (cls == null) {
//                throw new RuntimeException("No class registered under " + codecName);
//            }
//            codec = new LibItsBtp_TypesAndValuesCodec((TciCDRequired)(TriTciChannel.getInstance()));
////            Constructor<? extends ItsCodecImpl> ctor = cls.getConstructor(ctorParams);
////            codec = (TciCDProvided) ctor.newInstance((TciCDRequired)(TriTciChannel.getInstance()));
//        } catch (Exception ex) {
//            ex.printStackTrace();
//        }
//
//        return codec;
//    }
//    
//} // End of class CodecsProvider
