summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java
index 213451da55e..01944aee243 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java
@@ -38,11 +38,29 @@ public class FileDistributor {
return reference;
}
+ /**
+ * Adds the given file to the associated application packages' registry of file and marks the file
+ * for distribution to the given hosts.
+ * <b>Note: This class receives ownership of the given collection.</b>
+ *
+ * @return the reference to the file, created by the application package
+ */
+ public FileReference sendUriToHosts(String uri, Collection<Host> hosts) {
+ FileReference reference = fileRegistry.addUri(uri);
+ addToFilesToDistribute(reference, hosts);
+
+ return reference;
+ }
+
/** Same as sendFileToHost(relativePath,Collections.singletonList(host) */
public FileReference sendFileToHost(String relativePath, Host host) {
return sendFileToHosts(relativePath, Arrays.asList(host));
}
+ public FileReference sendUriToHost(String uri, Host host) {
+ return sendUriToHosts(uri, Arrays.asList(host));
+ }
+
private void addToFilesToDistribute(FileReference reference, Collection<Host> hosts) {
Set<Host> oldHosts = getHosts(reference);
oldHosts.addAll(hosts);