private Optional<OpenShiftRuntime> create(final OpenShiftRuntimeConfig runtimeConfig) throws ProvisioningException { final Optional<OpenShiftProvider> _openshiftProvider = runtimeRegistry.getProvider(runtimeConfig.getProviderId(), OpenShiftProvider.class); if (!_openshiftProvider.isPresent()) { return Optional.empty(); } OpenShiftProvider openshiftProvider = _openshiftProvider.get(); OpenShiftClient openshiftClient = openshift.getOpenShiftClient(openshiftProvider); LOG.info("Creating runtime..."); OpenShiftRuntimeState runtimeState; try { runtimeState = openshiftClient.create(runtimeConfig); } catch (OpenShiftClientException ex) { throw new ProvisioningException(ex.getMessage(), ex); } final String id = runtimeConfig.getRuntimeId().toString(); LOG.info("Created runtime: " + id); OpenShiftRuntimeEndpoint endpoint = openshiftClient.getRuntimeEndpoint(id); return Optional.of(new OpenShiftRuntime(id, buildRuntimeName(runtimeConfig, id), runtimeConfig, openshiftProvider, endpoint, new OpenShiftRuntimeInfo(runtimeConfig), runtimeState)); }
@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)); } }
@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)); } }