Skip to content

Commit

Permalink
Passing camel contextes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Jun 15, 2024
1 parent 4e83657 commit 51f3779
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class FileWatcherComponent extends DefaultComponent {

@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
Endpoint endpoint = new FileWatcherEndpoint(uri, this);
Endpoint endpoint = new FileWatcherEndpoint(getCamelContext(), uri, this);
setProperties(endpoint, parameters);
return endpoint;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
*/
package nl.vpro.camel;

import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.*;
import org.apache.camel.support.DefaultEndpoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -31,8 +29,9 @@ class FileWatcherEndpoint extends DefaultEndpoint {
private static final Logger LOG = LoggerFactory.getLogger(FileWatcherEndpoint.class);


FileWatcherEndpoint(String uri, FileWatcherComponent component) {
FileWatcherEndpoint(CamelContext camelContext, String uri, FileWatcherComponent component) {
super(uri, component);
setCamelContext(camelContext);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
*/
package nl.vpro.camel.newrelic;

import java.util.Map;

import org.apache.camel.Endpoint;
import org.apache.camel.support.DefaultComponent;

import java.util.Map;

public class TraceComponent extends DefaultComponent {

@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
Endpoint endpoint = new TraceEndpoint(uri, this);
Endpoint endpoint = new TraceEndpoint(getCamelContext(), uri, this);
setProperties(endpoint, parameters);
return endpoint;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@
*/
package nl.vpro.camel.newrelic;

import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.support.DefaultConsumer;
import org.apache.camel.support.DefaultEndpoint;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import org.apache.camel.*;
import org.apache.camel.support.DefaultConsumer;
import org.apache.camel.support.DefaultEndpoint;

/**
* @author Roelof Jan Koekoek
* @since 1.1
*/
class TraceEndpoint extends DefaultEndpoint {
private final CopyOnWriteArrayList<DefaultConsumer> consumers = new CopyOnWriteArrayList<>();

TraceEndpoint(String uri, TraceComponent component) {
TraceEndpoint(CamelContext context, String uri, TraceComponent component) {
super(uri, component);
setCamelContext(context);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion camel-scp/src/main/java/nl/vpro/camel/ScpComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ScpComponent extends DefaultComponent {

@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
Endpoint endpoint = new ScpEndpoint(uri, remaining, this);
Endpoint endpoint = new ScpEndpoint(getCamelContext(), uri, remaining, this);
setProperties(endpoint, parameters);
return endpoint;
}
Expand Down
3 changes: 2 additions & 1 deletion camel-scp/src/main/java/nl/vpro/camel/ScpEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ public class ScpEndpoint extends DefaultEndpoint {
private String userHosts;


public ScpEndpoint(String uri, String remaining, ScpComponent component) {
public ScpEndpoint(CamelContext context, String uri, String remaining, ScpComponent component) {
super(uri, component);
this.remoteHostName = remaining;
setCamelContext(context);
}


Expand Down

0 comments on commit 51f3779

Please sign in to comment.