[JBoss JIRA] Commented: (JBAS-2595) JMX Resolver for JSF
by Stan Silvert (JIRA)
[ http://jira.jboss.com/jira/browse/JBAS-2595?page=comments#action_12345395 ]
Stan Silvert commented on JBAS-2595:
------------------------------------
I've made a lot of progress on this in past couple of months. The EL Resolver allows you to easily manage an entire cluster with a few simple JSP pages. Instead of hunting for the attributes and operations you are looking for in the jmx-console, you just define your own pages with the attributes and operations you are interested in. Plus, you get cluster views and the power of JSF components for free. Here are all the features implemented so far:
MAPPING
Mapping ObjectName to the EL can be done in the following ways:
Use the JMX Resolver's "ObjectName" implicit object (reserved word):
${ObjectName['java.lang:type=Runtime'].StartTime}
Place an ObjectName object in some scope that the EL can see:
<% session.setAttribute("runtime", new ObjectName("java.lang:type=Runtime")); %>
${runtime.StartTime}
Define an ObjectName alias in web.xml with a "jmx." prefix:
<context-param>
<param-name>jmx.runtime</param-name>
<param-value>java.lang:type=Runtime</param-value>
</context-param>
${runtime.StartTime}
USAGE
The EL Resolver can be used with JSF, Facelets, JSTL, or any other taglib that supports Unified EL:
<h:outputText value="#{ObjectName['java.lang:type=Runtime'].StartTime}"><f:convertDateTime type="both" timeStyle="short"/></h:outputText>
<c:set var"serverStartTime" value="${ObjectName['java.lang:type=Runtime'].StartTime" scope="application" />
The EL Resolver can set attributes on MBeans just like any other JavaBean:
<h:inputText value="#{defaultDS.MaxSize}" converter="javax.faces.Integer" />
The EL Resolver can invoke MBean operations. This allows them to be used as the target of JSF actions. You just need to add "invoke" onto the end of the expression. Currently, this only supports no-arg operations:
<h:commandButton value="Run GC" action="#{ObjectName['jboss.system:type=Server'].runGarbageCollector.invoke}"/>
If the proper interface is implemented, an MBean can act as a JSF ActionListener, ValueChangeListener, or Validator. Note that because the interface is well-known, the "invoke" is not used on the actionListener. Only the method name defined in the interface is used. JSF will pass the needed params to the invocation, which will take place on the MBean:
<h:commandButton value="Submit" action="#{myMBeanAlias.fooAction.invoke}">
<f:actionListener binding="#{myMBeanActionListenerAlias.processAction}" />
</h:commandButton>
MBEAN QUERY SUPPORT
You can use the EL Resolver's "QueryNames" implicit object to do a JMX queryNames() and then loop through the results. Currently, this only supports queries based on ObjectName matching. Later, it may include full JMX query support using Query objects. For instance to loop through all the WebModule MBeans you would use #{QueryNames['jboss.web:j2eeType=WebModule,*']} like this:
<font size="18">Web Deployments</font>
<table border="1">
<tr><th>Path</th><th>Start Time</th><th>Max Active</th><th>Start/Stop</th><th>Reload</th></tr>
<c:forEach var="webapp" items="#{QueryNames['jboss.web:j2eeType=WebModule,*']}">
<tr>
<td><h:outputText value="#{webapp.path}" rendered="#{webapp.path != ''}"/>
<h:outputText value="/" rendered="#{webapp.path == ''}" /></td>
<td><h:outputText value="#{webapp.startTime}" rendered="#{webapp.startTime > 0}"><f:convertDateTime type="both" timeStyle="short"/></h:outputText>
<h:outputText value="Stopped" rendered="#{webapp.startTime == 0}" /></td>
<td><h:commandButton value="Start" action="#{webapp.start.invoke}" rendered="${webapp.state == 0}"/>
<h:commandButton value="Stop" action="#{webapp.stop.invoke}" rendered="${webapp.state == 1}"/></td>
<td><h:commandButton value="Reload" action="#{webapp.reload.invoke}" /></td>
</tr>
</c:forEach>
</table>
CLUSTER SUPPORT
The EL Resolver contains support for JBoss Cluster. It does automatic discovery and uses JMX Remoting to call MBeans on remote nodes. The EL Resolver listens for cluster events to keep the reachable remote MBean servers up to date. To access the nodes, you loop through the cluster using the "allNodes" implicit object:
<font size="18">Server Statistics</font>
<table border="1">
<tr><th>Server</th><th>Start Time</th><th>Active Threads</th><th>Total Memory</th><th>Free Memory</th><th>Run GC</th></tr>
<c:forEach var="node" items="#{allNodes}">
<tr>
<td>${node.servercfg.ServerName}</td>
<td><h:outputText value="#{node.Runtime.StartTime}"><f:convertDateTime type="both" timeStyle="short"/></h:outputText></td>
<td>${node.ServerInfo.ActiveThreadCount}</td>
<td>${node.ServerInfo.TotalMemory}</td>
<td>${node.ServerInfo.FreeMemory}</td>
<td><h:commandButton value="Run GC" action="#{node.Server.runGarbageCollector.invoke}"/></td>
</tr>
</c:forEach>
</table>
> JMX Resolver for JSF
> --------------------
>
> Key: JBAS-2595
> URL: http://jira.jboss.com/jira/browse/JBAS-2595
> Project: JBoss Application Server
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: Web (Tomcat) service
> Affects Versions: JBossAS-4.0.4RC1
> Reporter: Stan Silvert
> Assigned To: Stan Silvert
> Priority: Optional
> Fix For: JBossAS-5.0.1.CR1
>
>
> The JMX resolver does for JMX what Seam is doing for EJB. That is, it provides a ?seam? for JMX and JSF. It allows you to map an MBean as a JSF managed bean. Then you can use attributes from JMX in any JSF component.
> The obvious use case for this is where you want to create a custom JMX console that only contains the attributes you are interested in. For example, I might want to monitor/modify the attributes for some DataSources and Tomcat threads all on a single JSP page. I would create a faces-config-jmx.xml file like this and place it in the WEB-INF directory:
> <faces-config-jmx>
> <managed-bean>
> <managed-bean-name>defaultDS</managed-bean-name>
> <jmx-object-name>jboss.jca:name=DefaultDS,service=ManagedConnectionPool</jmx-object-name>
> </managed-bean>
> <managed-bean>
> <managed-bean-name>foo</managed-bean-name>
> <jmx-object-name>Foo:name=Foo,type=XMBean</jmx-object-name>
> </managed-bean>
> </faces-config-jmx>
> To use this in a JSP page, I just use the managed bean name in my JSF component as usual:
> <h:form>
> <p>
> <h:outputText value="New DefaultDS maxSize: "/>
> <h:inputText value="#{defaultDS.MaxSize}" converter="javax.faces.Integer" />
> <br/></br>
> <h:outputText value="New DefaultDS AvailableConnectionCount: "/>
> <h:outputText value="#{defaultDS.AvailableConnectionCount}" />
> <br/><br/>
> <h:outputText value="Array access test for foo.myArray[2]: "/>
> <br/>
> <h:outputText value="Current value is: #{foo.myArray[2]}" />
> <h:commandButton value="Submit"/>
> </p>
> </h:form>
> The mechanism to do JMX to JSF resolution will be installed automatically using the new JSF initialization specified here: http://jira.jboss.com/jira/browse/JBAS-2593
> The application developer is only required to provide a faces-config-jmx.xml containing the mappings from managed bean names to JMX ObjectNames.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 2 months
[JBoss JIRA] Created: (JBXB-88) Problem with repeated but not repeatable particles
by Alexey Loubyansky (JIRA)
Problem with repeated but not repeatable particles
--------------------------------------------------
Key: JBXB-88
URL: http://jira.jboss.com/jira/browse/JBXB-88
Project: JBoss XML Binding (JBossXB)
Issue Type: Bug
Affects Versions: JBossXB-1.0.0.CR7
Reporter: Alexey Loubyansky
Assigned To: Alexey Loubyansky
Parsing content of a complex type like
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
fails with
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to start {http://www.jboss.org/test/xml/repeatedElements}child: the element is not repeatable, repeatable parent expected to be a model group but got element {http://www.jboss.org/test/xml/repeatedElements}top
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.endRepeatableParent(SundayContentHandler.java:566)
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:219)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:323)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:160)
... 23 more
See testcase RepeatedElementsUnitTestCase
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 3 months