Search in sources :

Example 1 with ConsolePluginService

use of org.glassfish.admingui.plugin.ConsolePluginService in project Payara by payara.

the class HelpHandlers method getHelpTOC.

/**
 *	<p> This handler provides access to {@link IntegrationPoint}s for the
 *	    requested key.</p>
 *
 *	@param	handlerCtx	The <code>HandlerContext</code>.
 */
@Handler(id = "getHelpTOC", input = { @HandlerInput(name = "locale", type = Locale.class) }, output = { @HandlerOutput(name = "toc", type = TOC.class) })
public static void getHelpTOC(HandlerContext handlerCtx) {
    // Get the desired Locale and the ConsolePluginService...
    Locale locale = (Locale) handlerCtx.getInputValue("locale");
    ConsolePluginService cps = PluginHandlers.getPluginService(handlerCtx.getFacesContext());
    // Determine the correct locale for the path...
    String localePath = getHelpLocalePath(locale, cps);
    handlerCtx.setOutputValue("toc", cps.getHelpTOC(localePath));
}
Also used : Locale(java.util.Locale) ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) Handler(com.sun.jsftemplating.annotation.Handler)

Example 2 with ConsolePluginService

use of org.glassfish.admingui.plugin.ConsolePluginService in project Payara by payara.

the class HelpHandlers method getHelpIndex.

/**
 *	<p> This handler provides access to {@link IntegrationPoint}s for the
 *	    requested key.</p>
 *
 *	@param	handlerCtx	The <code>HandlerContext</code>.
 */
@Handler(id = "getHelpIndex", input = { @HandlerInput(name = "locale", type = Locale.class) }, output = { @HandlerOutput(name = "index", type = Index.class) })
public static void getHelpIndex(HandlerContext handlerCtx) {
    // Get the desired Locale and the ConsolePluginService...
    Locale locale = (Locale) handlerCtx.getInputValue("locale");
    ConsolePluginService cps = PluginHandlers.getPluginService(handlerCtx.getFacesContext());
    // Determine the correct locale for the path...
    String localePath = getHelpLocalePath(locale, cps);
    handlerCtx.setOutputValue("index", cps.getHelpIndex(localePath));
}
Also used : Locale(java.util.Locale) ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) Handler(com.sun.jsftemplating.annotation.Handler)

Example 3 with ConsolePluginService

use of org.glassfish.admingui.plugin.ConsolePluginService in project Payara by payara.

the class ConsoleClassLoader method findModuleClassLoader.

/**
 *	<p> This method find the <code>ClassLoader</code> associated with the
 *	    named module.</p>
 */
public static ClassLoader findModuleClassLoader(String moduleName) {
    // System.out.println("Find module ClassLoader: " + moduleName);
    // Get the ServletContext
    ServletContext servletCtx = (ServletContext) (FacesContext.getCurrentInstance().getExternalContext()).getContext();
    // Get the Habitat from the ServletContext
    ServiceLocator habitat = (ServiceLocator) servletCtx.getAttribute(HABITAT_ATTRIBUTE);
    // correct ClassLoader for the requested module (or null)
    return habitat.<ConsolePluginService>getService(ConsolePluginService.class).getModuleClassLoader(moduleName);
}
Also used : ServiceLocator(org.glassfish.hk2.api.ServiceLocator) ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) ServletContext(javax.servlet.ServletContext)

Example 4 with ConsolePluginService

use of org.glassfish.admingui.plugin.ConsolePluginService in project Payara by payara.

the class PluginHandlers method getPluginResources.

/**
 *	<p> This handler returns a
 *	    <code>Map&lt;String id, List&lt;URL&gt;&gt;</code> containing all
 *	    the matches of the requested resource.  Each <code>List</code> in
 *	    the <code>Map</code> is associated with a GUI Plugin, and the key
 *	    to the <code>Map</code> is the plugin id.</p>
 *
 *	@param	handlerCtx	The <code>HandlerContext</code>.
 */
@Handler(id = "getPluginResources", input = { @HandlerInput(name = "name", type = String.class, required = true) }, output = { @HandlerOutput(name = "resources", type = Map.class) })
public static void getPluginResources(HandlerContext handlerCtx) {
    String name = (String) handlerCtx.getInputValue("name");
    ConsolePluginService cps = getPluginService(handlerCtx.getFacesContext());
    handlerCtx.setOutputValue("resources", cps.getResources(name));
}
Also used : ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) Handler(com.sun.jsftemplating.annotation.Handler) LayoutViewHandler(com.sun.jsftemplating.layout.LayoutViewHandler)

Example 5 with ConsolePluginService

use of org.glassfish.admingui.plugin.ConsolePluginService in project Payara by payara.

the class PluginHandlers method getPluginIdFromViewId.

@Handler(id = "getPluginIdFromViewId", input = { @HandlerInput(name = "viewId", type = String.class, required = true) }, output = { @HandlerOutput(name = "pluginId", type = String.class) })
public static void getPluginIdFromViewId(HandlerContext handlerCtx) {
    String viewId = (String) handlerCtx.getInputValue("viewId");
    if (viewId == null) {
        return;
    }
    ConsolePluginService cps = getPluginService(handlerCtx.getFacesContext());
    String pluginId = "common";
    int next = viewId.indexOf("/", 1);
    if (next > -1) {
        pluginId = viewId.substring(0, next);
        String resource = viewId.substring(next);
        if (pluginId.startsWith("/")) {
            pluginId = pluginId.substring(1);
        }
        ClassLoader cl = cps.getModuleClassLoader(pluginId);
        URL url = null;
        if (cl != null) {
            url = cl.getResource(resource);
        }
        if (url == null) {
            pluginId = "common";
        }
    }
    handlerCtx.setOutputValue("pluginId", pluginId);
}
Also used : ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) IntegrationPoint(org.glassfish.admingui.connector.IntegrationPoint) URL(java.net.URL) Handler(com.sun.jsftemplating.annotation.Handler) LayoutViewHandler(com.sun.jsftemplating.layout.LayoutViewHandler)

Aggregations

ConsolePluginService (org.glassfish.admingui.plugin.ConsolePluginService)6 Handler (com.sun.jsftemplating.annotation.Handler)5 LayoutViewHandler (com.sun.jsftemplating.layout.LayoutViewHandler)3 Locale (java.util.Locale)2 URL (java.net.URL)1 ServletContext (javax.servlet.ServletContext)1 IntegrationPoint (org.glassfish.admingui.connector.IntegrationPoint)1 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)1