Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.management.snmp.IPAcl
Class JdmkAcl

    java.lang.Object
      com.sun.management.snmp.IPAcl.JdmkAcl

All Implemented Interfaces:
  InetAddressAcl, Serializable

public class JdmkAcl
extends Object
implements InetAddressAcl, Serializable

Defines an implementation of the `InetAddressAcl` 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 `jdmk.acl.file` property.
2. The return value of `getEtcDir("conf" + File.separator + "jdmk.acl")` in class `DefaultPaths`.

Since:
  Java DMK 5.1
Version:
  4.38 11/29/06
Author:
  Sun Microsystems, Inc
See Also:
  Serialized Form

Constructor Summary
`JdmkAcl(String name)` Constructs the Java Dynamic Management(TM) Access Control List based on IP addresses.
`JdmkAcl(String name, String fileName)` Constructs the Java Dynamic Management(TM) Access Control List based on IP addresses.

Method Summary
`boolean` | `checkCommunity(String community)` Checks whether or not a community string is defined.
`boolean` | `checkReadPermission(InetAddress address)` Checks whether or not the specified host has `READ` access.
`boolean` | `checkReadPermission(InetAddress address, String community)` Checks whether or not the specified host and community have `READ` access.
`boolean` | `checkWritePermission(InetAddress address)` Checks whether or not the specified host has `WRITE` access.
`boolean` | `checkWritePermission(InetAddress address, String community)` Checks whether or not the specified host and community have `WRITE` access.
`Enumeration` | `communities()` Returns an enumeration of community strings.
`Enumeration` | `entries()` Returns an enumeration of the entries in this ACL.
`String` | `getAuthorizedListFile()` Returns the full path of the file used to get ACL information.
`Enumeration` | `getInformCommunities(InetAddress i)` Returns an enumeration of inform communities for a given host.
`Enumeration` | `getInformDestinations()` Returns an enumeration of inform destinations.
`String` | `getName()` Returns the name of the ACL.
`static com.sun.management.snmp.IPAcl.PermissionImpl` | `getREAD()` Returns the read permission instance used.
`Enumeration` | `getTrapCommunities(InetAddress i)` Returns an enumeration of trap communities for a given host.
`Enumeration` | `getTrapDestinations()` Returns an enumeration of trap destinations.
`static com.sun.management.snmp.IPAcl.PermissionImpl` | `getWRITE()` Returns the write permission instance used.
`void` | `rereadTheFile()` Resets this ACL to the values contained in the configuration file.
`void` | `setAuthorizedListFile(String filename)` Sets the full path of the file containing the ACL information.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JdmkAcl

    public JdmkAcl(String name,
                   String fileName)
            throws UnknownHostException,
                   IllegalArgumentException

  Constructs the Java Dynamic Management(TM) Access Control List based on IP addresses. The ACL will take the given owner name. The ACL will take the given acl file. The current IP address will be the owner of the ACL.

Parameters:
  `name` - The name of the ACL.
  `fileName` - The name of the ACL file.
Throws:
  `UnknownHostException` - If the local host is unknown.
  `IllegalArgumentException` - If the ACL file doesn't exist.

### JdmkAcl

    public JdmkAcl(String name)
            throws UnknownHostException,
                   IllegalArgumentException

  Constructs the Java Dynamic Management(TM) 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:
  `name` - The name of the ACL.
Throws:
  `UnknownHostException` - If the local host is unknown. Thrown only if this class is instantiated internally by `SnmpAdaptorServer` or `SnmpV3AdaptorServer` .
  `IllegalArgumentException` - If the ACL file doesn't exist.

Method Detail

### entries

    public 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.

### communities

    public Enumeration communities()

  Returns an enumeration of community strings. Community strings are returned as String.

  Returns:
    The enumeration of community strings.

### getName

    public String getName()

  Returns the name of the ACL.

  Specified by:
    `getName` in interface `InetAddressAcl`
  Returns:
    The name of the ACL.

### getREAD

    public static com.sun.management.snmp.IPAcl.PermissionImpl getREAD()

  Returns the read permission instance used.

  Returns:
    The read permission instance.

