KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > framework > adaptor > PermissionStorage


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.osgi.framework.adaptor;
13
14 import java.io.IOException JavaDoc;
15
16 /**
17  * Permission Storage interface for managing a persistent storage of
18  * bundle permissions.
19  *
20  * <p>This class is used to provide methods to manage
21  * persistent storage of bundle permissions. The PermissionStorage object
22  * is returned by the FrameworkAdaptor object and is called
23  * to persistently store bundle permissions.
24  *
25  * <p>The permission data will typically take the form of encoded
26  * <tt>PermissionInfo</tt> Strings.
27  * See org.osgi.service.permissionadmin.PermissionInfo.
28  *
29  * <p>For example
30  * <pre>
31  * PermissionStorage storage = adaptor.getPermissionStorage();
32  * try {
33  * storage.setPermissionData(location, permissions);
34  * } catch (IOException e) {
35  * // Take some error action.
36  * }
37  * </pre>
38  * <p>
39  * Clients may implement this interface.
40  * </p>
41  * @since 3.1
42  */

43 public interface PermissionStorage {
44     /**
45      * Returns the locations that have permission data assigned to them,
46      * that is, locations for which permission data
47      * exists in persistent storage.
48      *
49      * @return The locations that have permission data in
50      * persistent storage, or <tt>null</tt> if there is no permission data
51      * in persistent storage.
52      * @throws IOException If a failure occurs accessing persistent storage.
53      */

54     public String JavaDoc[] getLocations() throws IOException JavaDoc;
55
56     /**
57      * Gets the permission data assigned to the specified
58      * location.
59      *
60      * @param location The location whose permission data is to
61      * be returned.
62      * The location can be <tt>null</tt> for the default permission data.
63      *
64      * @return The permission data assigned to the specified
65      * location, or <tt>null</tt> if that location has not been assigned any
66      * permission data.
67      * @throws IOException If a failure occurs accessing persistent storage.
68      */

69     public String JavaDoc[] getPermissionData(String JavaDoc location) throws IOException JavaDoc;
70
71     /**
72      * Assigns the specified permission data to the specified
73      * location.
74      *
75      * @param location The location that will be assigned the
76      * permissions.
77      * The location can be <tt>null</tt> for the default permission data.
78      * @param data The permission data to be assigned, or <tt>null</tt>
79      * if the specified location is to be removed from persistent storaqe.
80      * @throws IOException If a failure occurs modifying persistent storage.
81      */

82     public void setPermissionData(String JavaDoc location, String JavaDoc[] data) throws IOException JavaDoc;
83
84     /**
85      * Persists the array of encoded ConditionalPermissionInfo strings
86      * @param infos an array of encoded ConditionalPermissionInfo strings
87      * @throws IOException If a failure occurs modifying persistent storage.
88      * @since 3.2
89      */

90     public void saveConditionalPermissionInfos(String JavaDoc[] infos) throws IOException JavaDoc;
91
92     /**
93      * Returns the persistent array of encoded ConditionalPermissionInfo strings
94      * @return an array of encoded ConditionalPermissionInfo strings or null
95      * if none exist in persistent storage.
96      * @throws IOException If a failure occurs accessing persistent storage.
97      * @since 3.2
98      */

99     public String JavaDoc[] getConditionalPermissionInfos() throws IOException JavaDoc;
100 }
101
Popular Tags