Class RemoteTemplateStorage
java.lang.Object
eu.cloudnetservice.driver.impl.template.RemoteTemplateStorage
- All Implemented Interfaces:
eu.cloudnetservice.driver.base.Named, eu.cloudnetservice.driver.template.TemplateStorage, AutoCloseable
public abstract class RemoteTemplateStorage
extends Object
implements eu.cloudnetservice.driver.template.TemplateStorage
The default implementation of a template storage which pulls its information from a remote provider.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final eu.cloudnetservice.driver.ComponentInfoprivate final Stringprivate final eu.cloudnetservice.driver.network.NetworkClient -
Constructor Summary
ConstructorsConstructorDescriptionRemoteTemplateStorage(@NonNull String name, @NonNull eu.cloudnetservice.driver.ComponentInfo componentInfo, @NonNull eu.cloudnetservice.driver.network.NetworkClient networkClient) Constructs a new remote template storage instance. -
Method Summary
Modifier and TypeMethodDescriptionappendOutputStream(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull String path) appendOutputStreamAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull String path) booleandeploy(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate target, @NonNull InputStream inputStream) deployAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate target, @NonNull InputStream inputStream) booleandeployDirectory(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate target, @NonNull Path directory, @Nullable Predicate<Path> filter) deployDirectoryAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate target, @NonNull Path directory, @Nullable Predicate<Path> filter) name()newInputStream(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull String path) newInputStreamAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull String path) newOutputStream(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull String path) newOutputStreamAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull String path) private @NonNull OutputStreamopenLocalOutputStream(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull String path, @NonNull Path localPath, boolean append) Opens a new output stream to a temporary local file which will be deployed to the remote component once the stream was closed.openZipInputStreamAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template) booleanpullAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull Path directory) zipTemplate(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template) zipTemplateAsync(@NonNull eu.cloudnetservice.driver.service.ServiceTemplate template) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.cloudnetservice.driver.template.TemplateStorage
close, closeAsync, contains, containsAsync, create, createAsync, createDirectory, createDirectoryAsync, createFile, createFileAsync, delete, deleteAsync, deleteFile, deleteFileAsync, deployDirectory, deployDirectoryAsync, fileInfo, fileInfoAsync, hasFile, hasFileAsync, listFiles, listFilesAsync, openZipInputStream, templates, templatesAsync
-
Field Details
-
name
-
componentInfo
private final eu.cloudnetservice.driver.ComponentInfo componentInfo -
networkClient
private final eu.cloudnetservice.driver.network.NetworkClient networkClient
-
-
Constructor Details
-
RemoteTemplateStorage
@RPCInvocationTarget public RemoteTemplateStorage(@NonNull @NonNull String name, @NonNull @NonNull eu.cloudnetservice.driver.ComponentInfo componentInfo, @NonNull @NonNull eu.cloudnetservice.driver.network.NetworkClient networkClient) Constructs a new remote template storage instance.- Parameters:
name- the name of the storage which was created.componentInfo- the information about the current component.networkClient- the network client of the current component.- Throws:
NullPointerException- if the given name, component info or network client is null.
-
-
Method Details
-
name
-
deployDirectory
-
deploy
public boolean deploy(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate target, @NonNull @NonNull InputStream inputStream) - Specified by:
deployin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
pull
-
deployAsync
@NonNull public @NonNull CompletableFuture<Boolean> deployAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate target, @NonNull @NonNull InputStream inputStream) - Specified by:
deployAsyncin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
pullAsync
-
zipTemplate
@Nullable public @Nullable InputStream zipTemplate(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template) - Specified by:
zipTemplatein interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
appendOutputStream
@NonNull public @NonNull OutputStream appendOutputStream(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull @NonNull String path) throws IOException - Specified by:
appendOutputStreamin interfaceeu.cloudnetservice.driver.template.TemplateStorage- Throws:
IOException
-
newOutputStream
@NonNull public @NonNull OutputStream newOutputStream(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull @NonNull String path) throws IOException - Specified by:
newOutputStreamin interfaceeu.cloudnetservice.driver.template.TemplateStorage- Throws:
IOException
-
newInputStream
@Nullable public @Nullable InputStream newInputStream(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull @NonNull String path) throws IOException - Specified by:
newInputStreamin interfaceeu.cloudnetservice.driver.template.TemplateStorage- Throws:
IOException
-
zipTemplateAsync
@NonNull public @NonNull CompletableFuture<InputStream> zipTemplateAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template) - Specified by:
zipTemplateAsyncin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
openZipInputStreamAsync
@NonNull public @NonNull CompletableFuture<ZipInputStream> openZipInputStreamAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template) - Specified by:
openZipInputStreamAsyncin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
appendOutputStreamAsync
@NonNull public @NonNull CompletableFuture<OutputStream> appendOutputStreamAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull @NonNull String path) - Specified by:
appendOutputStreamAsyncin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
newOutputStreamAsync
@NonNull public @NonNull CompletableFuture<OutputStream> newOutputStreamAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull @NonNull String path) - Specified by:
newOutputStreamAsyncin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
deployDirectoryAsync
@NonNull public @NonNull CompletableFuture<Boolean> deployDirectoryAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate target, @NonNull @NonNull Path directory, @Nullable @Nullable Predicate<Path> filter) - Specified by:
deployDirectoryAsyncin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
newInputStreamAsync
@NonNull public @NonNull CompletableFuture<InputStream> newInputStreamAsync(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull @NonNull String path) - Specified by:
newInputStreamAsyncin interfaceeu.cloudnetservice.driver.template.TemplateStorage
-
openLocalOutputStream
@NonNull private @NonNull OutputStream openLocalOutputStream(@NonNull @NonNull eu.cloudnetservice.driver.service.ServiceTemplate template, @NonNull @NonNull String path, @NonNull @NonNull Path localPath, boolean append) throws IOException Opens a new output stream to a temporary local file which will be deployed to the remote component once the stream was closed.- Parameters:
template- the template in which the file to open the stream for is located.path- the path to the file in the given template for which the stream was opened.localPath- the local path to the file which should be used as a temporary location to write to.append- if the stream should append to the content in the remote file.- Returns:
- a new output stream which writes to a local temp files and deploys its data once closed.
- Throws:
IOException- if an I/O error occurs while opening the stream.NullPointerException- if one of the given parameters is null.
-