jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/AclEntryImpl.java
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 5506 jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/AclEntryImpl.java@202f599c92aa
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package com.sun.jmx.snmp.IPAcl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.security.acl.Permission;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.net.UnknownHostException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.security.Principal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.security.acl.AclEntry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * Represent one entry in the Access Control List (ACL).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * This ACL entry object contains a permission associated with a particular principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * (A principal represents an entity such as an individual machine or a group).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @see java.security.acl.AclEntry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
class AclEntryImpl implements AclEntry, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  private static final long serialVersionUID = -5047185131260073216L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        setPrincipal(i.getPrincipal());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        permList = new Vector<Permission>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        commList = new Vector<String>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        for (Enumeration<String> en = i.communities(); en.hasMoreElements();){
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
          addCommunity(en.nextElement());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        for (Enumeration<Permission> en = i.permissions(); en.hasMoreElements();){
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
          addPermission(en.nextElement());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        if (i.isNegative()) setNegativePermissions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
   * Contructs an empty ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  public AclEntryImpl (){
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        princ = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        permList = new Vector<Permission>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        commList = new Vector<String>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
   * Constructs an ACL entry with a specified principal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
   * @param p the principal to be set for this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
  public AclEntryImpl (Principal p) throws UnknownHostException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        princ = p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        permList = new Vector<Permission>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        commList = new Vector<String>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
   * Clones this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
   * @return a clone of this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
  public Object clone() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        AclEntryImpl i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
          i = new AclEntryImpl(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        }catch (UnknownHostException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
          i = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        return (Object) i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
   * Returns true if this is a negative ACL entry (one denying the associated principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
   * the set of permissions in the entry), false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
   * @return true if this is a negative ACL entry, false if it's not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  public boolean isNegative(){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        return neg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
   * Adds the specified permission to this ACL entry. Note: An entry can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
   * have multiple permissions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
   * @param perm the permission to be associated with the principal in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
   *        entry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
   * @return true if the permission is removed, false if the permission was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
   *         not part of this entry's permission set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
  public boolean addPermission(java.security.acl.Permission perm){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        if (permList.contains(perm)) return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        permList.addElement(perm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
   * Removes the specified permission from this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
   * @param perm the permission to be removed from this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
   * @return true if the permission is removed, false if the permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
   *         was not part of this entry's permission set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  public boolean removePermission(java.security.acl.Permission perm){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        if (!permList.contains(perm)) return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        permList.removeElement(perm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
   * Checks if the specified permission is part of the permission set in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
   * this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
   * @param perm the permission to be checked for.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
   * @return true if the permission is part of the permission set in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
   *         entry, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
  public boolean checkPermission(java.security.acl.Permission perm){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        return (permList.contains(perm));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
   * Returns an enumeration of the permissions in this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
   * @return an enumeration of the permissions in this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
  public Enumeration<Permission> permissions(){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        return permList.elements();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
   * Sets this ACL entry to be a negative one. That is, the associated principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
   * (e.g., a user or a group) will be denied the permission set specified in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
   * entry. Note: ACL entries are by default positive. An entry becomes a negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
   * entry only if this setNegativePermissions method is called on it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
   * Not Implemented.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
  public void setNegativePermissions(){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        neg = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
   * Returns the principal for which permissions are granted or denied by this ACL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
   * entry. Returns null if there is no principal set for this entry yet.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
   * @return the principal associated with this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
  public Principal getPrincipal(){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        return princ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
   * Specifies the principal for which permissions are granted or denied by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
   * this ACL entry. If a principal was already set for this ACL entry,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
   * false is returned, otherwise true is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
   * @param p the principal to be set for this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
   * @return true if the principal is set, false if there was already a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
   *         principal set for this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
  public boolean setPrincipal(Principal p) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        if (princ != null )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
          return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        princ = p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
   * Returns a string representation of the contents of this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
   * @return a string representation of the contents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
  public String toString(){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        return "AclEntry:"+princ.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
   * Returns an enumeration of the communities in this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
   * @return an enumeration of the communities in this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
  public Enumeration<String> communities(){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        return commList.elements();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
   * Adds the specified community to this ACL entry. Note: An entry can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
   * have multiple communities.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
   * @param comm the community to be associated with the principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
   *        in this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
   * @return true if the community was added, false if the community was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
   *         already part of this entry's community set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
  public boolean addCommunity(String comm){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        if (commList.contains(comm)) return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        commList.addElement(comm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
   * Removes the specified community from this ACL entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
   * @param comm the community  to be removed from this entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
   * @return true if the community is removed, false if the community was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
   *         not part of this entry's community set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
  public boolean removeCommunity(String comm){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        if (!commList.contains(comm)) return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        commList.removeElement(comm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
   * Checks if the specified community is part of the community set in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
   * entry.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
   * @param  comm the community to be checked for.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
   * @return true if the community is part of the community set in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
   *         entry, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
  public boolean checkCommunity(String comm){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        return (commList.contains(comm));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
  private Principal princ = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
  private boolean neg     = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
  private Vector<Permission> permList = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
  private Vector<String> commList = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
}