KickJava   Java API By Example, From Geeks To Geeks.

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


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 GrantMetaData
18 {
19     /**
20      * The codebase that grant applies to.
21      */

22     private final String JavaDoc m_codebase;
23
24     /**
25      * The signer of codebase. May be null but if null then
26      * keyStore must also be null.
27      */

28     private final String JavaDoc m_signedBy;
29
30     /**
31      * The keyStore to load signer from. May be null but if
32      * null then signedBy must also be null.
33      */

34     private final String JavaDoc m_keyStore;
35
36     /**
37      * The set of permissions to grant codebase.
38      */

39     private final PermissionMetaData[] m_permissions;
40
41     /**
42      * Construct a grant.
43      *
44      * @param codebase the codebase grant is about
45      * @param signedBy who signed the codebase
46      * @param keyStore the name of the keystore the signer is loaded from
47      * @param permissions the set of permissions associated with grant
48      */

49     public GrantMetaData( final String JavaDoc codebase,
50                           final String JavaDoc signedBy,
51                           final String JavaDoc keyStore,
52                           final PermissionMetaData[] permissions )
53     {
54         if( null == permissions )
55         {
56             throw new NullPointerException JavaDoc( "permissions" );
57         }
58         if( null == signedBy && null != keyStore )
59         {
60             throw new NullPointerException JavaDoc( "signedBy" );
61         }
62         if( null == keyStore && null != signedBy )
63         {
64             throw new NullPointerException JavaDoc( "keyStore" );
65         }
66         for( int i = 0; i < permissions.length; i++ )
67         {
68             if( null == permissions[ i ] )
69             {
70                 throw new NullPointerException JavaDoc( "permissions[" + i + "]" );
71             }
72         }
73
74         m_codebase = codebase;
75         m_signedBy = signedBy;
76         m_keyStore = keyStore;
77         m_permissions = permissions;
78     }
79
80     /**
81      * Return the code base for grant.
82      *
83      * @return the code base for grant.
84      */

85     public String JavaDoc getCodebase()
86     {
87         return m_codebase;
88     }
89
90     /**
91      * Return the signer for grant.
92      *
93      * @return the signer for grant.
94      */

95     public String JavaDoc getSignedBy()
96     {
97         return m_signedBy;
98     }
99
100     /**
101      * Return the key store to load signer from.
102      *
103      * @return the key store to load signer from.
104      */

105     public String JavaDoc getKeyStore()
106     {
107         return m_keyStore;
108     }
109
110     /**
111      * Return the set of permissions associated with grant.
112      *
113      * @return the set of permissions associated with grant.
114      */

115     public PermissionMetaData[] getPermissions()
116     {
117         return m_permissions;
118     }
119 }
120
Popular Tags