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.cxf.cxfbean;
018    
019    import java.io.IOException;
020    
021    import org.apache.camel.component.cxf.transport.CamelTransportFactory;
022    import org.apache.commons.logging.Log;
023    import org.apache.commons.logging.LogFactory;
024    import org.apache.cxf.service.model.EndpointInfo;
025    import org.apache.cxf.transport.Destination;
026    
027    /**
028     * CXF Bean TransportFactory that overrides CamelTransportFactory to create
029     * a specific Destination (@link CxfBeanDestination}.
030     * 
031     * @version $Revision: 2739 $
032     */
033    public class CxfBeanTransportFactory extends CamelTransportFactory  {
034        public static final String TRANSPORT_ID = "http://cxf.apache.org/transports/camel/cxfbean";
035        private static final Log LOG = LogFactory.getLog(CxfBeanTransportFactory.class);
036        private CxfBeanComponent cxfBeanComponent;
037     
038        @Override
039        public Destination getDestination(EndpointInfo endpointInfo) throws IOException {
040            if (LOG.isDebugEnabled()) {
041                LOG.debug("Create CxfBeanDestination: " + endpointInfo);
042            }
043            
044            // lookup endpoint from component instead of CamelContext because it may not
045            // be added to the CamelContext yet.
046            return new CxfBeanDestination(cxfBeanComponent, getBus(), this, endpointInfo);
047        }
048    
049        /**
050         * @param cxfBeanComponent
051         */
052        public void setCxfBeanComponent(CxfBeanComponent cxfBeanComponent) {
053            this.cxfBeanComponent = cxfBeanComponent;
054            
055        }
056        
057    }