If you want to report status for your component on the Component's Admin page, you'll need to do two things:
So, the sequence is roughly this:
Admin Console -> Component -> getStatus() -> (AsireObject) -> Admin Console -> Browser -> XSL Transform -> (HTML)
You can override the default getStatus() method in your component to display additional status on the administration page for your component.
The template for your status page should look like this:
public AspireObject getStatus() throws AspireException { // addDerivedStatus adds a tag into which your status will be stored AspireObject status = addDerivedStatus("myStatus", super.getStatus()); // The "status" variable is now "pushed" into the sub-element ("myStatus" in the example above). // This means that you can add new attributes and elements to the tag directly, for example: status.setAttribute("attA", "Attribute A"); // Adds an attribute to my status tag status.add("elementB", "Element B content"); // add a new element with content // Note: You can also use status.push() to add a new parent <tag> and then start adding children into that status.popAll(); return status; }
In order to test your new getStatus() code, do the following:
You should now see the XML status including the new tags that your getStatus() method added to your component.
It is this XML data which will be transformed into XHTML for display by the "status.xsl" transform (see below).
As an example, the getStatus() code above should return the following example XML (note the "<myStatus>" element below):
<status application="/aspire" component="/FeedOneExample/MyComponent" server="http://localhost:50505"> <component description="..." factoryName="aspire-my-component" implementation="com.searchtechnologies.aspire.Components.MyComponent" name="/FeedOneExample/MyComponent" subType="default"> <config/> <myStatus attA="Attribute A"> <<<<<<<<<<<NEW<<<<<<<<<<< <elementB>Element B content</elementB> </myStatus> </component> </status>
Every component has an XSL transform for displaying status, stored in:
In Eclipse:
Example
The headers and footers of the admin page will come from templates which are available from the Aspire Application, including things like "common.xsl", "component-manager.xsl", "utilities.js", etc.
In order to include your new status, you'll need to add XSLT commands to status.xsl to copy the data from your new XML tag (as reported by the component) into XHTML tags for presentation.
The XPath to your new status will be: /status/component/{new tag}
For example: /status/component/myStatus/@attA --> Get the contents of attribute A
Sample XSTL fragment
<p/> Test of getting attribute: <xslt:value-of select="/status/component/myStatus/@attA"/> <p/> Test of getting element: <xslt:value-of select="/status/component/myStatus/elementB"/>
And then, once you redeploy your component, your new status should appear on the admin page.
Example of how your code might look inside of status.xsl:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="/aspire/files/common.xsl"/> <xsl:import href="/aspire/files/component-manager.xsl"/> <xsl:output indent="yes" method="html" /> <xsl:template match="/"> <html> <script src="/aspire/files/js/JSON.js" /> <script src="/aspire/files/js/JSONError.js" /> <script src="/aspire/files/js/utilities.js" /> <head> <title>Fetch URL Stage Status - <xsl:value-of select="/status/component/@name"/></title> </head> <body> <xsl:call-template name="header"/> <table> <tr> <td> <img border="1"> <xsl:attribute name="src"><xsl:value-of select="concat(/status/@application,/status/@component)" />/files/images.jpeg</xsl:attribute> </img> </td> <td> <h2 style="margin-left:2em">Fetch URL Stage: <xsl:value-of select="/status/component/@name"/></h2> </td> </tr> </table> <p/> <xsl:variable name="component" select="/status/component"/> <xsl:variable name="compMgr" select="/status/component/componentManager"/> <!-- HERE HERE HERE HERE --> <p/> Test of getting attribute: <xslt:value-of select="/status/component/myStatus/@attA"/> <p/> Test of getting element: <xslt:value-of select="/status/component/myStatus/elementB"/> <p /> <hr width="50%" /> <xsl:call-template name="componentDetail"/> </body> </html> </xsl:template> </xsl:stylesheet>