### getWRITE

    public static com.sun.management.snmp.IPAcl.PermissionImpl getWRITE()

  Returns the write permission instance used.

  Returns:
    The write permission instance.

### setAuthorizedListFile

    public void setAuthorizedListFile(String filename)
                               throws IllegalArgumentException,
                                      NotOwnerException,
                                      UnknownHostException

  Sets the full path of the file containing the ACL information. Setting a file makes the previous loaded ACL configuration to be cleared. Access control is based on this new file. If `IllegalArgumentException` is thrown, the previous existing ACL configuration is not cleared.

  Parameters:
    `filename` - The full path of the file containing the ACL information.
  Throws:
    `IllegalArgumentException` - If the passed ACL file is null or doesn't exist.
    `NotOwnerException` - This exception is never thrown.
    `UnknownHostException` - If IP addresses for hosts contained in the ACL file couldn't be found.

### rereadTheFile

    public void rereadTheFile()
                       throws NotOwnerException,
                              UnknownHostException

  Resets this ACL to the values contained in the configuration file.

  Throws:
    `NotOwnerException` - If the principal attempting the reset is not an owner of this ACL.
    `UnknownHostException` - If IP addresses for hosts contained in the ACL file couldn't be found.

### getAuthorizedListFile

    public String getAuthorizedListFile()

  Returns the full path of the file used to get ACL information.

  Returns:
    The full path of the file used to get ACL information.

### checkReadPermission

    public boolean checkReadPermission(InetAddress address)

  Checks whether or not the specified host has `READ` access.

  Specified by:
    `checkReadPermission` in interface `InetAddressAcl`
  Parameters:
    `address` - The host address to check.
  Returns:
    `true` if the host has read permission, `false` otherwise.

### checkReadPermission

    public boolean checkReadPermission(InetAddress address,
                                       String community)

  Checks whether or not the specified host and community have `READ` access.

  Specified by:
    `checkReadPermission` in interface `InetAddressAcl`
  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(String community)

  Checks whether or not a community string is defined.

  Specified by:
    `checkCommunity` in interface `InetAddressAcl`
  Parameters:
    `community` - The community to check.
  Returns:
    `true` if the community is known, `false` otherwise.

### checkWritePermission

    public boolean checkWritePermission(InetAddress address)

  Checks whether or not the specified host has `WRITE` access.

  Specified by:
    `checkWritePermission` in interface `InetAddressAcl`
  Parameters:
    `address` - The host address to check.
  Returns:
    `true` if the host has write permission, `false` otherwise.

### checkWritePermission

    public boolean checkWritePermission(InetAddress address,
                                        String community)

  Checks whether or not the specified host and community have `WRITE` access.

  Specified by:
    `checkWritePermission` in interface `InetAddressAcl`
  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 Enumeration getTrapDestinations()

  Returns an enumeration of trap destinations.

  Specified by:
    `getTrapDestinations` in interface `InetAddressAcl`
  Returns:
    An enumeration of the trap destinations (enumeration of `InetAddress`).``

### getTrapCommunities

    public Enumeration getTrapCommunities(InetAddress i)

  Returns an enumeration of trap communities for a given host.

  Specified by:
    `getTrapCommunities` in interface `InetAddressAcl`
  Parameters:
    `i` - The address of the host.
  Returns:
    An enumeration of trap communities for a given host (enumeration of `String`).``

### getInformDestinations

    public Enumeration getInformDestinations()

  Returns an enumeration of inform destinations.

  Specified by:
    `getInformDestinations` in interface `InetAddressAcl`
  Returns:
    An enumeration of the inform destinations (enumeration of `InetAddress`).``

### getInformCommunities

    public Enumeration getInformCommunities(InetAddress i)

  Returns an enumeration of inform communities for a given host.

  Specified by:
    `getInformCommunities` in interface `InetAddressAcl`
  Parameters:
    `i` - The address of the host.
  Returns:
    An enumeration of inform communities for a given host (enumeration of `String`).``

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| FCS Release jdmk-5_1-b34.3 2007.01.18_18:11:52_MET
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.