The integration-point elements in the console-config.xml file specify attributes for the user interface features that you choose to implement. The example file provides examples of most of the available kinds of integration points at this release. Your own add-on component can use some or all of them.
For complete details about the Administration Console user interface features, see the API documentation for Project Woodstock.
For each integration-point element, specify the following attributes.
An identifier for the integration point.
The ID of the integration point's parent.
The type of the integration point.
A numeric value that specifies the relative ordering of integration points for add-on components that specify the same parentId. A lower number specifies a higher priority (for example, 100 represents a higher priority than 400). The integration points for add-on components are always placed after those in the basic Administration Console. You might need to experiment to place the integration point where you want it. This attribute is optional.
The content for the integration point, typically a JavaServer Faces page. In the example, you can find the JavaServer Faces pages in the directory project/src/main/resources/.
The order in which these attributes are specified does not matter, and in the example console-config.xml file the order varies. To improve readability, this chapter uses the same order throughout.
The following topics are addressed here:
You can add a node to the navigation tree, either at the top level or under another node. To add a node, use an integration point of type org.glassfish.admingui:treeNode. Use the parentId attribute to specify where the new node should be placed. Any tree node, including those added by other add-on components, can be specified. Examples include the following:
At the top level
Under the Application Server node
Under the Applications node
Under the Web Applications node
Under the Resources node
Under the Configuration node
Under the Web Container node
Under the HTTP Service node
The webContainer and httpService nodes are available only if you installed the web container module for the Administration Console (the console-web-gui.jar OSGi bundle).
If you do not specify a parentId, the new content is added to the root of the integration point, in this case the top level node, tree.
For example, the following integration-point element uses a parentId of tree to place the new node at the top level.
<integration-point id="sampleNode" parentId="tree" type="org.glassfish.admingui:treeNode" priority="200" content="sampleNode.jsf" />
This example specifies the following values in addition to the parentId:
The id value, sampleNode, specifies the integration point ID.
The type value, org.glassfish.admingui:treeNode, specifies the integration point type as a tree node.
The priority value, 200, specifies the order of the node on the tree.
The content value, sampleNode.jsf, specifies the JavaServer Faces page that displays the node.
The example console-config.xml file provides other examples of tree nodes under the Resources and Configuration nodes.
A JavaServer Faces page for a tree node uses the JSFTemplating tag sun:treeNode. This tag provides all the capabilities of the Project Woodstock tag webuijsf:treeNode.
In the example, the sampleNode.jsf file has the following content:
<sun:treeNode id="treeNode1" text="SampleTop" url="/sample/page/testPage.jsf?name=SampleTop" target="main" imageURL="resource/sample/images/sample.png" > <sun:treeNode id="treeNodeBB" text="SampleBB" url="/sample/page/testPage.jsf?name=SampleBB" target="main" imageURL="resource/sample/images/sample.png" /> </sun:treeNode>
This file uses the sun:treenode tag to specify both a top-level tree node and another node nested beneath it. In your own JavaServer Faces pages, specify the attributes of this tag as follows:
A unique identifier for the tree node.
The node name that appears in the tree.
The location of the JavaServer Faces page that appears when you click the node. In the example, most of the integration points use a very simple JavaServer Faces page called testPage.jsf, which is in the src/main/resources/page/ directory. Specify the integration point id value as the root of the URL; in this case, it is sample (see Specifying the ID of an Add-On Component). The rest of the URL is relative to the src/main/resources/ directory, where sampleNode.jsf resides.
The url tag in this example passes a name parameter to the JavaServer Faces page.
The frame in which to display the JavaServer Faces page specified by the url tag. Normally, the value is main.
The location of a graphic to display next to the node name. In the example, the graphic is always sample.png, which is in the src/main/resources/images/ directory. The URL for the deployed images directory is relative to resource/idval/, where idval is the integration point id value (see Specifying the ID of an Add-On Component).
You can add a tab to an existing tab set, or you can create a tab set for your own page. One way to add a tab or tab set is to use an integration point of type org.glassfish.admingui:serverInstTab, which adds a tab to the tab set on the main Application Server page of the Administration Console. You can also create sub-tabs. Once again, the parentId element specifies where to place the tab or tab set.
In the example, the following integration-point element adds a new tab on the main Application Server page of the Administration Console:
<integration-point id="sampleTab" parentId="serverInstTabs" type="org.glassfish.admingui:serverInstTab" priority="500" content="sampleTab.jsf" />
This example specifies the following values:
The id value, sampleTab, specifies the integration point ID.
The parentId value, serverInstTabs, specifies the tab set associated with the server instance. The Application Server page is the only one of the default Administration Console pages that has a tab set.
The type value, org.glassfish.admingui:serverInstTab, specifies the integration point type as a tab associated with the server instance.
The priority value, 500, specifies the order of the tab within the tab set. This value is optional.
The content value, sampleTab.jsf, specifies the JavaServer Faces page that displays the tab.
The following integration-point elements add a new tab with two sub-tabs, also on the main Application Server page of the Administration Console:
<integration-point id="sampleTabWithSubTab" parentId="serverInstTabs" type="org.glassfish.admingui:serverInstTab" priority="300" content="sampleTabWithSubTab.jsf" /> <integration-point id="sampleSubTab1" parentId="sampleTabWithSubTab" type="org.glassfish.admingui:serverInstTab" priority="300" content="sampleSubTab1.jsf" /> <integration-point id="sampleSubTab2" parentId="sampleTabWithSubTab" type="org.glassfish.admingui:serverInstTab" priority="400" content="sampleSubTab2.jsf" />
These examples specify the following values:
The id values, sampleTabWithSubTab, sampleSubTab1, and sampleSubTab2, specify the integration point IDs for the tab and its sub-tabs.
The parentId of the new tab, serverInstTabs, specifies the tab set associated with the server instance. The parentId of the two sub-tabs, sampleTabWithSubTab, is the id value of this new tab.
The type value, org.glassfish.admingui:serverInstTab, specifies the integration point type for all the tabs as a tab associated with the server instance.
The priority values specify the order of the tabs within the tab set. This value is optional. In this case, the priority value for sampleTabWithSubTab is 300, which is higher than the value for sampleTab. That means that sampleTabWithSubTab appears to the left of sampleTab in the Administration Console. The priority values for sampleSubTab1 and sampleSubTab2 are 300 and 400 respectively, so sampleSubTab1 appears to the left of sampleSubTab2.
The content values, sampleTabWithSubTab.jsf, sampleSubTab1.jsf, and sampleSubTab2.jsf, specify the JavaServer Faces pages that display the tabs.
A JavaServer Faces page for a tab uses the JSFTemplating tag sun:tab. This tag provides all the capabilities of the Project Woodstock tag webuijsf:tab.
In the example, the sampleTab.jsf file has the following content:
<sun:tab id="sampleTab" immediate="true" text="Sample First Tab"> <!command setSessionAttribute(key="serverInstTabs" value="sampleTab"); redirect(page="#{request.contextPath}/page/ tabPage.jsf?name=Sample%20First%20Tab"); /> </sun:tab>
In the actual file there are no line breaks in the redirect value.
In your own JavaServer Faces pages, specify the attributes of this tag as follows:
A unique identifier for the tab, in this case sampleTab.
If set to true, event handling for this component should be handled immediately (in the Apply Request Values phase) rather than waiting until the Invoke Application phase.
The tab name that appears in the tab set.
The JSFTemplating page displays tab content differently from the way the page for a node displays node content. It invokes two handlers for the command event: setSessionAttribute and redirect. The redirect handler has the same effect for a tab that the url attribute has for a node. It invokes a simple JavaServer Faces page called tabPage.jsf, in the src/main/resources/page/ directory, passing the text “Sample First Tab” to the page in a name parameter.
The sampleSubTab1.jsf and sampleSubTab2.jsf files are almost identical to sampleTab.jsf. The most important difference is that each sets the session attribute serverInstTabs to the base name of the JavaServer Faces file that corresponds to that tab:
setSessionAttribute(key="serverInstTabs" value="sampleTab");
setSessionAttribute(key="serverInstTabs" value="sampleSubTab1");
setSessionAttribute(key="serverInstTabs" value="sampleSubTab2");
You can add either a single task or a group of tasks to the Common Tasks page of the Administration Console. To add a task or task group, use an integration point of type org.glassfish.admingui:commonTask. You can add a single task to either the Deployment task group or the Monitoring task group, but not to any other group.
See Adding a Task Group to the Common Tasks Page for information on adding a task group.
In the example console-config.xml file, the following integration-point element adds a task to the Deployment task group:
<integration-point id="sampleCommonTask" parentId="deployment" type="org.glassfish.admingui:commonTask" priority="200" content="sampleCommonTask.jsf" />
This example specifies the following values:
The id value, sampleCommonTask, specifies the integration point ID.
The parentId value, deployment, specifies that the task is to be placed in the Deployment task group.
Specify a value of monitoring to place the task in the Monitoring task group.
The type value, org.glassfish.admingui:commonTask, specifies the integration point type as a common task.
The priority value, 200, specifies the order of the task within the task group.
The content value, sampleCommonTask.jsf, specifies the JavaServer Faces page that displays the task.
A JavaServer Faces page for a task uses the JSFTemplating tag sun:commonTask. This tag provides all the capabilities of the Project Woodstock tag webuijsf:commonTask.
In the example, the sampleCommonTask.jsf file has the following content:
<sun:commonTask text="Sample Application Page" toolTip="Sample Application Page" infoLinkUrl="/com_sun_webui_jsf/help/ helpwindow.jsf?&windowTitle=Help+Window&helpFile=applications.html" onClick="admingui.nav.selectTreeNodeById('form:tree:deployment:ejb'); parent.location='#{facesContext.externalContext.requestContextPath}/sample/ page/testPage.jsf?name=Sample%20Application%20Page'; return false;"> </sun:commonTask>
In the actual file, there are no line breaks in the infoLinkUrl attribute or the parent.location code values.
This file uses the sun:commonTask tag to specify the task. In your own JavaServer Faces pages, specify the attributes of this tag as follows:
The task name that appears on the Common Tasks page.
The text that appears when a user places the mouse cursor over the task name.
The URL for the link that is displayed at the bottom of the task's information panel.
Scripting code that is to be executed when a user clicks the task name. The parent.location value on the next line is part of the onClick code.
You can add a new group of tasks to the Common Tasks page to display the most important tasks for your add-on component. To add a task group, use an integration point of type org.glassfish.admingui:commonTask.
In the example console-config.xml file, the following integration-point element adds a new task group to the Common Tasks page:
<integration-point id="sampleGroup" parentId="commonTasksSection" type="org.glassfish.admingui:commonTask" priority="500" content="sampleTaskGroup.jsf" />
This example specifies the following values:
The id value, sampleGroup, specifies the integration point ID.
The parentId value, commonTasksSection, specifies that the task group is to be placed on the Common Tasks page.
The type value, org.glassfish.admingui:commonTask, specifies the integration point type as a common task.
The priority value, 500, specifies the order of the task group on the Common Tasks page. The low value places it at the end of the page.
The content value, sampleTaskGroup.jsf, specifies the JavaServer Faces page that displays the task.
A JavaServer Faces page for a task group uses the JSFTemplating tag sun:commonTasksGroup. This tag provides all the capabilities of the Project Woodstock tag webuijsf:commonTasksGroup.
In the example, the sampleTaskGroup.jsf file has the following content:
<sun:commonTasksGroup title="My Own Sample Group"> <sun:commonTask text="Go To Sample Resource" toolTip="Go To Sample Resource" infoLinkUrl="/com_sun_webui_jsf/help/ helpwindow.jsf?&windowTitle=Help+Window&helpFile=jdbcconnectionpoolnew1.html" onClick="admingui.nav.selectTreeNodeById('form:tree:resources:treeNode1'); parent.location='#{facesContext.externalContext.requestContextPath}/sample/ page/testPage.jsf?name=name=Sample%20Resource%20Page'; return false;"> </sun:commonTask> <sun:commonTask text="Sample Configuration" toolTip="Go To Sample Configuration" infoLinkUrl="/com_sun_webui_jsf/help/ helpwindow.jsf?&windowTitle=Help+Window&helpFile=jdbcconnectionpoolnew1.html" onClick="admingui.nav.selectTreeNodeById( 'form:tree:configuration:sampleConfigNode'); parent.location='#{facesContext.externalContext.requestContextPath}/sample/ page/testPage.jsf?name=Sample%20Configuration%20Page'; return false;"> </sun:commonTask> </sun:commonTasksGroup>
In the actual file, there are no line breaks in the infoLinkUrl and parent.location attribute values.
This file uses the sun:commonTasksGroup tag to specify the task group, and two sun:commonTask tags to specify the tasks in the task group. The sun:commonTasksGroup tag has only one attribute, title, which specifies the name of the task group.
You can add content for your add-on component to an existing top-level page, such as the Configuration page or the Resources page. To add content to one of these pages, use an integration point of type org.glassfish.admingui:configuration or org.glassfish.admingui:resources.
In the example console-config.xml file, the following integration-point element adds new content to the top-level Resources page:
<integration-point id="sampleResourceLink" parentId="propSheetSection" type="org.glassfish.admingui:resources" priority="100" content="sampleResourceLink.jsf" />
This example specifies the following values:
The id value, sampleResourceLink, specifies the integration point ID.
The parentId value, propSheetSection, specifies that the content is to be a section of a property sheet on the page.
The type value, org.glassfish.admingui:resources, specifies the integration point type as the Resources page.
To add content to the Configuration page, specify the type value as org.glassfish.admingui:configuration.
The priority value, 100, specifies the order of the content on the Resources page. The high value places it at the top of the page.
The content value, sampleResourceLink.jsf, specifies the JavaServer Faces page that displays the new content on the Resources page.
Another integration-point element in the console-config.xml file places similar content on the Configuration page.
A JavaServer Faces page for page content often uses the JSFTemplating tag sun:property to specify a property on a property sheet. This tag provides all the capabilities of the Project Woodstock tag webuijsf:property.
In the example, the sampleResourceLink.jsf file has the following content:
<sun:property> <sun:hyperlink toolTip="Sample Resource" url="/sample/page/testPage.jsf?name=Sample%20Resource%20Page" > <sun:image url="/resource/sample/images/sample.png" /> <sun:staticText text="Sample Resource" /> </sun:hyperlink> </sun:property> <sun:property> <sun:hyperlink toolTip="Another" url="/sample/page/testPage.jsf?name=Another" > <sun:image url="/resource/sample/images/sample.png" /> <sun:staticText text="Another" /> </sun:hyperlink> </sun:property>
The file specifies two simple properties on the property sheet, one above the other. Each consists of a sun:hyperlink element (a link to a URL). Within each sun:hyperlink element is nested a sun:image element, specifying an image, and a sun:staticText element, specifying the text to be placed next to the image.
Each sun:hyperlink element uses a toolTip attribute and a url attribute. Each url attribute references the testPage.jsf file that is used elsewhere in the example, specifying different content for the name parameter.
You can use many other kinds of user interface elements within a sun:property element.
Your add-on component may require new configuration tasks. In addition to implementing commands that accomplish these tasks (see Chapter 4, Extending the asadmin Utility), you can provide property sheets that enable users to configure your component or to perform tasks such as creating and editing resources for it.
Most of the user interface features used in the example reference the file testPage.jsf or (for tabs) the file tabPage.jsf. Both files are in the src/main/resources/page/ directory. The testPage.jsf file looks like this:
<!composition template="/templates/propertySheetTemplate.tpl" pageTitle="TEST Sample Page Title" helpText="Shows you what my page looks like" > <!define name="properties"> <sun:property id="prop1" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="page Name:" > <sun:staticText text="$pageSession{pageName}" > <!beforeCreate getRequestValue(key="name" value=>$page{pageName}); /> </sun:staticText> </sun:property> </define> </composition>
The page uses the composition directive to specify that the page uses the propertySheetTemplate.tpl template and to specify a page title and inline help text. (See Property Sheet Template for more information about this template and more examples.) The page uses additional directives, events, and tags to specify its content.