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.activemq.plugin;
018
019import org.apache.activemq.broker.Broker;
020import org.apache.activemq.broker.BrokerPlugin;
021import org.slf4j.Logger;
022import org.slf4j.LoggerFactory;
023
024/**
025 * A StatisticsBrokerPlugin
026 * You can retrieve a Map Message for a Destination - or
027 * Broker containing statistics as key-value pairs The message must contain a
028 * replyTo Destination - else its ignored
029 * To retrieve stats on the broker send a empty message to ActiveMQ.Statistics.Broker (Queue or Topic)
030 * With a replyTo set to the destination you want the stats returned to.
031 * To retrieve stats for a destination - e.g. foo - send an empty message to ActiveMQ.Statistics.Destination.foo
032 * - this works with wildcards to - you get a message for each wildcard match on the replyTo destination.
033 * The stats message is a MapMessage populated with statistics for the target
034 * @org.apache.xbean.XBean element="statisticsBrokerPlugin"
035 *
036 */
037public class StatisticsBrokerPlugin implements BrokerPlugin {
038    private static Logger LOG = LoggerFactory.getLogger(StatisticsBrokerPlugin.class);
039    /** 
040     * @param broker
041     * @return the plug-in
042     * @throws Exception
043     * @see org.apache.activemq.broker.BrokerPlugin#installPlugin(org.apache.activemq.broker.Broker)
044     */
045    public Broker installPlugin(Broker broker) throws Exception {
046        StatisticsBroker answer = new StatisticsBroker(broker);
047        LOG.info("Installing StaticsBroker");
048        return answer;
049    }
050}