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     */
017    package org.apache.camel.component.activemq;
018    
019    import org.apache.camel.CamelContext;
020    import org.apache.camel.component.jms.JmsComponent;
021    import org.apache.camel.component.jms.JmsConfiguration;
022    
023    /**
024     * The <a href="http://activemq.apache.org/camel/activemq.html">ActiveMQ Component</a>
025     *
026     * @version $Revision: 1.1 $
027     */
028    public class ActiveMQComponent extends JmsComponent {
029        /**
030         * Creates an <a href="http://activemq.apache.org/camel/activemq.html">ActiveMQ Component</a>
031         *
032         * @return the created component
033         */
034        public static ActiveMQComponent activeMQComponent() {
035            return new ActiveMQComponent();
036        }
037    
038        /**
039         * Creates an <a href="http://activemq.apache.org/camel/activemq.html">ActiveMQ Component</a>
040         * connecting to the given <a href="http://activemq.apache.org/configuring-transports.html">broker URL</a>
041         *
042         * @param brokerURL the URL to connect to
043         * @return the created component
044         */
045        public static ActiveMQComponent activeMQComponent(String brokerURL) {
046            ActiveMQComponent answer = new ActiveMQComponent();
047            answer.getConfiguration().setBrokerURL(brokerURL);
048            return answer;
049        }
050    
051        public ActiveMQComponent() {
052        }
053    
054        public ActiveMQComponent(CamelContext context) {
055            super(context);
056        }
057    
058        public ActiveMQComponent(ActiveMQConfiguration configuration) {
059            super(configuration);
060        }
061    
062        @Override
063        public ActiveMQConfiguration getConfiguration() {
064            return (ActiveMQConfiguration) super.getConfiguration();
065        }
066    
067        public void setBrokerURL(String brokerURL) {
068            getConfiguration().setBrokerURL(brokerURL);
069        }
070    
071    
072        @Override
073        protected JmsConfiguration createConfiguration() {
074            return new ActiveMQConfiguration();
075        }
076    }