KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > examples > services > relation > SimplePersonalLibrary


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8 package mx4j.examples.services.relation;
9
10 import javax.management.relation.RelationTypeSupport JavaDoc;
11 import javax.management.relation.RoleInfo JavaDoc;
12
13 /**
14  * @version $Revision: 1.1 $
15  */

16 public class SimplePersonalLibrary extends RelationTypeSupport JavaDoc
17 {
18
19    public SimplePersonalLibrary(String JavaDoc relationTypeName)
20    {
21       super(relationTypeName);
22
23       try
24       {
25          RoleInfo JavaDoc ownerRoleInfo = new RoleInfo JavaDoc("owner",
26                                                // the name of the MBean class of which all members must be an instance.
27
"mx4j.examples.services.relation.SimpleOwner",
28                                                true, //read
29
true, //write
30
1, // only one owner
31
1,
32                                                "Owner");
33          addRoleInfo(ownerRoleInfo);
34
35          RoleInfo JavaDoc booksRoleInfo = new RoleInfo JavaDoc("books",
36                                                "mx4j.examples.services.relation.SimpleBooks",
37                                                true,
38                                                true,
39                                                1, // feeling nasty can only own max 4 books and no fewer than 1
40
4,
41                                                "Books");
42          addRoleInfo(booksRoleInfo);
43       }
44       catch (Exception JavaDoc ex)
45       {
46          throw new RuntimeException JavaDoc(ex.getMessage());
47       }
48    }
49 }
Popular Tags