Skip to content

Commit

Permalink
Fix findings apache#9
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Oct 4, 2019
1 parent 9787bbd commit 444f561
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
@Singleton
public class CamelProducers {
private CamelContext context;
private volatile CamelContext context;

public void setContext(CamelContext context) {
this.context = context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.quarkus.arc.ArcContainer;

/**
* Helper methods retrieve beans from the {@link Arc} container.
* Helper methods to retrieve beans from the {@link Arc} container.
*/
@Vetoed
final class BeanManagerHelper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CamelMainBuildItem create(
List<CamelMainListenerBuildItem> listeners,
BeanContainerBuildItem beanContainerBuildItem) {

RuntimeValue<CamelMain> main = recorder.create(context.getCamelContext(), beanContainerBuildItem.getValue());
RuntimeValue<CamelMain> main = recorder.createCamelMain(context.getCamelContext(), beanContainerBuildItem.getValue());
for (CamelMainListenerBuildItem listener: listeners) {
recorder.addListener(main, listener.getListener());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@

import io.quarkus.builder.item.MultiBuildItem;
import org.apache.camel.main.MainListener;
import org.apache.camel.quarkus.main.CamelMain;

/**
* A {@link MultiBuildItem} holding {@link MainListener}s to add to {@link CamelMain}.
*/
public final class CamelMainListenerBuildItem extends MultiBuildItem {
private final MainListener listener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void configure(CamelContext context) {

@Override
public void afterStart(MainSupport main) {
fireEvent(CamelMainEvents.AsfterStart.class, new CamelMainEvents.AsfterStart());
fireEvent(CamelMainEvents.AfterStart.class, new CamelMainEvents.AfterStart());
}

@Override
Expand All @@ -46,7 +46,7 @@ public void beforeStop(MainSupport main) {

@Override
public void afterStop(MainSupport main) {
fireEvent(CamelMainEvents.AsfterStop.class, new CamelMainEvents.AsfterStop());
fireEvent(CamelMainEvents.AfterStop.class, new CamelMainEvents.AfterStop());
}

private static <T> void fireEvent(Class<T> clazz, T event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,34 @@ public final class CamelMainEvents {
private CamelMainEvents() {
}

/**
* Event fired by {@link CamelMain} before the CamelContext is being created and started.
*/
public static class BeforeStart {
}

/**
* Event fired by {@link CamelMain} to configure the created CamelContext.
*/
public static class Configure {
}

public static class AsfterStart {
/**
* Event fired by {@link CamelMain} after the CamelContext has been started.
*/
public static class AfterStart {
}

/**
* Event fired by {@link CamelMain} before the CamelContext is being stopped.
*/
public static class BeforeStop {
}

public static class AsfterStop {

/**
* Event fired by {@link CamelMain} after the CamelContext has been stopped.
*/
public static class AfterStop {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

@Singleton
public class CamelMainProducers {
private CamelMain main;
private volatile CamelMain main;

public void setMain(CamelMain main) {
this.main = main;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.apache.camel.quarkus.main;

import java.util.function.Supplier;

import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.ShutdownContext;
Expand All @@ -27,7 +25,10 @@

@Recorder
public class CamelMainRecorder {
public RuntimeValue<CamelMain> create(RuntimeValue<CamelContext> runtime, BeanContainer container) {
public RuntimeValue<CamelMain> createCamelMain(
RuntimeValue<CamelContext> runtime,
BeanContainer container) {

CamelMain main = new CamelMain();
main.setCamelContext(runtime.getValue());
main.disableHangupSupport();
Expand All @@ -42,10 +43,11 @@ public RuntimeValue<CamelMain> create(RuntimeValue<CamelContext> runtime, BeanCo
public void addRouteBuilder(
RuntimeValue<CamelMain> main,
String className) {

try {
main.getValue().addRouteBuilder(Class.forName(className));
} catch (Exception e) {
throw new RuntimeException(e);
throw new RuntimeException("Could not add route builder '" + className + "'", e);
}
}

Expand All @@ -72,13 +74,4 @@ public void run() {
throw new RuntimeException(e);
}
}

public Supplier<CamelMain> mainSupplier(RuntimeValue<CamelMain> main) {
return new Supplier<CamelMain>() {
@Override
public CamelMain get() {
return main.getValue();
}
};
}
}

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
<!-- build those first -->
<module>core</module>
<module>core-impl</module>
<!--<module>core-cdi</module>-->
<module>main</module>

<module>netty-http</module>
Expand Down

0 comments on commit 444f561

Please sign in to comment.