Search in sources :

Example 6 with OpenShiftProvider

use of org.guvnor.ala.openshift.model.OpenShiftProvider in project kie-wb-common by kiegroup.

the class OpenShiftProviderConfigExecutor method apply.

@Override
public Optional<OpenShiftProvider> apply(final OpenShiftProviderConfig openshiftProviderConfig) {
    if (openshiftProviderConfig.getName() == null || openshiftProviderConfig.getName().isEmpty()) {
        throw new ProvisioningException("No name was provided for the OpenShiftProviderConfig.getName() " + "configuration parameter. You might probably have to properly set " + "the pipeline input parameter: " + ProviderConfig.PROVIDER_NAME);
    }
    Provider provider = runtimeRegistry.getProvider(openshiftProviderConfig.getName());
    OpenShiftProvider openshiftProvider;
    if (provider != null) {
        if (!(provider instanceof OpenShiftProvider)) {
            throw new ProvisioningException("The provider: " + openshiftProviderConfig.getName() + " must be an instance of " + OpenShiftProviderConfig.class + " but is: " + provider.getClass());
        } else {
            openshiftProvider = (OpenShiftProvider) provider;
        }
    } else {
        openshiftProvider = new OpenShiftProviderImpl(openshiftProviderConfig.getName(), openshiftProviderConfig);
        runtimeRegistry.registerProvider(openshiftProvider);
    }
    return Optional.of(openshiftProvider);
}
Also used : ProvisioningException(org.guvnor.ala.exceptions.ProvisioningException) OpenShiftProvider(org.guvnor.ala.openshift.model.OpenShiftProvider) OpenShiftProviderConfig(org.guvnor.ala.openshift.config.OpenShiftProviderConfig) Provider(org.guvnor.ala.runtime.providers.Provider) OpenShiftProvider(org.guvnor.ala.openshift.model.OpenShiftProvider) OpenShiftProviderImpl(org.guvnor.ala.openshift.model.OpenShiftProviderImpl)

Example 7 with OpenShiftProvider

use of org.guvnor.ala.openshift.model.OpenShiftProvider in project kie-wb-common by kiegroup.

the class OpenShiftRuntimeMarshallerTest method getValue.

@Override
public OpenShiftRuntime getValue() {
    OpenShiftProvider providerId = createOpenShiftProvider();
    OpenShiftRuntimeConfig runtimeConfig = new ContextAwareOpenShiftRuntimeExecConfig(RUNTIME_NAME, providerId, APPLICATION_NAME, KIE_SERVER_CONTAINER_DEPLOYMENT, PROJECT_NAME, RESOURCE_SECRETS_URI, RESOURCE_STREAMS_URI, RESOURCE_TEMPLATE_NAME, RESOURCE_TEMPLATE_PARAM_DELIMITER, RESOURCE_TEMPLATE_PARAM_ASSIGNER, RESOURCE_TEMPLATE_PARAM_VALUES, RESOURCE_TEMPLATE_URI, SERVICE_NAME);
    return new OpenShiftRuntime(RUNTIME_ID, RUNTIME_NAME, runtimeConfig, providerId, new OpenShiftRuntimeEndpoint(PROTOCOL, HOST, PORT, CONTEXT), new OpenShiftRuntimeInfo(runtimeConfig), new OpenShiftRuntimeState(STATE, STARTED_AT));
}
Also used : ContextAwareOpenShiftRuntimeExecConfig(org.guvnor.ala.openshift.config.impl.ContextAwareOpenShiftRuntimeExecConfig) OpenShiftRuntime(org.guvnor.ala.openshift.model.OpenShiftRuntime) OpenShiftProviderImplMarshallerTest.createOpenShiftProvider(org.guvnor.ala.openshift.marshalling.OpenShiftProviderImplMarshallerTest.createOpenShiftProvider) OpenShiftProvider(org.guvnor.ala.openshift.model.OpenShiftProvider) OpenShiftRuntimeState(org.guvnor.ala.openshift.model.OpenShiftRuntimeState) OpenShiftRuntimeInfo(org.guvnor.ala.openshift.model.OpenShiftRuntimeInfo) OpenShiftRuntimeEndpoint(org.guvnor.ala.openshift.model.OpenShiftRuntimeEndpoint) OpenShiftRuntimeConfig(org.guvnor.ala.openshift.config.OpenShiftRuntimeConfig)

Aggregations

OpenShiftProvider (org.guvnor.ala.openshift.model.OpenShiftProvider)7 OpenShiftRuntime (org.guvnor.ala.openshift.model.OpenShiftRuntime)3 ProvisioningException (org.guvnor.ala.exceptions.ProvisioningException)2 OpenShiftClient (org.guvnor.ala.openshift.access.OpenShiftClient)2 OpenShiftClientException (org.guvnor.ala.openshift.access.exceptions.OpenShiftClientException)2 OpenShiftProviderConfig (org.guvnor.ala.openshift.config.OpenShiftProviderConfig)2 OpenShiftRuntimeConfig (org.guvnor.ala.openshift.config.OpenShiftRuntimeConfig)2 OpenShiftRuntimeEndpoint (org.guvnor.ala.openshift.model.OpenShiftRuntimeEndpoint)2 OpenShiftRuntimeInfo (org.guvnor.ala.openshift.model.OpenShiftRuntimeInfo)2 OpenShiftRuntimeState (org.guvnor.ala.openshift.model.OpenShiftRuntimeState)2 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 DefaultOpenShiftClient (io.fabric8.openshift.client.DefaultOpenShiftClient)1 Client (javax.ws.rs.client.Client)1 WebTarget (javax.ws.rs.client.WebTarget)1 ProviderConfig (org.guvnor.ala.config.ProviderConfig)1 RuntimeOperationException (org.guvnor.ala.exceptions.RuntimeOperationException)1 ContextAwareOpenShiftRuntimeExecConfig (org.guvnor.ala.openshift.config.impl.ContextAwareOpenShiftRuntimeExecConfig)1 OpenShiftProviderConfigImpl (org.guvnor.ala.openshift.config.impl.OpenShiftProviderConfigImpl)1 OpenShiftProviderImplMarshallerTest.createOpenShiftProvider (org.guvnor.ala.openshift.marshalling.OpenShiftProviderImplMarshallerTest.createOpenShiftProvider)1 OpenShiftProviderImpl (org.guvnor.ala.openshift.model.OpenShiftProviderImpl)1