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

io.dekorate.servicebinding.manifest.ServiceBindingResourceGenerator Maven / Gradle / Ivy

There is a newer version: 4.1.4
Show newest version
package io.dekorate.servicebinding.manifest;

import io.dekorate.ConfigurationRegistry;
import io.dekorate.Logger;
import io.dekorate.LoggerFactory;
import io.dekorate.ManifestGenerator;
import io.dekorate.ResourceRegistry;
import io.dekorate.kubernetes.config.Configuration;
import io.dekorate.servicebinding.config.EditableServiceBindingConfig;
import io.dekorate.servicebinding.config.ServiceBindingConfig;
import io.dekorate.servicebinding.decorator.AddServiceBindingResourceDecorator;

public class ServiceBindingResourceGenerator implements ManifestGenerator {

  private final ResourceRegistry resourceRegistry;
  private final ConfigurationRegistry configurationRegistry;

  private static final String SERVICEBINDING = "servicebinding";

  private final Logger LOGGER = LoggerFactory.getLogger();

  public ServiceBindingResourceGenerator(ResourceRegistry resources, ConfigurationRegistry configurationRegistry) {
    this.resourceRegistry = resources;
    this.configurationRegistry = configurationRegistry;
  }

  @Override
  public int order() {
    return 310;
  }

  @Override
  public String getKey() {
    return SERVICEBINDING;
  }

  public boolean accepts(Class type) {
    return type.equals(ServiceBindingConfig.class) || type.equals(EditableServiceBindingConfig.class);
  }

  public void generate(ServiceBindingConfig config) {
    LOGGER.info("Processing service binding config.");
    addVisitors(config);
  }

  private void addVisitors(ServiceBindingConfig config) {
    resourceRegistry.decorate(new AddServiceBindingResourceDecorator(config));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy