javax.management.relation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » management » javax.management.relation 
javax.management.relation
javax.management.relation package

Provides the definition of the Relation Service. The Relation Service is used to record relationships between MBeans in an MBean Server. The Relation Service is itself an MBean. More than one instance of a {@link javax.management.relation.RelationService RelationService} MBean can be registered in an MBean Server.

A relation type defines a relationship between MBeans. It contains roles that the MBeans play in the relationship. Usually there are at least two roles in a relation type.

A relation is a named instance of a relation type, where specific MBeans appear in the roles, represented by their {@link javax.management.ObjectName ObjectName}s.

For example, suppose there are Module MBeans, representing modules within an application. A DependsOn relation type could express the relationship that some modules depend on others, which could be used to determine the order in which the modules are started or stopped. The DependsOn relation type would have two roles, dependent and dependedOn.

Every role is typed, meaning that an MBean that appears in that role must be an instance of the role's type. In the DependsOn example, both roles would be of type Module.

Every role has a cardinality, which provides lower and upper bounds on the number of MBeans that can appear in that role in a given relation instance. Usually, the lower and upper bounds are both 1, with exactly one MBean appearing in the role. The cardinality only limits the number of MBeans in the role per relation instance. The same MBean can appear in the same role in any number of instances of a relation type. In the DependsOn example, a given module can depend on many other modules, and be depended on by many others, but any given relation instance links exactly one dependent module with exactly one dependedOn module.

A relation type can be created explicitly, as an object implementing the {@link javax.management.relation.RelationType RelationType} interface, typically a {@link javax.management.relation.RelationTypeSupport RelationTypeSupport}. Alternatively, it can be created implicitly using the Relation Service's {@link javax.management.relation.RelationServiceMBean#createRelationType(String, RoleInfo[]) createRelationType} method.

A relation instance can be created explicitly, as an object implementing the {@link javax.management.relation.Relation Relation} interface, typically a {@link javax.management.relation.RelationSupport RelationSupport}. (A RelationSupport is itself a valid MBean, so it can be registered in the MBean Server, though this is not required.) Alternatively, a relation instance can be created implicitly using the Relation Service's {@link javax.management.relation.RelationServiceMBean#createRelation(String, String, RoleList) createRelation} method.

The DependsOn example might be coded as follows.

import java.util.*;
import javax.management.*;
import javax.management.relation.*;

// ...
MBeanServer mbs = ...;

// Create the Relation Service MBean
ObjectName relSvcName = new ObjectName(":type=RelationService");
RelationService relSvcObject = new RelationService(true);
mbs.registerMBean(relSvcObject, relSvcName);

// Create an MBean proxy for easier access to the Relation Service
RelationServiceMBean relSvc =
    MBeanServerInvocationHandler.newProxyInstance(mbs, relSvcName,
						  RelationServiceMBean.class,
						  false);

// Define the DependsOn relation type
RoleInfo[] dependsOnRoles = {
    new RoleInfo("dependent", Module.class.getName()),
    new RoleInfo("dependedOn", Module.class.getName())
};
relSvc.createRelationType("DependsOn", dependsOnRoles);

// Now define a relation instance "moduleA DependsOn moduleB"

ObjectName moduleA = new ObjectName(":type=Module,name=A");
ObjectName moduleB = new ObjectName(":type=Module,name=B");

Role dependent = new Role("dependent", Collections.singletonList(moduleA));
Role dependedOn = new Role("dependedOn", Collections.singletonList(moduleB));
Role[] roleArray = {dependent, dependedOn};
RoleList roles = new RoleList(Arrays.asList(roleArray));
relSvc.createRelation("A-DependsOn-B", "DependsOn", roles);

// Query the Relation Service to find what modules moduleA depends on
Map<ObjectName,List<String>> dependentAMap =
    relSvc.findAssociatedMBeans(moduleA, "DependsOn", "dependent");
Set<ObjectName> dependentASet = dependentAMap.keySet();
// Set of ObjectName containing moduleB
@see Java SE 6 Platform documentation on JMX technology, in particular the JMX Specification, version 1.4 @since 1.5
Java Source File NameTypeComment
InvalidRelationIdException.javaClass This exception is raised when relation id provided for a relation is already used.
InvalidRelationServiceException.javaClass This exception is raised when an invalid Relation Service is provided.
InvalidRelationTypeException.javaClass Invalid relation type.
InvalidRoleInfoException.javaClass This exception is raised when, in a role info, its minimum degree is greater than its maximum degree.
InvalidRoleValueException.javaClass Role value is invalid.
MBeanServerNotificationFilter.javaClass Filter for MBeanServerNotification .
Relation.javaInterface This interface has to be implemented by any MBean class expected to represent a relation managed using the Relation Service.

Simple relations, i.e.

RelationException.javaClass This class is the superclass of any exception which can be raised during relation management.
RelationNotFoundException.javaClass This exception is raised when there is no relation for a given relation id in a Relation Service.
RelationNotification.javaClass A notification of a change in the Relation Service.
RelationService.javaClass The Relation Service is in charge of creating and deleting relation types and relations, of handling the consistency and of providing query mechanisms.
RelationServiceMBean.javaInterface The Relation Service is in charge of creating and deleting relation types and relations, of handling the consistency and of providing query mechanisms.
RelationServiceNotRegisteredException.javaClass This exception is raised when an access is done to the Relation Service and that one is not registered.
RelationSupport.javaClass A RelationSupport object is used internally by the Relation Service to represent simple relations (only roles, no properties or methods), with an unlimited number of roles, of any relation type.
RelationSupportMBean.javaInterface A RelationSupport object is used internally by the Relation Service to represent simple relations (only roles, no properties or methods), with an unlimited number of roles, of any relation type.
RelationType.javaInterface The RelationType interface has to be implemented by any class expected to represent a relation type.
RelationTypeNotFoundException.javaClass This exception is raised when there is no relation type with given name in Relation Service.
RelationTypeSupport.javaClass A RelationTypeSupport object implements the RelationType interface.
Role.javaClass Represents a role: includes a role name and referenced MBeans (via their ObjectNames).
RoleInfo.javaClass A RoleInfo object summarises a role in a relation type.
RoleInfoNotFoundException.javaClass This exception is raised when there is no role info with given name in a given relation type.
RoleList.javaClass A RoleList represents a list of roles (Role objects).
RoleNotFoundException.javaClass This exception is raised when a role in a relation does not exist, or is not readable, or is not settable.
RoleResult.javaClass Represents the result of a multiple access to several roles of a relation (either for reading or writing).
RoleStatus.javaClass This class describes the various problems which can be encountered when accessing a role.
RoleUnresolved.javaClass Represents an unresolved role: a role not retrieved from a relation due to a problem.
RoleUnresolvedList.javaClass A RoleUnresolvedList represents a list of RoleUnresolved objects, representing roles not retrieved from a relation due to a problem encountered when trying to access (read or write) the roles.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.