Search in sources :

Example 11 with StartupContext

use of com.sun.enterprise.module.bootstrap.StartupContext in project Payara by payara.

the class CommonClassLoaderServiceImpl method findDerbyClient.

private List<File> findDerbyClient() {
    final String DERBY_HOME_PROP = "AS_DERBY_INSTALL";
    StartupContext startupContext = env.getStartupContext();
    Properties arguments = null;
    if (startupContext != null) {
        arguments = startupContext.getArguments();
    }
    String derbyHome = null;
    if (arguments != null) {
        derbyHome = arguments.getProperty(DERBY_HOME_PROP, System.getProperty(DERBY_HOME_PROP));
    }
    File derbyLib = null;
    if (derbyHome != null) {
        derbyLib = new File(derbyHome, "lib");
    }
    if (derbyLib == null || !derbyLib.exists()) {
        // maybe the jdk...
        if (System.getProperty("java.version").compareTo("1.6") > 0) {
            File jdkHome = new File(System.getProperty("java.home"));
            derbyLib = new File(jdkHome, "../db/lib");
        }
    }
    if (!derbyLib.exists()) {
        logger.info(KernelLoggerInfo.cantFindDerby);
        return Collections.EMPTY_LIST;
    }
    return Arrays.asList(derbyLib.listFiles(new FilenameFilter() {

        @Override
        public boolean accept(File dir, String name) {
            // already mentioned in the Class-Path header of the main jars
            return (name.endsWith(".jar") && !name.startsWith("derbyLocale_"));
        }
    }));
}
Also used : FilenameFilter(java.io.FilenameFilter) StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) Properties(java.util.Properties) JarFile(java.util.jar.JarFile) File(java.io.File)

Example 12 with StartupContext

use of com.sun.enterprise.module.bootstrap.StartupContext 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)

Example 13 with StartupContext

use of com.sun.enterprise.module.bootstrap.StartupContext in project Payara by payara.

the class ModuleConfigurationLoader method addConfigBeanFor.

protected <U extends ConfigBeanProxy> void addConfigBeanFor(Class<U> extensionType) {
    if (!RankedConfigBeanProxy.class.isAssignableFrom(extensionType)) {
        if (getExtension(extensionType, extensionOwner) != null) {
            return;
        }
    }
    StartupContext context = serviceLocator.getService(StartupContext.class);
    List<ConfigBeanDefaultValue> configBeanDefaultValueList = configModularityUtils.getDefaultConfigurations(extensionType, configModularityUtils.getRuntimeTypePrefix(context));
    configurationParser.parseAndSetConfigBean(configBeanDefaultValueList);
}
Also used : StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) ConfigBeanDefaultValue(com.sun.enterprise.config.modularity.customization.ConfigBeanDefaultValue) RankedConfigBeanProxy(com.sun.enterprise.config.modularity.RankedConfigBeanProxy)

Aggregations

StartupContext (com.sun.enterprise.module.bootstrap.StartupContext)13 ModulesRegistry (com.sun.enterprise.module.ModulesRegistry)6 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)6 ModuleStartup (com.sun.enterprise.module.bootstrap.ModuleStartup)3 StaticModulesRegistry (com.sun.enterprise.module.single.StaticModulesRegistry)3 File (java.io.File)3 Properties (java.util.Properties)3 DynamicConfiguration (org.glassfish.hk2.api.DynamicConfiguration)3 DynamicConfigurationService (org.glassfish.hk2.api.DynamicConfigurationService)3 SingleModulesRegistry (com.sun.enterprise.module.single.SingleModulesRegistry)2 FilenameFilter (java.io.FilenameFilter)2 JarFile (java.util.jar.JarFile)2 Logger (java.util.logging.Logger)2 ProcessEnvironment (org.glassfish.api.admin.ProcessEnvironment)2 GlassFishException (org.glassfish.embeddable.GlassFishException)2 Version (com.sun.appserv.server.util.Version)1 RankedConfigBeanProxy (com.sun.enterprise.config.modularity.RankedConfigBeanProxy)1 ConfigBeanDefaultValue (com.sun.enterprise.config.modularity.customization.ConfigBeanDefaultValue)1 Domain (com.sun.enterprise.config.serverbeans.Domain)1 EmbeddedInhabitantsParser (com.sun.enterprise.glassfish.bootstrap.EmbeddedInhabitantsParser)1