All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.metaeffekt.artifact.resolver.manager.execenv.EnvironmentParameters Maven / Gradle / Ivy

There is a newer version: 0.134.0
Show newest version
/*
 * Copyright 2021-2024 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.metaeffekt.artifact.resolver.manager.execenv;

import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

/**
 * A description of a readily initialized environment. 
* Implementations should contain enough information to query for such an environment from some list of readied * executors. */ @EqualsAndHashCode public abstract class EnvironmentParameters { /** * A default registry prefix; used when not otherwise specified. */ public String defaultRegistryPrefix = "docker.io"; /** * The name of the image to use, part of the image identifier. * * @return Return the image base name. */ public abstract String getImageBaseName(); /** * The version (tag) of the image. * * @return Return the image version (tag). */ public abstract String getImageVersion(); /** * Useful for instantiation of a corresponding environment class. * * @return the environment implementation that shall be used to fulfill the parameters */ public abstract Class getEnvironmentClass(); /** * Assembles an image identifier from other parameters. * * @return returns an image identifier, ready to use in pulling stuff */ public String getImageIdentifier() { return getRegistryPrefix() + "/" + getImageBaseName() + ":" + getImageVersion(); } /** * The name of the registry in the form of a prefix at the beginning of image identifiers.
* For example "docker.io" for docker hub. * * @return returns the registry prefix to be used with this container */ public String getRegistryPrefix() { return defaultRegistryPrefix; } @Override public String toString() { String className = this.getEnvironmentClass().getSimpleName(); if (StringUtils.isEmpty(className)) { className = "(empty classname, probably anonymous)"; } return className + "{" + "defaultRegistryPrefix='" + defaultRegistryPrefix + '\'' + "imageBaseName='" + getImageBaseName() + '\'' + "imageVersion='" + getImageVersion() + '\'' + '}'; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy