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

io.dekorate.halkyon.handler.ComponentBaseConfigHandler Maven / Gradle / Ivy

There is a newer version: 2.0.0.beta2
Show newest version
package io.dekorate.halkyon.handler;

import io.dekorate.Configurators;
import io.dekorate.Handler;
import io.dekorate.HandlerFactory;
import io.dekorate.Resources;
import io.dekorate.WithProject;
import io.dekorate.config.ConfigurationSupplier;
import io.dekorate.kubernetes.config.BaseConfig;
import io.dekorate.kubernetes.config.BaseConfigBuilder;
import io.dekorate.kubernetes.config.Configuration;
import io.dekorate.kubernetes.config.EditableBaseConfig;
import io.dekorate.project.ApplyProjectInfo;
import io.dekorate.project.Project;

// this is used only to provide a fallback BaseConfig when none exists
public class ComponentBaseConfigHandler implements Handler, HandlerFactory, WithProject {
  
  @Override
  public int order() {
    return 200;
  }
  
  @Override
  public Handler create(Resources resources, Configurators configurators) {
    return new ComponentBaseConfigHandler();
  }
  
  @Override
  public boolean canHandle(Class type) {
    return type.equals(BaseConfig.class) ||
      type.equals(EditableBaseConfig.class);
  }
  
  @Override
  public void handle(BaseConfig config) {
  
  }
  
  @Override
  public ConfigurationSupplier getFallbackConfig() {
    Project p = getProject();
    return new ConfigurationSupplier<>(new BaseConfigBuilder().accept(new ApplyProjectInfo(p)));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy