Class PluginHandlers
- java.lang.Object
-
- org.glassfish.admingui.common.handlers.PluginHandlers
-
public class PluginHandlers extends Object
This class will provide JSFTemplating
Handlers that provide access toIntegrationPoints and possibily other information / services needed to provide plugin functionality i.e. getting resources, etc.).- Author:
- Ken Paulsen (ken.paulsen@sun.com)
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPluginHandlers()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcalculateHelpUrl(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)static voidgetAppEditIntegrationPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)static voidgetContentOfIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)Finds the integration point of the specified type.static StringgetHelpPathForResource(String resource, Locale locale, ClassLoader cl)This function attempts to calculate a help path with the given locale and classloader.static jakarta.faces.component.UIComponentgetIntegrationPointParent(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent root, org.glassfish.admingui.connector.IntegrationPoint point)This method returns the parent for the content of the givenIntegrationPoint.static voidgetIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)This handler provides access toIntegrationPoints for the requested key.static List<org.glassfish.admingui.connector.IntegrationPoint>getIntegrationPoints(jakarta.faces.context.FacesContext context, String type)static voidgetPluginIdFromViewId(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)static voidgetPluginResources(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)This handler returns aMap<String id, List<URL>>containing all the matches of the requested resource.static org.glassfish.admingui.plugin.ConsolePluginServicegetPluginService(jakarta.faces.context.FacesContext ctx)Find and return theConsolePluginService.static Set<org.glassfish.admingui.connector.IntegrationPoint>getSortedIntegrationPoints(List<org.glassfish.admingui.connector.IntegrationPoint> points)This method sorts the givenIntegrationPoint's by parentId and then by priority.static voidincludeFirstIntegrationPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)Includes the first IP based on priority for the given type.static voidincludeIntegrationPoint(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent parent, org.glassfish.admingui.connector.IntegrationPoint point)This method includes a singleIntegrationPointunder the given parentUIComponent.static voidincludeIntegrationPoints(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent root, Set<org.glassfish.admingui.connector.IntegrationPoint> points)static voidincludeIntegrations(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)This handler addsIntegrationPoints of a given type to aUIComponenttree.static voidretrievePluginPageContents(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)This handler is used for the navigation nodes that request content from an external URL.
-
-
-
Method Detail
-
getPluginService
public static org.glassfish.admingui.plugin.ConsolePluginService getPluginService(jakarta.faces.context.FacesContext ctx)
Find and return the
ConsolePluginService. This method uses the HK2Habitatto locate theConsolePluginService.- Parameters:
ctx- TheFacesContext.
-
getPluginResources
public static void getPluginResources(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler returns a
Map<String id, List<URL>>containing all the matches of the requested resource. EachListin theMapis associated with a GUI Plugin, and the key to theMapis the plugin id.- Parameters:
handlerCtx- TheHandlerContext.
-
getIntegrationPoints
public static void getIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler provides access to
IntegrationPoints for the requested key.- Parameters:
handlerCtx- TheHandlerContext.
-
getIntegrationPoints
public static List<org.glassfish.admingui.connector.IntegrationPoint> getIntegrationPoints(jakarta.faces.context.FacesContext context, String type)
-
includeIntegrations
public static void includeIntegrations(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler adds
IntegrationPoints of a given type to aUIComponenttree. It looks forIntegrationPoints using the giventype. It then sorts the results (if any) byparentId, and then by priority. It next interates over each one looking for aUIComponentwith anidwhich matches the its ownparentIdvalue. It then uses the content of theIntegrationPointto attempt to include the .jsf page it refers to under the identified parent component.
-
includeFirstIntegrationPoint
public static void includeFirstIntegrationPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) throws IOExceptionIncludes the first IP based on priority for the given type. It adds the content to the given UIComponent root. If the IP content looks like a URL (contains ://), a StaticText component will be added with the value of the content from the URL.- Throws:
IOException
-
getContentOfIntegrationPoints
public static void getContentOfIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) throws IOExceptionFinds the integration point of the specified type. Returns the contents of this IP type as a list. The content can be a comma separated String. This is useful for the case such as dropdown or list box to allow additional options in the component.- Throws:
IOException
-
getAppEditIntegrationPoint
public static void getAppEditIntegrationPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) throws IOException- Throws:
IOException
-
getSortedIntegrationPoints
public static Set<org.glassfish.admingui.connector.IntegrationPoint> getSortedIntegrationPoints(List<org.glassfish.admingui.connector.IntegrationPoint> points)
This method sorts the given
IntegrationPoint's by parentId and then by priority. It returns aSortedSetof the results with the ABC order parentId. When parentId's match, the highest piority will appear first.
-
includeIntegrationPoints
public static void includeIntegrationPoints(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent root, Set<org.glassfish.admingui.connector.IntegrationPoint> points)- Parameters:
points- This parameter should be theIntegrationPoints to include in the order in which you want to include them if that matters (i.e. useSortedSet).
-
getIntegrationPointParent
public static jakarta.faces.component.UIComponent getIntegrationPointParent(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent root, org.glassfish.admingui.connector.IntegrationPoint point)This method returns the parent for the content of the given
IntegrationPoint.- Parameters:
root- TheUIComponentin which to search for the parent.point- TheIntegrationPointwhich is looking for its parentUIComponent.
-
includeIntegrationPoint
public static void includeIntegrationPoint(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent parent, org.glassfish.admingui.connector.IntegrationPoint point)This method includes a single
IntegrationPointunder the given parentUIComponent.- Parameters:
ctx- TheFacesContext.parent- The parent for theIntegrationPoint.point- TheIntegrationPoint.
-
retrievePluginPageContents
public static void retrievePluginPageContents(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler is used for the navigation nodes that request content from an external URL. This handler pulls the "real url" from from the component specified by the
compIdparameter (this necessarily depends on the presence of the navigation container in the view for the component look up to work). Once the component has been found, the url is retrieved from the attribute map, and its contents retrieved. IfprocessPageis true, the URL contents are interpretted and the resulting component(s) are added to the component tree (This feature is not currently supported).. Otherwise, the contents are returned in the output parameterpluginPageto be output as-is on the page.- Parameters:
handlerCtx- TheHandlerContext.
-
getPluginIdFromViewId
public static void getPluginIdFromViewId(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
-
calculateHelpUrl
public static void calculateHelpUrl(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
-
getHelpPathForResource
public static String getHelpPathForResource(String resource, Locale locale, ClassLoader cl)
This function attempts to calculate a help path with the given locale and classloader. It only succeeds if it is able to confirm a file exists at the generated path as determined by
ClassLoader.getResource(path). The paths checked are the following in this order:/locale.toString()/help/<resource>/locale.getLanguage()_locale.getCountry()/help/<resource>/locale.getLanguage()/help/<resource>
If all of those fail to yield a file in the classpath, then
nullwill be returned.
-
-