Example usage for com.liferay.portal.kernel.util ServerDetector isTomcat

List of usage examples for com.liferay.portal.kernel.util ServerDetector isTomcat

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ServerDetector isTomcat.

Prototype

public static boolean isTomcat() 

Source Link

Usage

From source file:com.liferay.server.manager.internal.executor.ErrorLogExecutor.java

License:Open Source License

@Override
protected File getLogFile() {
    File logFile = null;//  w  w  w  .ja v a  2  s . c om

    if (ServerDetector.isGlassfish()) {
        File logDirectory = new File(System.getProperty("catalina.home"), "logs");

        logFile = new File(logDirectory, "server.log");
    } else if (ServerDetector.isJBoss()) {
        File logDirectory = new File(System.getProperty("jboss.server.log.dir"));

        logFile = new File(logDirectory, "boot.log");
    } else if (ServerDetector.isTomcat()) {
        logFile = new File(StringBundler.concat(System.getProperty("catalina.base"), "/logs/catalina.",
                getTomcatDateString(), ".log"));
    }

    return logFile;
}

From source file:com.liferay.server.manager.internal.executor.PluginExecutor.java

License:Open Source License

protected List<File> getInstalledDirectories(final String context) throws Exception {

    List<File> installedDirs = new ArrayList<>();

    String installedDirName = DeployManagerUtil.getInstalledDir();

    File installedDir = new File(installedDirName, context);

    if (installedDir.exists()) {
        installedDirs.add(installedDir);
    } else {/*from w  ww .  j  av a 2 s.co  m*/
        File deployWarDir = new File(installedDirName, context + ".war");

        installedDirs.add(deployWarDir);
    }

    if (ServerDetector.isTomcat()) {
        File tempDir = new File(SystemProperties.get(SystemProperties.TMP_DIR));

        File[] tempContextDirs = tempDir.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String name) {
                if (name.endsWith("-" + context)) {
                    return true;
                }

                return false;
            }

        });

        if (ArrayUtil.isNotEmpty(tempContextDirs)) {
            Arrays.sort(tempContextDirs, new Comparator<File>() {

                @Override
                public int compare(File file1, File file2) {
                    String fileName1 = file1.getName();
                    String fileName2 = file2.getName();

                    return fileName1.compareTo(fileName2);
                }

            });

            File tempContextDir = tempContextDirs[tempContextDirs.length - 1];

            installedDirs.add(tempContextDir);
        }
    }

    return installedDirs;
}

From source file:com.liferay.servermanager.executor.ErrorLogExecutor.java

License:Open Source License

@Override
protected File getLogFile() {
    File logFile = null;/*from   w  ww  .ja va 2s .  c  o m*/

    if (ServerDetector.isGlassfish()) {
        File logDirectory = new File(System.getProperty("catalina.home"), "logs");

        logFile = new File(logDirectory, "server.log");
    } else if (ServerDetector.isJBoss()) {
        File logDirectory = new File(System.getProperty("jboss.server.log.dir"));

        logFile = new File(logDirectory, "boot.log");
    } else if (ServerDetector.isTomcat()) {
        logFile = new File(
                System.getProperty("catalina.base") + "/logs/catalina." + getTomcatDateString() + ".log");
    }

    return logFile;
}

From source file:com.liferay.servermanager.executor.PluginExecutor.java

License:Open Source License

protected List<File> getInstalledDirectories(final String context) throws Exception {

    List<File> installedDirs = new ArrayList<File>();

    String installedDirName = DeployManagerUtil.getInstalledDir();

    File installedDir = new File(installedDirName, context);

    if (installedDir.exists()) {
        installedDirs.add(installedDir);
    } else {//  w w  w  .  j  a v  a 2s  .c o  m
        File deployWarDir = new File(installedDirName, context + ".war");

        installedDirs.add(deployWarDir);
    }

    if (ServerDetector.isTomcat()) {
        File tempDir = new File(SystemProperties.get(SystemProperties.TMP_DIR));

        File[] tempContextDirs = tempDir.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String name) {
                if (name.endsWith("-" + context)) {
                    return true;
                }

                return false;
            }

        });

        if (ArrayUtil.isNotEmpty(tempContextDirs)) {
            Arrays.sort(tempContextDirs, new Comparator<File>() {

                @Override
                public int compare(File file1, File file2) {
                    String fileName1 = file1.getName();
                    String fileName2 = file2.getName();

                    return fileName1.compareTo(fileName2);
                }

            });

            File tempContextDir = tempContextDirs[tempContextDirs.length - 1];

            installedDirs.add(tempContextDir);
        }
    }

    return installedDirs;
}