Class Wrapper

  • All Implemented Interfaces:
    de.dytanic.cloudnet.driver.api.DriverAPIUser

    public final class Wrapper
    extends de.dytanic.cloudnet.driver.CloudNetDriver
    implements de.dytanic.cloudnet.driver.api.DriverAPIUser
    This class is the main class of the application wrapper, which performs the basic driver functions and the setup of the application to be wrapped.
    See Also:
    CloudNetDriver
    • Field Summary

      • Fields inherited from class de.dytanic.cloudnet.driver.CloudNetDriver

        cloudServiceFactory, driverEnvironment, eventManager, generalCloudServiceProvider, groupConfigurationProvider, logger, messenger, moduleProvider, nodeInfoProvider, permissionManagement, scheduler, servicesRegistry, serviceTaskProvider, taskScheduler
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot configureServiceInfoSnapshot()  
      @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot createServiceInfoSnapshot()
      Creates a completed new ServiceInfoSnapshot instance based of the properties of the current ServiceInfoSnapshot instance
      @NotNull java.util.Collection<de.dytanic.cloudnet.driver.template.TemplateStorage> getAvailableTemplateStorages()  
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<de.dytanic.cloudnet.driver.template.TemplateStorage>> getAvailableTemplateStoragesAsync()  
      @NotNull de.dytanic.cloudnet.driver.provider.service.SpecificCloudServiceProvider getCloudServiceProvider​(@NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot serviceInfoSnapshot)  
      @NotNull de.dytanic.cloudnet.driver.provider.service.SpecificCloudServiceProvider getCloudServiceProvider​(@NotNull java.lang.String name)  
      @NotNull de.dytanic.cloudnet.driver.provider.service.SpecificCloudServiceProvider getCloudServiceProvider​(@NotNull java.util.UUID uniqueId)  
      @NotNull java.util.List<java.lang.String> getCommandLineArguments()  
      @NotNull java.lang.String getComponentName()  
      @NotNull IWrapperConfiguration getConfig()  
      @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot getCurrentServiceInfoSnapshot()  
      @NotNull IDatabaseProvider getDatabaseProvider()
      Deprecated.
      use CloudNetDriver.getDatabaseProvider() instead
      static Wrapper getInstance()  
      @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot getLastServiceInfoSnapShot()  
      @NotNull de.dytanic.cloudnet.driver.template.TemplateStorage getLocalTemplateStorage()  
      @NotNull java.lang.Thread getMainThread()  
      de.dytanic.cloudnet.driver.network.INetworkChannel getNetworkChannel()  
      @NotNull de.dytanic.cloudnet.driver.network.INetworkClient getNetworkClient()  
      @NotNull java.lang.String getNodeUniqueId()  
      de.dytanic.cloudnet.driver.service.ServiceConfiguration getServiceConfiguration()
      Is an shortcut for Wrapper.getConfig().getServiceConfiguration()
      de.dytanic.cloudnet.driver.service.ServiceId getServiceId()
      Is an shortcut for Wrapper.getConfig().getServiceId()
      @NotNull de.dytanic.cloudnet.driver.template.TemplateStorage getTemplateStorage​(java.lang.String storage)  
      @NotNull java.io.File getWorkDirectory()
      Deprecated.
      @NotNull java.nio.file.Path getWorkingDirectoryPath()  
      void publishServiceInfoUpdate()
      This method should be used to send the current ServiceInfoSnapshot and all subscribers on the network and to update their information.
      void publishServiceInfoUpdate​(@NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot serviceInfoSnapshot)  
      de.dytanic.cloudnet.common.collection.Pair<java.lang.Boolean,​java.lang.String[]> sendCommandLineAsPermissionUser​(@NotNull java.util.UUID uniqueId, @NotNull java.lang.String commandLine)
      Application wrapper implementation of this method.
      @NotNull de.dytanic.cloudnet.common.concurrent.ITask<de.dytanic.cloudnet.common.collection.Pair<java.lang.Boolean,​java.lang.String[]>> sendCommandLineAsPermissionUserAsync​(@NotNull java.util.UUID uniqueId, @NotNull java.lang.String commandLine)
      Application wrapper implementation of this method.
      void setDatabaseProvider​(@NotNull IDatabaseProvider databaseProvider)
      Deprecated.
      void setGlobalLogLevel​(int logLevel)  
      void setGlobalLogLevel​(@NotNull de.dytanic.cloudnet.common.logging.LogLevel logLevel)  
      void start()  
      void stop()  
      void unregisterPacketListenersByClassLoader​(@NotNull java.lang.ClassLoader classLoader)
      Removes all PacketListeners from all channels of the Network Connctor from a specific ClassLoader.
      • Methods inherited from class de.dytanic.cloudnet.driver.CloudNetDriver

        getCloudServiceFactory, getCloudServiceProvider, getDriverEnvironment, getEventManager, getGroupConfigurationProvider, getLocalTemplateStorageTemplates, getLocalTemplateStorageTemplatesAsync, getLogger, getMessenger, getModuleProvider, getNodeInfoProvider, getOwnPID, getPermissionManagement, getServicesRegistry, getServiceTaskProvider, getTaskExecutor, getTaskScheduler, getTemplateStorageTemplates, getTemplateStorageTemplatesAsync, optionalInstance, setInstance, setPermissionManagement
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface de.dytanic.cloudnet.driver.api.DriverAPIUser

        executeChunkedDriverAPIMethod, executeDriverAPIMethod, executeDriverAPIMethod, executeVoidDriverAPIMethod, executeVoidDriverAPIMethod
    • Method Detail

      • getInstance

        public static Wrapper getInstance()
      • start

        public void start()
                   throws java.lang.Exception
        Specified by:
        start in class de.dytanic.cloudnet.driver.CloudNetDriver
        Throws:
        java.lang.Exception
      • stop

        public void stop()
        Specified by:
        stop in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getComponentName

        @NotNull
        public @NotNull java.lang.String getComponentName()
        Specified by:
        getComponentName in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getLocalTemplateStorage

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.template.TemplateStorage getLocalTemplateStorage()
        Specified by:
        getLocalTemplateStorage in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getNodeUniqueId

        @NotNull
        public @NotNull java.lang.String getNodeUniqueId()
        Specified by:
        getNodeUniqueId in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getTemplateStorage

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.template.TemplateStorage getTemplateStorage​(java.lang.String storage)
        Specified by:
        getTemplateStorage in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getAvailableTemplateStorages

        @NotNull
        public @NotNull java.util.Collection<de.dytanic.cloudnet.driver.template.TemplateStorage> getAvailableTemplateStorages()
        Specified by:
        getAvailableTemplateStorages in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getAvailableTemplateStoragesAsync

        @NotNull
        public @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<de.dytanic.cloudnet.driver.template.TemplateStorage>> getAvailableTemplateStoragesAsync()
        Specified by:
        getAvailableTemplateStoragesAsync in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getCloudServiceProvider

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.provider.service.SpecificCloudServiceProvider getCloudServiceProvider​(@NotNull
                                                                                                                         @NotNull java.lang.String name)
        Specified by:
        getCloudServiceProvider in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getCloudServiceProvider

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.provider.service.SpecificCloudServiceProvider getCloudServiceProvider​(@NotNull
                                                                                                                         @NotNull java.util.UUID uniqueId)
        Specified by:
        getCloudServiceProvider in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getCloudServiceProvider

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.provider.service.SpecificCloudServiceProvider getCloudServiceProvider​(@NotNull
                                                                                                                         @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot serviceInfoSnapshot)
        Specified by:
        getCloudServiceProvider in class de.dytanic.cloudnet.driver.CloudNetDriver
      • setGlobalLogLevel

        public void setGlobalLogLevel​(@NotNull
                                      @NotNull de.dytanic.cloudnet.common.logging.LogLevel logLevel)
        Specified by:
        setGlobalLogLevel in class de.dytanic.cloudnet.driver.CloudNetDriver
      • setGlobalLogLevel

        public void setGlobalLogLevel​(int logLevel)
        Specified by:
        setGlobalLogLevel in class de.dytanic.cloudnet.driver.CloudNetDriver
      • sendCommandLineAsPermissionUser

        public de.dytanic.cloudnet.common.collection.Pair<java.lang.Boolean,​java.lang.String[]> sendCommandLineAsPermissionUser​(@NotNull
                                                                                                                                      @NotNull java.util.UUID uniqueId,
                                                                                                                                      @NotNull
                                                                                                                                      @NotNull java.lang.String commandLine)
        Application wrapper implementation of this method. See the full documentation at the CloudNetDriver class.
        Specified by:
        sendCommandLineAsPermissionUser in class de.dytanic.cloudnet.driver.CloudNetDriver
        See Also:
        CloudNetDriver
      • sendCommandLineAsPermissionUserAsync

        @NotNull
        public @NotNull de.dytanic.cloudnet.common.concurrent.ITask<de.dytanic.cloudnet.common.collection.Pair<java.lang.Boolean,​java.lang.String[]>> sendCommandLineAsPermissionUserAsync​(@NotNull
                                                                                                                                                                                                 @NotNull java.util.UUID uniqueId,
                                                                                                                                                                                                 @NotNull
                                                                                                                                                                                                 @NotNull java.lang.String commandLine)
        Application wrapper implementation of this method. See the full documentation at the CloudNetDriver class.
        Specified by:
        sendCommandLineAsPermissionUserAsync in class de.dytanic.cloudnet.driver.CloudNetDriver
        See Also:
        CloudNetDriver
      • getServiceId

        public de.dytanic.cloudnet.driver.service.ServiceId getServiceId()
        Is an shortcut for Wrapper.getConfig().getServiceId()
        Returns:
        the ServiceId instance which was set in the config by the node
      • getServiceConfiguration

        public de.dytanic.cloudnet.driver.service.ServiceConfiguration getServiceConfiguration()
        Is an shortcut for Wrapper.getConfig().getServiceConfiguration()
        Returns:
        the first instance which was set in the config by the node
      • createServiceInfoSnapshot

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot createServiceInfoSnapshot()
        Creates a completed new ServiceInfoSnapshot instance based of the properties of the current ServiceInfoSnapshot instance
        Returns:
        the new ServiceInfoSnapshot instance
      • configureServiceInfoSnapshot

        @Internal
        public de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot configureServiceInfoSnapshot()
      • publishServiceInfoUpdate

        public void publishServiceInfoUpdate()
        This method should be used to send the current ServiceInfoSnapshot and all subscribers on the network and to update their information. It calls the ServiceInfoSnapshotConfigureEvent before send the update to the node.
        See Also:
        ServiceInfoSnapshotConfigureEvent
      • publishServiceInfoUpdate

        public void publishServiceInfoUpdate​(@NotNull
                                             @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot serviceInfoSnapshot)
      • unregisterPacketListenersByClassLoader

        public void unregisterPacketListenersByClassLoader​(@NotNull
                                                           @NotNull java.lang.ClassLoader classLoader)
        Removes all PacketListeners from all channels of the Network Connctor from a specific ClassLoader. It is recommended to do this with the disables of your own plugin
        Parameters:
        classLoader - the ClassLoader from which the IPacketListener implementations derive.
      • getWorkDirectory

        @NotNull
        @Deprecated
        public @NotNull java.io.File getWorkDirectory()
        Deprecated.
      • getWorkingDirectoryPath

        @NotNull
        public @NotNull java.nio.file.Path getWorkingDirectoryPath()
      • getCommandLineArguments

        @NotNull
        public @NotNull java.util.List<java.lang.String> getCommandLineArguments()
      • getNetworkClient

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.network.INetworkClient getNetworkClient()
        Specified by:
        getNetworkClient in class de.dytanic.cloudnet.driver.CloudNetDriver
      • getMainThread

        @NotNull
        public @NotNull java.lang.Thread getMainThread()
      • getLastServiceInfoSnapShot

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot getLastServiceInfoSnapShot()
      • getCurrentServiceInfoSnapshot

        @NotNull
        public @NotNull de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot getCurrentServiceInfoSnapshot()
      • getDatabaseProvider

        @NotNull
        @Deprecated
        @ScheduledForRemoval
        public @NotNull IDatabaseProvider getDatabaseProvider()
        Deprecated.
        use CloudNetDriver.getDatabaseProvider() instead
        Specified by:
        getDatabaseProvider in class de.dytanic.cloudnet.driver.CloudNetDriver
      • setDatabaseProvider

        @Deprecated
        @ScheduledForRemoval
        public void setDatabaseProvider​(@NotNull
                                        @NotNull IDatabaseProvider databaseProvider)
        Deprecated.
      • getNetworkChannel

        public de.dytanic.cloudnet.driver.network.INetworkChannel getNetworkChannel()
        Specified by:
        getNetworkChannel in interface de.dytanic.cloudnet.driver.api.DriverAPIUser