Class VirtualizationService
java.lang.Object
de.bytestore.hostinger.process.service.VirtualizationService
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
ConstructorsConstructorDescriptionVirtualizationService(WebhookService webhookService) Constructor for the VirtualizationService class. -
Method Summary
Modifier and TypeMethodDescriptionintcount(VirtualizedType typeIO) Counts the number of instances based on the provided VirtualizedType.intCounts the number of Virtualized entities that match the given type.voidcreate(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.getInterfaces(Virtualized virtualizedIO, InterfaceType filterIO, boolean onlyActive) Retrieves a list of VirtualizedNetwork objects representing the network interfaces of a virtualized machine / container.voidkill(Virtualized virtualizedIO) Executes the kill action for the given Virtualized object.list()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.voidpassword(Virtualized virtualizedIO) Executes the password action for the specified Virtualized object.voidpause(Virtualized virtualizedIO) Pauses the execution of a virtualized machine / container by triggering the pause action for all registered VirtualizedExtensionPoint listeners.voidremove(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.voidreset(Virtualized virtualizedIO) Resets the given Virtualized object.voidresume(Virtualized virtualizedIO) Resumes the execution of a virtualized machine / container by triggering the resume action for all registered VirtualizedExtensionPoint listeners.voidstart(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.voidstop(Virtualized virtualizedIO) Stops the virtualizedIO by executing the stop action for all VirtualizedListeners.voidupdate(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.voidwebhooks()Registers event types with a class and listener, executes webhooks, and manages webhooks.
-
Constructor Details
-
VirtualizationService
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
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
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
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
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
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
Stops the virtualizedIO by executing the stop action for all VirtualizedListeners.- Parameters:
virtualizedIO- the virtualizedIO to stop
-
reset
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
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
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
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
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
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
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
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
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
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
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
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
-
getConfig
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.
-