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 to IntegrationPoints 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
    protected
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    calculateHelpUrl(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
     
    static void
    getAppEditIntegrationPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
     
    static void
    getContentOfIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
    Finds the integration point of the specified type.
    static String
    This function attempts to calculate a help path with the given locale and classloader.
    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.
    static void
    getIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
    This handler provides access to IntegrationPoints for the requested key.
    static List<org.glassfish.admingui.connector.IntegrationPoint>
    getIntegrationPoints(jakarta.faces.context.FacesContext context, String type)
     
    static void
    getPluginIdFromViewId(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
     
    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.
    static org.glassfish.admingui.plugin.ConsolePluginService
    getPluginService(jakarta.faces.context.FacesContext ctx)
    Find and return the ConsolePluginService.
    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.
    static void
    includeFirstIntegrationPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
    Includes the first IP based on priority for the given type.
    static void
    includeIntegrationPoint(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent parent, org.glassfish.admingui.connector.IntegrationPoint point)
    This method includes a single IntegrationPoint under the given parent UIComponent.
    static void
    includeIntegrationPoints(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent root, Set<org.glassfish.admingui.connector.IntegrationPoint> points)
     
    static void
    includeIntegrations(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
    This handler adds IntegrationPoints of a given type to a UIComponent tree.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PluginHandlers

      protected PluginHandlers()

      Constructor.

  • Method Details

    • getPluginService

      public static org.glassfish.admingui.plugin.ConsolePluginService getPluginService(jakarta.faces.context.FacesContext ctx)

      Find and return the ConsolePluginService. This method uses the HK2 Habitat to locate the ConsolePluginService.

      Parameters:
      ctx - The FacesContext.
    • 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. Each List in the Map is associated with a GUI Plugin, and the key to the Map is the plugin id.

      Parameters:
      handlerCtx - The HandlerContext.
    • 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 - The HandlerContext.
    • 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 a UIComponent tree. It looks for IntegrationPoints using the given type. It then sorts the results (if any) by parentId, and then by priority. It next interates over each one looking for a UIComponent with an id which matches the its own parentId value. It then uses the content of the IntegrationPoint to 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 IOException
      Includes 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 IOException
      Finds 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 a SortedSet of 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 the IntegrationPoints to include in the order in which you want to include them if that matters (i.e. use SortedSet).
    • 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 - The UIComponent in which to search for the parent.
      point - The IntegrationPoint which is looking for its parent UIComponent.
    • 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 IntegrationPoint under the given parent UIComponent.

      Parameters:
      ctx - The FacesContext.
      parent - The parent for the IntegrationPoint.
      point - The IntegrationPoint.
    • 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 compId parameter (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. If processPage is 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 parameter pluginPage to be output as-is on the page.

      Parameters:
      handlerCtx - The HandlerContext.
    • 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 null will be returned.