You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
I have seen several postings asking about integration between Seam and JMX.
Here is a simple approach for registering a POJO as an MBean and a Component.
Here is the configuration:
<jmx:managed-bean name="echoService" objectName="net.taylor.jmx:service=EchoService" type="net.taylor.jmx.EchoServiceMBean" implementation="net.taylor.jmx.EchoService" />
Here is injections:
@In private EchoService echoService;
Here is the component code:
@Scope(ScopeType.APPLICATION) @AutoCreate @Startup @BypassInterceptors public class ManagedBean { private String objectName; private Class<?> type; private Class<?> implementation; private String agentId; private ObjectName _objectName; private MBeanServer server; private Object mbean; // setters/getters @Create public void create() throws Exception { List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(agentId); server = servers.get(0); _objectName = new ObjectName(objectName); mbean = MBeanProxy.create(implementation, type, _objectName, server); } @Destroy public void destroy() throws Exception { server.unregisterMBean(_objectName); } @Unwrap public Object getMBean() { return mbean; } }
Here is the full code: ManagedBean.java