com.sun.jaw.impl.adaptor.IPacl
Class Jawacl

java.lang.Object
  |
  +--com.sun.jaw.impl.adaptor.IPacl.Jawacl

public class Jawacl
extends java.lang.Object
implements IPAclSrvIf, java.io.Serializable

This class defines an implementation of the IPAclSrvIf interface.

In this implementation the ACL information is stored on a flat file and its default location is specified in the following order:

  1. The value of the jaw.acl.file property.
  2. The return value of getEtcDir("conf"+File.separator+"jaw.acl") in class DefaultPaths.

See Also:
Serialized Form

Constructor Summary
Jawacl(java.lang.String Owner)
          Constructs the Java Dynamic Management Access Control List based on IP addresses.
 
Method Summary
 boolean checkCommunity(java.lang.String community)
          Checks whether or not a community string is defined.
 boolean checkReadPermission(java.net.InetAddress address)
          Checks whether or not the specified host has READ access.
 boolean checkReadPermission(java.net.InetAddress address, java.lang.String community)
          Checks whether or not the specified host and community have READ access.
 boolean checkWritePermission(java.net.InetAddress address)
          Checks whether or not the specified host has WRITE access.
 boolean checkWritePermission(java.net.InetAddress address, java.lang.String community)
          Checks whether or not the specified host and community have WRITE access.
 java.util.Enumeration entries()
          Returns an enumeration of the entries in this ACL.
 java.lang.String getAuthorizedListFile()
          Returns the full path of the file used to get ACL informations.
 java.lang.String getName()
          Returns the name of the ACL.
static com.sun.jaw.impl.adaptor.IPacl.internal.PermissionImpl getREAD()
          Returns the read permission instance used.
 java.util.Enumeration getTrapCommunities(java.net.InetAddress i)
          Returns an enumeration of trap communities for a given host.
 java.util.Enumeration getTrapDestinations()
          Returns an enumeration of trap destinations.
static com.sun.jaw.impl.adaptor.IPacl.internal.PermissionImpl getWRITE()
          Returns the write permission instance used.
 void rereadTheFile()
          Resets this ACL to the values contained in the configuration file.
 void setAuthorizedListFile(java.lang.String filename)
          Sets the full path of the file containing the ACL informations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jawacl

public Jawacl(java.lang.String Owner)
       throws java.net.UnknownHostException
Constructs the Java Dynamic Management Access Control List based on IP addresses. The ACL will take the given owner name. The current IP address will be the owner of the ACL.
Parameters:
owner - The name of the ACL.
Throws:
java.net.UnknownHostException - if the local host is unknown.
Method Detail

entries

public java.util.Enumeration entries()
Returns an enumeration of the entries in this ACL. Each element in the enumeration is of type java.security.acl.AclEntry.
Returns:
an enumeration of the entries in this ACL.

getName

public java.lang.String getName()
Returns the name of the ACL.
Specified by:
getName in interface IPAclSrvIf
Returns:
the name of the ACL.

getREAD

public static com.sun.jaw.impl.adaptor.IPacl.internal.PermissionImpl getREAD()
Returns the read permission instance used.
Returns:
the read permission instance.

getWRITE

public static com.sun.jaw.impl.adaptor.IPacl.internal.PermissionImpl getWRITE()
Returns the write permission instance used.
Returns:
the write permission instance.

setAuthorizedListFile

public void setAuthorizedListFile(java.lang.String filename)
Sets the full path of the file containing the ACL informations.
Parameters:
filename - the full path of the file containing the ACL informations.

rereadTheFile

public void rereadTheFile()
                   throws java.security.acl.NotOwnerException,
                          java.net.UnknownHostException
Resets this ACL to the values contained in the configuration file.
Throws:
java.security.acl.NotOwnerException - if the principal attempting the reset is not an owner of this ACL.
java.net.UnknownHostException - if IP addresses for hosts contained in the ACL file couldn't be found.

getAuthorizedListFile

public java.lang.String getAuthorizedListFile()
Returns the full path of the file used to get ACL informations.
Returns:
the full path of the file used to get ACL informations.

checkReadPermission

public boolean checkReadPermission(java.net.InetAddress address)
Checks whether or not the specified host has READ access.
Specified by:
checkReadPermission in interface IPAclSrvIf
Parameters:
address - the host address to check.
Returns:
true if the host has read permission, false otherwise.

checkReadPermission

public boolean checkReadPermission(java.net.InetAddress address,
                                   java.lang.String community)
Checks whether or not the specified host and community have READ access.
Specified by:
checkReadPermission in interface IPAclSrvIf
Parameters:
address - the host address to check.
community - the community associated with the host.
Returns:
true if the pair (host, community) has read permission, false otherwise.

checkCommunity

public boolean checkCommunity(java.lang.String community)
Checks whether or not a community string is defined.
Specified by:
checkCommunity in interface IPAclSrvIf
Parameters:
community - the community to check.
Returns:
true if the community is known, false otherwise.

checkWritePermission

public boolean checkWritePermission(java.net.InetAddress address)
Checks whether or not the specified host has WRITE access.
Specified by:
checkWritePermission in interface IPAclSrvIf
Parameters:
address - the host address to check.
Returns:
true if the host has write permission, false otherwise.

checkWritePermission

public boolean checkWritePermission(java.net.InetAddress address,
                                    java.lang.String community)
Checks whether or not the specified host and community have WRITE access.
Specified by:
checkWritePermission in interface IPAclSrvIf
Parameters:
address - the host address to check.
community - the community associated with the host.
Returns:
true if the pair (host, community) has write permission, false otherwise.

getTrapDestinations

public java.util.Enumeration getTrapDestinations()
Returns an enumeration of trap destinations.
Specified by:
getTrapDestinations in interface IPAclSrvIf
Returns:
an enumeration of the trap destinations.

getTrapCommunities

public java.util.Enumeration getTrapCommunities(java.net.InetAddress i)
Returns an enumeration of trap communities for a given host.
Specified by:
getTrapCommunities in interface IPAclSrvIf
Parameters:
i - the address of the host.
Returns:
an enumeration of trap communities for a given host.