- java.lang.Object
-
- org.snmp4j.agent.mo.MOAccessImpl
-
- All Implemented Interfaces:
MOAccess
- Direct Known Subclasses:
SimMOFactory.SimMOAccess
public class MOAccessImpl extends Object implements MOAccess
TheMOAccessImplclass implements an immutableMOAccess. For special purposes, it can be sub-classed to modify access dynamically, for example to build an simulation agent where objects may be modified in a certain mode even if they are read-only normally.- Version:
- 1.0
- Author:
- Frank Fock
-
-
Field Summary
Fields Modifier and Type Field Description static MOAccessACCESS_FOR_NOTIFYstatic MOAccessACCESS_READ_CREATEstatic MOAccessACCESS_READ_ONLYstatic MOAccessACCESS_READ_WRITEstatic MOAccessACCESS_WRITE_ONLYstatic shortACCESSIBLE_FOR_CREATEstatic shortACCESSIBLE_FOR_NOTIFYstatic shortACCESSIBLE_FOR_READstatic shortACCESSIBLE_FOR_READ_CREATEstatic shortACCESSIBLE_FOR_READ_ONLYstatic shortACCESSIBLE_FOR_READ_WRITEstatic shortACCESSIBLE_FOR_WRITE
-
Constructor Summary
Constructors Constructor Description MOAccessImpl(int access)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringasString()Return the access rights as string where rights are separated by the pipe symbol (|).shortgetAccess()Returns the internal access ID.static MOAccessgetInstance(int moAccess)Returns the appropriateMOAccessinstance for the supplied access ID.booleanisAccessibleForCreate()Check whether the managed object can be created (through a SET request on a non existant instance of a columnar object).booleanisAccessibleForNotify()Check whether the managed object can be send in a notification.booleanisAccessibleForRead()Check whether the managed object can be read (i.e.booleanisAccessibleForWrite()Check whether the managed object can be written (i.e.StringtoString()
-
-
-
Field Detail
-
ACCESSIBLE_FOR_READ
public static final short ACCESSIBLE_FOR_READ
- See Also:
- Constant Field Values
-
ACCESSIBLE_FOR_WRITE
public static final short ACCESSIBLE_FOR_WRITE
- See Also:
- Constant Field Values
-
ACCESSIBLE_FOR_CREATE
public static final short ACCESSIBLE_FOR_CREATE
- See Also:
- Constant Field Values
-
ACCESSIBLE_FOR_NOTIFY
public static final short ACCESSIBLE_FOR_NOTIFY
- See Also:
- Constant Field Values
-
ACCESSIBLE_FOR_READ_ONLY
public static final short ACCESSIBLE_FOR_READ_ONLY
- See Also:
- Constant Field Values
-
ACCESSIBLE_FOR_READ_WRITE
public static final short ACCESSIBLE_FOR_READ_WRITE
- See Also:
- Constant Field Values
-
ACCESSIBLE_FOR_READ_CREATE
public static final short ACCESSIBLE_FOR_READ_CREATE
- See Also:
- Constant Field Values
-
ACCESS_READ_ONLY
public static final MOAccess ACCESS_READ_ONLY
-
ACCESS_FOR_NOTIFY
public static final MOAccess ACCESS_FOR_NOTIFY
-
ACCESS_WRITE_ONLY
public static final MOAccess ACCESS_WRITE_ONLY
-
ACCESS_READ_WRITE
public static final MOAccess ACCESS_READ_WRITE
-
ACCESS_READ_CREATE
public static final MOAccess ACCESS_READ_CREATE
-
-
Method Detail
-
isAccessibleForRead
public boolean isAccessibleForRead()
Description copied from interface:MOAccessCheck whether the managed object can be read (i.e. accessed by GET, GETNEXT, or GETBULK requests).- Specified by:
isAccessibleForReadin interfaceMOAccess- Returns:
trueif the managed object instance(s) can be read.
-
isAccessibleForWrite
public boolean isAccessibleForWrite()
Description copied from interface:MOAccessCheck whether the managed object can be written (i.e. accessed by SET requests).- Specified by:
isAccessibleForWritein interfaceMOAccess- Returns:
trueif the managed object instance(s) can be written.
-
isAccessibleForNotify
public boolean isAccessibleForNotify()
Description copied from interface:MOAccessCheck whether the managed object can be send in a notification.- Specified by:
isAccessibleForNotifyin interfaceMOAccess- Returns:
trueif the managed object instance(s) can be send in a notification.
-
isAccessibleForCreate
public boolean isAccessibleForCreate()
Description copied from interface:MOAccessCheck whether the managed object can be created (through a SET request on a non existant instance of a columnar object).- Specified by:
isAccessibleForCreatein interfaceMOAccess- Returns:
trueif the managed object instance(s) can be created.
-
getAccess
public final short getAccess()
Returns the internal access ID.- Returns:
- a short value identifying the configured access level.
-
getInstance
public static MOAccess getInstance(int moAccess)
Returns the appropriateMOAccessinstance for the supplied access ID. If that ID matches one of the standard access levels defined by this class, then that instance is returned. Otherwise, a new instance will be created with that access ID.- Parameters:
moAccess- a bitwise OR combination of the basic access levels defined by this class.- Returns:
- a MOAccess instance.
-
asString
public String asString()
Return the access rights as string where rights are separated by the pipe symbol (|).- Returns:
- the access rights as pipe symbol separated string, for example "read|write" if
isAccessibleForRead()andisAccessibleForWrite()returntrue(and all other returnfalse). - Since:
- 2.5.0
-
-