Richard S. Hall | 930fecc | 2005-08-16 18:33:34 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java,v 1.6 2005/07/14 10:47:13 pkriens Exp $ |
| 3 | * |
| 4 | * Copyright (c) OSGi Alliance (2005). All Rights Reserved. |
| 5 | * |
| 6 | * This program and the accompanying materials are made available under the |
| 7 | * terms of the Eclipse Public License v1.0 which accompanies this |
| 8 | * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. |
| 9 | */ |
| 10 | |
| 11 | package org.osgi.service.condpermadmin; |
| 12 | |
| 13 | import java.security.AccessControlContext; |
| 14 | import java.util.Enumeration; |
| 15 | import org.osgi.service.permissionadmin.PermissionInfo; |
| 16 | |
| 17 | /** |
| 18 | * This is a framework service that allows ConditionalPermissionInfos to be |
| 19 | * added to, retrieved from, and removed from the framework. |
| 20 | * |
| 21 | * @version $Revision: 1.6 $ |
| 22 | */ |
| 23 | public interface ConditionalPermissionAdmin { |
| 24 | /** |
| 25 | * Add a new Conditional Permission Info to the repository. |
| 26 | * |
| 27 | * The Conditional Permission Info will be given a unique, never reused name. |
| 28 | * |
| 29 | * @param conds the Conditions that need to be satisfied to enable the |
| 30 | * corresponding Permissions. |
| 31 | * @param perms the Permissions that are enable when the corresponding |
| 32 | * Conditions are satisfied. |
| 33 | * @return the ConditionalPermissionInfo that for the newly added Conditions |
| 34 | * and Permissions. |
| 35 | */ |
| 36 | ConditionalPermissionInfo addConditionalPermissionInfo( |
| 37 | ConditionInfo conds[], PermissionInfo perms[]); |
| 38 | |
| 39 | /** |
| 40 | * Set or create a Conditional Permission Info with conditions and |
| 41 | * permissions. |
| 42 | * |
| 43 | * If the given <code>name</code> is null or not used in the repository |
| 44 | * yet, a new Conditional Permission Info must be created, otherwise the |
| 45 | * existing Conditional Permission Info must be reused. |
| 46 | * |
| 47 | * @param name the name of this Conditional Permission Info, or |
| 48 | * <code>null</code>. |
| 49 | * @param conds the Conditions that need to be satisfied to enable the |
| 50 | * corresponding Permissions. |
| 51 | * @param perms the Permissions that are enable when the corresponding |
| 52 | * Conditions are satisfied. |
| 53 | * @return the ConditionalPermissionInfo that for the newly added Conditions |
| 54 | * and Permissions. |
| 55 | */ |
| 56 | ConditionalPermissionInfo setConditionalPermissionInfo(String name, |
| 57 | ConditionInfo conds[], PermissionInfo perms[]); |
| 58 | |
| 59 | /** |
| 60 | * Returns the ConditionalPermissionInfos that are currently managed by |
| 61 | * ConditionalPermissionAdmin. The Enumeration is made up of |
| 62 | * ConditionalPermissionInfos. Calling ConditionalPermissionInfo.delete() |
| 63 | * will remove the ConditionalPermissionInfo from |
| 64 | * ConditionalPermissionAdmin. |
| 65 | * |
| 66 | * @return the ConditionalPermissionInfos that are currently managed by |
| 67 | * ConditionalPermissionAdmin. The Enumeration is made up of |
| 68 | * ConditionalPermissionInfos. |
| 69 | */ |
| 70 | Enumeration getConditionalPermissionInfos(); |
| 71 | |
| 72 | /** |
| 73 | * Return the the Conditional Permission Info with the given name. |
| 74 | * |
| 75 | * @param name the name of the Conditional Permission Info that must be |
| 76 | * returned |
| 77 | */ |
| 78 | ConditionalPermissionInfo getConditionalPermissionInfo(String name); |
| 79 | |
| 80 | /** |
| 81 | * Returns the AccessControlContext that corresponds to the given signers. |
| 82 | * |
| 83 | * @param signers the signers that will be checked agains |
| 84 | * BundleSignerCondition. |
| 85 | * @return an AccessControlContext that has the Permissions associated with |
| 86 | * the signer. |
| 87 | */ |
| 88 | AccessControlContext getAccessControlContext(String signers[]); |
| 89 | } |