Search in sources :

Example 1 with ConsoleConfig

use of org.glassfish.admingui.connector.ConsoleConfig in project Payara by payara.

the class ConsolePluginService method init.

/**
 *	<p> Initialize the available {@link IntegrationPoint}s.</p>
 */
protected synchronized void init() {
    if (initialized) {
        return;
    }
    initialized = true;
    // First find the parser
    if ((providers != null) && (providers.iterator().hasNext())) {
        // Get our parser...
        ConfigParser parser = new ConfigParser(habitat);
        URL url = null;
        String id = null;
        // Loop through the configs and add them all
        for (ConsoleProvider provider : providers) {
            // Read the contents from the URL
            url = provider.getConfiguration();
            if (url == null) {
                url = provider.getClass().getClassLoader().getResource(ConsoleProvider.DEFAULT_CONFIG_FILENAME);
            }
            if (url == null) {
                if (logger.isLoggable(Level.INFO)) {
                    logger.info("Unable to find " + ConsoleProvider.DEFAULT_CONFIG_FILENAME + " file for provider '" + provider.getClass().getName() + "'");
                }
                continue;
            }
            // System.out.println("Provider *"+provider+"* : url=*"+url+"*");
            DomDocument doc = parser.parse(url);
            // Get the New IntegrationPoints
            ConsoleConfig config = (ConsoleConfig) doc.getRoot().get();
            // Save the ClassLoader for later
            // System.out.println("Storing: " + config.getId() + " : " + provider.getClass().getClassLoader());
            id = config.getId();
            moduleClassLoaderMap.put(id, provider.getClass().getClassLoader());
            classLoaderModuleMap.put(provider.getClass().getClassLoader(), id);
            // Add the new IntegrationPoints
            addIntegrationPoints(config.getIntegrationPoints(), id);
        }
    }
    // Log some trace messages
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Console Plugin Service has been Initialized!");
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest(pointsByType.toString());
        }
    }
}
Also used : ConsoleConfig(org.glassfish.admingui.connector.ConsoleConfig) ConfigParser(org.jvnet.hk2.config.ConfigParser) ConsoleProvider(org.glassfish.api.admingui.ConsoleProvider) URL(java.net.URL) DomDocument(org.jvnet.hk2.config.DomDocument)

Aggregations

URL (java.net.URL)1 ConsoleConfig (org.glassfish.admingui.connector.ConsoleConfig)1 ConsoleProvider (org.glassfish.api.admingui.ConsoleProvider)1 ConfigParser (org.jvnet.hk2.config.ConfigParser)1 DomDocument (org.jvnet.hk2.config.DomDocument)1