@@ -0,0 +1,2193 @@
+package com.equalize.xpi.af.modules.util;%0A%0Aimport java.lang.reflect.Constructor;%0A%0Aimport com.equalize.xpi.af.modules.FormatConversionBean;%0Aimport com.sap.aii.af.lib.mp.module.ModuleException;%0Aimport com.sap.engine.interfaces.messaging.api.Message;%0Aimport com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;%0A%0Apublic class ConverterFactory %7B%0A%0A%09// Private constructor%0A%09private ConverterFactory() %7B%09%09%0A%09%7D%0A%0A%09public static ConverterFactory newInstance() %7B%0A%09%09return new ConverterFactory();%0A%09%7D%0A%0A%09public AbstractModuleConverter newConverter(Message msg, ParameterHelper param, AuditLogHelper audit, DynamicConfigurationHelper dyncfg) throws ModuleException %7B%0A%09%09String converterClassName = param.getMandatoryParameter(%22converterClass%22);%0A%09%09audit.addLog(AuditLogStatus.SUCCESS, %22Conversion using class: %22 + converterClassName);%0A%0A%09%09try %7B%0A%09%09%09// Dynamic loading and instantiation of converter class%0A%09%09%09Class%3C?%3E converterClass = loadClass(converterClassName, audit);%0A%09%09%09Constructor%3C?%3E constructor = converterClass.getConstructor(Message.class, ParameterHelper.class, AuditLogHelper.class, DynamicConfigurationHelper.class);%0A%09%09%09AbstractModuleConverter conv = (AbstractModuleConverter) constructor.newInstance(msg, param, audit, dyncfg);%0A%09%09%09return conv;%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09audit.addLog(AuditLogStatus.ERROR, %22Error initializing class: %22 + converterClassName);%0A%09%09%09throw new ModuleException(e.getMessage(), e);%0A%09%09%7D%0A%09%7D%0A%0A%09private Class%3C?%3E loadClass(String className, AuditLogHelper audit)throws ClassNotFoundException %7B%0A%09%09Class%3C?%3E klass = null;%0A%09%09ClassLoader classloader = null;%0A%09%09try %7B%0A%09%09%09classloader = Thread.currentThread().getContextClassLoader();%0A%09%09%09klass = Class.forName(className, true, classloader);%0A%09%09%09return klass;%0A%09%09%7D catch (ClassNotFoundException e) %7B%0A%09%09%09try %7B%0A%09%09%09%09audit.addLog(AuditLogStatus.WARNING, %22Switching to FormatConversionBean class loader%22);%0A%09%09%09%09classloader = FormatConversionBean.class.getClassLoader();%0A%09%09%09%09klass = Class.forName(className, true, classloader);%0A%09%09%09%09return klass;%0A%09%09%09%7D catch (ClassNotFoundException e2) %7B%0A%09%09%09%09audit.addLog(AuditLogStatus.WARNING, %22Switching to default class loader%22);%0A%09%09%09%09klass = Class.forName(className);%0A%09%09%09%09return klass;%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create ConverterFactory.java