Pramati Server's Management Console complies with the Java Management Extensions (JMX) specifications and the JSR 77 (the Java specification for J2EE Server Management) information model.
JMX defines management interfaces and services designed for distributed environments, focused on providing functionality for managing networks, systems and applications.
Console is built with components called Management Beans (MBeans). These beans can be either standard or dynamic. Console uses dynamic MBeans that conform to a specific interface and allow for wide flexibility at runtime. MBeans can generate and propagate notification events to components across multiple tiers. Service providers and developers can build standard management components into their products, and avoid investing in complex management systems.
Pramati MBean Server can be accessed from within the same VM or remotely.
To access MBean Server from within the same VM, simply look up java:comp/MBeanServer, as:
javax.naming.InitialContext ic = new javax.naming.InitialContext();
javax.management.MBeanServer mbeanServer =
(javax.management.MBeanServer)ic.lookup("java:comp/
MBeanServer");
This code can be executed from a Server startup hook or any standard J2EE component such as a servlet or an EJB.
To manage Pramati Server remotely, MBean Server must be accessed from
outside the VM, through the RMI-based client connector that
is bound to the Naming service by the name, rmi-client-connector. The
following code illustrates this:
java.util.Properties props=new java.util.Properties();
props.put("java.naming.factory.initial",
"com.pramati.naming.client.PramatiClientContextFactory");
props.put("java.naming.provider.url", "rmi://Host-IP:NamingPort");
javax.naming.InitialContext ic = new javax.naming.InitialContext(props);
com.pramati.jmx.connector.ClientConnector cc =
(com.pramati.jmx.connector.ClientConnector)
ic.lookup("rmi-client-connector");
The Java API for com.pramati.jmx.connector.ClientConnector can be found at javadocs\com\pramati\jmx\connector\Connector.html
Pramati Server exposes Management APIs to facilitate server management through custom tools and applications. These Management APIs can be viewed from Console in the Control Objects tab on Catalog page.
Start navigating from
com.pramati.services.j2ee.spi.admin.J2EEServerMBean
or
com.pramati.services.jms.spi.admin.JMSServerMBean
which can be obtained by looking up root-server-mbean or jms-servermbean
either from the same VM or remotely.
The following sample code obtains a J2EEServerMBean, the management
interface for managing Server, in the same VM.
javax.naming.InitialContext ic = new javax.naming.InitialContext();
com.pramati.services.j2ee.spi.admin.J2EEServerMBean
j2eeServerMBean=(com.pramati.services.j2ee.spi.admin.J2EEServerMBean)
ic.lookup("rootserver-mbean");
The following sample code obtains a J2EEServerMBean from a remote VM:
java.util.Properties props=new java.util.Properties();
props.put("java.naming.factory.initial",.
"com.pramati.naming.client.PramatiClientContextFactory");
props.put("java.naming.provider.url", "rmi://Host-IP:NamingPort");
javax.naming.InitialContext ic = new javax.naming.InitialContext(props);
com.pramati.services.j2ee.spi.admin.J2EEServerMBean
j2eeServerMBean = (com.pramati.services.j2ee.spi.admin.J2EEServerMBean)
ic.lookup("rootserver-mbean");
The following sample code obtains a JMSServerMBean, the management
interface for the Pramati Message Server, in the same VM:
javax.naming.InitialContext ic = new javax.naming.InitialContext();
com.pramati.services.jms.spi.admin.JMSServerMBean
jmsServerMBean = (com.pramati.services.jms.spi.admin.JMSServerMBean)
ic.lookup("jms-server-mbean");
This sample code obtains a JMSServerMBean from a remote VM:
java.util.Properties props=new java.util.Properties();
props.put("java.naming.factory.initial",
"com.pramati.naming.client.PramatiClientContextFactory");
props.put("java.naming.provider.url", "rmi://Host-IP:NamingPort");
javax.naming.InitialContext ic = new javax.naming.InitialContext(
props);
com.pramati.services.jms.spi.admin.JMSServerMBean
jmsServerMBean =(com.pramati.services.jms.spi.admin.JMSServerMBean)
ic.lookup("jms-server-mbean");
Replace ‘Host-IP’ with the actual IP of the host where Server is running and ‘NamingPort’ with the port that is used by the Naming Service running on the host. For example, “rmi://Host-IP:NamingPort” may be replaced by “rmi://localhost:9191”, where the lookup is on another VM on the same host with Naming Service on port 9191.
The Java API is available at http://www.pramati.com/docstore/1205009/javadoc/index.html
MBean API for Management Console
You can instantiate and register your own MBeans in the MBean Server using the m-let service. An m-let text file contains information on the MBeans to be obtained. The location of the m-let text file is specifed by a URL, so that, when the file is loaded, the instance of each MBean defined in the m-let text file, is created and registered. The MBean by name mlet-service is bound to the server by default.
working.htmThe m-let text file should have the following pseudo XML format:
<MLET CODE = class | OBJECT = serfile ARCHIVE = "archivelist" [CODEBASE = codebaseURL] [NAME = MBeanName] [VERSION = version] > [arglist] </MLET>The following table contains attribute definitions:
| Attribute | Description |
|---|---|
| code | Class name of the MBean including package name is specified here. Either the code or object attribute must be present. |
| object | Serialized represenation of the MBean to be obtained |
| archive | JAR name or JAR comma-separated list enclosed in double quotes. |
| codebase | This specifies the URL of the MBean to be obtained. The JAR name must be stored in the URL specified here. |
| name | Name of the MBean to be registered. |
| version | This version number must contain non-negative integers. It can be used to specify whether or not the JAR files need to be loaded from the server to update those already loaded by the m-let service. |
The m-let text file should be present in the same directory as the JAR files and class files.
After creating the m-let text file, click on View under MBean Viewer from Console main page. This invokes MBean Viewer Dialog. Select domain as Pramati and click on name type=mlet-service.
Specify value as the URL where the m-let text file is present. This would register the MBean to the server and create a new domain.