Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/osgi/service/useradmin/Role.java


1   /*
2    * $Header: /cvshome/repository/org/osgi/service/useradmin/Role.java,v 1.4 2001/07/31 19:06:00 pkriens Exp $
3    *
4    * Copyright (c) The Open Services Gateway Initiative (2001).
5    * All Rights Reserved.
6    *
7    * Implementation of certain elements of the Open Services Gateway Initiative
8    * (OSGI) Specification may be subject to third party intellectual property
9    * rights, including without limitation, patent rights (such a third party may
10   * or may not be a member of OSGi). OSGi is not responsible and shall not be
11   * held responsible in any manner for identifying or failing to identify any or
12   * all such third party intellectual property rights.
13   *
14   * This document and the information contained herein are provided on an "AS
15   * IS" basis and OSGI DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
16   * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL
17   * NOT INFRINGE ANY RIGHTS AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR
18   * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL OSGI BE LIABLE FOR ANY
19   * LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF
20   * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTIAL,
21   * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH THIS
22   * DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE
23   * POSSIBILITY OF SUCH LOSS OR DAMAGE.
24   *
25   * All Company, brand and product names may be trademarks that are the sole
26   * property of their respective owners. All rights reserved.
27   */
28  
29  package org.osgi.service.useradmin;
30  
31  import java.util.Dictionary;
32  
33  /**
34   * The base interface for <tt>Role</tt> objects managed by the User Admin
35   * service.
36   * 
37   * <p>This interface exposes the characteristics shared by all <tt>Role</tt> classes: a name,
38   * a type, and a set of properties.
39   * <p>
40   * Properties represent public information about the <tt>Role</tt> object that can be read by
41   * anyone. Specific {@link UserAdminPermission}objects are required to
42   * change a <tt>Role</tt> object's properties.
43   * <p>
44   * <tt>Role</tt> object properties are <tt>Dictionary</tt> objects. Changes to
45   * these objects are propagated to the User Admin service and
46   * made persistent.
47   * <p>
48   * Every User Admin service contains a set of predefined <tt>Role</tt> objects that are always present
49   * and cannot be removed. All predefined <tt>Role</tt> objects are of type <tt>ROLE</tt>.
50   * This version of the <tt>org.osgi.service.useradmin</tt> package defines a
51   * single predefined role named &quot;user.anyone&quot;, which is inherited
52   * by any other role. Other predefined roles may be added in the future.
53   * Since &quot;user.anyone&quot; is a <tt>Role</tt> object that has properties associated with
54   * it that can be read and modified.  Access to these properties and their
55   * use is application specific and is controlled using 
56   * <tt>UserAdminPermission</tt> in the same way that properties for other
57   * <tt>Role</tt> objects are.
58   *
59   * @version $Revision: 1.4 $
60   * @author Open Services Gateway Initiative
61   */
62  
63  public interface Role {
64  
65    /**
66     * The type of a predefined role.
67     *
68     * <p>The value of <tt>ROLE</tt> is 0.
69     */
70    public static final int ROLE = 0;
71  
72    /**
73     * The type of a {@link User}role.
74     *
75     * <p>The value of <tt>USER</tt> is 1.
76     */
77    public static final int USER = 1;
78  
79    /**
80     * The type of a {@link Group}role.
81     *
82     * <p>The value of <tt>GROUP</tt> is 2.
83     */
84    public static final int GROUP = 2;
85  
86    /**
87     * Returns the name of this role.
88     *
89     * @return The role's name.
90     */
91    public String getName();
92  
93    /**
94     * Returns the type of this role.
95     *
96     * @return The role's type.
97     */
98    public int getType();
99  
100   /**
101    * Returns a <tt>Dictionary</tt> of the (public) properties of this <tt>Role</tt> object. Any changes
102    * to the returned <tt>Dictionary</tt> will change the properties of this <tt>Role</tt> object. This
103    * will cause a <tt>UserAdminEvent</tt> object of type {@link UserAdminEvent#ROLE_CHANGED}to 
104    * be broadcast to any <tt>UserAdminListener</tt> objects.
105    * 
106    * <p>Only objects of type <tt>String</tt> may be used as property keys, and
107    * only objects of type <tt>String</tt> or <tt>byte[]</tt>
108    * may be used as property values.
109    * Any other types will cause an exception of type
110    * <tt>IllegalArgumentException</tt> to be raised.
111    * 
112    * <p>In order to add, change, or remove a property in the returned <tt>Dictionary</tt>,
113    * a {@link UserAdminPermission}named after the property name (or
114    * a prefix of it) with action <code>changeProperty</code> is required.
115    *
116    * @return <tt>Dictionary</tt> containing the properties of this <tt>Role</tt> object.
117    */
118   public Dictionary getProperties();
119 }