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

io.quarkiverse.operatorsdk.runtime.DependentResourceSpecMetadata Maven / Gradle / Ivy

The newest version!
package io.quarkiverse.operatorsdk.runtime;

import java.util.Set;

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.javaoperatorsdk.operator.api.config.dependent.DependentResourceSpec;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
import io.quarkus.runtime.annotations.IgnoreProperty;
import io.quarkus.runtime.annotations.RecordableConstructor;

public class DependentResourceSpecMetadata extends
        DependentResourceSpec {
    private final C dependentResourceConfig;
    private Class dependentType;
    private final String dependentTypeName;

    @RecordableConstructor
    public DependentResourceSpecMetadata(Class> dependentResourceClass,
            C dependentResourceConfig,
            String name, Set dependsOn,
            Condition readyCondition,
            Condition reconcileCondition,
            Condition deletePostCondition,
            Condition activationCondition,
            String quarkusUseEventSourceWithName,
            String dependentTypeName) {
        super(dependentResourceClass, name, dependsOn, readyCondition, reconcileCondition, deletePostCondition,
                activationCondition,
                quarkusUseEventSourceWithName);
        this.dependentResourceConfig = dependentResourceConfig;
        this.dependentTypeName = dependentTypeName;
    }

    // Needed for the recordable constructor
    public C getDependentResourceConfig() {
        return dependentResourceConfig;
    }

    @SuppressWarnings("unchecked")
    @IgnoreProperty
    public Class getDependentType() {
        if (dependentType == null) {
            try {
                dependentType = (Class) Thread.currentThread().getContextClassLoader().loadClass(dependentTypeName);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(e);
            }
        }
        return dependentType;
    }

    // Needed for the recordable constructor
    @SuppressWarnings("unused")
    public String getDependentTypeName() {
        return dependentTypeName;
    }

    // Needed for the recordable constructor
    @SuppressWarnings("unused")
    public String getQuarkusUseEventSourceWithName() {
        return getUseEventSourceWithName().orElse(null);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy