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));
}
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));
}
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);
}
use of org.glassfish.admingui.plugin.ConsolePluginService in project Payara by payara.
the class PluginHandlers method getPluginResources.
/**
* <p> This handler returns a
* <code>Map<String id, List<URL>></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));
}
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);
}
Aggregations