source: fedd/abac-src/rtml/src/edu/stanford/rt/credential/RoleDefinition.java @ 8780cbec

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since 8780cbec was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.7 KB
Line 
1package edu.stanford.rt.credential;
2/**
3 * @author Ninghui Li, Sandra Qiu<br>
4 *
5 * Implementation of role definition in RTML, which is represented by
6 * <code>Definition</code> group element.
7 *
8 * A role definition has a head and a body.
9 */
10public class RoleDefinition
11{
12        /**
13         * Role head.
14         */
15        private Role head; // always a local role
16        /**
17         * Role body.
18         */
19        private PrincipalExpression body;
20        /**
21         * role definition context
22         */
23        private CredentialDomain context;
24
25        /**
26         * Constructor for RoleDefinition.
27         */
28        public RoleDefinition(
29                CredentialDomain context,
30                Role head,
31                PrincipalExpression body)
32        {
33                this.context = context;
34                this.head = head;
35                this.body = body;
36        }
37        /**
38         * Returns the body.
39         * @return PrincipalExpression
40         */
41        public PrincipalExpression getBody()
42        {
43                return body;
44        }
45        /**
46         * Returns the head.
47         * @return Role
48         */
49        public Role getHead()
50        {
51                return head;
52        }
53
54        /**
55         * Method getContext.
56         * @return CredentialDomain
57         */
58        public CredentialDomain getContext() throws DomainSpecException
59        {
60                if (!context.isComplete())
61                        throw new DomainSpecException("Incomplete CredentialDomain");
62                return context;
63        }
64
65        /**
66         * Method toString.
67         * @param indent
68         * @return String
69         */
70        public String toString(String indent)
71        {
72                String thisIndent = indent + "  ";
73                StringBuffer sb = new StringBuffer();
74                sb.append(thisIndent).append("Role Definition: \n");
75                sb.append(thisIndent + "  ").append("Head: \n");
76                sb.append(head.toString(thisIndent + "  ")).append("\n");
77                sb.append(thisIndent + "  ").append("Body: \n");
78                sb.append(body.toString(thisIndent + "  ")).append("\n");
79                return sb.toString();
80        }
81
82}
Note: See TracBrowser for help on using the repository browser.