Relationship Service

This service allows for the explicit definition of relationships among objects. Relationships are defined in terms of type, roles within the relationship, and the cardinality of each role. Objects fulfill a role when they participate in a relationship. You can define an agent/proxy relationship, for example, in which a single object fulfills the agent role, and multiple objects serve as proxies for that agent.

The Relationship and Role interfaces are at the heart of the service. A RelationshipFactory is used to create Relationships, and similarly for the RoleFactory. A RelationshipIterator can iterate through the relationships a given object plays roles in. In addition to these generic relationship interfaces, the service also provides several specific relationship types in their own modules. Object graphs can be created using the interfaces in the CosGraphs module, containment relationships can be created using the CosContainment module, and reference relationships are defined using the CosReference module.

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.