Search in sources :

Example 6 with StaticModulesRegistry

use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.

the class RemoteCLICommand method getManHabitat.

/**
 * Return a ServiceLocator used just for reading man pages from the modules
 * in the modules directory.
 */
private static synchronized ServiceLocator getManHabitat() {
    if (manServiceLocator != null)
        return manServiceLocator;
    ModulesRegistry registry = new StaticModulesRegistry(getModuleClassLoader());
    manServiceLocator = registry.createServiceLocator("default");
    return manServiceLocator;
}
Also used : ModulesRegistry(com.sun.enterprise.module.ModulesRegistry) StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry) StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry)

Example 7 with StaticModulesRegistry

use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.

the class RemoteCommand method getManHabitat.

/**
 * Return a ServiceLocator used just for reading man pages from the
 * modules in the modules directory.
 */
private static synchronized ServiceLocator getManHabitat() {
    if (manServiceLocator != null)
        return manServiceLocator;
    ModulesRegistry registry = new StaticModulesRegistry(getModuleClassLoader());
    ServiceLocator serviceLocator = registry.createServiceLocator("default");
    manServiceLocator = serviceLocator;
    return manServiceLocator;
}
Also used : ServiceLocator(org.glassfish.hk2.api.ServiceLocator) StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry) StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry)

Example 8 with StaticModulesRegistry

use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.

the class VerifyDomainXmlCommand method executeCommand.

/**
 */
@Override
protected int executeCommand() throws CommandException, CommandValidationException {
    File domainXMLFile = getDomainXml();
    logger.log(Level.FINER, "Domain XML file = {0}", domainXMLFile);
    try {
        // get the list of JAR files from the modules directory
        ArrayList<URL> urls = new ArrayList<URL>();
        File idir = new File(System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
        File mdir = new File(idir, "modules");
        for (File f : mdir.listFiles()) {
            if (f.toString().endsWith(".jar")) {
                urls.add(f.toURI().toURL());
            }
        }
        final URL[] urlsA = urls.toArray(new URL[urls.size()]);
        ClassLoader cl = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {

            @Override
            public Object run() {
                return new URLClassLoader(urlsA, Globals.class.getClassLoader());
            }
        });
        ModulesRegistry registry = new StaticModulesRegistry(cl);
        ServiceLocator serviceLocator = registry.createServiceLocator("default");
        ConfigParser parser = new ConfigParser(serviceLocator);
        URL domainURL = domainXMLFile.toURI().toURL();
        DomDocument doc = parser.parse(domainURL);
        Dom domDomain = doc.getRoot();
        Domain domain = domDomain.createProxy(Domain.class);
        DomainXmlVerifier validator = new DomainXmlVerifier(domain);
        if (validator.invokeConfigValidator())
            return 1;
    } catch (Exception e) {
        throw new CommandException(e);
    }
    return 0;
}
Also used : Dom(org.jvnet.hk2.config.Dom) ArrayList(java.util.ArrayList) ConfigParser(org.jvnet.hk2.config.ConfigParser) StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry) URL(java.net.URL) IOException(java.io.IOException) DomDocument(org.jvnet.hk2.config.DomDocument) ServiceLocator(org.glassfish.hk2.api.ServiceLocator) PrivilegedAction(java.security.PrivilegedAction) ModulesRegistry(com.sun.enterprise.module.ModulesRegistry) StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry) URLClassLoader(java.net.URLClassLoader) URLClassLoader(java.net.URLClassLoader) Domain(com.sun.enterprise.config.serverbeans.Domain) File(java.io.File)

Example 9 with StaticModulesRegistry

use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.

the class Globals method getStaticHabitat.

/**
 * Returns the default service locator. If it does not exist, one will be created.
 * @return
 */
public static ServiceLocator getStaticHabitat() {
    if (defaultHabitat == null) {
        synchronized (staticLock) {
            if (defaultHabitat == null) {
                ModulesRegistry modulesRegistry = new StaticModulesRegistry(Globals.class.getClassLoader());
                defaultHabitat = modulesRegistry.createServiceLocator("default");
            }
        }
    }
    return defaultHabitat;
}
Also used : StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry) ModulesRegistry(com.sun.enterprise.module.ModulesRegistry) StaticModulesRegistry(com.sun.enterprise.module.single.StaticModulesRegistry)

Aggregations

StaticModulesRegistry (com.sun.enterprise.module.single.StaticModulesRegistry)9 ModulesRegistry (com.sun.enterprise.module.ModulesRegistry)8 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)5 StartupContext (com.sun.enterprise.module.bootstrap.StartupContext)3 File (java.io.File)2 IOException (java.io.IOException)2 URLClassLoader (java.net.URLClassLoader)2 PrivilegedAction (java.security.PrivilegedAction)2 ProcessEnvironment (org.glassfish.api.admin.ProcessEnvironment)2 Domain (com.sun.enterprise.config.serverbeans.Domain)1 ClientNamingConfiguratorImpl (com.sun.enterprise.naming.impl.ClientNamingConfiguratorImpl)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 Logger (java.util.logging.Logger)1 ClientNamingConfigurator (org.glassfish.api.naming.ClientNamingConfigurator)1 DynamicConfiguration (org.glassfish.hk2.api.DynamicConfiguration)1 DynamicConfigurationService (org.glassfish.hk2.api.DynamicConfigurationService)1 ConfigParser (org.jvnet.hk2.config.ConfigParser)1 Dom (org.jvnet.hk2.config.Dom)1