Search in sources :

Example 1 with ManagedDataFormat

use of org.apache.camel.management.mbean.ManagedDataFormat in project camel by apache.

the class DefaultManagementObjectStrategy method getManagedObjectForDataFormat.

@SuppressWarnings({ "deprecation", "unchecked" })
public Object getManagedObjectForDataFormat(CamelContext context, DataFormat dataFormat) {
    if (dataFormat instanceof org.apache.camel.spi.ManagementAware) {
        return ((org.apache.camel.spi.ManagementAware<DataFormat>) dataFormat).getManagedObject(dataFormat);
    } else {
        ManagedDataFormat md = new ManagedDataFormat(context, dataFormat);
        md.init(context.getManagementStrategy());
        return md;
    }
}
Also used : ManagedDataFormat(org.apache.camel.management.mbean.ManagedDataFormat)

Example 2 with ManagedDataFormat

use of org.apache.camel.management.mbean.ManagedDataFormat in project camel by apache.

the class ManagedManagementStrategy method getManagedObjectName.

public <T> T getManagedObjectName(Object managedObject, String customName, Class<T> nameType) throws Exception {
    if (managedObject == null) {
        return null;
    }
    ObjectName objectName = null;
    if (managedObject instanceof ManagedCamelContext) {
        ManagedCamelContext mcc = (ManagedCamelContext) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForCamelContext(mcc.getContext());
    } else if (managedObject instanceof ManagedComponent) {
        ManagedComponent mc = (ManagedComponent) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForComponent(mc.getComponent(), mc.getComponentName());
    } else if (managedObject instanceof ManagedDataFormat) {
        ManagedDataFormat md = (ManagedDataFormat) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForDataFormat(md.getContext(), md.getDataFormat());
    } else if (managedObject instanceof ManagedEndpoint) {
        ManagedEndpoint me = (ManagedEndpoint) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForEndpoint(me.getEndpoint());
    } else if (managedObject instanceof Endpoint) {
        objectName = getManagementNamingStrategy().getObjectNameForEndpoint((Endpoint) managedObject);
    } else if (managedObject instanceof ManagedRoute) {
        ManagedRoute mr = (ManagedRoute) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForRoute(mr.getRoute());
    } else if (managedObject instanceof ManagedErrorHandler) {
        ManagedErrorHandler meh = (ManagedErrorHandler) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForErrorHandler(meh.getRouteContext(), meh.getErrorHandler(), meh.getErrorHandlerBuilder());
    } else if (managedObject instanceof ManagedProcessor) {
        ManagedProcessor mp = (ManagedProcessor) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForProcessor(mp.getContext(), mp.getProcessor(), mp.getDefinition());
    } else if (managedObject instanceof ManagedConsumer) {
        ManagedConsumer ms = (ManagedConsumer) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForConsumer(ms.getContext(), ms.getConsumer());
    } else if (managedObject instanceof ManagedProducer) {
        ManagedProducer ms = (ManagedProducer) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForProducer(ms.getContext(), ms.getProducer());
    } else if (managedObject instanceof ManagedTracer) {
        ManagedTracer mt = (ManagedTracer) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForTracer(mt.getContext(), mt.getTracer());
    } else if (managedObject instanceof ManagedBacklogTracer) {
        ManagedBacklogTracer mt = (ManagedBacklogTracer) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForTracer(mt.getContext(), mt.getBacklogTracer());
    } else if (managedObject instanceof ManagedBacklogDebugger) {
        ManagedBacklogDebugger md = (ManagedBacklogDebugger) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForTracer(md.getContext(), md.getBacklogDebugger());
    } else if (managedObject instanceof ManagedEventNotifier) {
        ManagedEventNotifier men = (ManagedEventNotifier) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForEventNotifier(men.getContext(), men.getEventNotifier());
    } else if (managedObject instanceof ManagedThreadPool) {
        ManagedThreadPool mes = (ManagedThreadPool) managedObject;
        objectName = getManagementNamingStrategy().getObjectNameForThreadPool(mes.getContext(), mes.getThreadPool(), mes.getId(), mes.getSourceId());
    } else if (managedObject instanceof ManagedService) {
        // check for managed service should be last
        ManagedService ms = (ManagedService) managedObject;
        // skip endpoints as they are already managed
        if (ms.getService() instanceof Endpoint) {
            return null;
        }
        objectName = getManagementNamingStrategy().getObjectNameForService(ms.getContext(), ms.getService());
    }
    return nameType.cast(objectName);
}
Also used : ManagedService(org.apache.camel.management.mbean.ManagedService) ManagedCamelContext(org.apache.camel.management.mbean.ManagedCamelContext) ManagedErrorHandler(org.apache.camel.management.mbean.ManagedErrorHandler) ManagedBacklogDebugger(org.apache.camel.management.mbean.ManagedBacklogDebugger) ManagedComponent(org.apache.camel.management.mbean.ManagedComponent) ManagedEventNotifier(org.apache.camel.management.mbean.ManagedEventNotifier) ManagedThreadPool(org.apache.camel.management.mbean.ManagedThreadPool) ManagedTracer(org.apache.camel.management.mbean.ManagedTracer) ManagedDataFormat(org.apache.camel.management.mbean.ManagedDataFormat) ManagedEndpoint(org.apache.camel.management.mbean.ManagedEndpoint) ObjectName(javax.management.ObjectName) ManagedProducer(org.apache.camel.management.mbean.ManagedProducer) Endpoint(org.apache.camel.Endpoint) ManagedEndpoint(org.apache.camel.management.mbean.ManagedEndpoint) ManagedConsumer(org.apache.camel.management.mbean.ManagedConsumer) ManagedRoute(org.apache.camel.management.mbean.ManagedRoute) ManagedProcessor(org.apache.camel.management.mbean.ManagedProcessor) ManagedBacklogTracer(org.apache.camel.management.mbean.ManagedBacklogTracer)

Aggregations

ManagedDataFormat (org.apache.camel.management.mbean.ManagedDataFormat)2 ObjectName (javax.management.ObjectName)1 Endpoint (org.apache.camel.Endpoint)1 ManagedBacklogDebugger (org.apache.camel.management.mbean.ManagedBacklogDebugger)1 ManagedBacklogTracer (org.apache.camel.management.mbean.ManagedBacklogTracer)1 ManagedCamelContext (org.apache.camel.management.mbean.ManagedCamelContext)1 ManagedComponent (org.apache.camel.management.mbean.ManagedComponent)1 ManagedConsumer (org.apache.camel.management.mbean.ManagedConsumer)1 ManagedEndpoint (org.apache.camel.management.mbean.ManagedEndpoint)1 ManagedErrorHandler (org.apache.camel.management.mbean.ManagedErrorHandler)1 ManagedEventNotifier (org.apache.camel.management.mbean.ManagedEventNotifier)1 ManagedProcessor (org.apache.camel.management.mbean.ManagedProcessor)1 ManagedProducer (org.apache.camel.management.mbean.ManagedProducer)1 ManagedRoute (org.apache.camel.management.mbean.ManagedRoute)1 ManagedService (org.apache.camel.management.mbean.ManagedService)1 ManagedThreadPool (org.apache.camel.management.mbean.ManagedThreadPool)1 ManagedTracer (org.apache.camel.management.mbean.ManagedTracer)1