Class VirtualizationService

java.lang.Object
de.bytestore.hostinger.process.service.VirtualizationService

@Component @Service public class VirtualizationService extends Object
The VirtualizationService class provides an interface for managing and interacting with virtualized machines or containers. It supports operations such as creating, listing, starting, stopping, updating, removing, and retrieving detailed information about virtualized entities. The operations are defined using extension points such as VirtualizedExtensionPoint and are configurable through various settings. Fields in this class manage dependencies and subsystems required to perform virtualization-related operations, such as working with webhooks, external services, and data management utilities. Fields: - log: An instance for logging and tracing operations performed in the virtualization lifecycle. - webhookService: A service to handle and manage webhooks for virtualization events. - guardianService: A service that provides security or access controls for virtualized entities. - moduleService: A service used for managing dynamic modules or extension points in the system. - dataManager: A utility for handling data interactions and persistent storage related to virtualization.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the VirtualizationService class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Counts the number of instances based on the provided VirtualizedType.
    int
    count(String typeIO)
    Counts the number of Virtualized entities that match the given type.
    void
    create(Virtualized virtualizedIO)
    Executes the create action for the given Virtualized object.
    current(Virtualized virtualizedIO)
    Retrieves the current state of the virtualized machine by executing the "current" action for all registered VirtualizedExtensionPoint listeners that match the provider.
    getConfig(Virtualized virtualizedIO)
    Retrieves the configuration for the specified Virtualized object.
    getConfig(String providerIO)
     
    getInterfaces(Virtualized virtualizedIO, InterfaceType filterIO, boolean onlyActive)
    Retrieves a list of VirtualizedNetwork objects representing the network interfaces of a virtualized machine / container.
    void
    kill(Virtualized virtualizedIO)
    Executes the kill action for the given Virtualized object.
    Returns a list of VirtualizedExtensionPoint objects.
    listFiles(Virtualized virtualizedIO, StorageType filterIO)
    Retrieves a list of VirtualizedFile objects representing the files in a virtualized machine / container.
    listStorage(Virtualized virtualizedIO, StorageType filterIO)
    Retrieves a list of VirtualizedStorage objects representing the storage information in a virtualized machine / container.
    void
    password(Virtualized virtualizedIO)
    Executes the password action for the specified Virtualized object.
    void
    pause(Virtualized virtualizedIO)
    Pauses the execution of a virtualized machine / container by triggering the pause action for all registered VirtualizedExtensionPoint listeners.
    void
    remove(Virtualized virtualizedIO)
    Removes a virtualized machine by triggering the remove action for all registered VirtualizedExtensionPoint listeners that match the provider of the specified Virtualized object.
    void
    reset(Virtualized virtualizedIO)
    Resets the given Virtualized object.
    void
    resume(Virtualized virtualizedIO)
    Resumes the execution of a virtualized machine / container by triggering the resume action for all registered VirtualizedExtensionPoint listeners.
    void
    start(Virtualized virtualizedIO)
    Starts the virtualized machine by triggering the start action for all registered VirtualizedExtensionPoint listeners.
    stats(Virtualized virtualizedIO)
    Retrieves the process statistics of the virtualized machine / container.
    status(Virtualized virtualizedIO)
    Retrieves the status of a virtualized machine.
    void
    stop(Virtualized virtualizedIO)
    Stops the virtualizedIO by executing the stop action for all VirtualizedListeners.
    void
    update(Virtualized virtualizedIO)
    Updates the given Virtualized object by executing the update action for all registered VirtualizedExtensionPoint listeners that match the provider.
    vnc(Virtualized virtualizedIO)
    Retrieves the VNCSocket object for the given Virtualized machine / Container.
    void
    Registers event types with a class and listener, executes webhooks, and manages webhooks.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VirtualizationService

      public VirtualizationService(WebhookService webhookService)
      Constructor for the VirtualizationService class.
      Parameters:
      webhookService - An instance of WebhookService used to manage webhook-related operations.
  • Method Details

    • webhooks

      public void webhooks()
      Registers event types with a class and listener, executes webhooks, and manages webhooks.
      Since:
      1.0
    • list

      Returns a list of VirtualizedExtensionPoint objects.
      Returns:
      A List of VirtualizedExtensionPoint objects.
    • create

      public void create(Virtualized virtualizedIO)
      Executes the create action for the given Virtualized object. This method triggers the create action for all registered VirtualizedExtensionPoint listeners.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
    • listStorage

      public ArrayList<VirtualizedStorage> listStorage(Virtualized virtualizedIO, StorageType filterIO)
      Retrieves a list of VirtualizedStorage objects representing the storage information in a virtualized machine / container.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      filterIO - The StorageType object specifying the type of storage to retrieve. Use StorageType.UNKNOWN to retrieve all storage.
      Returns:
      An ArrayList of VirtualizedStorage objects representing the storage that meet the specified criteria.
    • listFiles

      public ArrayList<VirtualizedFile> listFiles(Virtualized virtualizedIO, StorageType filterIO)
      Retrieves a list of VirtualizedFile objects representing the files in a virtualized machine / container.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      filterIO - The StorageType object specifying the type of files to retrieve. Use StorageType.UNKNOWN to retrieve all files.
      Returns:
      An ArrayList of VirtualizedFile objects representing the files that meet the specified criteria.
    • getInterfaces

      public ArrayList<VirtualizedNetwork> getInterfaces(Virtualized virtualizedIO, InterfaceType filterIO, boolean onlyActive)
      Retrieves a list of VirtualizedNetwork objects representing the network interfaces of a virtualized machine / container.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      filterIO - The InterfaceType object specifying the type of interfaces to retrieve. Use InterfaceType.UNKNOWN to retrieve all interfaces.
      onlyActive - Determines whether to only retrieve active interfaces.
      Returns:
      An ArrayList of VirtualizedNetwork objects representing the network interfaces that meet the specified criteria.
    • vnc

      public VNCSocket vnc(Virtualized virtualizedIO)
      Retrieves the VNCSocket object for the given Virtualized machine / Container.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      Returns:
      The VNCSocket object representing the VNC socket connection information.
    • status

      public ProcessStatus status(Virtualized virtualizedIO)
      Retrieves the status of a virtualized machine.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      Returns:
      The ProcessStatus enum representing the current status of the virtualized machine / container.
    • stop

      public void stop(Virtualized virtualizedIO)
      Stops the virtualizedIO by executing the stop action for all VirtualizedListeners.
      Parameters:
      virtualizedIO - the virtualizedIO to stop
    • reset

      public void reset(Virtualized virtualizedIO)
      Resets the given Virtualized object. This method triggers the reset action for all registered VirtualizedExtensionPoint listeners.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
    • start

      public void start(Virtualized virtualizedIO)
      Starts the virtualized machine by triggering the start action for all registered VirtualizedExtensionPoint listeners.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
    • kill

      public void kill(Virtualized virtualizedIO)
      Executes the kill action for the given Virtualized object. This method triggers the kill action for all registered VirtualizedExtensionPoint listeners.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
    • resume

      public void resume(Virtualized virtualizedIO)
      Resumes the execution of a virtualized machine / container by triggering the resume action for all registered VirtualizedExtensionPoint listeners.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container to resume.
      Throws:
      RuntimeException - If an exception occurs during the resume action.
    • pause

      public void pause(Virtualized virtualizedIO)
      Pauses the execution of a virtualized machine / container by triggering the pause action for all registered VirtualizedExtensionPoint listeners.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container to pause.
      Throws:
      RuntimeException - If an exception occurs during the pause action.
    • stats

      public ProcessStats stats(Virtualized virtualizedIO)
      Retrieves the process statistics of the virtualized machine / container.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      Returns:
      The ProcessStats object representing the process statistics of the virtualized machine.
    • count

      public int count(String typeIO)
      Counts the number of Virtualized entities that match the given type.
      Parameters:
      typeIO - the type of Virtualized entities to count, case insensitive
      Returns:
      the number of Virtualized entities that match the specified type
    • count

      public int count(VirtualizedType typeIO)
      Counts the number of instances based on the provided VirtualizedType.
      Parameters:
      typeIO - the VirtualizedType object used to determine the count
      Returns:
      the number of instances corresponding to the specified VirtualizedType
    • update

      public void update(Virtualized virtualizedIO)
      Updates the given Virtualized object by executing the update action for all registered VirtualizedExtensionPoint listeners that match the provider.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container to update.
    • current

      public Virtualized current(Virtualized virtualizedIO)
      Retrieves the current state of the virtualized machine by executing the "current" action for all registered VirtualizedExtensionPoint listeners that match the provider.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      Returns:
      The updated Virtualized object with the current state of the machine.
    • remove

      public void remove(Virtualized virtualizedIO)
      Removes a virtualized machine by triggering the remove action for all registered VirtualizedExtensionPoint listeners that match the provider of the specified Virtualized object.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container to remove.
    • password

      public void password(Virtualized virtualizedIO)
      Executes the password action for the specified Virtualized object. This method triggers the password update action.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine/container.
    • getConfig

      public VirtualizedExtensionConfig getConfig(String providerIO)
    • getConfig

      public VirtualizedExtensionConfig getConfig(Virtualized virtualizedIO)
      Retrieves the configuration for the specified Virtualized object.
      Parameters:
      virtualizedIO - The Virtualized object representing the virtualized machine / container.
      Returns:
      The VirtualizedExtensionConfig object representing the configuration for the specified Virtualized object.