diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java |
Publish
Diffstat (limited to 'config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java')
-rw-r--r-- | config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java new file mode 100644 index 00000000000..a6f7b8096ea --- /dev/null +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java @@ -0,0 +1,39 @@ +// Copyright 2016 Yahoo Inc. 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.Version; + +/** + * Factory for config models. + */ +public interface ModelFactory { + + /** + * Gets version of this {@link ModelFactory}. The version will be used to dispatch deployments to the correct + * {@link ModelFactory}. + * + * @return The version of a {@link Model} instance that this factory can create. + */ + Version getVersion(); + + /** + * Creates an instance of a {@link Model}. The resulting instance will be used to serve config. No model + * validation will be done, calling this method presupposes that {@link #createAndValidateModel} has already + * been called. + * + * @param modelContext An instance of {@link ModelContext}, containing dependencies for creating a {@link Model}. + * @return a {@link Model} instance. + */ + Model createModel(ModelContext modelContext); + + /** + * Creates an instance of a {@link Model}. The resulting instance will be used to serve config. Any validation + * of a {@link Model} and the {@link ModelContext} can be done in this method. + * + * @param modelContext An instance of {@link ModelContext}, containing dependencies for creating a {@link Model}. + * @param ignoreValidationErrors true if validation errors should not trigger exceptions. + * @return a {@link ModelCreateResult} instance. + */ + ModelCreateResult createAndValidateModel(ModelContext modelContext, boolean ignoreValidationErrors); + +} |