Clean up leftovers from removed non-camel-main based runtime
diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java
index 1536533..6022249 100644
--- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java
+++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java
@@ -16,8 +16,6 @@
*/
package org.apache.camel.quarkus.core;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Set;
import io.quarkus.arc.runtime.BeanContainer;
@@ -25,12 +23,6 @@
import io.quarkus.runtime.annotations.Recorder;
import org.apache.camel.CamelContext;
import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RouteConfigurationsBuilder;
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.builder.LambdaRouteBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
-import org.apache.camel.builder.endpoint.LambdaEndpointRouteBuilder;
import org.apache.camel.catalog.RuntimeCamelCatalog;
import org.apache.camel.impl.engine.DefaultVariableRepositoryFactory;
import org.apache.camel.spi.CamelContextCustomizer;
@@ -98,15 +90,6 @@
contextCustomizer.getValue().configure(context.getValue());
}
- public RuntimeValue<CamelRuntime> createRuntime(BeanContainer beanContainer, RuntimeValue<CamelContext> context) {
- final CamelRuntime runtime = new CamelContextRuntime(context.getValue());
-
- // register to the container
- beanContainer.beanInstance(CamelProducers.class).setRuntime(runtime);
-
- return new RuntimeValue<>(runtime);
- }
-
public RuntimeValue<CamelContextCustomizer> createNoShutdownStrategyCustomizer() {
return new RuntimeValue<>(context -> context.setShutdownStrategy(new NoShutdownStrategy()));
}
@@ -115,53 +98,6 @@
return new RuntimeValue<>(context -> context.setSourceLocationEnabled(true));
}
- public void addRoutes(RuntimeValue<CamelContext> context, List<String> nonCdiRoutesBuilderClassNames) {
- List<RoutesBuilder> allRoutesBuilders = new ArrayList<>();
-
- try {
- for (String nonCdiRoutesBuilderClassName : nonCdiRoutesBuilderClassNames) {
- Class<RoutesBuilder> nonCdiRoutesBuilderClass = context.getValue().getClassResolver()
- .resolveClass(nonCdiRoutesBuilderClassName, RoutesBuilder.class);
- allRoutesBuilders.add(context.getValue().getInjector().newInstance(nonCdiRoutesBuilderClass));
- }
-
- for (LambdaRouteBuilder builder : context.getValue().getRegistry().findByType(LambdaRouteBuilder.class)) {
- allRoutesBuilders.add(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- builder.accept(this);
- }
- });
- }
-
- for (LambdaEndpointRouteBuilder builder : context.getValue().getRegistry()
- .findByType(LambdaEndpointRouteBuilder.class)) {
- allRoutesBuilders.add(new EndpointRouteBuilder() {
- @Override
- public void configure() throws Exception {
- builder.accept(this);
- }
- });
- }
-
- allRoutesBuilders.addAll(context.getValue().getRegistry().findByType(RoutesBuilder.class));
-
- // Add RouteConfigurationsBuilders before RoutesBuilders
- for (RoutesBuilder routesBuilder : allRoutesBuilders) {
- if (routesBuilder instanceof RouteConfigurationsBuilder) {
- context.getValue().addRoutesConfigurations((RouteConfigurationsBuilder) routesBuilder);
- }
- }
- for (RoutesBuilder routesBuilder : allRoutesBuilders) {
- if (!(routesBuilder instanceof RouteConfigurationsBuilder)) {
- context.getValue().addRoutes(routesBuilder);
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
public void registerLifecycleEventBridge(RuntimeValue<CamelContext> context, Set<String> observedLifecycleEvents) {
context.getValue().addLifecycleStrategy(new CamelLifecycleEventBridge(observedLifecycleEvents));
}
diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRuntime.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRuntime.java
deleted file mode 100644
index 4bcbc59..0000000
--- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRuntime.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.core;
-
-import java.util.Arrays;
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spi.CamelEvent;
-import org.apache.camel.support.EventNotifierSupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A simple implementation of the {@link CamelRuntime} that directly starts/stop the {@link CamelContext}.
- */
-public class CamelContextRuntime implements CamelRuntime {
- private static final Logger LOGGER = LoggerFactory.getLogger(CamelContextRuntime.class);
- private final CamelContext camelContext;
- private final CountDownLatch latch;
-
- public CamelContextRuntime(CamelContext camelContext) {
- this.camelContext = camelContext;
- this.latch = new CountDownLatch(1);
- }
-
- @Override
- public void start(String[] args) {
- if (args.length > 0) {
- LOGGER.info("Ignoring args: {}", Arrays.toString(args));
- }
- camelContext.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {
- @Override
- public void notify(CamelEvent event) throws Exception {
- latch.countDown();
- }
-
- @Override
- public boolean isEnabled(CamelEvent event) {
- return event instanceof CamelEvent.CamelContextStoppedEvent;
- }
- });
- camelContext.start();
- }
-
- @Override
- public void stop() {
- camelContext.stop();
- }
-
- @Override
- public int waitForExit() {
- try {
- this.latch.await();
- } catch (InterruptedException e) {
- LOGGER.warn("", e);
- }
-
- return 0;
- }
-
- @Override
- public CamelContext getCamelContext() {
- return camelContext;
- }
-}