Skip to content

Commit

Permalink
fix(camel): getBreakpoints op for Camel BacklogDebugger changed betwe…
Browse files Browse the repository at this point in the history
…en v3 and v4
  • Loading branch information
tadayosi committed Oct 5, 2023
1 parent 0b6ba8c commit cc46d9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/hawtio/src/plugins/camel/camel-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MBeanNode } from '@hawtiosrc/plugins/shared'
import { jolokiaService } from '@hawtiosrc/plugins/shared/jolokia-service'
import { isObject } from '@hawtiosrc/util/objects'
import { isBlank } from '@hawtiosrc/util/strings'
import { debugService } from './debug'
import { ENDPOINT_OPERATIONS } from './endpoints/endpoints-service'
import {
componentNodeType,
Expand Down Expand Up @@ -261,7 +262,7 @@ export function canGetBreakpoints(node: MBeanNode): boolean {
if (!isRouteNode(node)) return false

const db = findDebugBean(node)
return db?.hasInvokeRights('getBreakpoints') ?? false
return db?.hasInvokeRights(debugService.getBreakpointsOperation(node)) ?? false
}

export function canTrace(node: MBeanNode): boolean {
Expand Down Expand Up @@ -357,7 +358,7 @@ export function compareVersions(version: string, major: number, minor: number):
* @param major major version as number
* @param minor minor version as number
*/
export function isCamelVersionEQGT(node: MBeanNode, major: number, minor: number) {
export function isCamelVersionEQGT(node: MBeanNode, major: number, minor: number): boolean {
const camelVersion = getCamelVersion(node)
if (!camelVersion) {
return false
Expand Down
10 changes: 9 additions & 1 deletion packages/hawtio/src/plugins/camel/debug/debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,19 @@ class DebugService {
return await this.isDebugging(node)
}

/**
* Returns the name of operation for getting all the breakpoints on the BacklogDebugger
* MBean. The operation name differs between Camel v3 and v4.
*/
getBreakpointsOperation(node: MBeanNode): string {
return camelService.isCamelVersionEQGT(node, 4, 0) ? 'breakpoints' : 'getBreakpoints'
}

async getBreakpoints(node: MBeanNode): Promise<string[]> {
const db = this.getDebugBean(node)
if (!db || !db.objectName) return []

const result = await jolokiaService.execute(db.objectName, 'getBreakpoints')
const result = await jolokiaService.execute(db.objectName, this.getBreakpointsOperation(node))
return result as string[]
}

Expand Down

0 comments on commit cc46d9d

Please sign in to comment.