Commit e16da27a authored by garciay's avatar garciay
Browse files

Wrong code merging between TCT3 & TTWB Codec code

parent 0d9a4cde
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -138,9 +138,5 @@ public interface ITciCDWrapper {
     */
    public Type getTypeForName(final String type);

	void logDebug(String debugMessage);

	void logError(String errorMessage);

    // FIXME To be continued
} // End of interface ITciCDWrapper
+9 −9
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@ import java.lang.reflect.Constructor;
import java.util.Map;
import java.util.TreeMap;

import org.etsi.adapter.TERFactory;
import org.etsi.ttcn.tci.TciCDProvided;
import org.etsi.ttcn.tci.TciTypeClass;
import org.etsi.codec.TciCDWrapperFactory;
import org.etsi.ttcn.codec.generic.Bitstring;
import org.etsi.ttcn.codec.generic.Boolean;
import org.etsi.ttcn.codec.generic.Charstring;
@@ -77,11 +77,11 @@ public class CodecFactory {
            return null;
        }
        
//        TciCDWrapper.getInstance().logDebug("getExternalCodec: Search external codec for " + encoding);
        //TERFactory.getInstance().logDebug("getExternalCodec: Search external codec for " + encoding);
        codec = externalCodecs.get(encoding);
        if(codec != null) {
        	TciCDWrapperFactory.getTciCDInstance().logDebug(String.format("%50s", encoding));
        	TciCDWrapperFactory.getTciCDInstance().logDebug(" ==> " + codec.getClass().getName());      
            TERFactory.getInstance().logDebug(String.format("%50s", encoding));
            TERFactory.getInstance().logDebug(" ==> " + codec.getClass().getName());      
            return codec;
        }
        return null;
@@ -89,11 +89,11 @@ public class CodecFactory {
    
    public ICodec getCodec(MainCodec mainCodec, int classType, String encoding, String typeName) {

    	TciCDWrapperFactory.getTciCDInstance().logDebug(String.format("%50s", typeName + "(" + encoding + ")"));
        TERFactory.getInstance().logDebug(String.format("%50s", typeName + "(" + encoding + ")"));
        Class<? extends ICodec> cls = null;
        Class<?>[] ctorParams = {MainCodec.class};

        TciCDWrapperFactory.getTciCDInstance().logDebug("getCodec: Search internal codec for " + classType + '/' + encoding + '/' + typeName);
        TERFactory.getInstance().logDebug("getCodec: Search internal codec for " + classType + '/' + encoding + '/' + typeName);
        cls = codecs.get(classType + '/' + encoding + '/' + typeName);
        if(cls == null) {
            cls = codecs.get(classType + '/' + encoding + '/');
@@ -103,7 +103,7 @@ public class CodecFactory {
        }

        if(cls != null) {
        	TciCDWrapperFactory.getTciCDInstance().logDebug(" ==> " + cls.getName());
            TERFactory.getInstance().logDebug(" ==> " + cls.getName());
            try {
                Constructor<? extends ICodec> ctor = cls.getConstructor(ctorParams);
                return ctor.newInstance(mainCodec);
@@ -113,12 +113,12 @@ public class CodecFactory {
            }
        }

        TciCDWrapperFactory.getTciCDInstance().logDebug(" ==> No codec found !");	  
        TERFactory.getInstance().logDebug(" ==> No codec found !");      
        return new Dummy(mainCodec);
    }

    public void setCodec(int classType, String encoding, String typeName, Class<? extends ICodec> codec) {
//        TciCDWrapper.getInstance().logDebug("setCodec: add " + classType + "/" + encoding + "/" + typeName + "/" + codec);
        //TERFactory.getInstance().logDebug("setCodec: add " + classType + "/" + encoding + "/" + typeName + "/" + codec);
        codecs.put(classType + '/' + encoding + '/' + typeName, codec);
    }