Search in sources :

Example 1 with INSTALL_ROOT_PROPERTY

use of com.sun.enterprise.util.SystemPropertyConstants.INSTALL_ROOT_PROPERTY in project Payara by payara.

the class CommonClassLoaderServiceImpl method findH2Client.

private List<File> findH2Client() {
    final String H2_HOME_PROP = "AS_H2_INSTALL";
    StartupContext startupContext = env.getStartupContext();
    Properties arguments = null;
    if (startupContext != null) {
        arguments = startupContext.getArguments();
    }
    String h2Home = null;
    if (arguments != null) {
        h2Home = arguments.getProperty(H2_HOME_PROP, System.getProperty(H2_HOME_PROP));
    }
    File h2Lib = null;
    if (h2Home != null) {
        h2Lib = new File(h2Home, "bin");
    } else if (env.isMicro() && arguments != null) {
        h2Home = arguments.getProperty(INSTALL_ROOT_PROPERTY, System.getProperty(INSTALL_ROOT_PROPERTY));
        h2Lib = new File(h2Home, "runtime");
    }
    if (h2Lib == null || !h2Lib.exists()) {
        logger.info(KernelLoggerInfo.cantFindH2);
        return Collections.EMPTY_LIST;
    }
    return Arrays.asList(h2Lib.listFiles((dir, name) -> name.startsWith("h2") && name.endsWith(".jar")));
}
Also used : Manifest(java.util.jar.Manifest) FilenameFilter(java.io.FilenameFilter) Arrays(java.util.Arrays) Properties(java.util.Properties) KernelLoggerInfo(org.glassfish.kernel.KernelLoggerInfo) MalformedURLException(java.net.MalformedURLException) URL(java.net.URL) INSTALL_ROOT_PROPERTY(com.sun.enterprise.util.SystemPropertyConstants.INSTALL_ROOT_PROPERTY) IOException(java.io.IOException) JarFile(java.util.jar.JarFile) Logger(java.util.logging.Logger) File(java.io.File) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) PostConstruct(org.glassfish.hk2.api.PostConstruct) Inject(javax.inject.Inject) List(java.util.List) Service(org.jvnet.hk2.annotations.Service) ServerEnvironment(org.glassfish.api.admin.ServerEnvironment) StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) SystemPropertyConstants(com.sun.enterprise.util.SystemPropertyConstants) CurrentBeforeParentClassLoader(com.sun.enterprise.loader.CurrentBeforeParentClassLoader) Collections(java.util.Collections) StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) Properties(java.util.Properties) JarFile(java.util.jar.JarFile) File(java.io.File)

Aggregations

CurrentBeforeParentClassLoader (com.sun.enterprise.loader.CurrentBeforeParentClassLoader)1 StartupContext (com.sun.enterprise.module.bootstrap.StartupContext)1 SystemPropertyConstants (com.sun.enterprise.util.SystemPropertyConstants)1 INSTALL_ROOT_PROPERTY (com.sun.enterprise.util.SystemPropertyConstants.INSTALL_ROOT_PROPERTY)1 File (java.io.File)1 FilenameFilter (java.io.FilenameFilter)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Properties (java.util.Properties)1 JarFile (java.util.jar.JarFile)1 Manifest (java.util.jar.Manifest)1 Level (java.util.logging.Level)1 Logger (java.util.logging.Logger)1 Inject (javax.inject.Inject)1 ServerEnvironment (org.glassfish.api.admin.ServerEnvironment)1