Class ServiceTemplate
- java.lang.Object
-
- de.dytanic.cloudnet.driver.service.ServiceTemplate
-
- All Implemented Interfaces:
de.dytanic.cloudnet.common.INameable,SerializableObject
public class ServiceTemplate extends java.lang.Object implements de.dytanic.cloudnet.common.INameable, SerializableObject
Defines the location of a template for services that can either be copied into a service or filled from a service by using aServiceDeployment. CloudNet's default storage is "local".
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLOCAL_STORAGE
-
Constructor Summary
Constructors Constructor Description ServiceTemplate()ServiceTemplate(java.lang.String prefix, java.lang.String name, java.lang.String storage)ServiceTemplate(java.lang.String prefix, java.lang.String name, java.lang.String storage, boolean alwaysCopyToStaticServices)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()java.lang.StringgetPrefix()java.lang.StringgetStorage()java.lang.StringgetTemplatePath()static ServiceTemplatelocal(java.lang.String prefix, java.lang.String name)@Nullable SpecificTemplateStoragenullableStorage()Creates a newSpecificTemplateStoragefor the given template.static ServiceTemplateparse(java.lang.String template)Parses a template out of a string in the following format: storage:prefix/name "storage:" is optional, only "prefix/name" needs to be providedstatic @NotNull ServiceTemplate[]parseArray(java.lang.String templates)Parses multiple templates out of a string in the format specified forparse(String)split by ";".voidread(@NotNull ProtocolBuffer buffer)booleanshouldAlwaysCopyToStaticServices()@NotNull SpecificTemplateStoragestorage()Creates a newSpecificTemplateStoragefor this template.java.lang.StringtoString()voidwrite(@NotNull ProtocolBuffer buffer)
-
-
-
Field Detail
-
LOCAL_STORAGE
public static final java.lang.String LOCAL_STORAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServiceTemplate
public ServiceTemplate(java.lang.String prefix, java.lang.String name, java.lang.String storage)
-
ServiceTemplate
public ServiceTemplate(java.lang.String prefix, java.lang.String name, java.lang.String storage, boolean alwaysCopyToStaticServices)
-
ServiceTemplate
public ServiceTemplate()
-
-
Method Detail
-
local
public static ServiceTemplate local(java.lang.String prefix, java.lang.String name)
-
parse
public static ServiceTemplate parse(java.lang.String template)
Parses a template out of a string in the following format: storage:prefix/name "storage:" is optional, only "prefix/name" needs to be providedalwaysCopyToStaticServiceswill always be false in the returnedServiceTemplate.- Parameters:
template- the template in the specified format- Returns:
- the parsed
ServiceTemplateor null if the format was invalid
-
parseArray
@NotNull public static @NotNull ServiceTemplate[] parseArray(java.lang.String templates)
Parses multiple templates out of a string in the format specified forparse(String)split by ";".- Parameters:
templates- the templates in the specified format- Returns:
- an array of the parsed templates, this will not contain any null elements if any format is wrong
-
shouldAlwaysCopyToStaticServices
public boolean shouldAlwaysCopyToStaticServices()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getTemplatePath
public java.lang.String getTemplatePath()
-
getPrefix
public java.lang.String getPrefix()
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfacede.dytanic.cloudnet.common.INameable
-
getStorage
public java.lang.String getStorage()
-
storage
@NotNull public @NotNull SpecificTemplateStorage storage()
Creates a newSpecificTemplateStoragefor this template.- Returns:
- a new instance of the
SpecificTemplateStorage - Throws:
java.lang.IllegalArgumentException- if the storage in this template doesn't exist
-
nullableStorage
@Nullable public @Nullable SpecificTemplateStorage nullableStorage()
Creates a newSpecificTemplateStoragefor the given template.- Returns:
- a new instance of the
SpecificTemplateStorageor null if the storage doesn't exist
-
write
public void write(@NotNull @NotNull ProtocolBuffer buffer)- Specified by:
writein interfaceSerializableObject
-
read
public void read(@NotNull @NotNull ProtocolBuffer buffer)- Specified by:
readin interfaceSerializableObject
-
-