* @throws EMFUserError the EMF user error
*/
public byte[] applyTransformations(byte[] impArchive, String archiveName, String pathImpTmpFolder)
throws EMFUserError {
logger.debug("IN");
ConfigSingleton conf = ConfigSingleton.getInstance();
try {
decompressArchive(pathImpTmpFolder, archiveName, impArchive);
} catch (Exception e) {
logger.error( "Error while decompressing exported archive " , e);
}
String archiveNameWithoutExtension = archiveName.substring(0, archiveName.lastIndexOf('.'));
String currVersion = getCurrentVersion();
String expVersion = "";
try {
expVersion = getExportVersion(pathImpTmpFolder, archiveNameWithoutExtension);
} catch (Exception e) {
logger.error( "Error while getting version name of the exporting system " , e);
}
// erase tmp folder
File fileTmpDir = new File(pathImpTmpFolder);
GeneralUtilities.deleteContentDir(fileTmpDir);
// if the exported version is equal to the current the archive has not
// to be transformed
if (currVersion.trim().equalsIgnoreCase(expVersion.trim())) {
return impArchive;
}
// read transformer class from configuration
List transClassName = new ArrayList();
List transList = conf.getAttributeAsList("IMPORTEXPORT.TRANSFORMERS.TRANSFORM");
fillListTransClassName(transList, expVersion, transClassName);
// instance all transformer
Iterator iterTrans = transClassName.iterator();
while (iterTrans.hasNext()) {
String className = (String) iterTrans.next();