Package org.apache.tomee.catalina

Examples of org.apache.tomee.catalina.TomcatWebAppBuilder$ContextInfo


import javax.servlet.ServletContext;

// mainly to avoid classloading issue since TomcatWebAppBuilder is added on the fly to tomcat classloader
public final class Deployer {
    public static void deploy(final ServletContext ctx) {
        final TomcatWebAppBuilder builder = SystemInstance.get().getComponent(TomcatWebAppBuilder.class);
        builder.configureStart(StandardContext.class.cast(Reflections.get(Reflections.get(ctx, "context"), "context")));
    }
View Full Code Here


public class TomcatWebappDeployer implements WebAppDeployer {
    private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, TomcatWebappDeployer.class);

    @Override
    public AppInfo deploy(final String host, final String context, final File file) {
        final TomcatWebAppBuilder tomcatWebAppBuilder = (TomcatWebAppBuilder) SystemInstance.get().getComponent(WebAppBuilder.class);

        final Collection<String> alreadyDeployed = tomcatWebAppBuilder.availableApps();

        try {
            tomcatWebAppBuilder.deployWebApps(fakeInfo(file, host, context), null); // classloader == null -> standalone war
        } catch (final Exception e) {
            throw new OpenEJBRuntimeException(e);
        }

        TomcatWebAppBuilder.ContextInfo info = contextInfo(file);

        if (info == null) { // try another time doing a diff with apps before deployment and apps after
            final Collection<String> deployedNow = tomcatWebAppBuilder.availableApps();
            final Iterator<String> it = deployedNow.iterator();
            while (it.hasNext()) {
                if (alreadyDeployed.contains(it.next())) {
                    it.remove();
                }
            }

            if (deployedNow.size() == 1) {
                info = contextInfo(new File(deployedNow.iterator().next()));
            }
        }

        if (info == null || info.appInfo == null) {
            LOGGER.error("Can't find of appInfo for " + (file != null ? file.getAbsolutePath() : null) + ", availables: " + tomcatWebAppBuilder.availableApps());
        }

        if (info == null) { // error
            return null;
        }
View Full Code Here

            }
        }
    }

    private TomcatWebAppBuilder.ContextInfo contextInfo(final File file) {
        final TomcatWebAppBuilder tomcatWebAppBuilder = (TomcatWebAppBuilder) SystemInstance.get().getComponent(WebAppBuilder.class);
        return tomcatWebAppBuilder.standaAloneWebAppInfo(file);
    }
View Full Code Here

public class TomcatWebappDeployer implements WebAppDeployer {
    private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, TomcatWebappDeployer.class);

    @Override
    public AppInfo deploy(final String host, final String context, final File file) {
        final TomcatWebAppBuilder tomcatWebAppBuilder = (TomcatWebAppBuilder) SystemInstance.get().getComponent(WebAppBuilder.class);

        final Collection<String> alreadyDeployed = tomcatWebAppBuilder.availableApps();

        try {
            tomcatWebAppBuilder.deployWebApps(fakeInfo(file, host, context), null); // classloader == null -> standalone war
        } catch (final Exception e) {
            throw new OpenEJBRuntimeException(e);
        }

        TomcatWebAppBuilder.ContextInfo info = contextInfo(file);

        if (info == null) { // try another time doing a diff with apps before deployment and apps after
            final Collection<String> deployedNow = tomcatWebAppBuilder.availableApps();
            final Iterator<String> it = deployedNow.iterator();
            while (it.hasNext()) {
                if (alreadyDeployed.contains(it.next())) {
                    it.remove();
                }
            }

            if (deployedNow.size() == 1) {
                info = contextInfo(new File(deployedNow.iterator().next()));
            }
        }

        if (info == null || info.appInfo == null) {
            LOGGER.error("Can't find of appInfo for " + (file != null ? file.getAbsolutePath() : null) + ", availables: " + tomcatWebAppBuilder.availableApps());
        }

        if (info == null) { // error
            return null;
        }
View Full Code Here

            }
        }
    }

    private TomcatWebAppBuilder.ContextInfo contextInfo(final File file) {
        final TomcatWebAppBuilder tomcatWebAppBuilder = (TomcatWebAppBuilder) SystemInstance.get().getComponent(WebAppBuilder.class);
        return tomcatWebAppBuilder.standaAloneWebAppInfo(file);
    }
View Full Code Here

public class TomcatWebappDeployer implements WebAppDeployer {
    private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, TomcatWebappDeployer.class);

    @Override
    public AppInfo deploy(final String context, final File file) {
        final TomcatWebAppBuilder tomcatWebAppBuilder = (TomcatWebAppBuilder) SystemInstance.get().getComponent(WebAppBuilder.class);

        final Collection<String> alreadyDeployed = tomcatWebAppBuilder.availableApps();

        try {
            tomcatWebAppBuilder.deployWebApps(fakeInfo(file, context), null); // classloader == null -> standalone war
        } catch (Exception e) {
            throw new OpenEJBRuntimeException(e);
        }

        TomcatWebAppBuilder.ContextInfo info = contextInfo(file);

        if (info == null) { // try another time doing a diff with apps before deployment and apps after
            final Collection<String> deployedNow = tomcatWebAppBuilder.availableApps();
            final Iterator<String> it = deployedNow.iterator();
            while (it.hasNext()) {
                if (alreadyDeployed.contains(it.next())) {
                    it.remove();
                }
            }

            if (deployedNow.size() == 1) {
                info = contextInfo(new File(deployedNow.iterator().next()));
            }
        }

        if (info == null || info.appInfo == null) {
            LOGGER.error("Can't find of appInfo for " + (file != null ? file.getAbsolutePath() : null) + ", availables: " + tomcatWebAppBuilder.availableApps());
        }

        if (info == null) { // error
            return null;
        }
View Full Code Here

            }
        }
    }

    private TomcatWebAppBuilder.ContextInfo contextInfo(final File file) {
        final TomcatWebAppBuilder tomcatWebAppBuilder = (TomcatWebAppBuilder) SystemInstance.get().getComponent(WebAppBuilder.class);
        return tomcatWebAppBuilder.standaAloneWebAppInfo(file);
    }
View Full Code Here

TOP

Related Classes of org.apache.tomee.catalina.TomcatWebAppBuilder$ContextInfo

Copyright © 2018 www.massapicom. 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.