FileDocCategorySizeDatePackage
AclEntryImpl.javaAPI DocJava SE 5 API6911Fri Aug 26 14:55:00 BST 2005com.sun.jmx.snmp.IPAcl

AclEntryImpl

public class AclEntryImpl extends Object implements Serializable, java.security.acl.AclEntry
Represent one entry in the Access Control List (ACL). This ACL entry object contains a permission associated with a particular principal. (A principal represents an entity such as an individual machine or a group).
see
java.security.acl.AclEntry
version
4.11 12/19/03
author
Sun Microsystems, Inc

Fields Summary
private Principal
princ
private boolean
neg
private Vector
permList
private Vector
commList
Constructors Summary
private AclEntryImpl(AclEntryImpl i)

	setPrincipal(i.getPrincipal());
	permList = new Vector();
	commList = new Vector();
	
	for (Enumeration en = i.communities(); en.hasMoreElements();){
	  addCommunity((String)en.nextElement());
	}
	
	for (Enumeration en = i.permissions(); en.hasMoreElements();){
	  addPermission((java.security.acl.Permission)en.nextElement());
	}
	if (i.isNegative()) setNegativePermissions();
  
public AclEntryImpl()
Contructs an empty ACL entry.

	princ = null;
	permList = new Vector();
	commList = new Vector();
  
public AclEntryImpl(Principal p)
Constructs an ACL entry with a specified principal.

param
p the principal to be set for this entry.

	princ = p;
	permList = new Vector();
	commList = new Vector();
  
Methods Summary
public booleanaddCommunity(java.lang.String comm)
Adds the specified community to this ACL entry. Note: An entry can have multiple communities.

param
comm the community to be associated with the principal in this entry.
return
true if the community was added, false if the community was already part of this entry's community set.

	if (commList.contains(comm)) return false;
	commList.addElement(comm);
	return true;
  
public booleanaddPermission(java.security.acl.Permission perm)
Adds the specified permission to this ACL entry. Note: An entry can have multiple permissions.

param
perm the permission to be associated with the principal in this entry
return
true if the permission is removed, false if the permission was not part of this entry's permission set.

	if (permList.contains(perm)) return false;
	permList.addElement(perm);
	return true;
  
public booleancheckCommunity(java.lang.String comm)
Checks if the specified community is part of the community set in this entry.

param
comm the community to be checked for.
return
true if the community is part of the community set in this entry, false otherwise.

	return (commList.contains(comm));
  
public booleancheckPermission(java.security.acl.Permission perm)
Checks if the specified permission is part of the permission set in this entry.

param
perm the permission to be checked for.
return
true if the permission is part of the permission set in this entry, false otherwise.

	return (permList.contains(perm));
  
public java.lang.Objectclone()
Clones this ACL entry.

return
a clone of this ACL entry.

	AclEntryImpl i;
	try {
	  i = new AclEntryImpl(this);
	}catch (UnknownHostException e) {
	  i = null;
	}
	return (Object) i;
  
public java.util.Enumerationcommunities()
Returns an enumeration of the communities in this ACL entry.

return
an enumeration of the communities in this ACL entry.

	return commList.elements();
  
public java.security.PrincipalgetPrincipal()
Returns the principal for which permissions are granted or denied by this ACL entry. Returns null if there is no principal set for this entry yet.

return
the principal associated with this entry.

	return princ;
  
public booleanisNegative()
Returns true if this is a negative ACL entry (one denying the associated principal the set of permissions in the entry), false otherwise.

return
true if this is a negative ACL entry, false if it's not.

	return neg;
  
public java.util.Enumerationpermissions()
Returns an enumeration of the permissions in this ACL entry.

return
an enumeration of the permissions in this ACL entry.

	return permList.elements();
  
public booleanremoveCommunity(java.lang.String comm)
Removes the specified community from this ACL entry.

param
comm the community to be removed from this entry.
return
true if the community is removed, false if the community was not part of this entry's community set.

	if (!commList.contains(comm)) return false;
	commList.removeElement(comm);
	return true;
  
public booleanremovePermission(java.security.acl.Permission perm)
Removes the specified permission from this ACL entry.

param
perm the permission to be removed from this entry.
return
true if the permission is removed, false if the permission was not part of this entry's permission set.

	if (!permList.contains(perm)) return false;
	permList.removeElement(perm);
	return true;
  
public voidsetNegativePermissions()
Sets this ACL entry to be a negative one. That is, the associated principal (e.g., a user or a group) will be denied the permission set specified in the entry. Note: ACL entries are by default positive. An entry becomes a negative entry only if this setNegativePermissions method is called on it. Not Implemented.

	neg = true;
  
public booleansetPrincipal(java.security.Principal p)
Specifies the principal for which permissions are granted or denied by this ACL entry. If a principal was already set for this ACL entry, false is returned, otherwise true is returned.

param
p the principal to be set for this entry.
return
true if the principal is set, false if there was already a principal set for this entry.

	if (princ != null ) 
	  return false;
	princ = p;
	return true;
  
public java.lang.StringtoString()
Returns a string representation of the contents of this ACL entry.

return
a string representation of the contents.

	return "AclEntry:"+princ.toString();