Class ServiceConfiguration.Builder
- java.lang.Object
-
- de.dytanic.cloudnet.driver.service.ServiceConfiguration.Builder
-
- Enclosing class:
- ServiceConfiguration
public static class ServiceConfiguration.Builder extends java.lang.ObjectBuilder for the creation of new services. All required parameters are: You can create a new service with this example:ServiceConfiguration .builder() .task("Lobby") .environment(ServiceEnvironmentType.MINECRAFT_SERVER) .maxHeapMemory(512) .build() .createNewService();this will return the newly created
ServiceInfoSnapshotor null if the service couldn't be created.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ServiceConfiguration.BuilderaddAllowedNodes(@NotNull java.lang.String @NotNull ... allowedNodes)A list of all allowed nodes.@NotNull ServiceConfiguration.BuilderaddAllowedNodes(@NotNull java.util.Collection<java.lang.String> allowedNodes)A list of all allowed nodes.@NotNull ServiceConfiguration.BuilderaddDeletedFilesAfterStop(@NotNull java.lang.String @NotNull ... deletedFilesAfterStop)The files that should be deleted after the service has been stopped.@NotNull ServiceConfiguration.BuilderaddDeletedFilesAfterStop(@NotNull java.util.Collection<java.lang.String> deletedFilesAfterStop)The files that should be deleted after the service has been stopped.@NotNull ServiceConfiguration.BuilderaddDeployments(@NotNull ServiceDeployment @NotNull ... deployments)The deployments for the new service.@NotNull ServiceConfiguration.BuilderaddDeployments(@NotNull java.util.Collection<ServiceDeployment> deployments)The deployments for the new service.@NotNull ServiceConfiguration.BuilderaddGroups(@NotNull java.lang.String @NotNull ... groups)The groups for the new service.@NotNull ServiceConfiguration.BuilderaddGroups(@NotNull java.util.Collection<java.lang.String> groups)The groups for the new service.@NotNull ServiceConfiguration.BuilderaddInclusions(@NotNull ServiceRemoteInclusion @NotNull ... inclusions)The inclusions for the new service.@NotNull ServiceConfiguration.BuilderaddInclusions(@NotNull java.util.Collection<ServiceRemoteInclusion> inclusions)The inclusions for the new service.@NotNull ServiceConfiguration.BuilderaddJvmOptions(@NotNull java.lang.String @NotNull ... jvmOptions)The jvm options for the new service.@NotNull ServiceConfiguration.BuilderaddJvmOptions(@NotNull java.util.Collection<java.lang.String> jvmOptions)The jvm options for the new service.@NotNull ServiceConfiguration.BuilderaddProcessParameters(@NotNull java.lang.String @NotNull ... jvmOptions)The process parameters for the new service.@NotNull ServiceConfiguration.BuilderaddProcessParameters(@NotNull java.util.Collection<java.lang.String> jvmOptions)The process parameters for the new service.@NotNull ServiceConfiguration.BuilderaddTemplates(@NotNull ServiceTemplate @NotNull ... templates)The templates for the new service.@NotNull ServiceConfiguration.BuilderaddTemplates(@NotNull java.util.Collection<ServiceTemplate> templates)The templates for the new service.@NotNull ServiceConfiguration.BuilderallowedNodes(@NotNull java.lang.String @NotNull ... allowedNodes)A list of all allowed nodes.@NotNull ServiceConfiguration.BuilderallowedNodes(@NotNull java.util.Collection<java.lang.String> allowedNodes)A list of all allowed nodes.@NotNull ServiceConfiguration.BuilderautoDeleteOnStop()Alias forautoDeleteOnStop(true).@NotNull ServiceConfiguration.BuilderautoDeleteOnStop(boolean autoDeleteOnStop)Whether this service should be deleted on stop (doesn't affect files of a static service) or the life cycle should be changed toServiceLifeCycle.PREPARED.@NotNull ServiceConfigurationbuild()@NotNull ServiceConfiguration.BuilderdeleteFilesAfterStop(@NotNull java.lang.String @NotNull ... deletedFilesAfterStop)The files that should be deleted after the service has been stopped.@NotNull ServiceConfiguration.BuilderdeleteFilesAfterStop(@NotNull java.util.Collection<java.lang.String> deletedFilesAfterStop)The files that should be deleted after the service has been stopped.@NotNull ServiceConfiguration.Builderdeployments(@NotNull ServiceDeployment @NotNull ... deployments)The deployments for the new service.@NotNull ServiceConfiguration.Builderdeployments(@NotNull java.util.Collection<ServiceDeployment> deployments)The deployments for the new service.@NotNull ServiceConfiguration.Builderenvironment(@NotNull ServiceEnvironmentType environment)The environment for the new service.@NotNull ServiceConfiguration.Buildergroups(@NotNull java.lang.String @NotNull ... groups)The groups for the new service.@NotNull ServiceConfiguration.Buildergroups(@NotNull java.util.Collection<java.lang.String> groups)The groups for the new service.@NotNull ServiceConfiguration.Builderinclusions(@NotNull ServiceRemoteInclusion @NotNull ... inclusions)The inclusions for the new service.@NotNull ServiceConfiguration.Builderinclusions(@NotNull java.util.Collection<ServiceRemoteInclusion> inclusions)The inclusions for the new service.@NotNull ServiceConfiguration.BuilderjavaCommand(@Nullable java.lang.String javaCommand)the java command to start the service with if this is null the default value from the config.json will be used@NotNull ServiceConfiguration.BuilderjvmOptions(@NotNull java.lang.String @NotNull ... jvmOptions)The jvm options for the new service.@NotNull ServiceConfiguration.BuilderjvmOptions(@NotNull java.util.Collection<java.lang.String> jvmOptions)The jvm options for the new service.@NotNull ServiceConfiguration.BuildermaxHeapMemory(int maxHeapMemory)The max heap memory for the new service.@NotNull ServiceConfiguration.Buildernode(@NotNull java.lang.String nodeUniqueId)The node where the new service will start.@NotNull ServiceConfiguration.BuilderprocessParameters(@NotNull java.util.Collection<java.lang.String> jvmOptions)The process parameters for the new service.@NotNull ServiceConfiguration.Builderproperties(@NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument properties)The default properties of the new service.@NotNull ServiceConfiguration.Builderruntime(@NotNull java.lang.String runtime)The runtime of the service.@NotNull ServiceConfiguration.BuilderserviceId(@NotNull ServiceId serviceId)The completeServiceIdfor the new service.@NotNull ServiceConfiguration.BuilderstartPort(int startPort)The start port for the new service.@NotNull ServiceConfiguration.BuilderstaticService()Alias forstaticService(true).@NotNull ServiceConfiguration.BuilderstaticService(boolean staticService)Whether the files should be deleted or saved on deletion of the service.@NotNull ServiceConfiguration.Buildertask(@NotNull ServiceTask task)Applies every option of the givenServiceTaskobject except for the Properties.@NotNull ServiceConfiguration.Buildertask(@NotNull java.lang.String task)The task for the new service.@NotNull ServiceConfiguration.BuildertaskId(int taskId)The task id for the new service (For example Lobby-1 would have the task id 1).@NotNull ServiceConfiguration.Buildertemplates(@NotNull ServiceTemplate @NotNull ... templates)The templates for the new service.@NotNull ServiceConfiguration.Buildertemplates(@NotNull java.util.Collection<ServiceTemplate> templates)The templates for the new service.@NotNull ServiceConfiguration.BuilderuniqueId(@NotNull java.util.UUID uniqueId)The uniqueId for the new service.
-
-
-
Method Detail
-
task
@NotNull public @NotNull ServiceConfiguration.Builder task(@NotNull @NotNull ServiceTask task)
Applies every option of the givenServiceTaskobject except for the Properties. This will override every previously set option of this builder.
-
serviceId
@NotNull public @NotNull ServiceConfiguration.Builder serviceId(@NotNull @NotNull ServiceId serviceId)
The completeServiceIdfor the new service. Calling this method will override all the following method calls:
-
task
@NotNull public @NotNull ServiceConfiguration.Builder task(@NotNull @NotNull java.lang.String task)
The task for the new service. No permanent task with that name has to exist. This will NOT use any options of the given task, to do that usetask(ServiceTask).
-
environment
@NotNull public @NotNull ServiceConfiguration.Builder environment(@NotNull @NotNull ServiceEnvironmentType environment)
The environment for the new service.
-
taskId
@NotNull public @NotNull ServiceConfiguration.Builder taskId(int taskId)
The task id for the new service (For example Lobby-1 would have the task id 1).
-
uniqueId
@NotNull public @NotNull ServiceConfiguration.Builder uniqueId(@NotNull @NotNull java.util.UUID uniqueId)
The uniqueId for the new service.
-
javaCommand
@NotNull public @NotNull ServiceConfiguration.Builder javaCommand(@Nullable @Nullable java.lang.String javaCommand)
the java command to start the service with if this is null the default value from the config.json will be used
-
node
@NotNull public @NotNull ServiceConfiguration.Builder node(@NotNull @NotNull java.lang.String nodeUniqueId)
The node where the new service will start. If the service cannot be created on this node or the node doesn't exist, it will NOT be created andServiceConfiguration.createNewService()will returnnull.
-
allowedNodes
@NotNull public @NotNull ServiceConfiguration.Builder allowedNodes(@NotNull @NotNull java.util.Collection<java.lang.String> allowedNodes)
A list of all allowed nodes. CloudNet will choose the node with the most free resources. If a node is provided usingnode(String), this option will be ignored.
-
allowedNodes
@NotNull public @NotNull ServiceConfiguration.Builder allowedNodes(@NotNull @NotNull java.lang.String @NotNull ... allowedNodes)
A list of all allowed nodes. CloudNet will choose the node with the most free resources. If a node is provided usingnode(String), this option will be ignored.
-
addAllowedNodes
@NotNull public @NotNull ServiceConfiguration.Builder addAllowedNodes(@NotNull @NotNull java.util.Collection<java.lang.String> allowedNodes)
A list of all allowed nodes. CloudNet will choose the node with the most free resources. If a node is provided usingnode(String), this option will be ignored.
-
addAllowedNodes
@NotNull public @NotNull ServiceConfiguration.Builder addAllowedNodes(@NotNull @NotNull java.lang.String @NotNull ... allowedNodes)
A list of all allowed nodes. CloudNet will choose the node with the most free resources. If a node is provided usingnode(String), this option will be ignored.
-
runtime
@NotNull public @NotNull ServiceConfiguration.Builder runtime(@NotNull @NotNull java.lang.String runtime)
The runtime of the service. If none is provided, the default "jvm" is used. By default, CloudNet only provides the "jvm" runtime, you can add your own with custom modules.
-
autoDeleteOnStop
@NotNull public @NotNull ServiceConfiguration.Builder autoDeleteOnStop(boolean autoDeleteOnStop)
Whether this service should be deleted on stop (doesn't affect files of a static service) or the life cycle should be changed toServiceLifeCycle.PREPARED.
-
autoDeleteOnStop
@NotNull public @NotNull ServiceConfiguration.Builder autoDeleteOnStop()
Alias forautoDeleteOnStop(true).
-
staticService
@NotNull public @NotNull ServiceConfiguration.Builder staticService(boolean staticService)
Whether the files should be deleted or saved on deletion of the service.
-
staticService
@NotNull public @NotNull ServiceConfiguration.Builder staticService()
Alias forstaticService(true).
-
groups
@NotNull public @NotNull ServiceConfiguration.Builder groups(@NotNull @NotNull java.lang.String @NotNull ... groups)
The groups for the new service. CloudNet will apply every template, deployment and inclusion of the given groups to the new service.
-
groups
@NotNull public @NotNull ServiceConfiguration.Builder groups(@NotNull @NotNull java.util.Collection<java.lang.String> groups)
The groups for the new service. CloudNet will apply every template, deployment and inclusion of the given groups to the new service.
-
addGroups
@NotNull public @NotNull ServiceConfiguration.Builder addGroups(@NotNull @NotNull java.lang.String @NotNull ... groups)
The groups for the new service. CloudNet will apply every template, deployment and inclusion of the given groups to the new service.
-
addGroups
@NotNull public @NotNull ServiceConfiguration.Builder addGroups(@NotNull @NotNull java.util.Collection<java.lang.String> groups)
The groups for the new service. CloudNet will apply every template, deployment and inclusion of the given groups to the new service.
-
inclusions
@NotNull public @NotNull ServiceConfiguration.Builder inclusions(@NotNull @NotNull ServiceRemoteInclusion @NotNull ... inclusions)
The inclusions for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceInclusions().
-
inclusions
@NotNull public @NotNull ServiceConfiguration.Builder inclusions(@NotNull @NotNull java.util.Collection<ServiceRemoteInclusion> inclusions)
The inclusions for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceInclusions().
-
addInclusions
@NotNull public @NotNull ServiceConfiguration.Builder addInclusions(@NotNull @NotNull ServiceRemoteInclusion @NotNull ... inclusions)
The inclusions for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceInclusions().
-
addInclusions
@NotNull public @NotNull ServiceConfiguration.Builder addInclusions(@NotNull @NotNull java.util.Collection<ServiceRemoteInclusion> inclusions)
The inclusions for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceInclusions().
-
templates
@NotNull public @NotNull ServiceConfiguration.Builder templates(@NotNull @NotNull ServiceTemplate @NotNull ... templates)
The templates for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceTemplates().
-
templates
@NotNull public @NotNull ServiceConfiguration.Builder templates(@NotNull @NotNull java.util.Collection<ServiceTemplate> templates)
The templates for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceTemplates().
-
addTemplates
@NotNull public @NotNull ServiceConfiguration.Builder addTemplates(@NotNull @NotNull ServiceTemplate @NotNull ... templates)
The templates for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceTemplates().
-
addTemplates
@NotNull public @NotNull ServiceConfiguration.Builder addTemplates(@NotNull @NotNull java.util.Collection<ServiceTemplate> templates)
The templates for the new service. They will be copied into the service directory before the service is started or by callingSpecificCloudServiceProvider.includeWaitingServiceTemplates().
-
deployments
@NotNull public @NotNull ServiceConfiguration.Builder deployments(@NotNull @NotNull ServiceDeployment @NotNull ... deployments)
The deployments for the new service. They will be copied into the template after the service is stopped or by callingSpecificCloudServiceProvider.deployResources().
-
deployments
@NotNull public @NotNull ServiceConfiguration.Builder deployments(@NotNull @NotNull java.util.Collection<ServiceDeployment> deployments)
The deployments for the new service. They will be copied into the template after the service is stopped or by callingSpecificCloudServiceProvider.deployResources().
-
addDeployments
@NotNull public @NotNull ServiceConfiguration.Builder addDeployments(@NotNull @NotNull ServiceDeployment @NotNull ... deployments)
The deployments for the new service. They will be copied into the template after the service is stopped or by callingSpecificCloudServiceProvider.deployResources().
-
addDeployments
@NotNull public @NotNull ServiceConfiguration.Builder addDeployments(@NotNull @NotNull java.util.Collection<ServiceDeployment> deployments)
The deployments for the new service. They will be copied into the template after the service is stopped or by callingSpecificCloudServiceProvider.deployResources().
-
deleteFilesAfterStop
@NotNull public @NotNull ServiceConfiguration.Builder deleteFilesAfterStop(@NotNull @NotNull java.lang.String @NotNull ... deletedFilesAfterStop)
The files that should be deleted after the service has been stopped.
-
deleteFilesAfterStop
@NotNull public @NotNull ServiceConfiguration.Builder deleteFilesAfterStop(@NotNull @NotNull java.util.Collection<java.lang.String> deletedFilesAfterStop)
The files that should be deleted after the service has been stopped.
-
addDeletedFilesAfterStop
@NotNull public @NotNull ServiceConfiguration.Builder addDeletedFilesAfterStop(@NotNull @NotNull java.lang.String @NotNull ... deletedFilesAfterStop)
The files that should be deleted after the service has been stopped.
-
addDeletedFilesAfterStop
@NotNull public @NotNull ServiceConfiguration.Builder addDeletedFilesAfterStop(@NotNull @NotNull java.util.Collection<java.lang.String> deletedFilesAfterStop)
The files that should be deleted after the service has been stopped.
-
maxHeapMemory
@NotNull public @NotNull ServiceConfiguration.Builder maxHeapMemory(int maxHeapMemory)
The max heap memory for the new service.
-
jvmOptions
@NotNull public @NotNull ServiceConfiguration.Builder jvmOptions(@NotNull @NotNull java.util.Collection<java.lang.String> jvmOptions)
The jvm options for the new service. They will be added directly before the "-Xmx" parameter in the startup command.
-
jvmOptions
@NotNull public @NotNull ServiceConfiguration.Builder jvmOptions(@NotNull @NotNull java.lang.String @NotNull ... jvmOptions)
The jvm options for the new service. They will be added directly before the "-Xmx" parameter in the startup command.
-
addJvmOptions
@NotNull public @NotNull ServiceConfiguration.Builder addJvmOptions(@NotNull @NotNull java.lang.String @NotNull ... jvmOptions)
The jvm options for the new service. They will be added directly before the "-Xmx" parameter in the startup command.
-
addJvmOptions
@NotNull public @NotNull ServiceConfiguration.Builder addJvmOptions(@NotNull @NotNull java.util.Collection<java.lang.String> jvmOptions)
The jvm options for the new service. They will be added directly before the "-Xmx" parameter in the startup command.
-
processParameters
@NotNull public @NotNull ServiceConfiguration.Builder processParameters(@NotNull @NotNull java.util.Collection<java.lang.String> jvmOptions)
The process parameters for the new service. This will be the last parameters that will be added to the command.
-
addProcessParameters
@NotNull public @NotNull ServiceConfiguration.Builder addProcessParameters(@NotNull @NotNull java.lang.String @NotNull ... jvmOptions)
The process parameters for the new service. This will be the last parameters that will be added to the command.
-
addProcessParameters
@NotNull public @NotNull ServiceConfiguration.Builder addProcessParameters(@NotNull @NotNull java.util.Collection<java.lang.String> jvmOptions)
The process parameters for the new service. This will be the last parameters that will be added to the command.
-
startPort
@NotNull public @NotNull ServiceConfiguration.Builder startPort(int startPort)
The start port for the new service. CloudNet will test whether the port is used or not, it will count up 1 while the port is used.
-
properties
@NotNull public @NotNull ServiceConfiguration.Builder properties(@NotNull @NotNull de.dytanic.cloudnet.common.document.gson.JsonDocument properties)
The default properties of the new service. CloudNet itself completely ignores them, but they can be useful if you want to transport data from the component that has created the service to the new service.
-
build
@NotNull public @NotNull ServiceConfiguration build()
-
-