01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08: package mx4j.examples.services.relation;
09:
10: import javax.management.relation.RelationTypeSupport;
11: import javax.management.relation.RoleInfo;
12:
13: /**
14: * @version $Revision: 1.1 $
15: */
16: public class SimplePersonalLibrary extends RelationTypeSupport {
17:
18: public SimplePersonalLibrary(String relationTypeName) {
19: super (relationTypeName);
20:
21: try {
22: RoleInfo ownerRoleInfo = new RoleInfo("owner",
23: // the name of the MBean class of which all members must be an instance.
24: "mx4j.examples.services.relation.SimpleOwner",
25: true, //read
26: true, //write
27: 1, // only one owner
28: 1, "Owner");
29: addRoleInfo(ownerRoleInfo);
30:
31: RoleInfo booksRoleInfo = new RoleInfo("books",
32: "mx4j.examples.services.relation.SimpleBooks",
33: true, true, 1, // feeling nasty can only own max 4 books and no fewer than 1
34: 4, "Books");
35: addRoleInfo(booksRoleInfo);
36: } catch (Exception ex) {
37: throw new RuntimeException(ex.getMessage());
38: }
39: }
40: }
|