nn.pp.vmcore

## Interface VirtualMediaEventListener

- All Known Implementing Classes:
    VMAdapter

      public interface VirtualMediaEventListener

  A listener for any events which might occur during a Virtual Media session
  See Also:
    `VMCore.addVirtualMediaEventListener(VirtualMediaEventListener, int)`, `VMCore.removeVirtualMediaEventListener(VirtualMediaEventListener)`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `VirtualMediaEventListener.LockFailAction` The user's decision about what to do if the drive locking failed

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ALL` All registration bits
    `static int` | `DRIVE_CONNECTED` Registration bit for drive connected events
    `static int` | `DRIVE_DISCONNECTED_BY_USER` Registration bit for drive disconnected events
    `static int` | `DRIVE_LOCKING` Registration bit for drive locking related events

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `disconnected(java.lang.Exception e)` The Connection has been dropped.
    `void` | `driveConnected()` The Virtual Media Drive has been successfully connected and the initial handshake has been processed.
    `void` | `driveDisconnectedByUser()` The Virtual Media Drive has been disconnected by User.
    `VirtualMediaEventListener.LockFailAction` | `driveLockingFailed()` Locking access to a drive failed.

- - ### Field Detail

    - #### DRIVE_LOCKING

          static final int DRIVE_LOCKING

      Registration bit for drive locking related events
      See Also:
        Constant Field Values

    - #### DRIVE_CONNECTED

          static final int DRIVE_CONNECTED

      Registration bit for drive connected events
      See Also:
        Constant Field Values

    - #### DRIVE_DISCONNECTED_BY_USER

          static final int DRIVE_DISCONNECTED_BY_USER

      Registration bit for drive disconnected events
      See Also:
        Constant Field Values

    - #### ALL

          static final int ALL

      All registration bits
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### driveConnected

          void driveConnected()

      The Virtual Media Drive has been successfully connected and the initial handshake has been processed.

      This event is sent when registered with the `DRIVE_CONNECTED` event mask.

    - #### driveDisconnectedByUser

          void driveDisconnectedByUser()

      The Virtual Media Drive has been disconnected by User.

      This event is sent when registered with the `DRIVE_DISCONNECTED_BY_USER` event mask.

    - #### disconnected

          void disconnected(java.lang.Exception e)

      The Connection has been dropped.

      This event is always sent, mask is ignored.

      Parameters:
        `e` - The exception which caused the disconnect. May be null if disconnect was not caused by an exception.

    - #### driveLockingFailed

          VirtualMediaEventListener.LockFailAction driveLockingFailed()

      Locking access to a drive failed.

      The `VMCore` tries to lock access to a drive if a virtual media session is established. This will prevent other processes from accessing this drive. Only with locked drives, virtual media operations may be performed safely. If drive locking failed and the caller decided that he wanted to be asked in this case (`VMCore.LockFailBehavior.ASK`), it's up to the caller to decide what to do now.

      The handler's return value decides the further behavior. If no `VirtualMediaEventListener` Handlers are registered or null is returned, the underlying implementation will behave as if `VirtualMediaEventListener.LockFailAction.CANCEL` was returned and cancel the virtual media session.

      Meaning of the return values:

      - `VirtualMediaEventListener.LockFailAction.RETRY`: Try locking again. If it fails again, the event will be generated again until it either succeeds or a different value is returned.
      - `VirtualMediaEventListener.LockFailAction.IGNORE`: Ignore the error, go ahead with a non-locked drive.
      - `VirtualMediaEventListener.LockFailAction.CANCEL`: Cancel the Virtual Media session at this point.
      Returns:
        The caller's decision about what to do now.

Copyright © 2025 Raritan Inc. All Rights Reserved.