001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.spi;
018
019import java.util.Map;
020
021import org.apache.camel.CamelContext;
022
023/**
024 * Service Factory for ManagementStrategy
025 */
026public interface ManagementStrategyFactory {
027
028    /**
029     * Creates the {@link ManagementStrategy}.
030     *
031     * @param context     the camel context
032     * @param properties  optional options to set on {@link ManagementAgent}
033     * @return the created strategy
034     * @throws Exception is thrown if error creating the strategy
035     */
036    ManagementStrategy create(CamelContext context, Map<String, Object> properties) throws Exception;
037
038    /**
039     * Creates the associated {@link LifecycleStrategy} that the management strategy uses.
040     *
041     * @param context     the camel context
042     * @return the created lifecycle strategy
043     * @throws Exception is thrown if error creating the lifecycle strategy
044     */
045    LifecycleStrategy createLifecycle(CamelContext context) throws Exception;
046
047    /**
048     * Setup the management on the {@link CamelContext}.
049     * <p/>
050     * This allows implementations to provide the logic for setting up management on Camel.
051     *
052     * @param camelContext  the camel context
053     * @param strategy      the management strategy
054     * @param lifecycle      the associated lifecycle strategy (optional)
055     */
056    void setupManagement(CamelContext camelContext, ManagementStrategy strategy, LifecycleStrategy lifecycle);
057
058}