Package betsy.bpel.corebpel

Source Code of betsy.bpel.corebpel.CoreBPELEngineExtension

package betsy.bpel.corebpel;

import betsy.bpel.model.BPELProcess;
import betsy.bpel.engines.AbstractEngine;
import betsy.bpel.engines.EnginePackageBuilder;
import corebpel.CoreBPEL;

import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

public class CoreBPELEngineExtension {
    public static void extendEngine(AbstractEngine engine, final List<String> transformations) {

        List<String> element = transformations.stream().filter((t) -> !CoreBPEL.XSL_SHEETS.contains(t)).collect(Collectors.toList());
        if (!element.isEmpty()) {
            throw new IllegalArgumentException("Given transformations " + element + " are not a valid CoreBPEL transformations");
        }

        engine.setPackageBuilder(new EnginePackageBuilder() {
            @Override
            public void createFolderAndCopyProcessFilesToTarget(BPELProcess process) {
                super.createFolderAndCopyProcessFilesToTarget(process);
                CoreBPEL coreBPEL = new CoreBPEL(process.getTargetTmpPath(), process.getTargetProcessFilePath());

                try {
                    coreBPEL.toCoreBPEL(transformations);
                } catch (IOException | TransformerException e) {
                    throw new RuntimeException("Error during corebpel transformation", e);
                }
            }

        });
    }

}
TOP

Related Classes of betsy.bpel.corebpel.CoreBPELEngineExtension

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.