1//File: CosRelationships.idl
2//Part of the Relationship Service
3
4#ifndef _COS_RELATIONSHIPS_IDL_
5#define _COS_RELATIONSHIPS_IDL_
6
7// omniORB specific pragmas to insert extra includes into the stub header.
8#pragma hh #include "COS_sysdep.h"
9
10#include <orb.idl>
11
12#if defined(__OMNIIDL__) || defined(__OMNIIDL2__)
13#include <ir.idl>
14#endif
15
16
17#include <CosObjectIdentity.idl>
18
19#pragma prefix "omg.org"
20
21
22
23module CosRelationships {
24
25	interface RoleFactory;
26	interface RelationshipFactory;
27	interface Relationship;
28	interface Role;
29	interface RelationshipIterator;
30
31	typedef Object RelatedObject;
32	typedef sequence<Role> Roles;
33	typedef string RoleName;
34	typedef sequence<RoleName> RoleNames;
35
36	struct NamedRole {RoleName name; Role aRole;};
37	typedef sequence<NamedRole> NamedRoles;
38
39	struct RelationshipHandle {
40			Relationship the_relationship;
41			CosObjectIdentity::ObjectIdentifier constant_random_id;
42	};
43	typedef sequence<RelationshipHandle> RelationshipHandles;
44
45	interface RelationshipFactory {
46		struct NamedRoleType {
47			RoleName name;
48			CORBA::InterfaceDef named_role_type;
49		};
50		typedef sequence<NamedRoleType> NamedRoleTypes;
51		readonly attribute CORBA::InterfaceDef relationship_type;
52		readonly attribute unsigned short degree;
53		readonly attribute NamedRoleTypes named_role_types;
54		exception RoleTypeError {NamedRoles culprits;};
55		exception MaxCardinalityExceeded {
56			NamedRoles culprits;};
57		exception DegreeError {unsigned short required_degree;};
58		exception DuplicateRoleName {NamedRoles culprits;};
59		exception UnknownRoleName {NamedRoles culprits;};
60
61		Relationship create (in NamedRoles named_roles)
62			raises (RoleTypeError,
63					MaxCardinalityExceeded,
64					DegreeError,
65                                        DuplicateRoleName,
66					UnknownRoleName);
67	};
68
69	interface Relationship : CosObjectIdentity::IdentifiableObject {
70		exception CannotUnlink {
71			Roles offending_roles;
72		};
73		readonly attribute NamedRoles named_roles;
74		void destroy () raises(CannotUnlink);
75	};
76
77	interface Role {
78		exception UnknownRoleName {};
79		exception UnknownRelationship {};
80		exception RelationshipTypeError {};
81		exception CannotDestroyRelationship {
82			RelationshipHandles offenders;
83		};
84		exception ParticipatingInRelationship {
85			RelationshipHandles the_relationships;
86		};
87		readonly attribute RelatedObject related_object;
88		RelatedObject get_other_related_object (
89			in RelationshipHandle rel,
90			in RoleName target_name)
91			raises (UnknownRoleName,
92					UnknownRelationship);
93		Role get_other_role (in RelationshipHandle rel,
94			in RoleName target_name)
95			raises (UnknownRoleName, UnknownRelationship);
96		void get_relationships (
97			in unsigned long how_many,
98			out RelationshipHandles rels,
99			out RelationshipIterator iterator);
100		void destroy_relationships()
101			raises(CannotDestroyRelationship);
102		void destroy() raises(ParticipatingInRelationship);
103		boolean check_minimum_cardinality ();
104		void link (in RelationshipHandle rel,
105			in NamedRoles named_roles)
106			raises( RelationshipFactory::MaxCardinalityExceeded,
107					RelationshipTypeError);
108		void unlink (in RelationshipHandle rel)
109			raises (UnknownRelationship);
110	};
111
112	interface RoleFactory {
113		exception NilRelatedObject {};
114		exception RelatedObjectTypeError {};
115		readonly attribute CORBA::InterfaceDef role_type;
116		readonly attribute unsigned long max_cardinality;
117		readonly attribute unsigned long min_cardinality;
118		typedef sequence<CORBA::InterfaceDef> InterfaceDefs;
119		readonly attribute InterfaceDefs related_object_types;
120
121		Role create_role (in RelatedObject related_object)
122			raises (NilRelatedObject, RelatedObjectTypeError);
123	};
124
125	interface RelationshipIterator {
126		boolean next_one (out RelationshipHandle rel);
127		boolean next_n (in unsigned long how_many,
128						out RelationshipHandles rels);
129		void destroy ();
130	};
131
132};
133
134#endif /* ifndef _COS_RELATIONSHIPS_IDL_ */
135