KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > condpermadmin > ConditionalPermissionAdmin


1 /*
2  * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java,v 1.13 2006/06/16 16:31:37 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.osgi.service.condpermadmin;
20
21 import java.security.AccessControlContext JavaDoc;
22 import java.util.Enumeration JavaDoc;
23
24 import org.osgi.service.permissionadmin.PermissionInfo;
25
26 /**
27  * Framework service to administer Conditional Permissions. Conditional
28  * Permissions can be added to, retrieved from, and removed from the framework.
29  *
30  * @version $Revision: 1.13 $
31  */

32 public interface ConditionalPermissionAdmin {
33     /**
34      * Create a new Conditional Permission Info.
35      *
36      * The Conditional Permission Info will be given a unique, never reused
37      * name.
38      *
39      * @param conds The Conditions that need to be satisfied to enable the
40      * corresponding Permissions.
41      * @param perms The Permissions that are enable when the corresponding
42      * Conditions are satisfied.
43      * @return The ConditionalPermissionInfo for the specified Conditions and
44      * Permissions.
45      * @throws SecurityException If the caller does not have
46      * <code>AllPermission</code>.
47      */

48     public ConditionalPermissionInfo addConditionalPermissionInfo(
49             ConditionInfo conds[], PermissionInfo perms[]);
50
51     /**
52      * Set or create a Conditional Permission Info with a specified name.
53      *
54      * If the specified name is <code>null</code>, a new Conditional
55      * Permission Info must be created and will be given a unique, never reused
56      * name. If there is currently no Conditional Permission Info with the
57      * specified name, a new Conditional Permission Info must be created with
58      * the specified name. Otherwise, the Conditional Permission Info with the
59      * specified name must be updated with the specified Conditions and
60      * Permissions.
61      *
62      * @param name The name of the Conditional Permission Info, or
63      * <code>null</code>.
64      * @param conds The Conditions that need to be satisfied to enable the
65      * corresponding Permissions.
66      * @param perms The Permissions that are enable when the corresponding
67      * Conditions are satisfied.
68      * @return The ConditionalPermissionInfo that for the specified name,
69      * Conditions and Permissions.
70      * @throws SecurityException If the caller does not have
71      * <code>AllPermission</code>.
72      */

73     public ConditionalPermissionInfo setConditionalPermissionInfo(String JavaDoc name,
74             ConditionInfo conds[], PermissionInfo perms[]);
75
76     /**
77      * Returns the Conditional Permission Infos that are currently managed by
78      * Conditional Permission Admin. Calling
79      * {@link ConditionalPermissionInfo#delete()} will remove the Conditional
80      * Permission Info from Conditional Permission Admin.
81      *
82      * @return An enumeration of the Conditional Permission Infos that are
83      * currently managed by Conditional Permission Admin.
84      */

85     public Enumeration JavaDoc getConditionalPermissionInfos();
86
87     /**
88      * Return the Conditional Permission Info with the specified name.
89      *
90      * @param name The name of the Conditional Permission Info to be returned.
91      * @return The Conditional Permission Info with the specified name.
92      */

93     public ConditionalPermissionInfo getConditionalPermissionInfo(String JavaDoc name);
94
95     /**
96      * Returns the Access Control Context that corresponds to the specified
97      * signers.
98      *
99      * @param signers The signers for which to return an Access Control Context.
100      * @return An <code>AccessControlContext</code> that has the Permissions
101      * associated with the signer.
102      */

103     public AccessControlContext JavaDoc getAccessControlContext(String JavaDoc[] signers);
104 }
105
Popular Tags