Class PluginHandlers
- java.lang.Object
-
- org.glassfish.admingui.common.handlers.PluginHandlers
-
public class PluginHandlers extends Object
This class will provide JSFTemplating
Handler
s that provide access toIntegrationPoint
s and possibily other information / services needed to provide plugin functionality i.e. getting resources, etc.).- Author:
- Ken Paulsen ([email protected])
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PluginHandlers()
Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods 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
getHelpPathForResource(String resource, Locale locale, ClassLoader cl)
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, IntegrationPoint point)
This method returns the parent for the content of the givenIntegrationPoint
.static void
getIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler provides access toIntegrationPoint
s for the requested key.static List<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 aMap<String id, List<URL>>
containing all the matches of the requested resource.static ConsolePluginService
getPluginService(jakarta.faces.context.FacesContext ctx)
Find and return theConsolePluginService
.static Set<IntegrationPoint>
getSortedIntegrationPoints(List<IntegrationPoint> points)
This method sorts the givenIntegrationPoint
'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, IntegrationPoint point)
This method includes a singleIntegrationPoint
under the given parentUIComponent
.static void
includeIntegrationPoints(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent root, Set<IntegrationPoint> points)
static void
includeIntegrations(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler addsIntegrationPoint
s of a given type to aUIComponent
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.
-
-
-
Method Detail
-
getPluginService
public static ConsolePluginService getPluginService(jakarta.faces.context.FacesContext ctx)
Find and return the
ConsolePluginService
. This method uses the HK2Habitat
to 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. EachList
in theMap
is associated with a GUI Plugin, and the key to theMap
is the plugin id.- Parameters:
handlerCtx
- TheHandlerContext
.
-
getIntegrationPoints
public static void getIntegrationPoints(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler provides access to
IntegrationPoint
s for the requested key.- Parameters:
handlerCtx
- TheHandlerContext
.
-
getIntegrationPoints
public static List<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
IntegrationPoint
s of a given type to aUIComponent
tree. It looks forIntegrationPoint
s using the giventype
. It then sorts the results (if any) byparentId
, and then by priority. It next interates over each one looking for aUIComponent
with anid
which matches the its ownparentId
value. It then uses the content of theIntegrationPoint
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<IntegrationPoint> getSortedIntegrationPoints(List<IntegrationPoint> points)
This method sorts the given
IntegrationPoint
's by parentId and then by priority. It returns aSortedSet
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<IntegrationPoint> points)
- Parameters:
points
- This parameter should be theIntegrationPoint
s 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, IntegrationPoint point)
This method returns the parent for the content of the given
IntegrationPoint
.- Parameters:
root
- TheUIComponent
in which to search for the parent.point
- TheIntegrationPoint
which is looking for its parentUIComponent
.
-
includeIntegrationPoint
public static void includeIntegrationPoint(jakarta.faces.context.FacesContext ctx, jakarta.faces.component.UIComponent parent, IntegrationPoint point)
This method includes a single
IntegrationPoint
under 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
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. IfprocessPage
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 parameterpluginPage
to 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
null
will be returned.
-
-