| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
package org.apache.camel.management; |
| 19 |
|
|
| 20 |
|
import java.io.IOException; |
| 21 |
|
|
| 22 |
|
import org.apache.camel.Endpoint; |
| 23 |
|
import org.apache.camel.Route; |
| 24 |
|
import org.springframework.jmx.export.annotation.ManagedAttribute; |
| 25 |
|
import org.springframework.jmx.export.annotation.ManagedOperation; |
| 26 |
|
import org.springframework.jmx.export.annotation.ManagedResource; |
| 27 |
|
|
| 28 |
|
@ManagedResource( |
| 29 |
|
description="Managed Route", |
| 30 |
|
currencyTimeLimit=15) |
| 31 |
|
public class ManagedRoute{ |
| 32 |
|
|
| 33 |
|
public static final String VALUE_UNKNOWN = "Unknown"; |
| 34 |
|
private Route route; |
| 35 |
|
|
| 36 |
0 |
ManagedRoute(Route route) { |
| 37 |
0 |
this.route = route; |
| 38 |
0 |
} |
| 39 |
|
|
| 40 |
|
public Route getRoute() { |
| 41 |
0 |
return route; |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
@ManagedAttribute(description = "Route Endpoint Uri") |
| 45 |
|
public String getEndpointUri() { |
| 46 |
0 |
Endpoint ep = route.getEndpoint(); |
| 47 |
0 |
return ep != null ? ep.getEndpointUri() : VALUE_UNKNOWN; |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
@ManagedOperation(description = "Start Route") |
| 51 |
|
public void start() throws IOException { |
| 52 |
0 |
throw new IOException("Not supported"); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
@ManagedOperation(description = "Stop Route") |
| 56 |
|
public void stop() throws IOException { |
| 57 |
0 |
throw new IOException("Not supported"); |
| 58 |
|
} |
| 59 |
|
} |