Java Reference
In-Depth Information
that correspond to the methods of the MBeanServer interface. Invocations of
these methods are forwarded to the Jini service, which forwards them to the
MBean server of the JMX agent. In addition, the connector client shields the
developer from the process of finding the Jini service. The JINIConnectorClient
class defines the Jini client.
9.3.2
Writing the Jini connector
Now that we have discussed the components that form the Jini connector, let's
begin writing the code. You will create the components in the order they were pre-
sented: the MBean, the Jini service, and then the Jini client. All the classes are in
the package jmxbook.ch9 . After you write all the classes, we will go over what you
need to do to compile and run them. To test the connector, you will need to write
some code for your JMXBookAgent class to include an instance of the Jini connector.
Writing the MBean
With the MBean, you must decide what attributes and operations you want to
expose in order to make the Jini service configurable and more useful. Table 9.3
lists the attributes and operations exposed by the JINIServerMBean interface.
Remember from chapter 4 that this type of interface indicates you are creating a
Standard MBean.
Table 9.3
Attributes and operations exposed by the JINIServerMBean interface
Attribute/operation
Description
Domain
Read-only attribute that indicates the domain of the agent that contains this
connector.
Read/write attribute that supplies the Jini service started by the MBean with
an identifier. This attribute is optional, but providing a value gives clients a way
to refine their search for the service (it makes the Jini service more unique).
EntryName
Read/write attribute that indicates which lookup service groups the Jini service
will register with. (For more information about the lookup service, go to http://
www.javasoft.com.)
Groups
Operation that tells the MBean to start the Jini service.
enableConnections
Table 9.3 gives a good view of what the MBean will be like. Now that you know
the exposed attributes and operations of the MBean, look at the JINIServer-
MBean interface:
package jmxbook.ch9;
public interface JINIServerMBean
Search WWH ::




Custom Search