Java Reference
In-Depth Information
The ManagedJINIService interface provides two operations:
addEntries() —Lets you add additional entries to the Jini service's service
template
modifyEntries() —Lets you change existing Entry objects
For the sake of time and space, this topic does not contain the code for the Jini
service we are describing. However, it does contain the code for the MBean used
to manage this service. Remember, the ManagedJINIService service (as it is called
because it implements the ManagedJINIService interface) creates an MBean
upon its creation. It should also destroy that MBean when it knows it is being
shut down.
Let's begin the examination of the MBean that manages the Jini service. List-
ing 5.1 is the JINIServiceManager Dynamic MBean class.
Listing 5.1
JINIServiceManager.java
package jmxbook.ch5;
Import packages
to support Jini
interaction
import net.jini.core.entry.*;
import net.jini.discovery.*;
import net.jini.core.lookup.*;
import java.util.*;
import javax.management.*;
import java.rmi.*;
import java.lang.reflect.*;
public class JINIServiceManager implements DynamicMBean
{
private ManagedJINIService serviceRef = null;
private String jiniInterfaceName = null;
private Entry initialAttribute = null;
private String serviceName = null;
public JINIServiceManager(Entry att )
{
jiniInterfaceName = "jmxbook.ch5.ManagedJINIService";
serviceRef = ( jmxbook.ch5.ManagedJINIService )
lookUpService();
initialAttribute = att;
}
public Object getAttribute( String name ) throws MBeanException,
AttributeNotFoundException, ReflectionException
{
throw new AttributeNotFoundException( name );
}
public AttributeList getAttributes( String[] names )
{
Look up service
reference
B
Expose MBean
attributes
Search WWH ::




Custom Search