KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > loom > xmlpolicy > metadata > PermissionMetaData


1 /*
2  * Copyright (C) The Spice Group. All rights reserved.
3  *
4  * This software is published under the terms of the Spice
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.loom.xmlpolicy.metadata;
9
10 /**
11  * This class defines a keystore that is used when locating
12  * signers of a codebase.
13  *
14  * @author Peter Donald
15  * @version $Revision: 1.1 $ $Date: 2004/04/19 22:20:25 $
16  */

17 public class PermissionMetaData
18 {
19     /**
20      * The class name of permission.
21      */

22     private final String JavaDoc m_classname;
23
24     /**
25      * The target of permission. The interpretation of this is
26      * determined by underlying permission classname.
27      */

28     private final String JavaDoc m_target;
29
30     /**
31      * The action(s) associated with permission.
32      * The interpretation of this field is relative to
33      * the permission and target.
34      */

35     private final String JavaDoc m_action;
36
37     /**
38      * The signer of the permission.
39      * (ie who signed the permission class).
40      */

41     private final String JavaDoc m_signedBy;
42
43     /**
44      * The keyStore to load signer from. May be null but if
45      * null then signedBy must also be null.
46      */

47     private final String JavaDoc m_keyStore;
48
49     /**
50      * Construct the permission meta data.
51      *
52      * @param classname the name of permission class
53      * @param target the target of permission (may be null)
54      * @param action the action of permission (may be null)
55      */

56     public PermissionMetaData( final String JavaDoc classname,
57                                final String JavaDoc target,
58                                final String JavaDoc action,
59                                final String JavaDoc signedBy,
60                                final String JavaDoc keyStore )
61     {
62         if( null == classname )
63         {
64             throw new NullPointerException JavaDoc( "classname" );
65         }
66         if( null == signedBy && null != keyStore )
67         {
68             throw new NullPointerException JavaDoc( "signedBy" );
69         }
70         if( null == keyStore && null != signedBy )
71         {
72             throw new NullPointerException JavaDoc( "keyStore" );
73         }
74
75         m_classname = classname;
76         m_target = target;
77         m_action = action;
78         m_signedBy = signedBy;
79         m_keyStore = keyStore;
80     }
81
82     /**
83      * Return the name of permission class.
84      *
85      * @return the name of permission class.
86      */

87     public String JavaDoc getClassname()
88     {
89         return m_classname;
90     }
91
92     /**
93      * Return the action of permission (may be null).
94      *
95      * @return the action of permission (may be null).
96      */

97     public String JavaDoc getTarget()
98     {
99         return m_target;
100     }
101
102     /**
103      * Return the action of permission (may be null).
104      *
105      * @return the action of permission (may be null)
106      */

107     public String JavaDoc getAction()
108     {
109         return m_action;
110     }
111
112     /**
113      * Return the principle name who signed the permission.
114      *
115      * @return the the principle name who signed the permission.
116      */

117     public String JavaDoc getSignedBy()
118     {
119         return m_signedBy;
120     }
121
122     /**
123      * Return the key store to load signer from.
124      *
125      * @return the key store to load signer from.
126      */

127     public String JavaDoc getKeyStore()
128     {
129         return m_keyStore;
130     }
131 }
132
Popular Tags