diff options
author | Håkon Hallingstad <hakon@oath.com> | 2017-09-20 14:29:30 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@oath.com> | 2017-09-20 14:29:30 +0200 |
commit | c683c5a16706434b101f5fe04bb51af1350e01c7 (patch) | |
tree | 499ff8752e53427da8b76b8cd43561a24b4f3c0b /config-model-api/src | |
parent | 42fd96cc55e1aa3d74f840f10bffed373ae5c824 (diff) |
Move SuperModel API to config-model-api
Diffstat (limited to 'config-model-api/src')
3 files changed, 59 insertions, 0 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationInfo.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationInfo.java new file mode 100644 index 00000000000..c6a72ebb3ff --- /dev/null +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ApplicationInfo.java @@ -0,0 +1,26 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config.model.api; + +import com.yahoo.config.provision.ApplicationId; + +public class ApplicationInfo { + private final ApplicationId applicationId; + private final long generation; + private final Model model; // NOT immutable + + public ApplicationInfo(ApplicationId applicationId, long generation, Model model) { + this.applicationId = applicationId; + this.generation = generation; + this.model = model; + } + + public ApplicationId getApplicationId() { + return applicationId; + } + public long getGeneration() { + return generation; + } + public Model getModel() { + return model; + } +} diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelListener.java b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelListener.java new file mode 100644 index 00000000000..16580c9e9f6 --- /dev/null +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelListener.java @@ -0,0 +1,20 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config.model.api; + +import com.yahoo.config.provision.ApplicationId; + +/** + * Interface for those wanting to be notified about changes to the SuperModel. + */ +public interface SuperModelListener { + /** + * Application has been activated: Either deployed the first time, + * internally redeployed, or externally triggered redeploy. + */ + void applicationActivated(ApplicationInfo application); + + /** + * Application has been removed. + */ + void applicationRemoved(ApplicationId id); +} diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelProvider.java b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelProvider.java new file mode 100644 index 00000000000..42437b20b83 --- /dev/null +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelProvider.java @@ -0,0 +1,13 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config.model.api; + +import java.util.List; + +public interface SuperModelProvider { + /** + * Returns all applications in the SuperModel. All changes to the SuperModel + * following that snapshot will be published to the listener. Warning: The listener + * methods may have been invoked before (or concurrently with) this method returning. + */ + List<ApplicationInfo> snapshot(SuperModelListener listener); +} |