nn.pp.vmcore

## Class VMAdapter

- java.lang.Object
- - nn.pp.vmcore.VMAdapter

- All Implemented Interfaces:
    java.util.EventListener, NotificationListener, VirtualMediaEventListener

      public class VMAdapter
      extends java.lang.Object
      implements NotificationListener, VirtualMediaEventListener

  This is a helper class which implements all the listener interfaces used by the `VirtualMediaEventListener` interface. If you want to implement these interfaces, you can derive from this class instead and just overwrite the methods you really need.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `VMAdapter.Consumer<T>`
    `static interface` | `VMAdapter.Supplier<T>`

    - ### Nested classes/interfaces inherited from interface nn.pp.vmcore.VirtualMediaEventListener

      `VirtualMediaEventListener.LockFailAction`

  - ### Field Summary

    - ### Fields inherited from interface nn.pp.vmcore.VirtualMediaEventListener

      `ALL, DRIVE_CONNECTED, DRIVE_DISCONNECTED_BY_USER, DRIVE_LOCKING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VMAdapter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `disconnected(java.lang.Exception e)` The Connection has been dropped.
    `VirtualMediaEventListener` | `disconnected(VMAdapter.Consumer<java.lang.Exception> c)`
    `void` | `driveConnected()` The Virtual Media Drive has been successfully connected and the initial handshake has been processed.
    `VirtualMediaEventListener` | `driveConnected(java.lang.Runnable r)`
    `void` | `driveDisconnectedByUser()` The Virtual Media Drive has been disconnected by User.
    `VirtualMediaEventListener` | `driveDisconnectedByUser(java.lang.Runnable r)`
    `VirtualMediaEventListener.LockFailAction` | `driveLockingFailed()` Locking access to a drive failed.
    `VirtualMediaEventListener` | `driveLockingFailed(VMAdapter.Supplier<VirtualMediaEventListener.LockFailAction> s)`
    `void` | `receivedNotification(INotificationEvent e)` A `NotificationEvent` has been received and shall be delivered.
    `NotificationListener` | `receivedNotification(VMAdapter.Consumer<INotificationEvent> c)`
    `void` | `textNotification(java.lang.String s)` An interesting event in text form should be delivered
    `NotificationListener` | `textNotification(VMAdapter.Consumer<java.lang.String> c)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VMAdapter

          public VMAdapter()

  - ### Method Detail

    - #### textNotification

          public void textNotification(java.lang.String s)

      Description copied from interface: `NotificationListener`
      An interesting event in text form should be delivered
      Specified by:
        `textNotification` in interface `NotificationListener`
      Parameters:
        `s` - The text event to deliver

    - #### receivedNotification

          public void receivedNotification(INotificationEvent e)

      Description copied from interface: `NotificationListener`
      A `NotificationEvent` has been received and shall be delivered.
      Specified by:
        `receivedNotification` in interface `NotificationListener`
      Parameters:
        `e` - The received event to deliver

    - #### disconnected

          public void disconnected(java.lang.Exception e)

      Description copied from interface: `VirtualMediaEventListener`

      The Connection has been dropped.

      This event is always sent, mask is ignored.

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

    - #### driveLockingFailed

          public VirtualMediaEventListener.LockFailAction driveLockingFailed()

      Description copied from interface: `VirtualMediaEventListener`

      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.
      Specified by:
        `driveLockingFailed` in interface `VirtualMediaEventListener`
      Returns:
        The caller's decision about what to do now.

    - #### driveConnected

          public void driveConnected()

      Description copied from interface: `VirtualMediaEventListener`

      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.

      Specified by:
        `driveConnected` in interface `VirtualMediaEventListener`

    - #### driveDisconnectedByUser

          public void driveDisconnectedByUser()

      Description copied from interface: `VirtualMediaEventListener`

      The Virtual Media Drive has been disconnected by User.

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

      Specified by:
        `driveDisconnectedByUser` in interface `VirtualMediaEventListener`

    - #### textNotification

          public NotificationListener textNotification(VMAdapter.Consumer<java.lang.String> c)

    - #### receivedNotification

          public NotificationListener receivedNotification(VMAdapter.Consumer<INotificationEvent> c)

    - #### disconnected

          public VirtualMediaEventListener disconnected(VMAdapter.Consumer<java.lang.Exception> c)

    - #### driveLockingFailed

          public VirtualMediaEventListener driveLockingFailed(VMAdapter.Supplier<VirtualMediaEventListener.LockFailAction> s)

    - #### driveConnected

          public VirtualMediaEventListener driveConnected(java.lang.Runnable r)

    - #### driveDisconnectedByUser

          public VirtualMediaEventListener driveDisconnectedByUser(java.lang.Runnable r)

Copyright © 2025 Raritan Inc. All Rights Reserved.