package org.apache.tomee;

import java.util.Collections;

import org.apache.catalina.core.StandardContext;
import org.apache.catalina.webresources.StandardRoot;
import org.apache.tomcat.vestige.launcher.webresources.VestigeJarResourceSet;

import fr.gaellalire.vestige.spi.resolver.VestigeJar;

public class VestigeTomEEController {

    public void setResources(StandardContext standardContext) {
        standardContext.setResources(new StandardRoot() {

            @Override
            public void processWebInfLib() {
                super.processWebInfLib();
                for (VestigeJar vestigeJar : webApp.vestigeWarDependencies) {
                    classResources.add(new VestigeJarResourceSet(this, "/WEB-INF/classes", vestigeJar, Collections.<VestigeJar> emptyList(), "/"));
                }
            }
        });
    }

}
