Java Reference
In-Depth Information
{
roleInfoArray[0]= new RoleInfo("VoiceProcessor",
"jmxbook.ch11.PhoneCard",
true,
true,
1,
10,
"The Role for Phone Card");
roleInfoArray[1] = new RoleInfo("FaxProcessor",
"jmxbook.ch11.FaxCard",
true,
true,
1,
1,
"The Role for Fax Card");
roleInfoArray[2] = new RoleInfo("CallRouter",
"jmxbook.ch11.RoutingTable",
true,
true,
1,
1,
"The Role for Routing Table");
}
catch(Exception e)
{
System.out.println(
"Error Creating the Relation Service MBean");
e.printStackTrace();
}
return roleInfoArray;
}
The role information array describes the roles that will form the relation. Each
RoleInfo
instance contains the role name and the MBean class name that can act
as this type of role. In addition, it describes whether the role is readable and
writeable (the two
boolean
values).
It also includes the
minDegree
and
maxDegree
values that describe the multi-
plicity of this role. The
minDegree
value (
1
in the case of the
VoiceProcessor
role)
indicates the minimum number of MBeans that can exist for this role. The
maxDegree
value (
10
in the case of the
VoiceProcessor
role) indicates the maxi-
mum number of MBeans that can exist for this role. The last parameter to the
constructor is the description of the role. With the
RoleInfo
objects in hand, you
can create the
RelationType
object.